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

Commit

Permalink
Ensure shader extension textures don't conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
jackoalan committed Mar 5, 2017
1 parent b80547d commit f1a7598
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions lib/Backend/GLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ std::string GLSL::makeFrag(const char* glslVer, bool alphaTest,
for (int i=0 ; i<extTexCount ; ++i)
{
const TextureInfo& extTex = extTexs[i];
texMapDecl += hecl::Format("TBINDING%u uniform sampler2D tex%u;\n",
texMapDecl += hecl::Format("TBINDING%u uniform sampler2D extTex%u;\n",
extTex.mapIdx, extTex.mapIdx);
}

Expand Down Expand Up @@ -552,7 +552,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory
objOut =
static_cast<boo::VulkanDataFactory::Context&>(ctx).
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
vertBlob, fragBlob, pipelineBlob, tag.newVertexFormat(ctx),
&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());
Expand Down Expand Up @@ -629,7 +629,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory
boo::IShaderPipeline* ret =
static_cast<boo::VulkanDataFactory::Context&>(ctx).
newShaderPipeline(nullptr, nullptr,
vertBlob, fragBlob, pipelineBlob,
&vertBlob, &fragBlob, &pipelineBlob,
tag.newVertexFormat(ctx),
blendSrc, blendDst, tag.getPrimType(),
tag.getDepthTest(), tag.getDepthWrite(),
Expand Down Expand Up @@ -673,7 +673,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory
boo::IShaderPipeline* ret =
static_cast<boo::VulkanDataFactory::Context&>(ctx).
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
pipeBlob.vert, pipeBlob.frag, pipeBlob.pipeline,
&pipeBlob.vert, &pipeBlob.frag, &pipeBlob.pipeline,
tag.newVertexFormat(ctx),
boo::BlendFactor((slot.srcFactor == hecl::Backend::BlendFactor::Original) ?
m_backend.m_blendSrc : slot.srcFactor),
Expand Down Expand Up @@ -766,7 +766,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory
boo::IShaderPipeline* ret =
static_cast<boo::VulkanDataFactory::Context&>(ctx).
newShaderPipeline(nullptr, nullptr,
vertBlob, fragBlob, pipelineBlob,
&vertBlob, &fragBlob, &pipelineBlob,
tag.newVertexFormat(ctx),
boo::BlendFactor((slot.srcFactor == hecl::Backend::BlendFactor::Original) ? blendSrc : slot.srcFactor),
boo::BlendFactor((slot.dstFactor == hecl::Backend::BlendFactor::Original) ? blendDst : slot.dstFactor),
Expand Down
8 changes: 4 additions & 4 deletions lib/Backend/HLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
objOut =
static_cast<boo::ID3DDataFactory::Context&>(ctx).
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
vertBlob, fragBlob, pipelineBlob,
ReferenceComPtr(vertBlob), ReferenceComPtr(fragBlob), ReferenceComPtr(pipelineBlob),
tag.newVertexFormat(ctx),
boo::BlendFactor(m_backend.m_blendSrc),
boo::BlendFactor(m_backend.m_blendDst),
Expand Down Expand Up @@ -412,7 +412,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
boo::IShaderPipeline* ret =
static_cast<boo::ID3DDataFactory::Context&>(ctx).
newShaderPipeline(nullptr, nullptr,
vertBlob, fragBlob, pipelineBlob,
ReferenceComPtr(vertBlob), ReferenceComPtr(fragBlob), ReferenceComPtr(pipelineBlob),
tag.newVertexFormat(ctx),
blendSrc, blendDst, tag.getPrimType(),
tag.getDepthTest(), tag.getDepthWrite(),
Expand Down Expand Up @@ -454,7 +454,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
boo::IShaderPipeline* ret =
static_cast<boo::ID3DDataFactory::Context&>(ctx).
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
thisPipeBlobs.vert, thisPipeBlobs.frag, thisPipeBlobs.pipeline,
ReferenceComPtr(thisPipeBlobs.vert), ReferenceComPtr(thisPipeBlobs.frag), ReferenceComPtr(thisPipeBlobs.pipeline),
tag.newVertexFormat(ctx),
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),
Expand Down Expand Up @@ -552,7 +552,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
boo::IShaderPipeline* ret =
static_cast<boo::ID3DDataFactory::Context&>(ctx).
newShaderPipeline(nullptr, nullptr,
vertBlob, fragBlob, pipelineBlob,
ReferenceComPtr(vertBlob), ReferenceComPtr(fragBlob), ReferenceComPtr(pipelineBlob),
tag.newVertexFormat(ctx),
boo::BlendFactor((slot.srcFactor == hecl::Backend::BlendFactor::Original) ? blendSrc : slot.srcFactor),
boo::BlendFactor((slot.dstFactor == hecl::Backend::BlendFactor::Original) ? blendDst : slot.dstFactor),
Expand Down
4 changes: 2 additions & 2 deletions lib/Backend/Metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ std::string Metal::makeFrag(size_t blockCount, const char** blockNames, bool alp
const TextureInfo& extTex = extTexs[i];
if (extTexCall.size())
extTexCall += ", ";
extTexCall += hecl::Format("tex%u", extTex.mapIdx);
texMapDecl += hecl::Format(",\ntexture2d<float> tex%u [[ texture(%u) ]]", extTex.mapIdx, extTex.mapIdx);
extTexCall += hecl::Format("extTex%u", extTex.mapIdx);
texMapDecl += hecl::Format(",\ntexture2d<float> extTex%u [[ texture(%u) ]]", extTex.mapIdx, extTex.mapIdx);
}

std::string blockCall;
Expand Down

0 comments on commit f1a7598

Please sign in to comment.