Skip to content

Instantly share code, notes, and snippets.

View Subv's full-sized avatar

Sebastian Valle Subv

  • Barranquilla, Colombia
View GitHub Profile
void RasterizerOpenGL::SyncLightPosition(int light_index) {
GLvec3 position = {
Pica::float16::FromRaw(Pica::g_state.regs.lighting.light[light_index].x).ToFloat32(),
Pica::float16::FromRaw(Pica::g_state.regs.lighting.light[light_index].y).ToFloat32(),
Pica::float16::FromRaw(Pica::g_state.regs.lighting.light[light_index].z).ToFloat32()};
if (position != uniform_block_data.data.light_src[light_index].position) {
uniform_block_data.data.light_src[light_index].position = position;
uniform_block_data.dirty = true;
}
diff --git a/src/video_core/swrasterizer/rasterizer.cpp b/src/video_core/swrasterizer/rasterizer.cpp
index a0ce851..c227092 100644
--- a/src/video_core/swrasterizer/rasterizer.cpp
+++ b/src/video_core/swrasterizer/rasterizer.cpp
@@ -116,19 +116,22 @@ static std::tuple<float24, float24, PAddr> ConvertCubeCoord(float24 u, float24 v
}
-float LookupLightingLut(size_t lut_index, float index) {
- index *= 256;
diff --git a/src/video_core/swrasterizer/framebuffer.cpp b/src/video_core/swrasterizer/framebuffer.cpp
index 7de3aac..3f5906a 100644
--- a/src/video_core/swrasterizer/framebuffer.cpp
+++ b/src/video_core/swrasterizer/framebuffer.cpp
@@ -280,17 +280,17 @@ Math::Vec4<u8> EvaluateBlendEquation(const Math::Vec4<u8>& src, const Math::Vec4
// TODO: How do these two actually work? OpenGL doesn't include the blend factors in the
// min/max computations, but is this what the 3DS actually does?
case FramebufferRegs::BlendEquation::Min:
- result.r() = std::min(src.r(), dest.r());
- result.g() = std::min(src.g(), dest.g());
static void sceneRender1(void)
{
// Update the uniforms
float zeros[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
GPUCMD_AddWrite(GPUREG_VSH_FLOATUNIFORM_CONFIG, 0x80000000|uLoc_projection1);
GPUCMD_AddWrites(GPUREG_VSH_FLOATUNIFORM_DATA, (u32*)&zeros, 4);
GPUCMD_AddWrite(GPUREG_VSH_FLOATUNIFORM_CONFIG, 0x80000000|(uLoc_projection1 + 1));
GPUCMD_AddWrites(GPUREG_VSH_FLOATUNIFORM_DATA, (u32*)&projection1 + 4, 12);
@Subv
Subv / .diff
Last active June 8, 2017 05:36
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index 4633a1d..15894e6 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -349,7 +351,11 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
vertex_cache_ids.fill(-1);
auto* shader_engine = Shader::GetEngine();
- Shader::UnitState shader_unit;
+ static Shader::UnitState shader_units[4] = {};
; Example PICA200 vertex shader
; Uniforms
.fvec projection[4]
; Constants
.constf myconst(0.0, 1.0, 0.0, 1.0)
.constf myconst2(1.0, 2.0, 3.0, 0.0)
.constf outofbounds(96.0, 0.0, 0.0, 0.0)
.alias zeros myconst.xxxx ; Vector full of zeros
; Example PICA200 vertex shader
; Uniforms
.fvec projection[4]
; Constants
.constf myconst(0.0, 1.0, 0.0, 1.0)
.constf myconst2(1.0, 2.0, 3.0, 0.0)
.constf outofbounds(96.0, 0.0, 0.0, 0.0)
.alias zeros myconst.xxxx ; Vector full of zeros
main:
if my_bool:
mov r7.xyzw, some_const.xyzw
mov o0.xyzw, white.xyzw
else:
mov o0.xyzw, r7.xyzw
end
@Subv
Subv / main.c
Created June 6, 2017 17:13
Nintendo 3DS PICA GPU Blend factors test
#include <3ds.h>
#include <citro3d.h>
#include <string.h>
#include <stdio.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR 0x68B0D8FF
#define DISPLAY_TRANSFER_FLAGS \
(GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
@Subv
Subv / opencv.py
Last active June 1, 2017 20:56
Sistemas distribuidos
import imutils
import time
import cv2
from picamera.array import PiRGBArray
from picamera import PiCamera
import datetime
import RPi.GPIO as GPIO
import numpy as np