yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

Pica: Add support for boolean uniforms.

This commit is contained in:
Tony Wasserka 2014-12-13 21:20:47 +01:00
parent 67618a2c55
commit aff808b2fd
4 changed files with 21 additions and 2 deletions

View File

@ -162,6 +162,12 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
break; break;
} }
case PICA_REG_INDEX(vs_bool_uniforms):
for (unsigned i = 0; i < 16; ++i)
VertexShader::GetBoolUniform(i) = (registers.vs_bool_uniforms.Value() & (1 << i));
break;
case PICA_REG_INDEX_WORKAROUND(vs_uniform_setup.set_value[0], 0x2c1): case PICA_REG_INDEX_WORKAROUND(vs_uniform_setup.set_value[0], 0x2c1):
case PICA_REG_INDEX_WORKAROUND(vs_uniform_setup.set_value[1], 0x2c2): case PICA_REG_INDEX_WORKAROUND(vs_uniform_setup.set_value[1], 0x2c2):
case PICA_REG_INDEX_WORKAROUND(vs_uniform_setup.set_value[2], 0x2c3): case PICA_REG_INDEX_WORKAROUND(vs_uniform_setup.set_value[2], 0x2c3):

View File

@ -492,7 +492,11 @@ struct Regs {
BitField<8, 2, TriangleTopology> triangle_topology; BitField<8, 2, TriangleTopology> triangle_topology;
INSERT_PADDING_WORDS(0x5b); INSERT_PADDING_WORDS(0x51);
BitField<0, 16, u32> vs_bool_uniforms;
INSERT_PADDING_WORDS(0x9);
// Offset to shader program entry point (in words) // Offset to shader program entry point (in words)
BitField<0, 16, u32> vs_main_offset; BitField<0, 16, u32> vs_main_offset;
@ -620,6 +624,7 @@ struct Regs {
ADD_FIELD(trigger_draw); ADD_FIELD(trigger_draw);
ADD_FIELD(trigger_draw_indexed); ADD_FIELD(trigger_draw_indexed);
ADD_FIELD(triangle_topology); ADD_FIELD(triangle_topology);
ADD_FIELD(vs_bool_uniforms);
ADD_FIELD(vs_main_offset); ADD_FIELD(vs_main_offset);
ADD_FIELD(vs_input_register_map); ADD_FIELD(vs_input_register_map);
ADD_FIELD(vs_uniform_setup); ADD_FIELD(vs_uniform_setup);
@ -690,6 +695,7 @@ ASSERT_REG_POSITION(num_vertices, 0x228);
ASSERT_REG_POSITION(trigger_draw, 0x22e); ASSERT_REG_POSITION(trigger_draw, 0x22e);
ASSERT_REG_POSITION(trigger_draw_indexed, 0x22f); ASSERT_REG_POSITION(trigger_draw_indexed, 0x22f);
ASSERT_REG_POSITION(triangle_topology, 0x25e); ASSERT_REG_POSITION(triangle_topology, 0x25e);
ASSERT_REG_POSITION(vs_bool_uniforms, 0x2b0);
ASSERT_REG_POSITION(vs_main_offset, 0x2ba); ASSERT_REG_POSITION(vs_main_offset, 0x2ba);
ASSERT_REG_POSITION(vs_input_register_map, 0x2bb); ASSERT_REG_POSITION(vs_input_register_map, 0x2bb);
ASSERT_REG_POSITION(vs_uniform_setup, 0x2c0); ASSERT_REG_POSITION(vs_uniform_setup, 0x2c0);

View File

@ -26,8 +26,9 @@ namespace VertexShader {
static struct { static struct {
Math::Vec4<float24> f[96]; Math::Vec4<float24> f[96];
} shader_uniforms;
std::array<bool,16> b;
} shader_uniforms;
// TODO: Not sure where the shader binary and swizzle patterns are supposed to be loaded to! // TODO: Not sure where the shader binary and swizzle patterns are supposed to be loaded to!
// For now, we just keep these local arrays around. // For now, we just keep these local arrays around.
@ -49,6 +50,11 @@ Math::Vec4<float24>& GetFloatUniform(u32 index)
return shader_uniforms.f[index]; return shader_uniforms.f[index];
} }
bool& GetBoolUniform(u32 index)
{
return shader_uniforms.b[index];
}
const std::array<u32, 1024>& GetShaderBinary() const std::array<u32, 1024>& GetShaderBinary()
{ {
return shader_memory; return shader_memory;

View File

@ -72,6 +72,7 @@ void SubmitSwizzleDataChange(u32 addr, u32 value);
OutputVertex RunShader(const InputVertex& input, int num_attributes); OutputVertex RunShader(const InputVertex& input, int num_attributes);
Math::Vec4<float24>& GetFloatUniform(u32 index); Math::Vec4<float24>& GetFloatUniform(u32 index);
bool& GetBoolUniform(u32 index);
const std::array<u32, 1024>& GetShaderBinary(); const std::array<u32, 1024>& GetShaderBinary();
const std::array<u32, 1024>& GetSwizzlePatterns(); const std::array<u32, 1024>& GetSwizzlePatterns();