{"record":{"id":"9d1d789529faff34","repo":"stride3d/stride","slug":"unsupported-resource-class-binding-class","errorCode":null,"errorMessage":"Unsupported resource class {binding.Class}","messagePattern":"Unsupported resource class (.+?)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Tests/FrameRenderer.Vulkan.cs","lineNumber":575,"sourceCode":"    }\n\n    private static VkDescriptorType GetDescriptorType(EffectResourceBindingDescription binding) => binding.Class switch\n    {\n        EffectParameterClass.ConstantBuffer => VkDescriptorType.UniformBuffer,\n        EffectParameterClass.Sampler => VkDescriptorType.Sampler,\n        EffectParameterClass.ShaderResourceView => binding.Type switch\n        {\n            EffectParameterType.Buffer => VkDescriptorType.UniformTexelBuffer,\n            EffectParameterType.StructuredBuffer or EffectParameterType.ByteAddressBuffer => VkDescriptorType.StorageBuffer,\n            _ => VkDescriptorType.SampledImage,\n        },\n        EffectParameterClass.UnorderedAccessView => binding.Type switch\n        {\n            EffectParameterType.RWBuffer => VkDescriptorType.StorageTexelBuffer,\n            EffectParameterType.RWStructuredBuffer or EffectParameterType.RWByteAddressBuffer => VkDescriptorType.StorageBuffer,\n            _ => VkDescriptorType.StorageImage,\n        },\n        _ => throw new NotSupportedException($\"Unsupported resource class {binding.Class}\"),\n    };\n\n    public override void RenderFrame(Span<byte> result)\n    {\n        SetupDescriptors();\n\n        // Quad geometry, same as the D3D11 renderer\n        ReadOnlySpan<float> vertices =\n        [\n            1f,  1f, 0f,  1.0f, 1.0f,\n            1f, -1f, 0f,  1.0f, 0.0f,\n            -1f,-1f, 0f,  0.0f, 0.0f,\n            -1f, 1f, 1f,  0.0f, 1.0f,\n        ];\n        ReadOnlySpan<uint> indices = [0, 1, 3, 1, 2, 3];\n        var (vertexBuffer, _) = CreateHostBuffer((ulong)(vertices.Length * sizeof(float)), VkBufferUsageFlags.VertexBuffer, MemoryMarshal.AsBytes(vertices));\n        var (indexBuffer, _) = CreateHostBuffer((ulong)(indices.Length * sizeof(uint)), VkBufferUsageFlags.IndexBuffer, MemoryMarshal.AsBytes(indices));\n","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Tests/FrameRenderer.Vulkan.cs#L557-L593","documentation":"Thrown by the descriptor-type mapping in VulkanFrameRenderer when an EffectParameterClass (resource kind from the shader bytecode) is not one of the handled classes (CBV, SRV, UAV, etc.). The switch translates HLSL-style binding classes into VkDescriptorType; any unrecognized class falls to the NotSupportedException arm.","triggerScenarios":"A shader whose reflection metadata contains a resource class not covered by the switch (e.g. samplers, acceleraton structures, or an unhandled EffectParameterClass value) reaching SetupDescriptors during descriptor-set layout construction.","commonSituations":"Tests exercising shaders with sampler or texture arrays beyond the mapped subset; new shader effect kinds added upstream without updating this mapping; typos in effect parameter classification producing unexpected class values.","solutions":["Extend the switch to map the missing EffectParameterClass (e.g. Sampler => VkDescriptorType.Sampler) to its VkDescriptorType.","Log binding.Class and binding.Type at the throw site to identify which resource kind is unmapped, then add the case.","If the resource is irrelevant to the frame test, skip bindings with unmapped classes instead of throwing."],"exampleFix":"// before\n_ => throw new NotSupportedException($\"Unsupported resource class {binding.Class}\"),\n// after\nEffectParameterClass.Sampler => VkDescriptorType.CombinedImageSampler,\n_ => throw new NotSupportedException($\"Unsupported resource class {binding.Class}\"),","handlingStrategy":"validation","validationCode":"static readonly HashSet<EffectParameterClass> SupportedClasses = new()\n{ EffectParameterClass.ConstantBuffer, EffectParameterClass.Texture, EffectParameterClass.UnorderedAccessView };\n\nif (!SupportedClasses.Contains(binding.Class))\n    throw new InvalidOperationException($\"Binding {binding.Name} uses unmapped class {binding.Class}\");","typeGuard":null,"tryCatchPattern":"try { renderer.RenderFrame(output); }\ncatch (NotSupportedException ex) when (ex.Message.StartsWith(\"Unsupported resource class\"))\n{\n    // log binding.Class, skip test or update the mapping table\n}","preventionTips":["Keep the class-to-VkDescriptorType mapping in one table and add a unit test enumerating all EffectParameterClass values.","Log unmapped classes with the shader name to speed up diagnosis.","Restrict test shaders to resources the renderer explicitly supports."],"tags":["vulkan","descriptors","shader-binding"],"backgroundTag":"unsupported-enum-value","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}