diff options
Diffstat (limited to 'src/video_core')
-rw-r--r-- | src/video_core/command_processor.cpp | 13 | ||||
-rw-r--r-- | src/video_core/pica.h | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 17 | ||||
-rw-r--r-- | src/video_core/shader/shader.cpp | 4 | ||||
-rw-r--r-- | src/video_core/shader/shader_interpreter.cpp | 74 |
5 files changed, 61 insertions, 49 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index bb618cacd..6bd5b281c 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -215,18 +215,17 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { PrimitiveAssembler<Shader::OutputVertex>& primitive_assembler = g_state.primitive_assembler; - if (g_debug_context) { + if (g_debug_context && g_debug_context->recorder) { for (int i = 0; i < 3; ++i) { const auto texture = regs.GetTextures()[i]; if (!texture.enabled) continue; u8* texture_data = Memory::GetPhysicalPointer(texture.config.GetPhysicalAddress()); - if (g_debug_context && Pica::g_debug_context->recorder) - g_debug_context->recorder->MemoryAccessed( - texture_data, Pica::Regs::NibblesPerPixel(texture.format) * - texture.config.width / 2 * texture.config.height, - texture.config.GetPhysicalAddress()); + g_debug_context->recorder->MemoryAccessed( + texture_data, Pica::Regs::NibblesPerPixel(texture.format) * + texture.config.width / 2 * texture.config.height, + texture.config.GetPhysicalAddress()); } } @@ -292,7 +291,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { } } - // Retreive vertex from register data + // Retrieve vertex from register data Shader::OutputVertex output_vertex = output_registers.ToVertex(regs.vs); // Send to renderer diff --git a/src/video_core/pica.h b/src/video_core/pica.h index b2db609ec..99bd59a69 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -40,7 +40,7 @@ namespace Pica { // field offset. Otherwise, the compiler will fail to compile this code. #define PICA_REG_INDEX_WORKAROUND(field_name, backup_workaround_index) \ ((typename std::enable_if<backup_workaround_index == PICA_REG_INDEX(field_name), \ - size_t>::type)PICA_REG_INDEX(field_name)) + size_t>::type) PICA_REG_INDEX(field_name)) #endif // _MSC_VER struct Regs { diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 03a588364..93f0ac105 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -390,6 +390,8 @@ void RendererOpenGL::DrawSingleScreenRotated(const ScreenInfo& screen_info, floa */ void RendererOpenGL::DrawScreens() { auto layout = render_window->GetFramebufferLayout(); + const auto& top_screen = layout.top_screen; + const auto& bottom_screen = layout.bottom_screen; glViewport(0, 0, layout.width, layout.height); glClear(GL_COLOR_BUFFER_BIT); @@ -403,12 +405,15 @@ void RendererOpenGL::DrawScreens() { glActiveTexture(GL_TEXTURE0); glUniform1i(uniform_color_texture, 0); - DrawSingleScreenRotated(screen_infos[0], (float)layout.top_screen.left, - (float)layout.top_screen.top, (float)layout.top_screen.GetWidth(), - (float)layout.top_screen.GetHeight()); - DrawSingleScreenRotated(screen_infos[1], (float)layout.bottom_screen.left, - (float)layout.bottom_screen.top, (float)layout.bottom_screen.GetWidth(), - (float)layout.bottom_screen.GetHeight()); + if (layout.top_screen_enabled) { + DrawSingleScreenRotated(screen_infos[0], (float)top_screen.left, (float)top_screen.top, + (float)top_screen.GetWidth(), (float)top_screen.GetHeight()); + } + if (layout.bottom_screen_enabled) { + DrawSingleScreenRotated(screen_infos[1], (float)bottom_screen.left, + (float)bottom_screen.top, (float)bottom_screen.GetWidth(), + (float)bottom_screen.GetHeight()); + } m_current_frame++; } diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index 272f3ffe1..3febe739c 100644 --- a/src/video_core/shader/shader.cpp +++ b/src/video_core/shader/shader.cpp @@ -146,10 +146,8 @@ DebugData<true> ShaderSetup::ProduceDebugInfo(const InputVertex& input, int num_ state.debug.max_opdesc_id = 0; // Setup input register table + boost::fill(state.registers.input, Math::Vec4<float24>::AssignToAll(float24::Zero())); const auto& attribute_register_map = config.input_register_map; - float24 dummy_register; - boost::fill(state.registers.input, &dummy_register); - for (unsigned i = 0; i < num_attributes; i++) state.registers.input[attribute_register_map.GetRegisterForAttribute(i)] = input.attr[i]; diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp index 501d00b6b..6abb6761f 100644 --- a/src/video_core/shader/shader_interpreter.cpp +++ b/src/video_core/shader/shader_interpreter.cpp @@ -116,32 +116,36 @@ void RunInterpreter(const ShaderSetup& setup, UnitState<Debug>& state, unsigned : state.address_registers[instr.common.address_register_index - 1]; const float24* src1_ = LookupSourceRegister(instr.common.GetSrc1(is_inverted) + - (!is_inverted * address_offset)); + (is_inverted ? 0 : address_offset)); const float24* src2_ = LookupSourceRegister(instr.common.GetSrc2(is_inverted) + - (is_inverted * address_offset)); + (is_inverted ? address_offset : 0)); const bool negate_src1 = ((bool)swizzle.negate_src1 != false); const bool negate_src2 = ((bool)swizzle.negate_src2 != false); float24 src1[4] = { - src1_[(int)swizzle.GetSelectorSrc1(0)], src1_[(int)swizzle.GetSelectorSrc1(1)], - src1_[(int)swizzle.GetSelectorSrc1(2)], src1_[(int)swizzle.GetSelectorSrc1(3)], + src1_[(int)swizzle.src1_selector_0.Value()], + src1_[(int)swizzle.src1_selector_1.Value()], + src1_[(int)swizzle.src1_selector_2.Value()], + src1_[(int)swizzle.src1_selector_3.Value()], }; if (negate_src1) { - src1[0] = src1[0] * float24::FromFloat32(-1); - src1[1] = src1[1] * float24::FromFloat32(-1); - src1[2] = src1[2] * float24::FromFloat32(-1); - src1[3] = src1[3] * float24::FromFloat32(-1); + src1[0] = -src1[0]; + src1[1] = -src1[1]; + src1[2] = -src1[2]; + src1[3] = -src1[3]; } float24 src2[4] = { - src2_[(int)swizzle.GetSelectorSrc2(0)], src2_[(int)swizzle.GetSelectorSrc2(1)], - src2_[(int)swizzle.GetSelectorSrc2(2)], src2_[(int)swizzle.GetSelectorSrc2(3)], + src2_[(int)swizzle.src2_selector_0.Value()], + src2_[(int)swizzle.src2_selector_1.Value()], + src2_[(int)swizzle.src2_selector_2.Value()], + src2_[(int)swizzle.src2_selector_3.Value()], }; if (negate_src2) { - src2[0] = src2[0] * float24::FromFloat32(-1); - src2[1] = src2[1] * float24::FromFloat32(-1); - src2[2] = src2[2] * float24::FromFloat32(-1); - src2[3] = src2[3] * float24::FromFloat32(-1); + src2[0] = -src2[0]; + src2[1] = -src2[1]; + src2[2] = -src2[2]; + src2[3] = -src2[3]; } float24* dest = @@ -451,34 +455,40 @@ void RunInterpreter(const ShaderSetup& setup, UnitState<Debug>& state, unsigned const bool negate_src3 = ((bool)swizzle.negate_src3 != false); float24 src1[4] = { - src1_[(int)swizzle.GetSelectorSrc1(0)], src1_[(int)swizzle.GetSelectorSrc1(1)], - src1_[(int)swizzle.GetSelectorSrc1(2)], src1_[(int)swizzle.GetSelectorSrc1(3)], + src1_[(int)swizzle.src1_selector_0.Value()], + src1_[(int)swizzle.src1_selector_1.Value()], + src1_[(int)swizzle.src1_selector_2.Value()], + src1_[(int)swizzle.src1_selector_3.Value()], }; if (negate_src1) { - src1[0] = src1[0] * float24::FromFloat32(-1); - src1[1] = src1[1] * float24::FromFloat32(-1); - src1[2] = src1[2] * float24::FromFloat32(-1); - src1[3] = src1[3] * float24::FromFloat32(-1); + src1[0] = -src1[0]; + src1[1] = -src1[1]; + src1[2] = -src1[2]; + src1[3] = -src1[3]; } float24 src2[4] = { - src2_[(int)swizzle.GetSelectorSrc2(0)], src2_[(int)swizzle.GetSelectorSrc2(1)], - src2_[(int)swizzle.GetSelectorSrc2(2)], src2_[(int)swizzle.GetSelectorSrc2(3)], + src2_[(int)swizzle.src2_selector_0.Value()], + src2_[(int)swizzle.src2_selector_1.Value()], + src2_[(int)swizzle.src2_selector_2.Value()], + src2_[(int)swizzle.src2_selector_3.Value()], }; if (negate_src2) { - src2[0] = src2[0] * float24::FromFloat32(-1); - src2[1] = src2[1] * float24::FromFloat32(-1); - src2[2] = src2[2] * float24::FromFloat32(-1); - src2[3] = src2[3] * float24::FromFloat32(-1); + src2[0] = -src2[0]; + src2[1] = -src2[1]; + src2[2] = -src2[2]; + src2[3] = -src2[3]; } float24 src3[4] = { - src3_[(int)swizzle.GetSelectorSrc3(0)], src3_[(int)swizzle.GetSelectorSrc3(1)], - src3_[(int)swizzle.GetSelectorSrc3(2)], src3_[(int)swizzle.GetSelectorSrc3(3)], + src3_[(int)swizzle.src3_selector_0.Value()], + src3_[(int)swizzle.src3_selector_1.Value()], + src3_[(int)swizzle.src3_selector_2.Value()], + src3_[(int)swizzle.src3_selector_3.Value()], }; if (negate_src3) { - src3[0] = src3[0] * float24::FromFloat32(-1); - src3[1] = src3[1] * float24::FromFloat32(-1); - src3[2] = src3[2] * float24::FromFloat32(-1); - src3[3] = src3[3] * float24::FromFloat32(-1); + src3[0] = -src3[0]; + src3[1] = -src3[1]; + src3[2] = -src3[2]; + src3[3] = -src3[3]; } float24* dest = |