From 02742f2efe4d400dc3562730badb5ea13aaa0876 Mon Sep 17 00:00:00 2001 From: assiduous Date: Wed, 9 Sep 2020 21:47:03 -0700 Subject: Another set of minor updates to mesh shader implementation --- .../GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp | 6 +++++- .../GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp | 6 +++++- Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp | 14 +++++++------- 3 files changed, 17 insertions(+), 9 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp index a7d3c169..536a2df0 100755 --- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp @@ -97,7 +97,7 @@ void DeviceContextD3D11Impl::SetPipelineState(IPipelineState* pPipelineState) COMMIT_SHADER(CS, ComputeShader); } - else + else if (Desc.PipelineType == PIPELINE_TYPE_GRAPHICS) { COMMIT_SHADER(VS, VertexShader); COMMIT_SHADER(PS, PixelShader); @@ -127,6 +127,10 @@ void DeviceContextD3D11Impl::SetPipelineState(IPipelineState* pPipelineState) m_pd3d11DeviceContext->IASetPrimitiveTopology(m_CommittedD3D11PrimTopology); } } + else + { + UNEXPECTED(GetPipelineTypeString(Desc.PipelineType), " pipelines '", Desc.Name, "' are not supported in OpenGL"); + } } // clang-format off diff --git a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp index 97d76fde..f0625c7b 100644 --- a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp @@ -65,7 +65,7 @@ PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters* pR } m_ShaderResourceLayoutHash = pCS->GetD3D11Resources()->GetHash(); } - else + else if (m_Desc.PipelineType == PIPELINE_TYPE_GRAPHICS) { #define INIT_SHADER(ShortName, ExpectedType) \ @@ -125,6 +125,10 @@ PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters* pR "Failed to create the Direct3D11 input layout"); } } + else + { + UNEXPECTED(GetPipelineTypeString(m_Desc.PipelineType), " pipelines are not supported by Direct3D11 backend"); + } m_pStaticResourceLayouts = ALLOCATE(GetRawAllocator(), "Raw memory for ShaderResourceLayoutD3D11", ShaderResourceLayoutD3D11, m_NumShaders); m_pStaticResourceCaches = ALLOCATE(GetRawAllocator(), "Raw memory for ShaderResourceCacheD3D11", ShaderResourceCacheD3D11, m_NumShaders); diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp index 3b6edc0e..0db57800 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp @@ -41,8 +41,8 @@ static const ShaderVersion HLSLValidateShaderVersion(const ShaderVersion& Versio { ModelVer = MaxVersion; LOG_ERROR_MESSAGE("Shader model ", Uint32{Version.Major}, "_", Uint32{Version.Minor}, - " is not supported by this device. Maximum supported model: ", - MaxVersion.Major, "_", MaxVersion.Minor, ". Attempting to use ", MaxVersion.Major, "_", MaxVersion.Minor, '.'); + " is not supported by this device. Attempting to use the maximum supported model ", + Uint32{MaxVersion.Major}, "_", Uint32{MaxVersion.Minor}, '.'); } else { @@ -66,22 +66,22 @@ static const ShaderVersion GetD3D11ShaderModel(ID3D11Device* pd3d11Device, const case D3D_FEATURE_LEVEL_11_1: case D3D_FEATURE_LEVEL_11_0: return (HLSLVersion.Major == 0 && HLSLVersion.Minor == 0) ? - ShaderVersion(5, 0) : + ShaderVersion{5, 0} : HLSLValidateShaderVersion(HLSLVersion, {5, 0}); case D3D_FEATURE_LEVEL_10_1: return (HLSLVersion.Major == 0 && HLSLVersion.Minor == 0) ? - ShaderVersion(4, 1) : + ShaderVersion{4, 1} : HLSLValidateShaderVersion(HLSLVersion, {4, 1}); case D3D_FEATURE_LEVEL_10_0: return (HLSLVersion.Major == 0 && HLSLVersion.Minor == 0) ? - ShaderVersion(4, 0) : + ShaderVersion{4, 0} : HLSLValidateShaderVersion(HLSLVersion, {4, 0}); default: UNEXPECTED("Unexpected D3D feature level ", static_cast(d3dDeviceFeatureLevel)); - return ShaderVersion(4, 0); + return ShaderVersion{4, 0}; } } @@ -95,7 +95,7 @@ ShaderD3D11Impl::ShaderD3D11Impl(IReferenceCounters* pRefCounters, pRenderDeviceD3D11, ShaderCI.Desc }, - ShaderD3DBase{ShaderCI, GetD3D11ShaderModel(pRenderDeviceD3D11->GetD3D11Device(), ShaderCI.HLSLVersion), false} + ShaderD3DBase{ShaderCI, GetD3D11ShaderModel(pRenderDeviceD3D11->GetD3D11Device(), ShaderCI.HLSLVersion), nullptr} // clang-format on { auto* pDeviceD3D11 = pRenderDeviceD3D11->GetD3D11Device(); -- cgit v1.2.3