12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- // This file is used to validate the functionality of the --strip-unused-srgs flag.
- // There are three SRGs in this file: SRG1, SRG2 and SRG3.
- // Nothing references SRG3, but SRG3 contains the fallback key and it should not be removed.
- // In the end no SRG should be stripped.
- ShaderResourceGroupSemantic slot1
- {
- FrequencyId = 1;
- };
- ShaderResourceGroupSemantic slot2
- {
- FrequencyId = 2;
- };
- ShaderResourceGroupSemantic slot3
- {
- FrequencyId = 3;
- ShaderVariantFallback = 128;
- };
- //Referenced by MainPS
- ShaderResourceGroup SRG1 : slot1
- {
- struct CB
- {
- float4 color;
- };
- ConstantBuffer<CB> m_uniforms;
- };
- // Referenced by SRG3. If SRG3 is stripped then this can be stripped too.
- ShaderResourceGroup SRG2 : slot2
- {
- struct MB
- {
- float4 position;
- };
- ConstantBuffer<MB> m_uniforms;
- MB m_other;
- };
- // Unused, but references SRG2 and it is the chosen fallback.
- // Should not be removed when --strip-unused-srgs is used.
- ShaderResourceGroup SRG3 : slot3
- {
- ConstantBuffer<SRG2::MB> m_mycbs; ConstantBuffer<SRG1::CB> m_srgcb; SRG2::MB m_mbr;
- float4 m_uniformColor;
- Texture2D m_texture;
- Buffer<float> m_buffer;
- Sampler m_dynamicSampler;
- Sampler m_staticSampler
- {
- AddressU = Wrap;
- AddressV = Wrap;
- AddressW = Wrap;
- MagFilter = Linear;
- };
-
- row_major float3x4 m_modelToWorld;
- row_major float3x3 m_normalMatrix;
-
- float4x4 GetWorldMatrix()
- {
- float4x4 modelToWorld = float4x4(
- float4(1, 0, 0, 0),
- float4(0, 1, 0, 0),
- float4(0, 0, 1, 0),
- float4(0, 0, 0, 1));
-
- modelToWorld[0] = m_modelToWorld[0];
- modelToWorld[1] = m_modelToWorld[1];
- modelToWorld[2] = m_modelToWorld[2];
- return modelToWorld;
- }
-
- float3x3 GetNormalMatrix()
- {
- return m_normalMatrix;
- }
- };
- float4 MainPS(float2 uv) : SV_Target0
- {
- return SRG1::m_uniforms.color;
- }
|