Skip to content

[SpecializationConstants] We should probably allow unbound shader resources when spec constants enabled, or adding sth. like PIPELINE_RESOURCE_FLAG_ALLOW_UNBOUND ? #777

@hzqst

Description

@hzqst
Image

otherwise we will have to bind an empty resource to every ShaderResourceVariable even it is not used at all.

   [SpecializationConstant] const int BaseTextureEnabled = 0;

    if (BaseTextureEnabled != 0)
    {
        baseColor = g_BaseTexture.Sample(g_BaseTexture_sampler, baseTexcoord);
    }

we know that g_BaseTexture will never be used in this case unless BaseTextureEnabled explicitly set in PSOCreate.pSpecializationConstant.

Currently, I'm using pShaderVariables->Set(m_pEmptyShaderVariableResource); to mitigate the issue, where m_pEmptyShaderVariableResource is a 1x1 Texture2D. not a good option though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions