Skip to content

Commit

Permalink
flag HLSLCC_FLAG_DISABLE_VULKAN_DUMMIES added
Browse files Browse the repository at this point in the history
  • Loading branch information
MrShoor committed Sep 29, 2016
1 parent e64ed95 commit 5522379
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
3 changes: 3 additions & 0 deletions include/hlslcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ static const unsigned int HLSLCC_FLAG_DISABLE_EXPLICIT_LOCATIONS = 0x400;
//If set, global uniforms are not stored in a struct.
static const unsigned int HLSLCC_FLAG_DISABLE_GLOBALS_STRUCT = 0x800;

//If set, no dummy materials will generated for Vulkan
static const unsigned int HLSLCC_FLAG_DISABLE_VULKAN_DUMMIES = 0x1000;

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
26 changes: 15 additions & 11 deletions src/toGLSLDeclaration.c
Original file line number Diff line number Diff line change
Expand Up @@ -2868,19 +2868,23 @@ Would generate a vec2 and a vec3. We discard the second one making .z invalid!
}
case OPCODE_DCL_SAMPLER:
{
if ((psContext->flags & HLSLCC_FLAG_COMBINE_TEXTURE_SAMPLERS) != HLSLCC_FLAG_COMBINE_TEXTURE_SAMPLERS)
{
ResourceBinding* psBinding = 0;
int found = GetResourceFromBindingPoint(RGROUP_SAMPLER, psDecl->asOperands[0].ui32RegisterNumber, &psContext->psShader->sInfo, &psBinding);
WriteUniformLayout(psContext, psBinding, NULL, psDecl->asOperands[0].ui32RegisterNumber, psContext->psShader->eShaderType, NULL, glsl);
if ((psContext->flags & HLSLCC_FLAG_DISABLE_VULKAN_DUMMIES) != HLSLCC_FLAG_DISABLE_VULKAN_DUMMIES)
{
if ((psContext->flags & HLSLCC_FLAG_COMBINE_TEXTURE_SAMPLERS) != HLSLCC_FLAG_COMBINE_TEXTURE_SAMPLERS)
{
ResourceBinding* psBinding = 0;
int found = GetResourceFromBindingPoint(RGROUP_SAMPLER, psDecl->asOperands[0].ui32RegisterNumber, &psContext->psShader->sInfo, &psBinding);
WriteUniformLayout(psContext, psBinding, NULL, psDecl->asOperands[0].ui32RegisterNumber, psContext->psShader->eShaderType, NULL, glsl);

if (psBinding->ui32Flags & REFLECT_RESOURCE_FLAGS_COMPARISON_SAMPLER) {
bformata(glsl, "uniform samplerShadow ");
} else {
bformata(glsl, "uniform sampler ");
if (psBinding->ui32Flags & REFLECT_RESOURCE_FLAGS_COMPARISON_SAMPLER) {
bformata(glsl, "uniform samplerShadow ");
}
else {
bformata(glsl, "uniform sampler ");
}
TranslateOperand(psContext, &psDecl->asOperands[0], TO_FLAG_NONE);
bcatcstr(glsl, ";\n");
}
TranslateOperand(psContext, &psDecl->asOperands[0], TO_FLAG_NONE);
bcatcstr(glsl, ";\n");
}
break;
}
Expand Down

0 comments on commit 5522379

Please sign in to comment.