From 0f67d92df9ca1f528b7a7fc8a8712aaea56f7115 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 16 Nov 2018 16:04:56 -0500 Subject: Bug fix - vk::binding on structured buffers (#720) * Fix output of binding of structured buffer on GLSL. * Added test to check vk binding is coming thru. * Fix closethit binding inconsistency. --- source/slang/emit.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 644725fa8..8038561d0 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -5951,8 +5951,28 @@ struct EmitVisitor // TODO: we should require either the extension or the version... requireGLSLVersion(430); - emit("layout(std430) buffer "); + Emit("layout(std430"); + auto layout = getVarLayout(ctx, varDecl); + if (layout) + { + LayoutResourceKind kind = LayoutResourceKind::DescriptorTableSlot; + EmitVarChain chain(layout); + + const UInt index = getBindingOffset(&chain, kind); + const UInt space = getBindingSpace(&chain, kind); + + Emit(", binding = "); + Emit(index); + if (space) + { + Emit(", set = "); + Emit(space); + } + } + + emit(") buffer "); + // Generate a dummy name for the block emit("_S"); Emit(ctx->shared->uniqueIDCounter++); -- cgit v1.2.3