diff --git a/renderdoc/api/replay/gl_pipestate.h b/renderdoc/api/replay/gl_pipestate.h index eb2b44c83..8c810c632 100644 --- a/renderdoc/api/replay/gl_pipestate.h +++ b/renderdoc/api/replay/gl_pipestate.h @@ -56,6 +56,8 @@ struct GLPipelineState ResourceId ibuffer; bool32 primitiveRestart; uint32_t restartIndex; + + bool32 provokingVertexLast; } m_VtxIn; struct ShaderStage @@ -67,6 +69,17 @@ struct GLPipelineState ShaderStageType stage; } m_VS, m_TCS, m_TES, m_GS, m_FS, m_CS; + + struct FixedVertexProcessing + { + float defaultInnerLevel[2]; + float defaultOuterLevel[4]; + bool32 discard; + + bool32 clipPlanes[8]; + bool32 clipOriginLowerLeft; + bool32 clipNegativeOneToOne; + } m_VtxProcess; struct Texture { @@ -214,4 +227,12 @@ struct GLPipelineState } m_Blending; } m_FB; + + struct Hints + { + QualityHint Derivatives; + QualityHint LineSmooth; + QualityHint PolySmooth; + QualityHint TexCompression; + } m_Hints; }; \ No newline at end of file diff --git a/renderdoc/api/replay/replay_enums.h b/renderdoc/api/replay/replay_enums.h index 9b251061f..e5b105bc7 100644 --- a/renderdoc/api/replay/replay_enums.h +++ b/renderdoc/api/replay/replay_enums.h @@ -178,6 +178,13 @@ enum SpecialFormat eSpecial_YUV, }; +enum QualityHint +{ + eQuality_DontCare, + eQuality_Nicest, + eQuality_Fastest, +}; + enum APIPipelineStateType { ePipelineState_D3D11, diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index 075563691..0ccb72899 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -1055,6 +1055,18 @@ void GLReplay::SavePipelineState() pipe.m_VtxIn.attributes[i].Format = fmt; } + + pipe.m_VtxIn.provokingVertexLast = (rs.ProvokingVertex != eGL_FIRST_VERTEX_CONVENTION); + + memcpy(pipe.m_VtxProcess.defaultInnerLevel, rs.PatchParams.defaultInnerLevel, sizeof(rs.PatchParams.defaultInnerLevel)); + memcpy(pipe.m_VtxProcess.defaultOuterLevel, rs.PatchParams.defaultOuterLevel, sizeof(rs.PatchParams.defaultOuterLevel)); + + pipe.m_VtxProcess.discard = rs.Enabled[GLRenderState::eEnabled_RasterizerDiscard]; + pipe.m_VtxProcess.clipOriginLowerLeft = (rs.ClipOrigin != eGL_UPPER_LEFT); + pipe.m_VtxProcess.clipNegativeOneToOne = (rs.ClipDepth != eGL_ZERO_TO_ONE); + for(int i=0; i < 8; i++) + pipe.m_VtxProcess.clipPlanes[i] = rs.Enabled[GLRenderState::eEnabled_ClipDistance0+i]; + // Shader stages & Textures GLint numTexUnits = 8; @@ -1071,7 +1083,7 @@ void GLReplay::SavePipelineState() pipe.m_GS.stage = eShaderStage_Geometry; pipe.m_FS.stage = eShaderStage_Fragment; pipe.m_CS.stage = eShaderStage_Compute; - + GLuint curProg = 0; gl.glGetIntegerv(eGL_CURRENT_PROGRAM, (GLint*)&curProg); @@ -1600,6 +1612,38 @@ void GLReplay::SavePipelineState() if(rs.ColorMasks[i].blue) pipe.m_FB.m_Blending.Blends[i].WriteMask |= 4; if(rs.ColorMasks[i].alpha) pipe.m_FB.m_Blending.Blends[i].WriteMask |= 8; } + + switch(rs.Hints.Derivatives) + { + default: + case eGL_DONT_CARE: pipe.m_Hints.Derivatives = eQuality_DontCare; break; + case eGL_NICEST: pipe.m_Hints.Derivatives = eQuality_Nicest; break; + case eGL_FASTEST: pipe.m_Hints.Derivatives = eQuality_Fastest; break; + } + + switch(rs.Hints.LineSmooth) + { + default: + case eGL_DONT_CARE: pipe.m_Hints.LineSmooth = eQuality_DontCare; break; + case eGL_NICEST: pipe.m_Hints.LineSmooth = eQuality_Nicest; break; + case eGL_FASTEST: pipe.m_Hints.LineSmooth = eQuality_Fastest; break; + } + + switch(rs.Hints.PolySmooth) + { + default: + case eGL_DONT_CARE: pipe.m_Hints.PolySmooth = eQuality_DontCare; break; + case eGL_NICEST: pipe.m_Hints.PolySmooth = eQuality_Nicest; break; + case eGL_FASTEST: pipe.m_Hints.PolySmooth = eQuality_Fastest; break; + } + + switch(rs.Hints.TexCompression) + { + default: + case eGL_DONT_CARE: pipe.m_Hints.TexCompression = eQuality_DontCare; break; + case eGL_NICEST: pipe.m_Hints.TexCompression = eQuality_Nicest; break; + case eGL_FASTEST: pipe.m_Hints.TexCompression = eQuality_Fastest; break; + } } void GLReplay::FillCBufferValue(WrappedOpenGL &gl, GLuint prog, bool bufferBacked, bool rowMajor, diff --git a/renderdocui/Interop/GLPipelineState.cs b/renderdocui/Interop/GLPipelineState.cs index 13df81204..7ef3c7cb5 100644 --- a/renderdocui/Interop/GLPipelineState.cs +++ b/renderdocui/Interop/GLPipelineState.cs @@ -61,6 +61,8 @@ namespace renderdoc public ResourceId ibuffer; public bool primitiveRestart; public UInt32 restartIndex; + + public bool provokingVertexLast; }; [CustomMarshalAs(CustomUnmanagedType.CustomClass)] public VertexInputs m_VtxIn; @@ -90,6 +92,23 @@ namespace renderdoc [CustomMarshalAs(CustomUnmanagedType.CustomClass)] public ShaderStage m_VS, m_TCS, m_TES, m_GS, m_FS, m_CS; + [StructLayout(LayoutKind.Sequential)] + public class FixedVertexProcessing + { + [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 2)] + public float[] defaultInnerLevel; + [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 4)] + public float[] defaultOuterLevel; + public bool discard; + + [CustomMarshalAs(CustomUnmanagedType.FixedArray, FixedLength = 8)] + public bool[] clipPlanes; + public bool clipOriginLowerLeft; + public bool clipNegativeOneToOne; + }; + [CustomMarshalAs(CustomUnmanagedType.CustomClass)] + public FixedVertexProcessing m_VtxProcess; + [StructLayout(LayoutKind.Sequential)] public class Texture { @@ -267,5 +286,16 @@ namespace renderdoc }; [CustomMarshalAs(CustomUnmanagedType.CustomClass)] public FrameBuffer m_FB; + + [StructLayout(LayoutKind.Sequential)] + public class Hints + { + public Int32 Derivatives; + public Int32 LineSmooth; + public Int32 PolySmooth; + public Int32 TexCompression; + }; + [CustomMarshalAs(CustomUnmanagedType.CustomClass)] + public Hints m_Hints; } }