Skip to content

Instantly share code, notes, and snippets.

@NoxWings
Last active November 9, 2022 20:20
Show Gist options
  • Save NoxWings/c9dc13d4a9b7648426dac50bb3b189f8 to your computer and use it in GitHub Desktop.
Save NoxWings/c9dc13d4a9b7648426dac50bb3b189f8 to your computer and use it in GitHub Desktop.
float2 positions[3] = {
float2( 0.0, -0.5),
float2( 0.5, 0.5),
float2(-0.5, 0.5)
};
float4 colors[3] = {
float4(1.0, 0.0, 0.0, 1.0),
float4(0.0, 1.0, 0.0, 1.0),
float4(0.0, 0.0, 1.0, 1.0)
};
// Vertex shader
struct VSInput {};
struct VSOutput {
float4 pos: SV_POSITION;
[[vk::location(0)]] float4 color: COLOR0;
};
VSOutput vert(VSInput input, uint vertexIndex: SV_VertexID) {
VSOutput output = (VSOutput)0;
output.pos = float4(positions[vertexIndex], 0.0, 1.0);
output.color = colors[vertexIndex];
return output;
}
// Pixel shader
struct PSInput {
[[vk::location(0)]] float4 color: COLOR0;
};
struct PSOutput {
float4 color: SV_TARGET0;
};
PSOutput pixel(PSInput input) {
PSOutput output = (PSOutput)0;
output.color = input.color;
return output;
}
[2022-11-09 21:19:17][editor::renderer::instance][ERROR] Vulkan: Validation Error: [ VUID-VkGraphicsPipelineCreateInfo-layout-00756 ] Object 0: handle = 0xec4bec000000000b, type = VK_OBJECT_TYPE_SHADER_MODULE; Object 1: handle = 0xcad092000000000d, type = VK_OBJECT_TYPE_PIPELINE_LAYOUT; | MessageID = 0x45717876 | Shader uses descriptor slot 0.0 (expected `VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK`) but not declared in pipeline layout The Vulkan spec states: layout must be consistent with all shaders specified in pStages (https://vulkan.lunarg.com/doc/view/1.3.231.1/windows/1.3-extensions/vkspec.html#VUID-VkGraphicsPipelineCreateInfo-layout-00756)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment