From 56aacdacde0e37e12d4e59ebf96db59e7a31bb44 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 10 Mar 2017 10:38:34 -1000 Subject: [PATCH] backface culling support --- hecl/extern/boo | 2 +- hecl/lib/Backend/GLSL.cpp | 18 ++++++++++-------- hecl/lib/Backend/HLSL.cpp | 8 ++++---- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/hecl/extern/boo b/hecl/extern/boo index 5c5287754..ca20aea83 160000 --- a/hecl/extern/boo +++ b/hecl/extern/boo @@ -1 +1 @@ -Subproject commit 5c528775491b0a71df322298a3e8a631a3dd94d1 +Subproject commit ca20aea8344d8bef8d85047e253e97fa27563f1f diff --git a/hecl/lib/Backend/GLSL.cpp b/hecl/lib/Backend/GLSL.cpp index b07687bbd..58c7e35db 100644 --- a/hecl/lib/Backend/GLSL.cpp +++ b/hecl/lib/Backend/GLSL.cpp @@ -362,7 +362,8 @@ struct GLSLBackendFactory : IShaderBackendFactory boo::BlendFactor(m_backend.m_blendSrc), boo::BlendFactor(m_backend.m_blendDst), tag.getPrimType(), tag.getDepthTest(), - tag.getDepthWrite(), tag.getBackfaceCulling()); + tag.getDepthWrite(), + tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None); if (!objOut) Log.report(logvisor::Fatal, "unable to build shader"); @@ -401,7 +402,7 @@ struct GLSLBackendFactory : IShaderBackendFactory 2, STD_BLOCKNAMES, blendSrc, blendDst, tag.getPrimType(), tag.getDepthTest(), tag.getDepthWrite(), - tag.getBackfaceCulling()); + tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None); if (!ret) Log.report(logvisor::Fatal, "unable to build shader"); return ret; @@ -448,7 +449,8 @@ struct GLSLBackendFactory : IShaderBackendFactory boo::BlendFactor((slot.srcFactor == hecl::Backend::BlendFactor::Original) ? m_backend.m_blendSrc : slot.srcFactor), boo::BlendFactor((slot.dstFactor == hecl::Backend::BlendFactor::Original) ? m_backend.m_blendDst : slot.dstFactor), tag.getPrimType(), tag.getDepthTest(), - tag.getDepthWrite(), tag.getBackfaceCulling()); + tag.getDepthWrite(), + tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None); if (!ret) Log.report(logvisor::Fatal, "unable to build shader"); returnFunc(ret); @@ -508,7 +510,7 @@ struct GLSLBackendFactory : IShaderBackendFactory boo::BlendFactor((slot.srcFactor == hecl::Backend::BlendFactor::Original) ? blendSrc : slot.srcFactor), boo::BlendFactor((slot.dstFactor == hecl::Backend::BlendFactor::Original) ? blendDst : slot.dstFactor), tag.getPrimType(), tag.getDepthTest(), tag.getDepthWrite(), - tag.getBackfaceCulling()); + tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None); if (!ret) Log.report(logvisor::Fatal, "unable to build shader"); returnFunc(ret); @@ -555,7 +557,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory &vertBlob, &fragBlob, &pipelineBlob, tag.newVertexFormat(ctx), boo::BlendFactor(m_backend.m_blendSrc), boo::BlendFactor(m_backend.m_blendDst), tag.getPrimType(), tag.getDepthTest(), tag.getDepthWrite(), - tag.getBackfaceCulling()); + tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None); if (!objOut) Log.report(logvisor::Fatal, "unable to build shader"); @@ -633,7 +635,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory tag.newVertexFormat(ctx), blendSrc, blendDst, tag.getPrimType(), tag.getDepthTest(), tag.getDepthWrite(), - tag.getBackfaceCulling()); + tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None); if (!ret) Log.report(logvisor::Fatal, "unable to build shader"); return ret; @@ -680,7 +682,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory boo::BlendFactor((slot.dstFactor == hecl::Backend::BlendFactor::Original) ? m_backend.m_blendDst : slot.dstFactor), tag.getPrimType(), tag.getDepthTest(), tag.getDepthWrite(), - tag.getBackfaceCulling()); + tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None); if (!ret) Log.report(logvisor::Fatal, "unable to build shader"); cachedSz += pipeBlob.vert.size() * sizeof(unsigned int); @@ -771,7 +773,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory boo::BlendFactor((slot.srcFactor == hecl::Backend::BlendFactor::Original) ? blendSrc : slot.srcFactor), boo::BlendFactor((slot.dstFactor == hecl::Backend::BlendFactor::Original) ? blendDst : slot.dstFactor), tag.getPrimType(), tag.getDepthTest(), tag.getDepthWrite(), - tag.getBackfaceCulling()); + tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None); if (!ret) Log.report(logvisor::Fatal, "unable to build shader"); returnFunc(ret); diff --git a/hecl/lib/Backend/HLSL.cpp b/hecl/lib/Backend/HLSL.cpp index fd72ed623..b6b904780 100644 --- a/hecl/lib/Backend/HLSL.cpp +++ b/hecl/lib/Backend/HLSL.cpp @@ -323,7 +323,7 @@ struct HLSLBackendFactory : IShaderBackendFactory boo::BlendFactor(m_backend.m_blendDst), tag.getPrimType(), tag.getDepthTest(), tag.getDepthWrite(), - tag.getBackfaceCulling()); + tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None); if (!objOut) Log.report(logvisor::Fatal, "unable to build shader"); @@ -416,7 +416,7 @@ struct HLSLBackendFactory : IShaderBackendFactory tag.newVertexFormat(ctx), blendSrc, blendDst, tag.getPrimType(), tag.getDepthTest(), tag.getDepthWrite(), - tag.getBackfaceCulling()); + tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None); if (!ret) Log.report(logvisor::Fatal, "unable to build shader"); return ret; @@ -460,7 +460,7 @@ struct HLSLBackendFactory : IShaderBackendFactory boo::BlendFactor((slot.dstFactor == hecl::Backend::BlendFactor::Original) ? m_backend.m_blendDst : slot.dstFactor), tag.getPrimType(), tag.getDepthTest(), tag.getDepthWrite(), - tag.getBackfaceCulling()); + tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None); if (!ret) Log.report(logvisor::Fatal, "unable to build shader"); if (thisPipeBlobs.vert) @@ -558,7 +558,7 @@ struct HLSLBackendFactory : IShaderBackendFactory boo::BlendFactor((slot.dstFactor == hecl::Backend::BlendFactor::Original) ? blendDst : slot.dstFactor), tag.getPrimType(), tag.getDepthTest(), tag.getDepthWrite(), - tag.getBackfaceCulling()); + tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None); if (!ret) Log.report(logvisor::Fatal, "unable to build shader"); returnFunc(ret);