diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/command_processor.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/pica.h | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 2 |
4 files changed, 9 insertions, 8 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index eb79974a8..9c0ed79c7 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp | |||
| @@ -138,7 +138,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 138 | 138 | ||
| 139 | immediate_input.attr[immediate_attribute_id++] = attribute; | 139 | immediate_input.attr[immediate_attribute_id++] = attribute; |
| 140 | 140 | ||
| 141 | if (immediate_attribute_id >= regs.vs.num_input_attributes + 1) { | 141 | if (immediate_attribute_id >= regs.vs.max_input_attribute_index + 1) { |
| 142 | MICROPROFILE_SCOPE(GPU_Drawing); | 142 | MICROPROFILE_SCOPE(GPU_Drawing); |
| 143 | immediate_attribute_id = 0; | 143 | immediate_attribute_id = 0; |
| 144 | 144 | ||
| @@ -150,7 +150,8 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 150 | g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation, | 150 | g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation, |
| 151 | static_cast<void*>(&immediate_input)); | 151 | static_cast<void*>(&immediate_input)); |
| 152 | Shader::UnitState shader_unit; | 152 | Shader::UnitState shader_unit; |
| 153 | shader_unit.LoadInputVertex(immediate_input, regs.vs.num_input_attributes + 1); | 153 | shader_unit.LoadInputVertex(immediate_input, |
| 154 | regs.vs.max_input_attribute_index + 1); | ||
| 154 | shader_engine->Run(g_state.vs, shader_unit); | 155 | shader_engine->Run(g_state.vs, shader_unit); |
| 155 | auto output_vertex = Shader::OutputVertex::FromRegisters( | 156 | auto output_vertex = Shader::OutputVertex::FromRegisters( |
| 156 | shader_unit.registers.output, regs, regs.vs.output_mask); | 157 | shader_unit.registers.output, regs, regs.vs.output_mask); |
diff --git a/src/video_core/pica.h b/src/video_core/pica.h index b2db609ec..5afc9d5dd 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h | |||
| @@ -868,7 +868,7 @@ struct Regs { | |||
| 868 | LightSrc light[8]; | 868 | LightSrc light[8]; |
| 869 | LightColor global_ambient; // Emission + (material.ambient * lighting.ambient) | 869 | LightColor global_ambient; // Emission + (material.ambient * lighting.ambient) |
| 870 | INSERT_PADDING_WORDS(0x1); | 870 | INSERT_PADDING_WORDS(0x1); |
| 871 | BitField<0, 3, u32> num_lights; // Number of enabled lights - 1 | 871 | BitField<0, 3, u32> max_light_index; // Number of enabled lights - 1 |
| 872 | 872 | ||
| 873 | union { | 873 | union { |
| 874 | BitField<2, 2, LightingFresnelSelector> fresnel_selector; | 874 | BitField<2, 2, LightingFresnelSelector> fresnel_selector; |
| @@ -1045,7 +1045,7 @@ struct Regs { | |||
| 1045 | BitField<48, 12, u64> attribute_mask; | 1045 | BitField<48, 12, u64> attribute_mask; |
| 1046 | 1046 | ||
| 1047 | // number of total attributes minus 1 | 1047 | // number of total attributes minus 1 |
| 1048 | BitField<60, 4, u64> num_extra_attributes; | 1048 | BitField<60, 4, u64> max_attribute_index; |
| 1049 | }; | 1049 | }; |
| 1050 | 1050 | ||
| 1051 | inline VertexAttributeFormat GetFormat(int n) const { | 1051 | inline VertexAttributeFormat GetFormat(int n) const { |
| @@ -1076,7 +1076,7 @@ struct Regs { | |||
| 1076 | } | 1076 | } |
| 1077 | 1077 | ||
| 1078 | inline int GetNumTotalAttributes() const { | 1078 | inline int GetNumTotalAttributes() const { |
| 1079 | return (int)num_extra_attributes + 1; | 1079 | return (int)max_attribute_index + 1; |
| 1080 | } | 1080 | } |
| 1081 | 1081 | ||
| 1082 | // Attribute loaders map the source vertex data to input attributes | 1082 | // Attribute loaders map the source vertex data to input attributes |
| @@ -1214,7 +1214,7 @@ struct Regs { | |||
| 1214 | 1214 | ||
| 1215 | union { | 1215 | union { |
| 1216 | // Number of input attributes to shader unit - 1 | 1216 | // Number of input attributes to shader unit - 1 |
| 1217 | BitField<0, 4, u32> num_input_attributes; | 1217 | BitField<0, 4, u32> max_input_attribute_index; |
| 1218 | }; | 1218 | }; |
| 1219 | 1219 | ||
| 1220 | // Offset to shader program entry point (in words) | 1220 | // Offset to shader program entry point (in words) |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 2d2f4edc1..9dd9ae0fb 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -467,7 +467,7 @@ void RasterizerOpenGL::NotifyPicaRegisterChanged(u32 id) { | |||
| 467 | 467 | ||
| 468 | // Fragment lighting switches | 468 | // Fragment lighting switches |
| 469 | case PICA_REG_INDEX(lighting.disable): | 469 | case PICA_REG_INDEX(lighting.disable): |
| 470 | case PICA_REG_INDEX(lighting.num_lights): | 470 | case PICA_REG_INDEX(lighting.max_light_index): |
| 471 | case PICA_REG_INDEX(lighting.config0): | 471 | case PICA_REG_INDEX(lighting.config0): |
| 472 | case PICA_REG_INDEX(lighting.config1): | 472 | case PICA_REG_INDEX(lighting.config1): |
| 473 | case PICA_REG_INDEX(lighting.abs_lut_input): | 473 | case PICA_REG_INDEX(lighting.abs_lut_input): |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index cc3e4bed5..a1aa07074 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h | |||
| @@ -84,7 +84,7 @@ union PicaShaderConfig { | |||
| 84 | // Fragment lighting | 84 | // Fragment lighting |
| 85 | 85 | ||
| 86 | state.lighting.enable = !regs.lighting.disable; | 86 | state.lighting.enable = !regs.lighting.disable; |
| 87 | state.lighting.src_num = regs.lighting.num_lights + 1; | 87 | state.lighting.src_num = regs.lighting.max_light_index + 1; |
| 88 | 88 | ||
| 89 | for (unsigned light_index = 0; light_index < state.lighting.src_num; ++light_index) { | 89 | for (unsigned light_index = 0; light_index < state.lighting.src_num; ++light_index) { |
| 90 | unsigned num = regs.lighting.light_enable.GetNum(light_index); | 90 | unsigned num = regs.lighting.light_enable.GetNum(light_index); |