From b42e2a47ed1d7c0c50d2d27c4fbce52a49801d5b Mon Sep 17 00:00:00 2001 From: Robert Konrad Date: Sun, 15 Oct 2023 17:13:12 +0200 Subject: [PATCH] Output a proper SPIR-V bound value --- Sources/backends/spirv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/backends/spirv.c b/Sources/backends/spirv.c index ba5de51..f4bfd8b 100644 --- a/Sources/backends/spirv.c +++ b/Sources/backends/spirv.c @@ -177,8 +177,10 @@ static void write_generator_magic_number(instructions_buffer *instructions) { instructions->instructions[instructions->offset++] = 0; // TODO: Register a number at https://github.com/KhronosGroup/SPIRV-Headers } +static uint32_t next_index = 1; + static void write_bound(instructions_buffer *instructions) { - instructions->instructions[instructions->offset++] = 256; // TODO: Exclusive upper bound of used IDs + instructions->instructions[instructions->offset++] = next_index; } static void write_instruction_schema(instructions_buffer *instructions) { @@ -190,8 +192,6 @@ static void write_capability(instructions_buffer *instructions, capability c) { write_instruction(instructions, 2, SPIRV_OPCODE_CAPABILITY, &operand); } -static uint32_t next_index = 1; - static uint32_t allocate_index(void) { uint32_t result = next_index; ++next_index;