diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-04-14 18:04:53 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-04-14 18:04:53 +0000 |
| commit | a509e890a55eade6b10a36563f35219b61bf2707 (patch) | |
| tree | 33da45d394e57b9afbeae90e78bcedbafdd320c3 /Graphics/GraphicsEngineOpenGL | |
| parent | Implemented input vertex layout conversion in Vulkan (diff) | |
| download | DiligentCore-a509e890a55eade6b10a36563f35219b61bf2707.tar.gz DiligentCore-a509e890a55eade6b10a36563f35219b61bf2707.zip | |
Moved primitive topology from draw attribs to pipeline state desc
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp | 16 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp | 2 |
2 files changed, 7 insertions, 11 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index 7a0dfafc..a771318d 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -655,12 +655,6 @@ namespace Diligent void DeviceContextGLImpl::Draw( DrawAttribs &DrawAttribs ) { - if( DrawAttribs.Topology == PRIMITIVE_TOPOLOGY_UNDEFINED ) - { - LOG_ERROR_MESSAGE("Primitive topology is undefined"); - return; - } - if (!m_pPipelineState) { LOG_ERROR("No pipeline state is bound."); @@ -669,11 +663,12 @@ namespace Diligent auto *pRenderDeviceGL = ValidatedCast<RenderDeviceGLImpl>(m_pDevice.RawPtr()); auto CurrNativeGLContext = pRenderDeviceGL->m_GLContext.GetCurrentNativeGLContext(); + const auto& PipelineDesc = m_pPipelineState->GetDesc().GraphicsPipeline; if(!m_bVAOIsUpToDate) { auto &VAOCache = pRenderDeviceGL->GetVAOCache(CurrNativeGLContext); IBuffer *pIndexBuffer = DrawAttribs.IsIndexed ? m_pIndexBuffer.RawPtr() : nullptr; - if( m_pPipelineState->GetDesc().GraphicsPipeline.InputLayout.NumElements > 0 || pIndexBuffer != nullptr) + if(PipelineDesc.InputLayout.NumElements > 0 || pIndexBuffer != nullptr) { const auto& VAO = VAOCache.GetVAO( m_pPipelineState, pIndexBuffer, m_VertexStreams, m_NumVertexStreams, m_ContextState ); m_ContextState.BindVAO( VAO ); @@ -690,11 +685,12 @@ namespace Diligent } GLenum GlTopology; - if (DrawAttribs.Topology >= PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST) + auto Topology = PipelineDesc.PrimitiveTopology; + if (Topology >= PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST) { #if GL_ARB_tessellation_shader GlTopology = GL_PATCHES; - auto NumVertices = static_cast<Int32>(DrawAttribs.Topology - PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + 1); + auto NumVertices = static_cast<Int32>(Topology - PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + 1); m_ContextState.SetNumPatchVertices(NumVertices); #else UNSUPPORTED("Tessellation is not supported"); @@ -702,7 +698,7 @@ namespace Diligent } else { - GlTopology = PrimitiveTopologyToGLTopology( DrawAttribs.Topology ); + GlTopology = PrimitiveTopologyToGLTopology( Topology ); } GLenum IndexType = 0; Uint32 FirstIndexByteOffset = 0; diff --git a/Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp b/Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp index 6a842a45..92ea6703 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp @@ -104,6 +104,7 @@ namespace Diligent GraphicsPipeline.DepthStencilDesc.DepthEnable = false; GraphicsPipeline.DepthStencilDesc.DepthWriteEnable = false; GraphicsPipeline.pVS = m_pVertexShader; + GraphicsPipeline.PrimitiveTopology = PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; static const char* CmpTypePrefix[3] = { "", "i", "u" }; for( Int32 Dim = RESOURCE_DIM_TEX_2D; Dim <= RESOURCE_DIM_TEX_3D; ++Dim ) @@ -217,7 +218,6 @@ namespace Diligent DrawAttribs DrawAttrs; DrawAttrs.NumVertices = 4; - DrawAttrs.Topology = PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; pCtxGL->Draw( DrawAttrs ); SrcTexVar->Set( nullptr ); |
