Skip to content

HLSL validation error when a Texture2D is inside a cbuffer #2754

@Ace17

Description

@Ace17

Here's a minimal example that triggers the error.
Do you think it's legit ? This code is accepted by fxc.exe.

// input.frag.hlsl (updated)
cbuffer MyCBuffer
{
    Texture2D myTexture;
    SamplerState mySampler;
}

float4 main(float4 parFragIn : SV_POSITION) : SV_TARGET
{
    return myTexture.SampleLevel(mySampler, float2(0, 0), 0).rgba;
}
% glslangValidator -V100 --spirv-val -S frag -D --target-env vulkan1.0 input.frag.hlsl -e main
input.frag.hlsl
error: SPIRV-Tools Validation Errors
error: In Vulkan, OpTypeStruct must not contain an opaque type.
  %MyCBuffer = OpTypeStruct %13 %14

% glslangValidator --version
Glslang Version: 10:11.0.0
ESSL Version: OpenGL ES GLSL 3.20 glslang Khronos. 11.0.0
GLSL Version: 4.60 glslang Khronos. 11.0.0
SPIR-V Version 0x00010500, Revision 4
GLSL.std.450 Version 100, Revision 1
Khronos Tool ID 8
SPIR-V Generator Version 10
GL_KHR_vulkan_glsl version 100
ARB_GL_gl_spirv version 100

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions