From f43a3249379519db96df542935662c97dfbd0598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandro=20S=C3=A1nchez=20Bach?= Date: Sun, 24 Nov 2013 01:47:17 +0100 Subject: [PATCH] New GCM commands implemented - NV4097_SET_DEPTH_BOUNDS_MIN - NV4097_SET_POLY_OFFSET_FILL_ENABLE - NV4097_SET_POLY_OFFSET_LINE_ENABLE - NV4097_SET_POLY_OFFSET_POINT_ENABLE - NV4097_SET_RESTART_INDEX_ENABLE - NV4097_SET_RESTART_INDEX --- rpcs3/Emu/GS/GL/GLGSRender.cpp | 17 +++++++++++++++++ rpcs3/Emu/GS/RSXThread.cpp | 29 ++++++++++++++++++++++++----- rpcs3/Emu/GS/RSXThread.h | 18 ++++++++++++++++++ 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/GS/GL/GLGSRender.cpp b/rpcs3/Emu/GS/GL/GLGSRender.cpp index 6e66e72289..740696c352 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.cpp +++ b/rpcs3/Emu/GS/GL/GLGSRender.cpp @@ -812,6 +812,10 @@ void GLGSRender::ExecCMD() Enable(m_set_stencil_test, GL_STENCIL_TEST); Enable(m_set_line_smooth, GL_LINE_SMOOTH); Enable(m_set_poly_smooth, GL_POLYGON_SMOOTH); + 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); + Enable(m_set_restart_index, GL_PRIMITIVE_RESTART); //Requires OpenGL 3.1+ if(m_set_clip_plane) { @@ -904,6 +908,12 @@ void GLGSRender::ExecCMD() checkForGlError("glDepthFunc"); } + if(m_set_depth_bounds) + { + glDepthRange(m_depth_bounds_min, m_depth_bounds_max); + checkForGlError("glDepthRange"); + } + if(m_set_clip) { glDepthRangef(m_clip_min, m_clip_max); @@ -960,6 +970,13 @@ void GLGSRender::ExecCMD() checkForGlError("glFogf(GL_FOG_END)"); } + if(m_set_restart_index) + { + ConLog.Warning("m_set_restart_index requires glPrimitiveRestartIndex()"); + //glPrimitiveRestartIndex(m_restart_index); //Requires OpenGL 3.1+ + //checkForGlError("glPrimitiveRestartIndex"); + } + if(m_indexed_array.m_count && m_draw_array_count) { ConLog.Warning("m_indexed_array.m_count && draw_array_count"); diff --git a/rpcs3/Emu/GS/RSXThread.cpp b/rpcs3/Emu/GS/RSXThread.cpp index 7b2c606136..e6758e77b9 100644 --- a/rpcs3/Emu/GS/RSXThread.cpp +++ b/rpcs3/Emu/GS/RSXThread.cpp @@ -372,6 +372,19 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 m_set_depth_bounds_test = args[0] ? true : false; break; + case NV4097_SET_DEPTH_BOUNDS_MIN: + { + m_set_depth_bounds = true; + const u32 depth_bounds_min = args[0]; + m_depth_bounds_min = (float&)depth_bounds_min; + if (count > 1) + { + const u32 depth_bounds_max = args[1]; + m_depth_bounds_max = (float&)depth_bounds_max; + } + } + break; + case NV4097_SET_ALPHA_FUNC: m_set_alpha_func = true; m_alpha_func = args[0]; @@ -826,11 +839,19 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 break; case NV4097_SET_POLY_OFFSET_FILL_ENABLE: - if(args[0]) ConLog.Error("NV4097_SET_POLY_OFFSET_FILL_ENABLE"); + m_set_poly_offset_fill = args[0] ? true : false; + break; + + case NV4097_SET_POLY_OFFSET_LINE_ENABLE: + m_set_poly_offset_line = args[0] ? true : false; + break; + + case NV4097_SET_POLY_OFFSET_POINT_ENABLE: + m_set_poly_offset_point = args[0] ? true : false; break; case NV4097_SET_RESTART_INDEX_ENABLE: - if(args[0]) ConLog.Error("NV4097_SET_RESTART_INDEX_ENABLE"); + m_set_restart_index = args[0] ? true : false; break; case NV4097_SET_POINT_PARAMS_ENABLE: @@ -943,9 +964,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 break; case NV4097_SET_RESTART_INDEX: - { - //TODO - } + m_restart_index = args[0]; break; case NV4097_INVALIDATE_L2: diff --git a/rpcs3/Emu/GS/RSXThread.h b/rpcs3/Emu/GS/RSXThread.h index 595a7df412..55cbdc4113 100644 --- a/rpcs3/Emu/GS/RSXThread.h +++ b/rpcs3/Emu/GS/RSXThread.h @@ -290,6 +290,9 @@ public: bool m_set_depth_func; int m_depth_func; + bool m_set_depth_bounds; + float m_depth_bounds_min; + float m_depth_bounds_max; bool m_set_alpha_test; bool m_set_blend; @@ -301,6 +304,12 @@ public: 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_restart_index; + u32 m_restart_index; bool m_set_viewport_horizontal; bool m_set_viewport_vertical; @@ -536,6 +545,10 @@ protected: m_clear_z = 0xffffff; m_clear_s = 0; + m_depth_bounds_min = 0.0; + m_depth_bounds_max = 1.0; + m_restart_index = 0xffffffff; + Reset(); } @@ -544,6 +557,7 @@ protected: m_set_color_mask = false; m_set_clip = false; m_set_depth_func = false; + m_set_depth_bounds = false; m_set_viewport_horizontal = false; m_set_viewport_vertical = false; m_set_scissor_horizontal = false; @@ -584,6 +598,10 @@ protected: m_set_cull_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_restart_index = false; m_clear_surface_mask = 0; m_begin_end = 0;