26 #include "GraphicsTypes.h" 27 #include "GLObjectWrapper.h" 28 #include "UniqueIdentifier.h" 29 #include "GLContext.h" 37 GLContextState(
class RenderDeviceGLImpl *pDeviceGL);
39 void SetProgram(
const GLObjectWrappers::GLProgramObj &GLProgram );
40 void SetPipeline(
const GLObjectWrappers::GLPipelineObj &GLPipeline );
41 void BindVAO(
const GLObjectWrappers::GLVertexArrayObj &VAO );
42 void BindFBO(
const GLObjectWrappers::GLFrameBufferObj &FBO );
43 void SetActiveTexture( Int32 Index );
44 void BindTexture( Int32 Index, GLenum BindTarget,
const GLObjectWrappers::GLTextureObj &Tex);
45 void BindSampler( Uint32 Index,
const GLObjectWrappers::GLSamplerObj &GLSampler);
46 void BindImage( Uint32 Index,
class TextureViewGLImpl *pTexView, GLint MipLevel, GLboolean IsLayered, GLint Layer, GLenum Access, GLenum Format );
47 void EnsureMemoryBarrier(Uint32 RequiredBarriers,
class AsyncWritableResource *pRes =
nullptr);
48 void SetPendingMemoryBarriers( Uint32 PendingBarriers );
50 void EnableDepthTest( Bool bEnable );
51 void EnableDepthWrites( Bool bEnable );
53 void EnableStencilTest( Bool bEnable );
54 void SetStencilWriteMask( Uint8 StencilWriteMask );
55 void SetStencilRef( GLenum Face, Int32 Ref );
61 void SetFrontFace( Bool FrontCounterClockwise );
62 void SetDepthBias(
float DepthBias,
float fSlopeScaledDepthBias );
63 void SetDepthClamp( Bool bEnableDepthClamp );
64 void EnableScissorTest( Bool bEnableScissorTest );
66 void SetBlendFactors(
const float *BlendFactors);
67 void SetBlendState(
const BlendStateDesc &BSDsc, Uint32 SampleMask);
69 Bool GetDepthWritesEnabled(){
return m_DSState.m_DepthWritesEnableState; }
70 Bool GetScissorTestEnabled(){
return m_RSState.ScissorTestEnable; }
71 void GetColorWriteMask( Uint32 RTIndex, Uint32 &WriteMask, Bool &bIsIndependent );
72 void SetColorWriteMask( Uint32 RTIndex, Uint32 WriteMask, Bool bIsIndependent );
74 void SetNumPatchVertices( Int32 NumVertices);
77 void SetCurrentGLContext(GLContext::NativeGLContextType Context) { m_CurrentGLContext = Context; }
78 GLContext::NativeGLContextType GetCurrentGLContext()
const {
return m_CurrentGLContext; }
88 Diligent::UniqueIdentifier m_GLProgId = -1;
89 Diligent::UniqueIdentifier m_GLPipelineId = -1;
90 Diligent::UniqueIdentifier m_VAOId = -1;
91 Diligent::UniqueIdentifier m_FBOId = -1;
92 std::vector< Diligent::UniqueIdentifier > m_BoundTextures;
93 std::vector< Diligent::UniqueIdentifier > m_BoundSamplers;
96 Diligent::UniqueIdentifier InterfaceID = -1;
98 GLboolean IsLayered = 0;
105 BoundImageInfo( Diligent::UniqueIdentifier _UniqueID,
107 GLboolean _IsLayered,
111 InterfaceID (_UniqueID ),
112 MipLevel (_MipLevel ),
113 IsLayered (_IsLayered),
119 bool operator==(
const BoundImageInfo &rhs)
const 121 return InterfaceID == rhs.InterfaceID &&
122 MipLevel == rhs.MipLevel &&
123 IsLayered == rhs.IsLayered &&
124 Layer == rhs.Layer &&
125 Access == rhs.Access &&
126 Format == rhs.Format;
129 std::vector< BoundImageInfo > m_BoundImages;
131 Uint32 m_PendingMemoryBarriers = 0;
133 class EnableStateHelper
136 enum class ENABLE_STATE : Int32
143 bool operator == (
bool bEnabled)
const 145 return (bEnabled && m_EnableState == ENABLE_STATE::ENABLED) ||
146 (!bEnabled && m_EnableState == ENABLE_STATE::DISABLED);
148 bool operator != (
bool bEnabled)
const 150 return !(*
this == bEnabled);
153 const EnableStateHelper& operator = (
bool bEnabled)
155 m_EnableState = bEnabled ? ENABLE_STATE::ENABLED : ENABLE_STATE::DISABLED;
161 return m_EnableState == ENABLE_STATE::ENABLED;
165 ENABLE_STATE m_EnableState = ENABLE_STATE::UNKNOWN;
168 struct DepthStencilGLState
170 EnableStateHelper m_DepthEnableState;
171 EnableStateHelper m_DepthWritesEnableState;
173 EnableStateHelper m_StencilTestEnableState;
174 Uint16 m_StencilReadMask = 0xFFFF;
175 Uint16 m_StencilWriteMask = 0xFFFF;
176 struct StencilOpState
182 Int32 Ref = std::numeric_limits<Int32>::min();
183 Uint32 Mask =
static_cast<Uint32
>(-1);
184 }m_StencilOpState[2];
187 struct RasterizerGLState
191 EnableStateHelper FrontCounterClockwise;
192 float fDepthBias = std::numeric_limits<float>::max();
193 float fSlopeScaledDepthBias = std::numeric_limits<float>::max();
194 EnableStateHelper DepthClampEnable;
195 EnableStateHelper ScissorTestEnable;
200 bool bFillModeSelectionSupported = True;
201 GLint m_iMaxCombinedTexUnits = 0;
204 Uint32 m_ColorWriteMasks[
MaxRenderTargets] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
205 EnableStateHelper m_bIndependentWriteMasks;
206 Int32 m_iActiveTexture = -1;
207 Int32 m_NumPatchVertices = -1;
209 GLContext::NativeGLContextType m_CurrentGLContext = {};
STENCIL_OP
Stencil operation.
Definition: DepthStencilState.h:42
Undefined fill mode.
Definition: RasterizerState.h:43
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
static constexpr Uint32 MaxRenderTargets
Maximum number of simultaneous render targets.
Definition: Constants.h:36
Undefined cull mode.
Definition: RasterizerState.h:66
Unknown comparison function.
Definition: GraphicsTypes.h:850
FILL_MODE
Fill mode.
Definition: RasterizerState.h:40
Undefined operation.
Definition: DepthStencilState.h:45
COMPARISON_FUNCTION
Comparison function.
Definition: GraphicsTypes.h:847
CULL_MODE
Cull mode.
Definition: RasterizerState.h:63