Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

Commit

Permalink
backface culling support
Browse files Browse the repository at this point in the history
  • Loading branch information
jackoalan committed Mar 10, 2017
1 parent c193e52 commit 325a919
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
18 changes: 10 additions & 8 deletions lib/Backend/GLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions lib/Backend/HLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 325a919

Please sign in to comment.