@@ -2428,6 +2429,7 @@ static struct spirv_compiler *spirv_compiler_create(const struct vkd3d_shader_ve rb_init(&compiler->symbol_table, vkd3d_symbol_compare); compiler->shader_type = shader_version->type; + compiler->is_dxil = shader_version->major >= 6; if ((shader_interface = vkd3d_find_struct(compile_info->next, INTERFACE_INFO))) { @@ -9480,7 +9482,7 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, compiler->location.column = 0; compiler->location.line = 1; - if ((result = vkd3d_shader_normalise(parser)) < 0) + if (!compiler->is_dxil && (result = vkd3d_shader_normalise(parser)) < 0) return result; instructions = parser->instructions;
I think we can just do that check inside vkd3d_shader_normalise(), and that seems preferable.
+static bool sm6_block_emit_instructions(struct sm6_block *block, struct sm6_parser *sm6) +{ + /* Reserve an extra instruction for the block terminator. */ + struct vkd3d_shader_instruction *ins = sm6_parser_require_space(sm6, block->instruction_count + 1); + + if (!ins) + return false; + + memcpy(ins, block->instructions, block->instruction_count * sizeof(*block->instructions)); + sm6->p.instructions.count += block->instruction_count; + return true; +}
Could we append that instruction here, instead of in the caller? Or as part of parsing the block, even?
From 239e51923cf60b33d4dddada3fadaaf7b769ed94 Mon Sep 17 00:00:00 2001 From: Conor McCarthy <cmccarthy@codeweavers.com> Date: Wed, 17 May 2023 16:43:26 +1000 Subject: [PATCH 4/6] vkd3d-shader/dxbc: Allow DXBC containers to have a zero checksum. The linux build of DXC writes a zero checksum.
But as far as I'm aware, such shaders are rejected by native d3d12. What are we trying to do here, exactly? If it's purely about local development testing with the Linux build of DXC, I have a tool for inspecting and modifying DXBC blobs that I've been meaning to upstream.