From: Józef Kucia jkucia@codeweavers.com
Translation to SPIR-V isn't implemented yet.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d-shader/dxbc.c | 100 ++++++++++++++++++++--- libs/vkd3d-shader/spirv.c | 54 +++++++++--- libs/vkd3d-shader/trace.c | 35 +++++++- libs/vkd3d-shader/vkd3d_shader_private.h | 27 +++++- 4 files changed, 186 insertions(+), 30 deletions(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index 045e8682a574..7336a7a3f4c6 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -78,6 +78,9 @@
#define VKD3D_SM4_REGISTER_MODIFIER (0x1u << 31)
+#define VKD3D_SM4_ADDRESSING_SHIFT2 28 +#define VKD3D_SM4_ADDRESSING_MASK2 (0x3u << VKD3D_SM4_ADDRESSING_SHIFT2) + #define VKD3D_SM4_ADDRESSING_SHIFT1 25 #define VKD3D_SM4_ADDRESSING_MASK1 (0x3u << VKD3D_SM4_ADDRESSING_SHIFT1)
@@ -512,11 +515,35 @@ static const enum vkd3d_data_type data_type_table[] = /* VKD3D_SM4_DATA_FLOAT */ VKD3D_DATA_FLOAT, };
+static bool shader_is_sm_5_1(const struct vkd3d_sm4_data *priv) +{ + const struct vkd3d_shader_version *version = &priv->shader_version; + return version->major >= 5 && version->minor >= 1; +} + static bool shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD **ptr, const DWORD *end, enum vkd3d_data_type data_type, struct vkd3d_shader_src_param *src_param); static bool shader_sm4_read_dst_param(struct vkd3d_sm4_data *priv, const DWORD **ptr, const DWORD *end, enum vkd3d_data_type data_type, struct vkd3d_shader_dst_param *dst_param);
+static bool shader_sm4_read_register_space(struct vkd3d_sm4_data *priv, + const DWORD **ptr, const DWORD *end, unsigned int *register_space) +{ + *register_space = 0; + + if (!shader_is_sm_5_1(priv)) + return true; + + if (*ptr >= end) + { + WARN("Invalid ptr %p >= end %p.\n", *ptr, end); + return false; + } + + *register_space = *(*ptr)++; + return true; +} + static void shader_sm4_read_conditional_op(struct vkd3d_shader_instruction *ins, DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count, struct vkd3d_sm4_data *priv) @@ -560,6 +587,7 @@ static void shader_sm4_read_dcl_resource(struct vkd3d_shader_instruction *ins, struct vkd3d_sm4_data *priv) { enum vkd3d_sm4_resource_type resource_type; + const DWORD *end = &tokens[token_count]; enum vkd3d_sm4_data_type data_type; enum vkd3d_data_type reg_data_type; DWORD components; @@ -575,7 +603,7 @@ static void shader_sm4_read_dcl_resource(struct vkd3d_shader_instruction *ins, ins->declaration.semantic.resource_type = resource_type_table[resource_type]; } reg_data_type = opcode == VKD3D_SM4_OP_DCL_RESOURCE ? VKD3D_DATA_RESOURCE : VKD3D_DATA_UAV; - shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], reg_data_type, &ins->declaration.semantic.reg); + shader_sm4_read_dst_param(priv, &tokens, end, reg_data_type, &ins->declaration.semantic.reg);
components = *tokens++; if ((components & 0xfff0) != (components & 0xf) * 0x1110) @@ -594,25 +622,47 @@ static void shader_sm4_read_dcl_resource(struct vkd3d_shader_instruction *ins,
if (reg_data_type == VKD3D_DATA_UAV) ins->flags = (opcode_token & VKD3D_SM5_UAV_FLAGS_MASK) >> VKD3D_SM5_UAV_FLAGS_SHIFT; + + shader_sm4_read_register_space(priv, &tokens, end, &ins->declaration.semantic.register_space); }
static void shader_sm4_read_dcl_constant_buffer(struct vkd3d_shader_instruction *ins, DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count, struct vkd3d_sm4_data *priv) { - shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_FLOAT, &ins->declaration.src); + const DWORD *end = &tokens[token_count]; + + shader_sm4_read_src_param(priv, &tokens, end, VKD3D_DATA_FLOAT, &ins->declaration.cb.src); if (opcode_token & VKD3D_SM4_INDEX_TYPE_MASK) ins->flags |= VKD3DSI_INDEXED_DYNAMIC; + + ins->declaration.cb.size = ins->declaration.cb.src.reg.idx[1].offset; + ins->declaration.cb.register_space = 0; + + if (shader_is_sm_5_1(priv)) + { + if (tokens >= end) + { + FIXME("Invalid ptr %p >= end %p.\n", tokens, end); + return; + } + + ins->declaration.cb.size = *tokens++; + shader_sm4_read_register_space(priv, &tokens, end, &ins->declaration.cb.register_space); + } }
static void shader_sm4_read_dcl_sampler(struct vkd3d_shader_instruction *ins, DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count, struct vkd3d_sm4_data *priv) { + const DWORD *end = &tokens[token_count]; + ins->flags = (opcode_token & VKD3D_SM4_SAMPLER_MODE_MASK) >> VKD3D_SM4_SAMPLER_MODE_SHIFT; if (ins->flags & ~VKD3D_SM4_SAMPLER_COMPARISON) FIXME("Unhandled sampler mode %#x.\n", ins->flags); - shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_SAMPLER, &ins->declaration.dst); + shader_sm4_read_src_param(priv, &tokens, end, VKD3D_DATA_SAMPLER, &ins->declaration.sampler.src); + shader_sm4_read_register_space(priv, &tokens, end, &ins->declaration.sampler.register_space); }
static void shader_sm4_read_dcl_index_range(struct vkd3d_shader_instruction *ins, @@ -808,20 +858,25 @@ static void shader_sm5_read_dcl_uav_raw(struct vkd3d_shader_instruction *ins, DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count, struct vkd3d_sm4_data *priv) { - shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_UAV, &ins->declaration.dst); + const DWORD *end = &tokens[token_count]; + + shader_sm4_read_dst_param(priv, &tokens, end, VKD3D_DATA_UAV, &ins->declaration.raw_resource.dst); ins->flags = (opcode_token & VKD3D_SM5_UAV_FLAGS_MASK) >> VKD3D_SM5_UAV_FLAGS_SHIFT; + shader_sm4_read_register_space(priv, &tokens, end, &ins->declaration.raw_resource.register_space); }
static void shader_sm5_read_dcl_uav_structured(struct vkd3d_shader_instruction *ins, DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count, struct vkd3d_sm4_data *priv) { - shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_UAV, - &ins->declaration.structured_resource.reg); + const DWORD *end = &tokens[token_count]; + + shader_sm4_read_dst_param(priv, &tokens, end, VKD3D_DATA_UAV, &ins->declaration.structured_resource.reg); ins->flags = (opcode_token & VKD3D_SM5_UAV_FLAGS_MASK) >> VKD3D_SM5_UAV_FLAGS_SHIFT; ins->declaration.structured_resource.byte_stride = *tokens; if (ins->declaration.structured_resource.byte_stride % 4) FIXME("Byte stride %u is not multiple of 4.\n", ins->declaration.structured_resource.byte_stride); + shader_sm4_read_register_space(priv, &tokens, end, &ins->declaration.structured_resource.register_space); }
static void shader_sm5_read_dcl_tgsm_raw(struct vkd3d_shader_instruction *ins, @@ -850,18 +905,23 @@ static void shader_sm5_read_dcl_resource_structured(struct vkd3d_shader_instruct DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count, struct vkd3d_sm4_data *priv) { - shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_RESOURCE, - &ins->declaration.structured_resource.reg); + const DWORD *end = &tokens[token_count]; + + shader_sm4_read_dst_param(priv, &tokens, end, VKD3D_DATA_RESOURCE, &ins->declaration.structured_resource.reg); ins->declaration.structured_resource.byte_stride = *tokens; if (ins->declaration.structured_resource.byte_stride % 4) FIXME("Byte stride %u is not multiple of 4.\n", ins->declaration.structured_resource.byte_stride); + shader_sm4_read_register_space(priv, &tokens, end, &ins->declaration.structured_resource.register_space); }
static void shader_sm5_read_dcl_resource_raw(struct vkd3d_shader_instruction *ins, DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count, struct vkd3d_sm4_data *priv) { - shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_RESOURCE, &ins->declaration.dst); + const DWORD *end = &tokens[token_count]; + + shader_sm4_read_dst_param(priv, &tokens, end, VKD3D_DATA_RESOURCE, &ins->declaration.dst); + shader_sm4_read_register_space(priv, &tokens, end, &ins->declaration.raw_resource.register_space); }
static void shader_sm5_read_sync(struct vkd3d_shader_instruction *ins, @@ -1470,8 +1530,26 @@ static bool shader_sm4_read_param(struct vkd3d_sm4_data *priv, const DWORD **ptr } }
- if (order > 2) - FIXME("Unhandled order %u.\n", order); + if (order < 3) + { + param->idx[2].offset = ~0u; + param->idx[2].rel_addr = NULL; + } + else + { + DWORD addressing = (token & VKD3D_SM4_ADDRESSING_MASK2) >> VKD3D_SM4_ADDRESSING_SHIFT2; + if (!(shader_sm4_read_reg_idx(priv, ptr, end, addressing, ¶m->idx[2]))) + { + ERR("Failed to read register index.\n"); + return false; + } + } + + if (order > 3) + { + WARN("Unhandled order %u.\n", order); + return false; + }
if (register_type == VKD3D_SM4_RT_IMMCONST) { diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 86d5be89b039..dfdc7eb5a24a 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -4671,39 +4671,42 @@ static void vkd3d_dxbc_compiler_emit_dcl_constant_buffer(struct vkd3d_dxbc_compi const struct vkd3d_shader_instruction *instruction) { uint32_t vec4_id, array_type_id, length_id, struct_id, pointer_type_id, var_id; - const struct vkd3d_shader_register *reg = &instruction->declaration.src.reg; + const struct vkd3d_shader_constant_buffer *cb = &instruction->declaration.cb; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const SpvStorageClass storage_class = SpvStorageClassUniform; + const struct vkd3d_shader_register *reg = &cb->src.reg; struct vkd3d_push_constant_buffer_binding *push_cb; struct vkd3d_symbol reg_symbol; - unsigned int cb_size;
assert(!(instruction->flags & ~VKD3DSI_INDEXED_DYNAMIC));
- cb_size = reg->idx[1].offset; + if (cb->register_space) + FIXME("Unhandled register space %u.\n", cb->register_space);
if ((push_cb = vkd3d_dxbc_compiler_find_push_constant_buffer(compiler, reg))) { /* Push constant buffers are handled in * vkd3d_dxbc_compiler_emit_push_constant_buffers(). */ - unsigned int cb_size_in_bytes = cb_size * VKD3D_VEC4_SIZE * sizeof(uint32_t); + unsigned int cb_size_in_bytes = cb->size * VKD3D_VEC4_SIZE * sizeof(uint32_t); push_cb->reg = *reg; if (cb_size_in_bytes > push_cb->pc.size) + { WARN("Constant buffer size %u exceeds push constant size %u.\n", cb_size_in_bytes, push_cb->pc.size); + } return; }
vec4_id = vkd3d_spirv_get_type_id(builder, VKD3D_TYPE_FLOAT, VKD3D_VEC4_SIZE); - length_id = vkd3d_dxbc_compiler_get_constant_uint(compiler, cb_size); + length_id = vkd3d_dxbc_compiler_get_constant_uint(compiler, cb->size); array_type_id = vkd3d_spirv_build_op_type_array(builder, vec4_id, length_id); vkd3d_spirv_build_op_decorate1(builder, array_type_id, SpvDecorationArrayStride, 16);
struct_id = vkd3d_spirv_build_op_type_struct(builder, &array_type_id, 1); vkd3d_spirv_build_op_decorate(builder, struct_id, SpvDecorationBlock, NULL, 0); vkd3d_spirv_build_op_member_decorate1(builder, struct_id, 0, SpvDecorationOffset, 0); - vkd3d_spirv_build_op_name(builder, struct_id, "cb%u_struct", cb_size); + vkd3d_spirv_build_op_name(builder, struct_id, "cb%u_struct", cb->size);
pointer_type_id = vkd3d_spirv_get_op_type_pointer(builder, storage_class, struct_id); var_id = vkd3d_spirv_build_op_variable(builder, &builder->global_stream, @@ -4756,12 +4759,15 @@ static void vkd3d_dxbc_compiler_emit_dcl_immediate_constant_buffer(struct vkd3d_ static void vkd3d_dxbc_compiler_emit_dcl_sampler(struct vkd3d_dxbc_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { - const struct vkd3d_shader_register *reg = &instruction->declaration.dst.reg; + const struct vkd3d_shader_register *reg = &instruction->declaration.sampler.src.reg; const SpvStorageClass storage_class = SpvStorageClassUniformConstant; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; uint32_t type_id, ptr_type_id, var_id; struct vkd3d_symbol reg_symbol;
+ if (instruction->declaration.sampler.register_space) + FIXME("Unhandled register space %u.\n", instruction->declaration.sampler.register_space); + if (vkd3d_dxbc_compiler_has_combined_sampler(compiler, NULL, reg)) return;
@@ -4980,6 +4986,10 @@ static void vkd3d_dxbc_compiler_emit_dcl_resource(struct vkd3d_dxbc_compiler *co const struct vkd3d_shader_instruction *instruction) { const struct vkd3d_shader_semantic *semantic = &instruction->declaration.semantic; + + if (semantic->register_space) + FIXME("Unhandled register space %u.\n", semantic->register_space); + vkd3d_dxbc_compiler_emit_resource_declaration(compiler, &semantic->reg.reg, semantic->resource_type, semantic->resource_data_type, 0, false); } @@ -4987,25 +4997,38 @@ static void vkd3d_dxbc_compiler_emit_dcl_resource(struct vkd3d_dxbc_compiler *co static void vkd3d_dxbc_compiler_emit_dcl_resource_raw(struct vkd3d_dxbc_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { - vkd3d_dxbc_compiler_emit_resource_declaration(compiler, &instruction->declaration.dst.reg, + const struct vkd3d_shader_raw_resource *resource = &instruction->declaration.raw_resource; + + if (resource->register_space) + FIXME("Unhandled register space %u.\n", resource->register_space); + + vkd3d_dxbc_compiler_emit_resource_declaration(compiler, &resource->dst.reg, VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_DATA_UINT, 0, true); }
static void vkd3d_dxbc_compiler_emit_dcl_uav_raw(struct vkd3d_dxbc_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { + const struct vkd3d_shader_raw_resource *resource = &instruction->declaration.raw_resource; + + if (resource->register_space) + FIXME("Unhandled register space %u.\n", resource->register_space); if (instruction->flags) FIXME("Unhandled UAV flags %#x.\n", instruction->flags);
- vkd3d_dxbc_compiler_emit_resource_declaration(compiler, &instruction->declaration.dst.reg, + vkd3d_dxbc_compiler_emit_resource_declaration(compiler, &resource->dst.reg, VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_DATA_UINT, 0, true); }
static void vkd3d_dxbc_compiler_emit_dcl_resource_structured(struct vkd3d_dxbc_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { - const struct vkd3d_shader_register *reg = &instruction->declaration.structured_resource.reg.reg; - unsigned int stride = instruction->declaration.structured_resource.byte_stride; + const struct vkd3d_shader_structured_resource *resource = &instruction->declaration.structured_resource; + const struct vkd3d_shader_register *reg = &resource->reg.reg; + unsigned int stride = resource->byte_stride; + + if (resource->register_space) + FIXME("Unhandled register space %u.\n", resource->register_space);
vkd3d_dxbc_compiler_emit_resource_declaration(compiler, reg, VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_DATA_UINT, stride / 4, false); @@ -5014,9 +5037,12 @@ static void vkd3d_dxbc_compiler_emit_dcl_resource_structured(struct vkd3d_dxbc_c static void vkd3d_dxbc_compiler_emit_dcl_uav_structured(struct vkd3d_dxbc_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { - const struct vkd3d_shader_register *reg = &instruction->declaration.structured_resource.reg.reg; - unsigned int stride = instruction->declaration.structured_resource.byte_stride; + const struct vkd3d_shader_structured_resource *resource = &instruction->declaration.structured_resource; + const struct vkd3d_shader_register *reg = &resource->reg.reg; + unsigned int stride = resource->byte_stride;
+ if (resource->register_space) + FIXME("Unhandled register space %u.\n", resource->register_space); if (instruction->flags) FIXME("Unhandled UAV flags %#x.\n", instruction->flags);
@@ -5029,6 +5055,8 @@ static void vkd3d_dxbc_compiler_emit_dcl_uav_typed(struct vkd3d_dxbc_compiler *c { const struct vkd3d_shader_semantic *semantic = &instruction->declaration.semantic;
+ if (semantic->register_space) + FIXME("Unhandled register space %u.\n", semantic->register_space); if (instruction->flags) FIXME("Unhandled UAV flags %#x.\n", instruction->flags);
diff --git a/libs/vkd3d-shader/trace.c b/libs/vkd3d-shader/trace.c index 13fb117b5360..279ede06658c 100644 --- a/libs/vkd3d-shader/trace.c +++ b/libs/vkd3d-shader/trace.c @@ -1042,6 +1042,17 @@ static void shader_dump_register(struct vkd3d_string_buffer *buffer, } shader_addline(buffer, "%u]", reg->idx[1].offset); } + + if (reg->idx[2].offset != ~0u) + { + shader_addline(buffer, "["); + if (reg->idx[2].rel_addr) + { + shader_dump_src_param(buffer, reg->idx[2].rel_addr, shader_version); + shader_addline(buffer, " + "); + } + shader_addline(buffer, "%u]", reg->idx[2].offset); + } }
if (reg->type == VKD3DSPR_FUNCTIONPOINTER) @@ -1333,6 +1344,13 @@ static void shader_dump_instruction_flags(struct vkd3d_string_buffer *buffer, } }
+static void shader_dump_register_space(struct vkd3d_string_buffer *buffer, + unsigned int register_space, const struct vkd3d_shader_version *shader_version) +{ + if (shader_version->major >= 5 && shader_version->minor >= 1) + shader_addline(buffer, ", space=%u", register_space); +} + static void shader_dump_instruction(struct vkd3d_string_buffer *buffer, const struct vkd3d_shader_instruction *ins, const struct vkd3d_shader_version *shader_version) { @@ -1346,13 +1364,17 @@ static void shader_dump_instruction(struct vkd3d_string_buffer *buffer, shader_dump_ins_modifiers(buffer, &ins->declaration.semantic.reg); shader_addline(buffer, " "); shader_dump_dst_param(buffer, &ins->declaration.semantic.reg, shader_version); + shader_dump_register_space(buffer, ins->declaration.semantic.register_space, shader_version); break;
case VKD3DSIH_DCL_CONSTANT_BUFFER: shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]); - shader_dump_src_param(buffer, &ins->declaration.src, shader_version); + shader_dump_src_param(buffer, &ins->declaration.cb.src, shader_version); + if (shader_version->major >= 5 && shader_version->minor >= 1) + shader_addline(buffer, "[%u]", ins->declaration.cb.size); shader_addline(buffer, ", %s", ins->flags & VKD3DSI_INDEXED_DYNAMIC ? "dynamicIndexed" : "immediateIndexed"); + shader_dump_register_space(buffer, ins->declaration.cb.register_space, shader_version); break;
case VKD3DSIH_DCL_FUNCTION_BODY: @@ -1447,20 +1469,23 @@ static void shader_dump_instruction(struct vkd3d_string_buffer *buffer,
case VKD3DSIH_DCL_RESOURCE_RAW: shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]); - shader_dump_dst_param(buffer, &ins->declaration.dst, shader_version); + shader_dump_dst_param(buffer, &ins->declaration.raw_resource.dst, shader_version); + shader_dump_register_space(buffer, ins->declaration.raw_resource.register_space, shader_version); break;
case VKD3DSIH_DCL_RESOURCE_STRUCTURED: shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]); shader_dump_dst_param(buffer, &ins->declaration.structured_resource.reg, shader_version); shader_addline(buffer, ", %u", ins->declaration.structured_resource.byte_stride); + shader_dump_register_space(buffer, ins->declaration.structured_resource.register_space, shader_version); break;
case VKD3DSIH_DCL_SAMPLER: shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]); - shader_dump_dst_param(buffer, &ins->declaration.dst, shader_version); + shader_dump_src_param(buffer, &ins->declaration.sampler.src, shader_version); if (ins->flags == VKD3DSI_SAMPLER_COMPARISON_MODE) shader_addline(buffer, ", comparisonMode"); + shader_dump_register_space(buffer, ins->declaration.sampler.register_space, shader_version); break;
case VKD3DSIH_DCL_TEMPS: @@ -1512,7 +1537,8 @@ static void shader_dump_instruction(struct vkd3d_string_buffer *buffer, shader_addline(buffer, "%s", shader_opcode_names[ins->handler_idx]); shader_dump_uav_flags(buffer, ins->flags); shader_addline(buffer, " "); - shader_dump_dst_param(buffer, &ins->declaration.dst, shader_version); + shader_dump_dst_param(buffer, &ins->declaration.raw_resource.dst, shader_version); + shader_dump_register_space(buffer, ins->declaration.raw_resource.register_space, shader_version); break;
case VKD3DSIH_DCL_UAV_STRUCTURED: @@ -1521,6 +1547,7 @@ static void shader_dump_instruction(struct vkd3d_string_buffer *buffer, shader_addline(buffer, " "); shader_dump_dst_param(buffer, &ins->declaration.structured_resource.reg, shader_version); shader_addline(buffer, ", %u", ins->declaration.structured_resource.byte_stride); + shader_dump_register_space(buffer, ins->declaration.structured_resource.register_space, shader_version); break;
case VKD3DSIH_DEF: diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index fba493e3b563..73ba93fe0133 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -558,7 +558,7 @@ struct vkd3d_shader_register { enum vkd3d_shader_register_type type; enum vkd3d_data_type data_type; - struct vkd3d_shader_register_index idx[2]; + struct vkd3d_shader_register_index idx[3]; enum vkd3d_immconst_type immconst_type; union { @@ -614,6 +614,7 @@ struct vkd3d_shader_semantic enum vkd3d_shader_resource_type resource_type; enum vkd3d_data_type resource_data_type; struct vkd3d_shader_dst_param reg; + unsigned int register_space; };
enum vkd3d_shader_input_sysval_semantic @@ -658,10 +659,30 @@ struct vkd3d_shader_register_semantic enum vkd3d_shader_input_sysval_semantic sysval_semantic; };
+struct vkd3d_shader_sampler +{ + struct vkd3d_shader_src_param src; + unsigned int register_space; +}; + +struct vkd3d_shader_constant_buffer +{ + struct vkd3d_shader_src_param src; + unsigned int size; + unsigned int register_space; +}; + struct vkd3d_shader_structured_resource { struct vkd3d_shader_dst_param reg; unsigned int byte_stride; + unsigned int register_space; +}; + +struct vkd3d_shader_raw_resource +{ + struct vkd3d_shader_dst_param dst; + unsigned int register_space; };
struct vkd3d_shader_tgsm @@ -741,10 +762,12 @@ struct vkd3d_shader_instruction struct vkd3d_shader_register_semantic register_semantic; struct vkd3d_shader_primitive_type primitive_type; struct vkd3d_shader_dst_param dst; - struct vkd3d_shader_src_param src; + struct vkd3d_shader_constant_buffer cb; + struct vkd3d_shader_sampler sampler; unsigned int count; unsigned int index; const struct vkd3d_shader_immediate_constant_buffer *icb; + struct vkd3d_shader_raw_resource raw_resource; struct vkd3d_shader_structured_resource structured_resource; struct vkd3d_shader_tgsm_raw tgsm_raw; struct vkd3d_shader_tgsm_structured tgsm_structured;