diff --git a/rpcs3/Emu/GS/GL/GLGSRender.cpp b/rpcs3/Emu/GS/GL/GLGSRender.cpp index 3e5189153b..2ead98763e 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.cpp +++ b/rpcs3/Emu/GS/GL/GLGSRender.cpp @@ -852,17 +852,19 @@ void GLGSRender::ExecCMD() glClear(f); } - Enable(m_depth_test_enable, GL_DEPTH_TEST); + Enable(m_set_depth_test, GL_DEPTH_TEST); Enable(m_set_alpha_test, GL_ALPHA_TEST); Enable(m_set_depth_bounds_test, GL_DEPTH_BOUNDS_TEST_EXT); Enable(m_set_blend, GL_BLEND); Enable(m_set_logic_op, GL_LOGIC_OP); - Enable(m_set_cull_face_enable, GL_CULL_FACE); + Enable(m_set_cull_face, GL_CULL_FACE); Enable(m_set_dither, GL_DITHER); Enable(m_set_stencil_test, GL_STENCIL_TEST); Enable(m_set_scissor_horizontal && m_set_scissor_vertical, GL_SCISSOR_TEST); Enable(m_set_line_smooth, GL_LINE_SMOOTH); Enable(m_set_poly_smooth, GL_POLYGON_SMOOTH); + Enable(m_set_point_sprite_control, GL_POINT_SPRITE); + Enable(m_set_specular, GL_LIGHTING); Enable(m_set_poly_offset_fill, GL_POLYGON_OFFSET_FILL); Enable(m_set_poly_offset_line, GL_POLYGON_OFFSET_LINE); Enable(m_set_poly_offset_point, GL_POLYGON_OFFSET_POINT); @@ -895,9 +897,15 @@ void GLGSRender::ExecCMD() checkForGlError("glPolygonMode(Back)"); } - if (m_set_poly_offset_scale_factor && m_set_poly_offset_bias) + if (m_set_point_size) { - glPolygonOffset(m_set_poly_offset_scale_factor, m_set_poly_offset_bias); + glPointSize(m_point_size); + checkForGlError("glPointSize"); + } + + if (m_set_poly_offset_mode) + { + glPolygonOffset(m_poly_offset_scale_factor, m_poly_offset_bias); checkForGlError("glPolygonOffset"); } diff --git a/rpcs3/Emu/GS/RSXThread.cpp b/rpcs3/Emu/GS/RSXThread.cpp index 2fb3346a94..9800d9dfb6 100644 --- a/rpcs3/Emu/GS/RSXThread.cpp +++ b/rpcs3/Emu/GS/RSXThread.cpp @@ -509,7 +509,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_DEPTH_TEST_ENABLE: { - m_depth_test_enable = ARGS(0) ? true : false; + m_set_depth_test = ARGS(0) ? true : false; } break; @@ -829,7 +829,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_CULL_FACE_ENABLE: { - m_set_cull_face_enable = ARGS(0) ? true : false; + m_set_cull_face = ARGS(0) ? true : false; } break; @@ -983,12 +983,35 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 } break; + case NV4097_SET_POLYGON_OFFSET_SCALE_FACTOR: + { + m_set_depth_test = true; + m_set_poly_offset_mode = true; + m_poly_offset_scale_factor = ARGS(0); + } + break; + + case NV4097_SET_POLYGON_OFFSET_BIAS: + { + m_set_depth_test = true; + m_set_poly_offset_mode = true; + m_poly_offset_bias = ARGS(0); + } + break; + case NV4097_SET_RESTART_INDEX_ENABLE: { m_set_restart_index = ARGS(0) ? true : false; } break; + case NV4097_SET_POINT_SIZE: + { + m_set_point_size = true; + m_point_size = ARGS(0); + } + break; + case NV4097_SET_POINT_PARAMS_ENABLE: { if (ARGS(0)) @@ -998,8 +1021,13 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_POINT_SPRITE_CONTROL: { - if (ARGS(0) & 0x1) - ConLog.Error("NV4097_SET_POINT_SPRITE_CONTROL enable"); + m_set_point_sprite_control = ARGS(0) ? true : false; + } + break; + + case NV4097_SET_SPECULAR_ENABLE: + { + m_set_specular = ARGS(0) ? true : false; } break; @@ -1322,7 +1350,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 { u32 a0 = ARGS(0); - m_depth_test_enable = a0 & 0x1 ? true : false; + m_set_depth_test = a0 & 0x1 ? true : false; m_set_stencil_test = a0 & 0x2 ? true : false; } break; diff --git a/rpcs3/Emu/GS/RSXThread.h b/rpcs3/Emu/GS/RSXThread.h index 1b2a675002..eb184a6e09 100644 --- a/rpcs3/Emu/GS/RSXThread.h +++ b/rpcs3/Emu/GS/RSXThread.h @@ -146,50 +146,55 @@ public: Callback m_flip_handler; public: + // Dither + bool m_set_dither; + + // Color mask bool m_set_color_mask; bool m_color_mask_r; bool m_color_mask_g; bool m_color_mask_b; bool m_color_mask_a; + // Clip bool m_set_clip; float m_clip_min; float m_clip_max; + // Depth test + bool m_set_depth_test; bool m_set_depth_func; int m_depth_func; + bool m_set_depth_mask; + u32 m_depth_mask; + + // Depth bound test + bool m_set_depth_bounds_test; bool m_set_depth_bounds; float m_depth_bounds_min; float m_depth_bounds_max; - bool m_set_alpha_test; - bool m_set_blend; - bool m_set_depth_bounds_test; - bool m_depth_test_enable; - bool m_set_cull_face_enable; - bool m_set_dither; - bool m_set_stencil_test; - bool m_set_line_smooth; - bool m_set_poly_smooth; - bool m_set_poly_offset_fill; - bool m_set_poly_offset_line; - bool m_set_poly_offset_point; - - bool m_set_poly_offset_scale_factor; - u32 m_poly_offset_scale_factor; - bool m_set_poly_offset_bias; - u32 m_poly_offset_bias; - + // Primitive restart bool m_set_restart_index; u32 m_restart_index; + // Point + bool m_set_point_size; + bool m_set_point_sprite_control; + u32 m_point_size; + u16 m_point_x; + u16 m_point_y; + + // Line smooth + bool m_set_line_smooth; + + // Viewport & scissor bool m_set_viewport_horizontal; bool m_set_viewport_vertical; u16 m_viewport_x; u16 m_viewport_y; u16 m_viewport_w; u16 m_viewport_h; - bool m_set_scissor_horizontal; bool m_set_scissor_vertical; u16 m_scissor_x; @@ -197,14 +202,24 @@ public: u16 m_scissor_w; u16 m_scissor_h; + // Polygon + bool m_set_poly_smooth; + bool m_set_poly_offset_fill; + bool m_set_poly_offset_line; + bool m_set_poly_offset_point; bool m_set_front_polygon_mode; u32 m_front_polygon_mode; bool m_set_back_polygon_mode; u32 m_back_polygon_mode; - + bool m_set_poly_offset_mode; + u32 m_poly_offset_scale_factor; + u32 m_poly_offset_bias; + + // Logic Ops bool m_set_logic_op; u32 m_logic_op; + // Clearing u32 m_clear_surface_mask; u32 m_clear_surface_z; u8 m_clear_surface_s; @@ -212,78 +227,6 @@ public: u8 m_clear_surface_color_g; u8 m_clear_surface_color_b; u8 m_clear_surface_color_a; - - bool m_set_blend_sfactor; - u16 m_blend_sfactor_rgb; - u16 m_blend_sfactor_alpha; - - bool m_set_blend_dfactor; - u16 m_blend_dfactor_rgb; - u16 m_blend_dfactor_alpha; - - bool m_set_stencil_mask; - u32 m_stencil_mask; - - bool m_set_stencil_func; - u32 m_stencil_func; - - bool m_set_stencil_func_ref; - u32 m_stencil_func_ref; - - bool m_set_stencil_func_mask; - u32 m_stencil_func_mask; - - bool m_set_stencil_fail; - u32 m_stencil_fail; - - bool m_set_stencil_zfail; - u32 m_stencil_zfail; - - bool m_set_stencil_zpass; - u32 m_stencil_zpass; - - bool m_set_two_sided_stencil_test_enable; - - bool m_set_back_stencil_mask; - u32 m_back_stencil_mask; - - bool m_set_back_stencil_func; - u32 m_back_stencil_func; - - bool m_set_back_stencil_func_ref; - u32 m_back_stencil_func_ref; - - bool m_set_back_stencil_func_mask; - u32 m_back_stencil_func_mask; - - bool m_set_back_stencil_fail; - u32 m_back_stencil_fail; - - bool m_set_back_stencil_zfail; - u32 m_back_stencil_zfail; - - bool m_set_back_stencil_zpass; - u32 m_back_stencil_zpass; - - bool m_set_blend_equation; - u16 m_blend_equation_rgb; - u16 m_blend_equation_alpha; - - bool m_set_depth_mask; - u32 m_depth_mask; - - bool m_set_line_width; - u32 m_line_width; - - bool m_set_shade_mode; - u32 m_shade_mode; - - bool m_set_blend_color; - u8 m_blend_color_r; - u8 m_blend_color_g; - u8 m_blend_color_b; - u8 m_blend_color_a; - u8 m_clear_color_r; u8 m_clear_color_g; u8 m_clear_color_b; @@ -291,13 +234,70 @@ public: u8 m_clear_s; u32 m_clear_z; - u32 m_context_dma_img_src; - u32 m_context_dma_img_dst; - u32 m_dst_offset; + // Blending + bool m_set_blend; + bool m_set_blend_dfactor; + u16 m_blend_dfactor_rgb; + u16 m_blend_dfactor_alpha; + bool m_set_blend_sfactor; + u16 m_blend_sfactor_rgb; + u16 m_blend_sfactor_alpha; + bool m_set_blend_equation; + u16 m_blend_equation_rgb; + u16 m_blend_equation_alpha; + bool m_set_blend_color; + u8 m_blend_color_r; + u8 m_blend_color_g; + u8 m_blend_color_b; + u8 m_blend_color_a; + + // Stencil Test + bool m_set_stencil_test; + bool m_set_stencil_mask; + u32 m_stencil_mask; + bool m_set_stencil_func; + u32 m_stencil_func; + bool m_set_stencil_func_ref; + u32 m_stencil_func_ref; + bool m_set_stencil_func_mask; + u32 m_stencil_func_mask; + bool m_set_stencil_fail; + u32 m_stencil_fail; + bool m_set_stencil_zfail; + u32 m_stencil_zfail; + bool m_set_stencil_zpass; + u32 m_stencil_zpass; + bool m_set_two_sided_stencil_test_enable; + bool m_set_back_stencil_mask; + u32 m_back_stencil_mask; + bool m_set_back_stencil_func; + u32 m_back_stencil_func; + bool m_set_back_stencil_func_ref; + u32 m_back_stencil_func_ref; + bool m_set_back_stencil_func_mask; + u32 m_back_stencil_func_mask; + bool m_set_back_stencil_fail; + u32 m_back_stencil_fail; + bool m_set_back_stencil_zfail; + u32 m_back_stencil_zfail; + bool m_set_back_stencil_zpass; + u32 m_back_stencil_zpass; + + // Line width + bool m_set_line_width; + u32 m_line_width; + + // Shader mode + bool m_set_shade_mode; + u32 m_shade_mode; + + // Lighting + bool m_set_specular; + + // Color u32 m_color_format; u16 m_color_format_src_pitch; u16 m_color_format_dst_pitch; - u32 m_color_conv; u32 m_color_conv_fmt; u32 m_color_conv_op; @@ -312,16 +312,18 @@ public: u32 m_color_conv_dsdx; u32 m_color_conv_dtdy; + // Semaphore bool m_set_semaphore_offset; u32 m_semaphore_offset; + // Fog bool m_set_fog_mode; u32 m_fog_mode; - bool m_set_fog_params; float m_fog_param0; float m_fog_param1; + // Clip plane bool m_set_clip_plane; u32 m_clip_plane_0; u32 m_clip_plane_1; @@ -330,6 +332,7 @@ public: u32 m_clip_plane_4; u32 m_clip_plane_5; + // Surface bool m_set_surface_format; u8 m_surface_color_format; u8 m_surface_depth_format; @@ -337,58 +340,56 @@ public: u8 m_surface_antialias; u8 m_surface_width; u8 m_surface_height; - - bool m_set_context_dma_color_a; - u32 m_context_dma_color_a; - - bool m_set_context_dma_color_b; - u32 m_context_dma_color_b; - - bool m_set_context_dma_color_c; - u32 m_context_dma_color_c; - - bool m_set_context_dma_color_d; - u32 m_context_dma_color_d; - - bool m_set_context_dma_z; - u32 m_context_dma_z; - bool m_set_surface_clip_horizontal; u16 m_surface_clip_x; u16 m_surface_clip_w; bool m_set_surface_clip_vertical; u16 m_surface_clip_y; u16 m_surface_clip_h; - - bool m_set_cull_face; - u32 m_cull_face; - - bool m_set_alpha_func; - u32 m_alpha_func; - - bool m_set_alpha_ref; - u32 m_alpha_ref; - u32 m_surface_pitch_a; u32 m_surface_pitch_b; u32 m_surface_pitch_c; u32 m_surface_pitch_d; u32 m_surface_pitch_z; - u32 m_surface_offset_a; u32 m_surface_offset_b; u32 m_surface_offset_c; u32 m_surface_offset_d; u32 m_surface_offset_z; + u32 m_surface_colour_target; + // DMA context + bool m_set_context_dma_color_a; + u32 m_context_dma_color_a; + bool m_set_context_dma_color_b; + u32 m_context_dma_color_b; + bool m_set_context_dma_color_c; + u32 m_context_dma_color_c; + bool m_set_context_dma_color_d; + u32 m_context_dma_color_d; + bool m_set_context_dma_z; + u32 m_context_dma_z; + u32 m_context_dma_img_src; + u32 m_context_dma_img_dst; + u32 m_dst_offset; + + // Cull face + bool m_set_cull_face; + u32 m_cull_face; + + // Alpha test + bool m_set_alpha_test; + bool m_set_alpha_func; + u32 m_alpha_func; + bool m_set_alpha_ref; + u32 m_alpha_ref; + + // Shader u16 m_shader_window_height; u8 m_shader_window_origin; u16 m_shader_window_pixel_centers; - u16 m_point_x, m_point_y; - - u32 m_surface_colour_target; - + // Front face bool m_set_front_face; u32 m_front_face; @@ -413,19 +414,26 @@ protected: , m_gcm_current_buffer(0) , m_read_buffer(true) { + m_set_depth_test = false; m_set_alpha_test = false; - m_set_blend = false; m_set_depth_bounds_test = false; - m_depth_test_enable = false; + m_set_blend = false; m_set_logic_op = false; - m_set_cull_face_enable = false; + m_set_cull_face = false; m_set_dither = false; m_set_stencil_test = false; + m_set_scissor_horizontal = false; + m_set_scissor_vertical = false; m_set_line_smooth = false; m_set_poly_smooth = false; + m_set_point_size = false; m_set_two_sided_stencil_test_enable = false; m_set_surface_clip_horizontal = false; m_set_surface_clip_vertical = false; + m_set_poly_offset_fill = false; + m_set_poly_offset_line = false; + m_set_poly_offset_point = false; + m_set_restart_index = false; m_clear_color_r = 0; m_clear_color_g = 0; @@ -443,11 +451,11 @@ protected: m_front_polygon_mode = 0x1B02; // GL_FILL m_back_polygon_mode = 0x1B02; // GL_FILL - + m_front_face = 0x0901; + m_point_x = 0; m_point_y = 0; - - m_front_face = 0x0901; + m_point_size = 0; // Construct Textures for(int i=0; i<16; i++) @@ -466,6 +474,7 @@ protected: m_set_clip = false; m_set_depth_func = false; m_set_depth_bounds = false; + m_set_depth_test = false; m_set_viewport_horizontal = false; m_set_viewport_vertical = false; m_set_scissor_horizontal = false; @@ -504,14 +513,17 @@ protected: m_set_context_dma_color_d = false; m_set_context_dma_z = false; m_set_cull_face = false; + m_set_front_face = false; m_set_alpha_func = false; m_set_alpha_ref = false; m_set_poly_offset_fill = false; m_set_poly_offset_line = false; m_set_poly_offset_point = false; - m_set_poly_offset_scale_factor = false; - m_set_poly_offset_bias = false; + m_set_poly_offset_mode = false; m_set_restart_index = false; + m_set_point_size = false; + m_set_point_sprite_control = false; + m_set_specular = false; m_clear_surface_mask = 0; m_begin_end = 0; diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index 7e44764af9..c44a731910 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -369,16 +369,17 @@ void InitContext(mem_ptr_t& cntxt) r.m_set_blend = false; //GcmCmdTypePrefix::cellGcmSetBlendEnableMrt(con, CELL_GCM_FALSE, CELL_GCM_FALSE, CELL_GCM_FALSE); r.m_set_logic_op = false; - r.m_set_cull_face_enable = false; + r.m_set_cull_face = false; r.m_set_depth_bounds_test = false; - r.m_depth_test_enable = false; + r.m_set_depth_test = false; //GcmCmdTypePrefix::cellGcmSetPolygonOffsetFillEnable(con, CELL_GCM_FALSE); r.m_set_stencil_test = false; r.m_set_two_sided_stencil_test_enable = false; //GcmCmdTypePrefix::cellGcmSetPointSpriteControl(con, CELL_GCM_FALSE, 0, 0); r.m_set_dither = true; - r.m_set_shade_mode = true; r.m_shade_mode = 0x1D01; //CELL_GCM_SMOOTH + r.m_set_shade_mode = true; r.m_shade_mode = 0x1D01; //GcmCmdTypePrefix::cellGcmSetFrequencyDividerOperation(con, 0); + r.m_set_specular = false; r.m_set_viewport_horizontal = r.m_set_viewport_vertical = true; r.m_viewport_x = 0; diff --git a/rpcs3/Gui/RSXDebugger.cpp b/rpcs3/Gui/RSXDebugger.cpp index 4ad1412ef7..3b73bf1cce 100644 --- a/rpcs3/Gui/RSXDebugger.cpp +++ b/rpcs3/Gui/RSXDebugger.cpp @@ -484,9 +484,9 @@ void RSXDebugger::GetFlags() LIST_FLAGS_ADD("Alpha test", render.m_set_alpha_test); LIST_FLAGS_ADD("Blend", render.m_set_blend); LIST_FLAGS_ADD("Scissor", render.m_set_scissor_horizontal && render.m_set_scissor_vertical); - LIST_FLAGS_ADD("Cull face", render.m_set_cull_face_enable); + LIST_FLAGS_ADD("Cull face", render.m_set_cull_face); LIST_FLAGS_ADD("Depth bounds test", render.m_set_depth_bounds_test); - LIST_FLAGS_ADD("Depth test", render.m_depth_test_enable); + LIST_FLAGS_ADD("Depth test", render.m_set_depth_test); LIST_FLAGS_ADD("Dither", render.m_set_dither); LIST_FLAGS_ADD("Line smooth", render.m_set_line_smooth); LIST_FLAGS_ADD("Logic op", render.m_set_logic_op); @@ -496,6 +496,8 @@ void RSXDebugger::GetFlags() LIST_FLAGS_ADD("Poly offset point", render.m_set_poly_offset_point); LIST_FLAGS_ADD("Stencil test", render.m_set_stencil_test); LIST_FLAGS_ADD("Primitive restart", render.m_set_restart_index); + LIST_FLAGS_ADD("Point Sprite", render.m_set_point_sprite_control); + LIST_FLAGS_ADD("Lighting ", render.m_set_specular); #undef LIST_FLAGS_ADD } @@ -636,19 +638,24 @@ void RSXDebugger::SetFlags(wxListEvent& event) GSRender& render = Emu.GetGSManager().GetRender(); switch(event.m_itemIndex) { - case 0: render.m_set_alpha_test ^= true; break; - case 1: render.m_set_blend ^= true; break; - case 2: render.m_set_cull_face_enable ^= true; break; - case 3: render.m_set_depth_bounds_test ^= true; break; - case 4: render.m_depth_test_enable ^= true; break; - case 5: render.m_set_dither ^= true; break; - case 6: render.m_set_line_smooth ^= true; break; - case 7: render.m_set_logic_op ^= true; break; - case 8: render.m_set_poly_smooth ^= true; break; - case 9: render.m_set_poly_offset_fill ^= true; break; - case 10: render.m_set_poly_offset_line ^= true; break; - case 11: render.m_set_poly_offset_point ^= true; break; - case 12: render.m_set_stencil_test ^= true; break; + case 0: render.m_set_alpha_test ^= true; break; + case 1: render.m_set_blend ^= true; break; + case 2: render.m_set_cull_face ^= true; break; + case 3: render.m_set_depth_bounds_test ^= true; break; + case 4: render.m_set_depth_test ^= true; break; + case 5: render.m_set_dither ^= true; break; + case 6: render.m_set_line_smooth ^= true; break; + case 7: render.m_set_logic_op ^= true; break; + case 8: render.m_set_poly_smooth ^= true; break; + case 9: render.m_set_poly_offset_fill ^= true; break; + case 10: render.m_set_poly_offset_line ^= true; break; + case 11: render.m_set_poly_offset_point ^= true; break; + case 12: render.m_set_stencil_test ^= true; break; + case 13: render.m_set_point_sprite_control ^= true; break; + case 14: render.m_set_restart_index ^= true; break; + case 15: render.m_set_specular ^= true; break; + case 16: render.m_set_scissor_horizontal ^= true; break; + case 17: render.m_set_scissor_vertical ^= true; break; } UpdateInformation();