You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-12-15 08:03:15 -08:00
1264 lines
67 KiB
Diff
1264 lines
67 KiB
Diff
From 84eb0cbafd4a64b81f4da5c0dbdc38242baf2ce5 Mon Sep 17 00:00:00 2001
|
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
|
Date: Thu, 16 Oct 2025 06:52:58 +1100
|
|
Subject: [PATCH] Updated vkd3d to 507990d3c5a7b61ad5df63a17bbd122d8dc7e2e3.
|
|
|
|
---
|
|
libs/vkd3d/libs/vkd3d-shader/d3dbc.c | 9 +-
|
|
libs/vkd3d/libs/vkd3d-shader/glsl.c | 2 +
|
|
libs/vkd3d/libs/vkd3d-shader/ir.c | 22 +-
|
|
libs/vkd3d/libs/vkd3d-shader/spirv.c | 364 ++++++++++++++-------------
|
|
4 files changed, 199 insertions(+), 198 deletions(-)
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
|
index b2d4ec23c6e..87a7d48acca 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
|
@@ -1597,6 +1597,9 @@ int d3dbc_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t c
|
|
|
|
program->has_descriptor_info = true;
|
|
|
|
+ if (TRACE_ON())
|
|
+ vsir_program_trace(program);
|
|
+
|
|
if (ret >= 0 && sm1.p.status < 0)
|
|
ret = sm1.p.status;
|
|
|
|
@@ -2171,11 +2174,11 @@ static void d3dbc_write_semantic_dcl(struct d3dbc_compiler *d3dbc,
|
|
VKD3D_ASSERT(ret);
|
|
reg.reg.type = output ? VKD3DSPR_OUTPUT : VKD3DSPR_INPUT;
|
|
reg.reg.idx[0].offset = element->register_index;
|
|
- if (!vkd3d_shader_ver_ge(version, 3, 0))
|
|
+ if ((version->type == VKD3D_SHADER_TYPE_PIXEL || output) && !vkd3d_shader_ver_ge(version, 3, 0))
|
|
{
|
|
- if (reg.reg.idx[0].offset > SM1_RASTOUT_REGISTER_OFFSET)
|
|
+ if (reg.reg.idx[0].offset >= SM1_RASTOUT_REGISTER_OFFSET)
|
|
reg.reg.idx[0].offset -= SM1_RASTOUT_REGISTER_OFFSET;
|
|
- else if (reg.reg.idx[0].offset > SM1_COLOR_REGISTER_OFFSET)
|
|
+ else if (reg.reg.idx[0].offset >= SM1_COLOR_REGISTER_OFFSET)
|
|
reg.reg.idx[0].offset -= SM1_COLOR_REGISTER_OFFSET;
|
|
}
|
|
}
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/glsl.c b/libs/vkd3d/libs/vkd3d-shader/glsl.c
|
|
index 91a96a5547e..ab45c4d1e73 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/glsl.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/glsl.c
|
|
@@ -514,6 +514,8 @@ static void VKD3D_PRINTF_FUNC(4, 0) shader_glsl_vprint_assignment(struct vkd3d_g
|
|
"Internal compiler error: Unhandled destination register data type %#x.", data_type);
|
|
/* fall through */
|
|
case VSIR_DATA_F32:
|
|
+ case VSIR_DATA_SNORM:
|
|
+ case VSIR_DATA_UNORM:
|
|
close = false;
|
|
break;
|
|
case VSIR_DATA_I32:
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
|
index c013c9e61bd..82901c6fb34 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
|
@@ -1223,11 +1223,12 @@ static enum vkd3d_result vsir_program_normalize_addr(struct vsir_program *progra
|
|
ins2->dst[0].reg.idx[0].offset = tmp_idx;
|
|
ins2->dst[0].reg.dimension = VSIR_DIMENSION_VEC4;
|
|
ins2->dst[0].write_mask = ins->dst[0].write_mask;
|
|
+ ins->dst[0].write_mask = VKD3DSP_WRITEMASK_ALL;
|
|
|
|
vsir_register_init(&ins2->src[0].reg, VKD3DSPR_TEMP, VSIR_DATA_F32, 1);
|
|
ins2->src[0].reg.idx[0].offset = tmp_idx;
|
|
ins2->src[0].reg.dimension = VSIR_DIMENSION_VEC4;
|
|
- ins2->src[0].swizzle = vsir_swizzle_from_writemask(ins2->dst[0].write_mask);
|
|
+ ins2->src[0].swizzle = VKD3D_SHADER_NO_SWIZZLE;
|
|
}
|
|
|
|
for (k = 0; k < ins->src_count; ++k)
|
|
@@ -1392,7 +1393,7 @@ static enum vkd3d_result vsir_program_lower_texkill(struct vsir_program *program
|
|
* not fused for "precise" operations."
|
|
* Windows drivers seem to conform with the latter, for SM 4-5 and SM 6. */
|
|
static enum vkd3d_result vsir_program_lower_precise_mad(struct vsir_program *program,
|
|
- struct vsir_program_iterator *it, unsigned int *tmp_idx)
|
|
+ struct vsir_program_iterator *it)
|
|
{
|
|
struct vkd3d_shader_instruction *mad, *mul_ins, *add_ins;
|
|
struct vkd3d_shader_dst_param *mul_dst;
|
|
@@ -1405,9 +1406,6 @@ static enum vkd3d_result vsir_program_lower_precise_mad(struct vsir_program *pro
|
|
if (!vsir_program_iterator_insert_after(it, 1))
|
|
return VKD3D_ERROR_OUT_OF_MEMORY;
|
|
|
|
- if (*tmp_idx == ~0u)
|
|
- *tmp_idx = program->temp_count++;
|
|
-
|
|
mul_ins = vsir_program_iterator_current(it);
|
|
add_ins = vsir_program_iterator_next(it);
|
|
|
|
@@ -1422,14 +1420,9 @@ static enum vkd3d_result vsir_program_lower_precise_mad(struct vsir_program *pro
|
|
mul_dst = mul_ins->dst;
|
|
*add_ins->dst = *mul_dst;
|
|
|
|
- mul_dst->modifiers = 0;
|
|
- vsir_register_init(&mul_dst->reg, VKD3DSPR_TEMP, mul_ins->src[0].reg.data_type, 1);
|
|
- mul_dst->reg.dimension = add_ins->dst->reg.dimension;
|
|
- mul_dst->reg.idx[0].offset = *tmp_idx;
|
|
+ dst_param_init_ssa(mul_dst, program->ssa_count, mul_ins->src[0].reg.data_type, VSIR_DIMENSION_VEC4);
|
|
+ src_param_init_ssa(&add_ins->src[0], program->ssa_count++, mul_ins->src[0].reg.data_type, VSIR_DIMENSION_VEC4);
|
|
|
|
- add_ins->src[0].reg = mul_dst->reg;
|
|
- add_ins->src[0].swizzle = vsir_swizzle_from_writemask(mul_dst->write_mask);
|
|
- add_ins->src[0].modifiers = 0;
|
|
add_ins->src[1] = mul_ins->src[2];
|
|
|
|
return VKD3D_OK;
|
|
@@ -1736,7 +1729,7 @@ static enum vkd3d_result vsir_program_lower_texld_sm1(struct vsir_program *progr
|
|
struct vkd3d_shader_instruction *ins, struct vkd3d_shader_message_context *message_context)
|
|
{
|
|
const struct vkd3d_shader_descriptor_info1 *sampler;
|
|
- unsigned int idx = ins->src[0].reg.idx[0].offset;
|
|
+ unsigned int idx = ins->dst[0].reg.idx[0].offset;
|
|
struct vkd3d_shader_src_param *srcs;
|
|
|
|
/* texld DST, t# -> sample DST, t#, resource#, sampler# */
|
|
@@ -2279,7 +2272,6 @@ static enum vkd3d_result vsir_program_lower_instructions(struct vsir_program *pr
|
|
{
|
|
struct vsir_program_iterator it = vsir_program_iterator(&program->instructions);
|
|
struct vkd3d_shader_instruction *ins;
|
|
- unsigned int tmp_idx = ~0u;
|
|
enum vkd3d_result ret;
|
|
|
|
for (ins = vsir_program_iterator_head(&it); ins; ins = vsir_program_iterator_next(&it))
|
|
@@ -2287,7 +2279,7 @@ static enum vkd3d_result vsir_program_lower_instructions(struct vsir_program *pr
|
|
switch (ins->opcode)
|
|
{
|
|
case VSIR_OP_MAD:
|
|
- if ((ret = vsir_program_lower_precise_mad(program, &it, &tmp_idx)) < 0)
|
|
+ if ((ret = vsir_program_lower_precise_mad(program, &it)) < 0)
|
|
return ret;
|
|
break;
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/spirv.c b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
|
index 8ff46759fb6..a1572f69438 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
|
@@ -2491,70 +2491,6 @@ static uint32_t vkd3d_spirv_build_op_glsl_std450_nclamp(struct vkd3d_spirv_build
|
|
GLSLstd450NClamp, operands, ARRAY_SIZE(operands));
|
|
}
|
|
|
|
-static uint32_t spirv_get_type_id(struct vkd3d_spirv_builder *builder,
|
|
- enum vsir_data_type data_type, unsigned int component_count)
|
|
-{
|
|
- uint32_t scalar_id, type_id;
|
|
-
|
|
- VKD3D_ASSERT(data_type < VSIR_DATA_TYPE_COUNT);
|
|
- if (!component_count || component_count > VKD3D_VEC4_SIZE)
|
|
- {
|
|
- ERR("Invalid component count %u.\n", component_count);
|
|
- return 0;
|
|
- }
|
|
-
|
|
- if ((type_id = builder->numeric_type_ids[data_type][component_count - 1]))
|
|
- return type_id;
|
|
-
|
|
- if (component_count == 1)
|
|
- {
|
|
- switch (data_type)
|
|
- {
|
|
- case VSIR_DATA_BOOL:
|
|
- type_id = vkd3d_spirv_get_op_type_bool(builder);
|
|
- break;
|
|
-
|
|
- case VSIR_DATA_F32:
|
|
- type_id = vkd3d_spirv_get_op_type_float(builder, 32);
|
|
- break;
|
|
-
|
|
- case VSIR_DATA_F64:
|
|
- type_id = vkd3d_spirv_get_op_type_float(builder, 64);
|
|
- break;
|
|
-
|
|
- case VSIR_DATA_I32:
|
|
- case VSIR_DATA_U32:
|
|
- case VSIR_DATA_MIXED:
|
|
- type_id = vkd3d_spirv_get_op_type_int(builder, 32, data_type == VSIR_DATA_I32);
|
|
- break;
|
|
-
|
|
- case VSIR_DATA_I64:
|
|
- case VSIR_DATA_U64:
|
|
- type_id = vkd3d_spirv_get_op_type_int(builder, 64, data_type == VSIR_DATA_I64);
|
|
- break;
|
|
-
|
|
- case VSIR_DATA_UNUSED:
|
|
- type_id = vkd3d_spirv_get_op_type_void(builder);
|
|
- break;
|
|
-
|
|
- default:
|
|
- FIXME("Unhandled data type \"%s\" (%#x).\n",
|
|
- vsir_data_type_get_name(data_type, "<unknown>"), data_type);
|
|
- return 0;
|
|
- }
|
|
- }
|
|
- else
|
|
- {
|
|
- VKD3D_ASSERT(data_type != VSIR_DATA_UNUSED);
|
|
- scalar_id = spirv_get_type_id(builder, data_type, 1);
|
|
- type_id = vkd3d_spirv_get_op_type_vector(builder, scalar_id, component_count);
|
|
- }
|
|
-
|
|
- builder->numeric_type_ids[data_type][component_count - 1] = type_id;
|
|
-
|
|
- return type_id;
|
|
-}
|
|
-
|
|
static void vkd3d_spirv_builder_init(struct vkd3d_spirv_builder *builder,
|
|
const char *entry_point, const char *source_name)
|
|
{
|
|
@@ -3471,6 +3407,74 @@ static struct vkd3d_string_buffer *vkd3d_shader_register_range_string(struct spi
|
|
return buffer;
|
|
}
|
|
|
|
+static uint32_t spirv_get_type_id(struct spirv_compiler *compiler,
|
|
+ enum vsir_data_type data_type, unsigned int component_count)
|
|
+{
|
|
+ struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
|
+ uint32_t scalar_id, type_id;
|
|
+
|
|
+ VKD3D_ASSERT(data_type < VSIR_DATA_TYPE_COUNT);
|
|
+ if (!component_count || component_count > VKD3D_VEC4_SIZE)
|
|
+ {
|
|
+ ERR("Invalid component count %u.\n", component_count);
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
+ if ((type_id = builder->numeric_type_ids[data_type][component_count - 1]))
|
|
+ return type_id;
|
|
+
|
|
+ if (component_count == 1)
|
|
+ {
|
|
+ switch (data_type)
|
|
+ {
|
|
+ case VSIR_DATA_BOOL:
|
|
+ type_id = vkd3d_spirv_get_op_type_bool(builder);
|
|
+ break;
|
|
+
|
|
+ case VSIR_DATA_F32:
|
|
+ case VSIR_DATA_SNORM:
|
|
+ case VSIR_DATA_UNORM:
|
|
+ type_id = vkd3d_spirv_get_op_type_float(builder, 32);
|
|
+ break;
|
|
+
|
|
+ case VSIR_DATA_F64:
|
|
+ type_id = vkd3d_spirv_get_op_type_float(builder, 64);
|
|
+ break;
|
|
+
|
|
+ case VSIR_DATA_I32:
|
|
+ case VSIR_DATA_U32:
|
|
+ case VSIR_DATA_MIXED:
|
|
+ type_id = vkd3d_spirv_get_op_type_int(builder, 32, data_type == VSIR_DATA_I32);
|
|
+ break;
|
|
+
|
|
+ case VSIR_DATA_I64:
|
|
+ case VSIR_DATA_U64:
|
|
+ type_id = vkd3d_spirv_get_op_type_int(builder, 64, data_type == VSIR_DATA_I64);
|
|
+ break;
|
|
+
|
|
+ case VSIR_DATA_UNUSED:
|
|
+ type_id = vkd3d_spirv_get_op_type_void(builder);
|
|
+ break;
|
|
+
|
|
+ default:
|
|
+ spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_NOT_IMPLEMENTED,
|
|
+ "Unhandled data type \"%s\" (%#x).",
|
|
+ vsir_data_type_get_name(data_type, "<unknown>"), data_type);
|
|
+ return 0;
|
|
+ }
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ VKD3D_ASSERT(data_type != VSIR_DATA_UNUSED);
|
|
+ scalar_id = spirv_get_type_id(compiler, data_type, 1);
|
|
+ type_id = vkd3d_spirv_get_op_type_vector(builder, scalar_id, component_count);
|
|
+ }
|
|
+
|
|
+ builder->numeric_type_ids[data_type][component_count - 1] = type_id;
|
|
+
|
|
+ return type_id;
|
|
+}
|
|
+
|
|
static uint32_t spirv_compiler_get_label_id(struct spirv_compiler *compiler, unsigned int block_id)
|
|
{
|
|
--block_id;
|
|
@@ -3636,7 +3640,7 @@ static uint32_t spirv_compiler_get_constant(struct spirv_compiler *compiler,
|
|
unsigned int i;
|
|
|
|
VKD3D_ASSERT(0 < component_count && component_count <= VKD3D_VEC4_SIZE);
|
|
- type_id = spirv_get_type_id(builder, data_type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, component_count);
|
|
|
|
switch (data_type)
|
|
{
|
|
@@ -3666,7 +3670,7 @@ static uint32_t spirv_compiler_get_constant(struct spirv_compiler *compiler,
|
|
if (component_count == 1)
|
|
return vkd3d_spirv_get_op_constant(builder, type_id, *values);
|
|
|
|
- scalar_type_id = spirv_get_type_id(builder, data_type, 1);
|
|
+ scalar_type_id = spirv_get_type_id(compiler, data_type, 1);
|
|
for (i = 0; i < component_count; ++i)
|
|
{
|
|
component_ids[i] = vkd3d_spirv_get_op_constant(builder, scalar_type_id, values[i]);
|
|
@@ -3683,7 +3687,7 @@ static uint32_t spirv_compiler_get_constant64(struct spirv_compiler *compiler,
|
|
unsigned int i;
|
|
|
|
VKD3D_ASSERT(0 < component_count && component_count <= VKD3D_DVEC2_SIZE);
|
|
- type_id = spirv_get_type_id(builder, data_type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, component_count);
|
|
|
|
if (data_type != VSIR_DATA_F64 && data_type != VSIR_DATA_I64 && data_type != VSIR_DATA_U64)
|
|
{
|
|
@@ -3696,7 +3700,7 @@ static uint32_t spirv_compiler_get_constant64(struct spirv_compiler *compiler,
|
|
if (component_count == 1)
|
|
return vkd3d_spirv_get_op_constant64(builder, type_id, *values);
|
|
|
|
- scalar_type_id = spirv_get_type_id(builder, data_type, 1);
|
|
+ scalar_type_id = spirv_get_type_id(compiler, data_type, 1);
|
|
for (i = 0; i < component_count; ++i)
|
|
{
|
|
component_ids[i] = vkd3d_spirv_get_op_constant64(builder, scalar_type_id, values[i]);
|
|
@@ -3756,9 +3760,7 @@ static uint32_t spirv_compiler_get_constant_uint64_vector(struct spirv_compiler
|
|
static uint32_t spirv_compiler_get_type_id_for_reg(struct spirv_compiler *compiler,
|
|
const struct vkd3d_shader_register *reg, uint32_t write_mask)
|
|
{
|
|
- struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
|
-
|
|
- return spirv_get_type_id(builder, reg->data_type, vsir_write_mask_component_count(write_mask));
|
|
+ return spirv_get_type_id(compiler, reg->data_type, vsir_write_mask_component_count(write_mask));
|
|
}
|
|
|
|
static uint32_t spirv_compiler_get_type_id_for_dst(struct spirv_compiler *compiler,
|
|
@@ -3884,7 +3886,7 @@ static uint32_t spirv_compiler_emit_array_variable(struct spirv_compiler *compil
|
|
uint32_t type_id, length_id, ptr_type_id;
|
|
unsigned int i;
|
|
|
|
- type_id = spirv_get_type_id(builder, data_type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, component_count);
|
|
for (i = 0; i < length_count; ++i)
|
|
{
|
|
if (!array_lengths[i])
|
|
@@ -3982,8 +3984,8 @@ static uint32_t spirv_compiler_emit_spec_constant(struct spirv_compiler *compile
|
|
info = get_spec_constant_info(name);
|
|
default_value = info ? info->default_value.u : 0;
|
|
|
|
- scalar_type_id = spirv_get_type_id(builder, type, 1);
|
|
- vector_type_id = spirv_get_type_id(builder, type, component_count);
|
|
+ scalar_type_id = spirv_get_type_id(compiler, type, 1);
|
|
+ vector_type_id = spirv_get_type_id(compiler, type, component_count);
|
|
|
|
for (unsigned int i = 0; i < component_count; ++i)
|
|
{
|
|
@@ -4032,7 +4034,7 @@ static uint32_t spirv_compiler_get_buffer_parameter(struct spirv_compiler *compi
|
|
unsigned int index = parameter - compiler->program->parameters;
|
|
uint32_t type_id, ptr_id, ptr_type_id;
|
|
|
|
- type_id = spirv_get_type_id(builder, type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, type, component_count);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassUniform, type_id);
|
|
ptr_id = vkd3d_spirv_build_op_access_chain1(builder, ptr_type_id,
|
|
compiler->spirv_parameter_info[index].buffer_id,
|
|
@@ -4096,7 +4098,7 @@ static uint32_t spirv_compiler_emit_construct_vector(struct spirv_compiler *comp
|
|
|
|
VKD3D_ASSERT(val_component_idx < val_component_count);
|
|
|
|
- type_id = spirv_get_type_id(builder, data_type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, component_count);
|
|
if (val_component_count == 1)
|
|
{
|
|
for (i = 0; i < component_count; ++i)
|
|
@@ -4129,7 +4131,7 @@ static uint32_t spirv_compiler_emit_register_addressing(struct spirv_compiler *c
|
|
addr_id = spirv_compiler_emit_load_src(compiler, reg_index->rel_addr, VKD3DSP_WRITEMASK_0);
|
|
if (reg_index->offset)
|
|
{
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
addr_id = vkd3d_spirv_build_op_iadd(builder, type_id, addr_id,
|
|
spirv_compiler_get_constant_uint(compiler, reg_index->offset));
|
|
}
|
|
@@ -4279,7 +4281,7 @@ static uint32_t spirv_compiler_get_descriptor_index(struct spirv_compiler *compi
|
|
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
|
uint32_t type_id, ptr_type_id, ptr_id, offset_id, index_ids[2];
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
if (!(offset_id = compiler->descriptor_offset_ids[push_constant_index]))
|
|
{
|
|
index_ids[0] = compiler->descriptor_offsets_member_id;
|
|
@@ -4352,7 +4354,7 @@ static void spirv_compiler_emit_dereference_register(struct spirv_compiler *comp
|
|
if (index_count)
|
|
{
|
|
component_count = vsir_write_mask_component_count(register_info->write_mask);
|
|
- type_id = spirv_get_type_id(builder, register_info->data_type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, register_info->data_type, component_count);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, register_info->storage_class, type_id);
|
|
register_info->id = vkd3d_spirv_build_op_access_chain(builder, ptr_type_id,
|
|
register_info->id, indexes, index_count);
|
|
@@ -4410,7 +4412,7 @@ static uint32_t spirv_compiler_emit_swizzle(struct spirv_compiler *compiler, uin
|
|
&& (component_count == 1 || vkd3d_swizzle_is_equal(val_write_mask, swizzle, write_mask)))
|
|
return val_id;
|
|
|
|
- type_id = spirv_get_type_id(builder, data_type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, component_count);
|
|
|
|
if (component_count == 1)
|
|
{
|
|
@@ -4461,7 +4463,7 @@ static uint32_t spirv_compiler_emit_vector_shuffle(struct spirv_compiler *compil
|
|
else
|
|
components[i] = VKD3D_VEC4_SIZE + vsir_swizzle_get_component(swizzle, i);
|
|
}
|
|
- type_id = spirv_get_type_id(builder, data_type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, component_count);
|
|
|
|
return vkd3d_spirv_build_op_vector_shuffle(builder, type_id,
|
|
vector1_id, vector2_id, components, component_count);
|
|
@@ -4477,7 +4479,7 @@ static uint32_t spirv_compiler_emit_int_to_bool(struct spirv_compiler *compiler,
|
|
|
|
VKD3D_ASSERT(!(condition & ~(VKD3D_SHADER_CONDITIONAL_OP_NZ | VKD3D_SHADER_CONDITIONAL_OP_Z)));
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_BOOL, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_BOOL, component_count);
|
|
op = condition & VKD3D_SHADER_CONDITIONAL_OP_Z ? SpvOpIEqual : SpvOpINotEqual;
|
|
|
|
return vkd3d_spirv_build_op_tr2(builder, &builder->function_stream, op, type_id, val_id,
|
|
@@ -4494,7 +4496,7 @@ static uint32_t spirv_compiler_emit_bool_to_int(struct spirv_compiler *compiler,
|
|
|
|
true_id = spirv_compiler_get_constant_uint_vector(compiler, signedness ? 0xffffffff : 1, component_count);
|
|
false_id = spirv_compiler_get_constant_uint_vector(compiler, 0, component_count);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, component_count);
|
|
|
|
return vkd3d_spirv_build_op_select(builder, type_id, val_id, true_id, false_id);
|
|
}
|
|
@@ -4508,7 +4510,7 @@ static uint32_t spirv_compiler_emit_bool_to_int64(struct spirv_compiler *compile
|
|
true_id = spirv_compiler_get_constant_uint64_vector(compiler, signedness ? UINT64_MAX : 1,
|
|
component_count);
|
|
false_id = spirv_compiler_get_constant_uint64_vector(compiler, 0, component_count);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U64, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U64, component_count);
|
|
|
|
return vkd3d_spirv_build_op_select(builder, type_id, val_id, true_id, false_id);
|
|
}
|
|
@@ -4521,7 +4523,7 @@ static uint32_t spirv_compiler_emit_bool_to_float(struct spirv_compiler *compile
|
|
|
|
true_id = spirv_compiler_get_constant_float_vector(compiler, signedness ? -1.0f : 1.0f, component_count);
|
|
false_id = spirv_compiler_get_constant_float_vector(compiler, 0.0f, component_count);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_F32, component_count);
|
|
|
|
return vkd3d_spirv_build_op_select(builder, type_id, val_id, true_id, false_id);
|
|
}
|
|
@@ -4534,7 +4536,7 @@ static uint32_t spirv_compiler_emit_bool_to_double(struct spirv_compiler *compil
|
|
|
|
true_id = spirv_compiler_get_constant_double_vector(compiler, signedness ? -1.0 : 1.0, component_count);
|
|
false_id = spirv_compiler_get_constant_double_vector(compiler, 0.0, component_count);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F64, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_F64, component_count);
|
|
|
|
return vkd3d_spirv_build_op_select(builder, type_id, val_id, true_id, false_id);
|
|
}
|
|
@@ -4600,7 +4602,7 @@ static uint32_t spirv_compiler_emit_load_undef(struct spirv_compiler *compiler,
|
|
|
|
VKD3D_ASSERT(reg->type == VKD3DSPR_UNDEF);
|
|
|
|
- type_id = spirv_get_type_id(builder, reg->data_type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, reg->data_type, component_count);
|
|
|
|
return vkd3d_spirv_get_op_undef(builder, type_id);
|
|
}
|
|
@@ -4631,7 +4633,7 @@ static uint32_t spirv_compiler_emit_load_scalar(struct spirv_compiler *compiler,
|
|
component_idx, reg->type, reg->idx[0].offset, reg_info->write_mask);
|
|
}
|
|
|
|
- type_id = spirv_get_type_id(builder, reg_info->data_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, reg_info->data_type, 1);
|
|
reg_id = reg_info->id;
|
|
if (reg_component_count != 1)
|
|
{
|
|
@@ -4646,13 +4648,13 @@ static uint32_t spirv_compiler_emit_load_scalar(struct spirv_compiler *compiler,
|
|
|
|
if (reg->data_type != VSIR_DATA_BOOL)
|
|
{
|
|
- type_id = spirv_get_type_id(builder, reg->data_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, reg->data_type, 1);
|
|
return vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
|
|
}
|
|
|
|
if (reg_info->data_type != VSIR_DATA_U32)
|
|
{
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
|
|
}
|
|
|
|
@@ -4669,7 +4671,7 @@ static uint32_t spirv_compiler_emit_constant_array(struct spirv_compiler *compil
|
|
element_count = icb->element_count;
|
|
|
|
component_count = icb->component_count;
|
|
- elem_type_id = spirv_get_type_id(builder, icb->data_type, component_count);
|
|
+ elem_type_id = spirv_get_type_id(compiler, icb->data_type, component_count);
|
|
length_id = spirv_compiler_get_constant_uint(compiler, element_count);
|
|
type_id = vkd3d_spirv_get_op_type_array(builder, elem_type_id, length_id);
|
|
|
|
@@ -4757,7 +4759,7 @@ static uint32_t spirv_compiler_emit_load_reg(struct spirv_compiler *compiler,
|
|
|
|
if (!spirv_compiler_get_register_info(compiler, reg, ®_info))
|
|
{
|
|
- type_id = spirv_get_type_id(builder, reg->data_type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, reg->data_type, component_count);
|
|
return vkd3d_spirv_get_op_undef(builder, type_id);
|
|
}
|
|
spirv_compiler_emit_dereference_register(compiler, reg, ®_info);
|
|
@@ -4776,7 +4778,7 @@ static uint32_t spirv_compiler_emit_load_reg(struct spirv_compiler *compiler,
|
|
}
|
|
else
|
|
{
|
|
- type_id = spirv_get_type_id(builder, reg_info.data_type,
|
|
+ type_id = spirv_get_type_id(compiler, reg_info.data_type,
|
|
vsir_write_mask_component_count(reg_info.write_mask));
|
|
val_id = vkd3d_spirv_build_op_load(builder, type_id, reg_info.id, SpvMemoryAccessMaskNone);
|
|
swizzle = data_type_is_64_bit(reg->data_type) ? vsir_swizzle_32_from_64(swizzle) : swizzle;
|
|
@@ -4789,13 +4791,13 @@ static uint32_t spirv_compiler_emit_load_reg(struct spirv_compiler *compiler,
|
|
|
|
if (reg->data_type != VSIR_DATA_BOOL)
|
|
{
|
|
- type_id = spirv_get_type_id(builder, reg->data_type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, reg->data_type, component_count);
|
|
return vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
|
|
}
|
|
|
|
if (reg_info.data_type != VSIR_DATA_U32)
|
|
{
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, component_count);
|
|
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
|
|
}
|
|
|
|
@@ -4848,7 +4850,7 @@ static void spirv_compiler_emit_store_scalar(struct spirv_compiler *compiler,
|
|
|
|
if (vsir_write_mask_component_count(dst_write_mask) > 1)
|
|
{
|
|
- type_id = spirv_get_type_id(builder, data_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, 1);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, storage_class, type_id);
|
|
component_idx = vsir_write_mask_get_component_idx(write_mask);
|
|
component_idx -= vsir_write_mask_get_component_idx(dst_write_mask);
|
|
@@ -4875,7 +4877,7 @@ static void spirv_compiler_emit_store(struct spirv_compiler *compiler, uint32_t
|
|
|
|
if (dst_component_count == 1 && component_count != 1)
|
|
{
|
|
- type_id = spirv_get_type_id(builder, data_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, 1);
|
|
val_id = vkd3d_spirv_build_op_composite_extract1(builder, type_id, val_id,
|
|
vsir_write_mask_get_component_idx(dst_write_mask));
|
|
write_mask &= dst_write_mask;
|
|
@@ -4888,7 +4890,7 @@ static void spirv_compiler_emit_store(struct spirv_compiler *compiler, uint32_t
|
|
|
|
if (dst_component_count != component_count)
|
|
{
|
|
- type_id = spirv_get_type_id(builder, data_type, dst_component_count);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, dst_component_count);
|
|
dst_val_id = vkd3d_spirv_build_op_load(builder, type_id, dst_id, SpvMemoryAccessMaskNone);
|
|
|
|
VKD3D_ASSERT(component_count <= ARRAY_SIZE(components));
|
|
@@ -4940,7 +4942,7 @@ static void spirv_compiler_emit_store_reg(struct spirv_compiler *compiler,
|
|
if (data_type == VSIR_DATA_BOOL)
|
|
val_id = spirv_compiler_emit_bool_to_int(compiler,
|
|
vsir_write_mask_component_count(src_write_mask), val_id, false);
|
|
- type_id = spirv_get_type_id(builder, reg_info.data_type,
|
|
+ type_id = spirv_get_type_id(compiler, reg_info.data_type,
|
|
vsir_write_mask_component_count(src_write_mask));
|
|
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
|
|
data_type = reg_info.data_type;
|
|
@@ -5021,13 +5023,13 @@ static void spirv_compiler_emit_store_dst_components(struct spirv_compiler *comp
|
|
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
|
uint32_t type_id, dst_type_id, val_id;
|
|
|
|
- type_id = spirv_get_type_id(builder, data_type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, component_count);
|
|
if (component_count > 1)
|
|
val_id = vkd3d_spirv_build_op_composite_construct(builder, type_id, component_ids, component_count);
|
|
else
|
|
val_id = *component_ids;
|
|
|
|
- dst_type_id = spirv_get_type_id(builder, dst->reg.data_type, component_count);
|
|
+ dst_type_id = spirv_get_type_id(compiler, dst->reg.data_type, component_count);
|
|
if (dst_type_id != type_id)
|
|
val_id = vkd3d_spirv_build_op_bitcast(builder, dst_type_id, val_id);
|
|
|
|
@@ -5195,7 +5197,7 @@ static uint32_t spirv_compiler_emit_draw_parameter_fixup(struct spirv_compiler *
|
|
vkd3d_spirv_add_iface_variable(builder, base_var_id);
|
|
spirv_compiler_decorate_builtin(compiler, base_var_id, base);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_I32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_I32, 1);
|
|
base_id = vkd3d_spirv_build_op_load(builder, type_id, base_var_id, SpvMemoryAccessMaskNone);
|
|
|
|
return vkd3d_spirv_build_op_isub(builder, type_id, index_id, base_id);
|
|
@@ -5229,10 +5231,10 @@ static uint32_t frag_coord_fixup(struct spirv_compiler *compiler, uint32_t frag_
|
|
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
|
uint32_t type_id, w_id;
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_F32, 1);
|
|
w_id = vkd3d_spirv_build_op_composite_extract1(builder, type_id, frag_coord_id, 3);
|
|
w_id = vkd3d_spirv_build_op_fdiv(builder, type_id, spirv_compiler_get_constant_float(compiler, 1.0f), w_id);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32, VKD3D_VEC4_SIZE);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_F32, VKD3D_VEC4_SIZE);
|
|
|
|
return vkd3d_spirv_build_op_composite_insert1(builder, type_id, w_id, frag_coord_id, 3);
|
|
}
|
|
@@ -5439,7 +5441,7 @@ static uint32_t spirv_compiler_emit_load_invocation_id(struct spirv_compiler *co
|
|
uint32_t type_id, id;
|
|
|
|
id = spirv_compiler_get_invocation_id(compiler);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_I32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_I32, 1);
|
|
|
|
return vkd3d_spirv_build_op_load(builder, type_id, id, SpvMemoryAccessMaskNone);
|
|
}
|
|
@@ -5778,7 +5780,7 @@ static void spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
|
vsir_register_init(&dst_reg, reg_type, VSIR_DATA_F32, 1);
|
|
dst_reg.idx[0].offset = element_idx;
|
|
|
|
- type_id = spirv_get_type_id(builder, data_type, input_component_count);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, input_component_count);
|
|
|
|
val_id = vkd3d_spirv_build_op_load(builder, type_id, input_id, SpvMemoryAccessMaskNone);
|
|
|
|
@@ -5787,7 +5789,7 @@ static void spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
|
|
|
if (data_type != VSIR_DATA_F32)
|
|
{
|
|
- float_type_id = spirv_get_type_id(builder, VSIR_DATA_F32, input_component_count);
|
|
+ float_type_id = spirv_get_type_id(compiler, VSIR_DATA_F32, input_component_count);
|
|
val_id = vkd3d_spirv_build_op_bitcast(builder, float_type_id, val_id);
|
|
}
|
|
|
|
@@ -6139,7 +6141,7 @@ static void spirv_compiler_emit_store_shader_output(struct spirv_compiler *compi
|
|
|
|
if (data_type != VSIR_DATA_F32)
|
|
{
|
|
- type_id = spirv_get_type_id(builder, data_type, VKD3D_VEC4_SIZE);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, VKD3D_VEC4_SIZE);
|
|
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
|
|
}
|
|
|
|
@@ -6162,7 +6164,7 @@ static void spirv_compiler_emit_store_shader_output(struct spirv_compiler *compi
|
|
output_id = output_info->id;
|
|
if (output_index_id)
|
|
{
|
|
- type_id = spirv_get_type_id(builder, data_type, vsir_write_mask_component_count(dst_write_mask));
|
|
+ type_id = spirv_get_type_id(compiler, data_type, vsir_write_mask_component_count(dst_write_mask));
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassOutput, type_id);
|
|
output_id = vkd3d_spirv_build_op_access_chain1(builder, ptr_type_id, output_id, output_index_id);
|
|
}
|
|
@@ -6174,7 +6176,7 @@ static void spirv_compiler_emit_store_shader_output(struct spirv_compiler *compi
|
|
return;
|
|
}
|
|
|
|
- type_id = spirv_get_type_id(builder, data_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, 1);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassOutput, type_id);
|
|
mask = output_info->array_element_mask;
|
|
array_idx = spirv_compiler_get_output_array_index(compiler, output);
|
|
@@ -6216,7 +6218,7 @@ static void spirv_compiler_emit_shader_epilogue_function(struct spirv_compiler *
|
|
function_id = compiler->epilogue_function_id;
|
|
|
|
void_id = vkd3d_spirv_get_op_type_void(builder);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32, 4);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_F32, 4);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassPrivate, type_id);
|
|
for (i = 0, count = 0; i < ARRAY_SIZE(compiler->private_output_variable); ++i)
|
|
{
|
|
@@ -6445,7 +6447,7 @@ static void spirv_compiler_emit_dcl_indexable_temp(struct spirv_compiler *compil
|
|
function_location = spirv_compiler_get_current_function_location(compiler);
|
|
vkd3d_spirv_begin_function_stream_insertion(builder, function_location);
|
|
|
|
- type_id = spirv_get_type_id(builder, temp->data_type, temp->component_count);
|
|
+ type_id = spirv_get_type_id(compiler, temp->data_type, temp->component_count);
|
|
length_id = spirv_compiler_get_constant_uint(compiler, temp->register_size);
|
|
type_id = vkd3d_spirv_get_op_type_array(builder, type_id, length_id);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, storage_class, type_id);
|
|
@@ -6486,7 +6488,7 @@ static void spirv_compiler_emit_push_constant_buffers(struct spirv_compiler *com
|
|
if (!(member_ids = vkd3d_calloc(count, sizeof(*member_ids))))
|
|
return;
|
|
|
|
- vec4_id = spirv_get_type_id(builder, VSIR_DATA_F32, VKD3D_VEC4_SIZE);
|
|
+ vec4_id = spirv_get_type_id(compiler, VSIR_DATA_F32, VKD3D_VEC4_SIZE);
|
|
|
|
for (i = 0, j = 0; i < compiler->shader_interface.push_constant_buffer_count; ++i)
|
|
{
|
|
@@ -6503,7 +6505,7 @@ static void spirv_compiler_emit_push_constant_buffers(struct spirv_compiler *com
|
|
|
|
if (compiler->offset_info.descriptor_table_count)
|
|
{
|
|
- uint32_t type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ uint32_t type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
length_id = spirv_compiler_get_constant_uint(compiler, compiler->offset_info.descriptor_table_count);
|
|
member_ids[j] = vkd3d_spirv_build_op_type_array(builder, type_id, length_id);
|
|
vkd3d_spirv_build_op_decorate1(builder, member_ids[j], SpvDecorationArrayStride, 4);
|
|
@@ -6696,7 +6698,7 @@ static void spirv_compiler_emit_cbv_declaration(struct spirv_compiler *compiler,
|
|
return;
|
|
}
|
|
|
|
- vec4_id = spirv_get_type_id(builder, VSIR_DATA_F32, VKD3D_VEC4_SIZE);
|
|
+ vec4_id = spirv_get_type_id(compiler, VSIR_DATA_F32, VKD3D_VEC4_SIZE);
|
|
length_id = spirv_compiler_get_constant_uint(compiler, 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);
|
|
@@ -6797,6 +6799,8 @@ static SpvImageFormat image_format_for_image_read(enum vsir_data_type data_type)
|
|
switch (data_type)
|
|
{
|
|
case VSIR_DATA_F32:
|
|
+ case VSIR_DATA_SNORM:
|
|
+ case VSIR_DATA_UNORM:
|
|
return SpvImageFormatR32f;
|
|
case VSIR_DATA_I32:
|
|
return SpvImageFormatR32i;
|
|
@@ -6831,7 +6835,7 @@ static uint32_t spirv_compiler_get_image_type_id(struct spirv_compiler *compiler
|
|
vkd3d_spirv_enable_capability(builder, SpvCapabilityStorageImageReadWithoutFormat);
|
|
}
|
|
|
|
- sampled_type_id = spirv_get_type_id(builder, data_type, 1);
|
|
+ sampled_type_id = spirv_get_type_id(compiler, data_type, 1);
|
|
|
|
return vkd3d_spirv_get_op_type_image(builder, sampled_type_id, resource_type_info->dim, 2,
|
|
resource_type_info->arrayed, resource_type_info->ms, reg->type == VKD3DSPR_UAV ? 2 : 1, format);
|
|
@@ -6957,7 +6961,7 @@ static void spirv_compiler_emit_resource_declaration(struct spirv_compiler *comp
|
|
{
|
|
uint32_t array_type_id, struct_id;
|
|
|
|
- type_id = spirv_get_type_id(builder, sampled_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, sampled_type, 1);
|
|
|
|
array_type_id = vkd3d_spirv_get_op_type_runtime_array(builder, type_id);
|
|
vkd3d_spirv_build_op_decorate1(builder, array_type_id, SpvDecorationArrayStride, 4);
|
|
@@ -6998,7 +7002,7 @@ static void spirv_compiler_emit_resource_declaration(struct spirv_compiler *comp
|
|
{
|
|
VKD3D_ASSERT(structure_stride); /* counters are valid only for structured buffers */
|
|
|
|
- counter_type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ counter_type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
if (spirv_compiler_is_opengl_target(compiler))
|
|
{
|
|
vkd3d_spirv_enable_capability(builder, SpvCapabilityAtomicStorage);
|
|
@@ -7062,7 +7066,7 @@ static void spirv_compiler_emit_workgroup_memory(struct spirv_compiler *compiler
|
|
if (alignment)
|
|
TRACE("Ignoring alignment %u.\n", alignment);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
length_id = spirv_compiler_get_constant_uint(compiler, size);
|
|
array_type_id = vkd3d_spirv_get_op_type_array(builder, type_id, length_id);
|
|
|
|
@@ -7761,7 +7765,7 @@ static void spirv_compiler_emit_ext_glsl_instruction(struct spirv_compiler *comp
|
|
component_count = vsir_write_mask_component_count(dst->write_mask);
|
|
uint_max_id = spirv_compiler_get_constant_uint_vector(compiler, UINT32_MAX, component_count);
|
|
condition_id = vkd3d_spirv_build_op_tr2(builder, &builder->function_stream, SpvOpIEqual,
|
|
- spirv_get_type_id(builder, VSIR_DATA_BOOL, component_count), val_id, uint_max_id);
|
|
+ spirv_get_type_id(compiler, VSIR_DATA_BOOL, component_count), val_id, uint_max_id);
|
|
rev_val_id = vkd3d_spirv_build_op_isub(builder, type_id,
|
|
spirv_compiler_get_constant_uint_vector(compiler, 31, component_count), val_id);
|
|
val_id = vkd3d_spirv_build_op_select(builder, type_id, condition_id, val_id, rev_val_id);
|
|
@@ -7811,7 +7815,7 @@ static void spirv_compiler_emit_mov(struct spirv_compiler *compiler,
|
|
dst_id = spirv_compiler_get_register_id(compiler, &dst->reg);
|
|
src_id = spirv_compiler_get_register_id(compiler, &src->reg);
|
|
|
|
- type_id = spirv_get_type_id(builder, dst_reg_info.data_type, VKD3D_VEC4_SIZE);
|
|
+ type_id = spirv_get_type_id(compiler, dst_reg_info.data_type, VKD3D_VEC4_SIZE);
|
|
val_id = vkd3d_spirv_build_op_load(builder, type_id, src_id, SpvMemoryAccessMaskNone);
|
|
dst_val_id = vkd3d_spirv_build_op_load(builder, type_id, dst_id, SpvMemoryAccessMaskNone);
|
|
|
|
@@ -7840,7 +7844,7 @@ general_implementation:
|
|
val_id = spirv_compiler_emit_load_src(compiler, src, write_mask);
|
|
if (dst->reg.data_type != src->reg.data_type)
|
|
{
|
|
- val_id = vkd3d_spirv_build_op_bitcast(builder, spirv_get_type_id(builder,
|
|
+ val_id = vkd3d_spirv_build_op_bitcast(builder, spirv_get_type_id(compiler,
|
|
dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask)), val_id);
|
|
}
|
|
spirv_compiler_emit_store_dst(compiler, dst, val_id);
|
|
@@ -7866,7 +7870,7 @@ static void spirv_compiler_emit_movc(struct spirv_compiler *compiler,
|
|
{
|
|
if (instruction->opcode == VSIR_OP_CMP)
|
|
condition_id = vkd3d_spirv_build_op_tr2(builder, &builder->function_stream, SpvOpFOrdGreaterThanEqual,
|
|
- spirv_get_type_id(builder, VSIR_DATA_BOOL, component_count), condition_id,
|
|
+ spirv_get_type_id(compiler, VSIR_DATA_BOOL, component_count), condition_id,
|
|
spirv_compiler_get_constant_float_vector(compiler, 0.0f, component_count));
|
|
else
|
|
condition_id = spirv_compiler_emit_int_to_bool(compiler,
|
|
@@ -7893,7 +7897,7 @@ static void spirv_compiler_emit_swapc(struct spirv_compiler *compiler,
|
|
src2_id = spirv_compiler_emit_load_src(compiler, &src[2], dst->write_mask);
|
|
|
|
component_count = vsir_write_mask_component_count(dst->write_mask);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_F32, component_count);
|
|
|
|
condition_id = spirv_compiler_emit_int_to_bool(compiler,
|
|
VKD3D_SHADER_CONDITIONAL_OP_NZ, src[0].reg.data_type, component_count, condition_id);
|
|
@@ -7929,7 +7933,7 @@ static void spirv_compiler_emit_dot(struct spirv_compiler *compiler,
|
|
for (i = 0; i < ARRAY_SIZE(src_ids); ++i)
|
|
src_ids[i] = spirv_compiler_emit_load_src(compiler, &src[i], write_mask);
|
|
|
|
- type_id = spirv_get_type_id(builder, data_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, 1);
|
|
|
|
val_id = vkd3d_spirv_build_op_tr2(builder, &builder->function_stream,
|
|
SpvOpDot, type_id, src_ids[0], src_ids[1]);
|
|
@@ -7972,7 +7976,7 @@ static void spirv_compiler_emit_imad(struct spirv_compiler *compiler,
|
|
unsigned int i, component_count;
|
|
|
|
component_count = vsir_write_mask_component_count(dst->write_mask);
|
|
- type_id = spirv_get_type_id(builder, dst->reg.data_type, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, dst->reg.data_type, component_count);
|
|
|
|
for (i = 0; i < ARRAY_SIZE(src_ids); ++i)
|
|
src_ids[i] = spirv_compiler_emit_load_src(compiler, &src[i], dst->write_mask);
|
|
@@ -8024,7 +8028,7 @@ static void spirv_compiler_emit_ftoi(struct spirv_compiler *compiler,
|
|
/* VSIR allows the destination of a signed conversion to be unsigned. */
|
|
|
|
int_max_id = spirv_compiler_get_constant_vector(compiler, dst->reg.data_type, component_count, INT_MAX);
|
|
- condition_type_id = spirv_get_type_id(builder, VSIR_DATA_BOOL, component_count);
|
|
+ condition_type_id = spirv_get_type_id(compiler, VSIR_DATA_BOOL, component_count);
|
|
condition_id = vkd3d_spirv_build_op_tr2(builder, &builder->function_stream,
|
|
SpvOpFOrdGreaterThanEqual, condition_type_id, val_id, float_max_id);
|
|
|
|
@@ -8077,7 +8081,7 @@ static void spirv_compiler_emit_ftou(struct spirv_compiler *compiler,
|
|
val_id = vkd3d_spirv_build_op_glsl_std450_max(builder, src_type_id, src_id, zero_id);
|
|
|
|
uint_max_id = spirv_compiler_get_constant_uint_vector(compiler, UINT_MAX, component_count);
|
|
- condition_type_id = spirv_get_type_id(builder, VSIR_DATA_BOOL, component_count);
|
|
+ condition_type_id = spirv_get_type_id(compiler, VSIR_DATA_BOOL, component_count);
|
|
condition_id = vkd3d_spirv_build_op_tr2(builder, &builder->function_stream,
|
|
SpvOpFOrdGreaterThanEqual, condition_type_id, val_id, float_max_id);
|
|
|
|
@@ -8102,7 +8106,7 @@ static void spirv_compiler_emit_dtof(struct spirv_compiler *compiler,
|
|
|
|
src_id = spirv_compiler_emit_load_src(compiler, src, write_mask);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_F32, component_count);
|
|
val_id = vkd3d_spirv_build_op_tr1(builder, &builder->function_stream, SpvOpFConvert, type_id, src_id);
|
|
if (instruction->flags & VKD3DSI_PRECISE_XYZW)
|
|
vkd3d_spirv_build_op_decorate(builder, val_id, SpvDecorationNoContraction, NULL, 0);
|
|
@@ -8126,7 +8130,7 @@ static void spirv_compiler_emit_bitfield_instruction(struct spirv_compiler *comp
|
|
VKD3D_ASSERT(2 <= src_count && src_count <= ARRAY_SIZE(src_ids));
|
|
|
|
data_type = dst->reg.data_type;
|
|
- type_id = spirv_get_type_id(builder, data_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, 1);
|
|
size = data_type_is_64_bit(src[src_count - 1].reg.data_type) ? 0x40 : 0x20;
|
|
mask_id = spirv_compiler_get_constant_uint(compiler, size - 1);
|
|
size_id = spirv_compiler_get_constant_uint(compiler, size);
|
|
@@ -8183,8 +8187,8 @@ static void spirv_compiler_emit_f16tof32(struct spirv_compiler *compiler,
|
|
unsigned int i, j;
|
|
|
|
instr_set_id = vkd3d_spirv_get_glsl_std450_instr_set(builder);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32, 2);
|
|
- scalar_type_id = spirv_get_type_id(builder, VSIR_DATA_F32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_F32, 2);
|
|
+ scalar_type_id = spirv_get_type_id(compiler, VSIR_DATA_F32, 1);
|
|
|
|
/* FIXME: Consider a single UnpackHalf2x16 instruction per 2 components. */
|
|
VKD3D_ASSERT(dst->write_mask & VKD3DSP_WRITEMASK_ALL);
|
|
@@ -8215,8 +8219,8 @@ static void spirv_compiler_emit_f32tof16(struct spirv_compiler *compiler,
|
|
unsigned int i, j;
|
|
|
|
instr_set_id = vkd3d_spirv_get_glsl_std450_instr_set(builder);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32, 2);
|
|
- scalar_type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_F32, 2);
|
|
+ scalar_type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
zero_id = spirv_compiler_get_constant_float(compiler, 0.0f);
|
|
|
|
/* FIXME: Consider a single PackHalf2x16 instruction per 2 components. */
|
|
@@ -8294,7 +8298,7 @@ static void spirv_compiler_emit_comparison_instruction(struct spirv_compiler *co
|
|
src0_id = spirv_compiler_emit_load_src(compiler, &src[0], write_mask);
|
|
src1_id = spirv_compiler_emit_load_src(compiler, &src[1], write_mask);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_BOOL, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_BOOL, component_count);
|
|
result_id = vkd3d_spirv_build_op_tr2(builder, &builder->function_stream,
|
|
op, type_id, src0_id, src1_id);
|
|
|
|
@@ -8346,7 +8350,7 @@ static void spirv_compiler_emit_float_comparison_instruction(struct spirv_compil
|
|
src0_id = spirv_compiler_emit_load_src(compiler, &src[0], dst->write_mask);
|
|
src1_id = spirv_compiler_emit_load_src(compiler, &src[1], dst->write_mask);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_BOOL, component_count);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_BOOL, component_count);
|
|
result_id = vkd3d_spirv_build_op_tr2(builder, &builder->function_stream, op, type_id, src0_id, src1_id);
|
|
|
|
result_id = spirv_compiler_emit_bool_to_float(compiler, component_count, result_id, false);
|
|
@@ -8873,7 +8877,7 @@ static void spirv_compiler_emit_ld(struct spirv_compiler *compiler,
|
|
|
|
spirv_compiler_prepare_image(compiler, &image, &src[1].reg, NULL, VKD3D_IMAGE_FLAG_NONE);
|
|
|
|
- type_id = spirv_get_type_id(builder, image.sampled_type, VKD3D_VEC4_SIZE);
|
|
+ type_id = spirv_get_type_id(compiler, image.sampled_type, VKD3D_VEC4_SIZE);
|
|
coordinate_mask = (1u << image.resource_type_info->coordinate_component_count) - 1;
|
|
coordinate_id = spirv_compiler_emit_load_src(compiler, &src[0], coordinate_mask);
|
|
if (image.resource_type_info->resource_type != VKD3D_SHADER_RESOURCE_BUFFER && !multisample)
|
|
@@ -8918,7 +8922,7 @@ static void spirv_compiler_emit_lod(struct spirv_compiler *compiler,
|
|
spirv_compiler_prepare_image(compiler, &image,
|
|
&resource->reg, &sampler->reg, VKD3D_IMAGE_FLAG_SAMPLED);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32, 2);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_F32, 2);
|
|
coordinate_id = spirv_compiler_emit_load_src(compiler, &src[0], VKD3DSP_WRITEMASK_ALL);
|
|
val_id = vkd3d_spirv_build_op_image_query_lod(builder,
|
|
type_id, image.sampled_image_id, coordinate_id);
|
|
@@ -8987,7 +8991,7 @@ static void spirv_compiler_emit_sample(struct spirv_compiler *compiler,
|
|
instruction, image.resource_type_info);
|
|
}
|
|
|
|
- sampled_type_id = spirv_get_type_id(builder, image.sampled_type, VKD3D_VEC4_SIZE);
|
|
+ sampled_type_id = spirv_get_type_id(compiler, image.sampled_type, VKD3D_VEC4_SIZE);
|
|
coordinate_id = spirv_compiler_emit_load_src(compiler, &src[0], VKD3DSP_WRITEMASK_ALL);
|
|
VKD3D_ASSERT(image_operand_count <= ARRAY_SIZE(image_operands));
|
|
val_id = vkd3d_spirv_build_op_image_sample(builder, op, sampled_type_id,
|
|
@@ -9031,7 +9035,7 @@ static void spirv_compiler_emit_sample_c(struct spirv_compiler *compiler,
|
|
instruction, image.resource_type_info);
|
|
}
|
|
|
|
- sampled_type_id = spirv_get_type_id(builder, image.sampled_type, 1);
|
|
+ sampled_type_id = spirv_get_type_id(compiler, image.sampled_type, 1);
|
|
coordinate_id = spirv_compiler_emit_load_src(compiler, &src[0], VKD3DSP_WRITEMASK_ALL);
|
|
dref_id = spirv_compiler_emit_load_src(compiler, &src[3], VKD3DSP_WRITEMASK_0);
|
|
val_id = vkd3d_spirv_build_op_image_sample_dref(builder, op, sampled_type_id,
|
|
@@ -9089,7 +9093,7 @@ static void spirv_compiler_emit_gather4(struct spirv_compiler *compiler,
|
|
instruction, image.resource_type_info);
|
|
}
|
|
|
|
- sampled_type_id = spirv_get_type_id(builder, image.sampled_type, VKD3D_VEC4_SIZE);
|
|
+ sampled_type_id = spirv_get_type_id(compiler, image.sampled_type, VKD3D_VEC4_SIZE);
|
|
coordinate_mask = (1u << image.resource_type_info->coordinate_component_count) - 1;
|
|
coordinate_id = spirv_compiler_emit_load_src(compiler, addr, coordinate_mask);
|
|
if (image_flags & VKD3D_IMAGE_FLAG_DEPTH)
|
|
@@ -9169,10 +9173,10 @@ static void spirv_compiler_emit_ld_raw_structured_srv_uav(struct spirv_compiler
|
|
|
|
if (storage_buffer_uav)
|
|
{
|
|
- texel_type_id = spirv_get_type_id(builder, resource_symbol->info.resource.sampled_type, 1);
|
|
+ texel_type_id = spirv_get_type_id(compiler, resource_symbol->info.resource.sampled_type, 1);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassUniform, texel_type_id);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
base_coordinate_id = spirv_compiler_emit_raw_structured_addressing(compiler,
|
|
type_id, resource_symbol->info.resource.structure_stride,
|
|
&src[0], VKD3DSP_WRITEMASK_0, &src[1], VKD3DSP_WRITEMASK_0);
|
|
@@ -9204,11 +9208,11 @@ static void spirv_compiler_emit_ld_raw_structured_srv_uav(struct spirv_compiler
|
|
|
|
spirv_compiler_prepare_image(compiler, &image, &resource->reg, NULL, VKD3D_IMAGE_FLAG_NONE);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
base_coordinate_id = spirv_compiler_emit_raw_structured_addressing(compiler,
|
|
type_id, image.structure_stride, &src[0], VKD3DSP_WRITEMASK_0, &src[1], VKD3DSP_WRITEMASK_0);
|
|
|
|
- texel_type_id = spirv_get_type_id(builder, image.sampled_type, VKD3D_VEC4_SIZE);
|
|
+ texel_type_id = spirv_get_type_id(compiler, image.sampled_type, VKD3D_VEC4_SIZE);
|
|
VKD3D_ASSERT(dst->write_mask & VKD3DSP_WRITEMASK_ALL);
|
|
for (i = 0, j = 0; i < VKD3D_VEC4_SIZE; ++i)
|
|
{
|
|
@@ -9247,7 +9251,7 @@ static void spirv_compiler_emit_ld_tgsm(struct spirv_compiler *compiler,
|
|
if (!spirv_compiler_get_register_info(compiler, &resource->reg, ®_info))
|
|
return;
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, reg_info.storage_class, type_id);
|
|
base_coordinate_id = spirv_compiler_emit_raw_structured_addressing(compiler,
|
|
type_id, reg_info.structure_stride, &src[0], VKD3DSP_WRITEMASK_0, &src[1], VKD3DSP_WRITEMASK_0);
|
|
@@ -9306,10 +9310,10 @@ static void spirv_compiler_emit_store_uav_raw_structured(struct spirv_compiler *
|
|
|
|
if (spirv_compiler_use_storage_buffer(compiler, &resource_symbol->info.resource))
|
|
{
|
|
- type_id = spirv_get_type_id(builder, resource_symbol->info.resource.sampled_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, resource_symbol->info.resource.sampled_type, 1);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassUniform, type_id);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
base_coordinate_id = spirv_compiler_emit_raw_structured_addressing(compiler,
|
|
type_id, resource_symbol->info.resource.structure_stride,
|
|
&src[0], VKD3DSP_WRITEMASK_0, &src[1], VKD3DSP_WRITEMASK_0);
|
|
@@ -9337,7 +9341,7 @@ static void spirv_compiler_emit_store_uav_raw_structured(struct spirv_compiler *
|
|
}
|
|
else
|
|
{
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
spirv_compiler_prepare_image(compiler, &image, &dst->reg, NULL, VKD3D_IMAGE_FLAG_NONE);
|
|
base_coordinate_id = spirv_compiler_emit_raw_structured_addressing(compiler,
|
|
type_id, image.structure_stride, &src[0], VKD3DSP_WRITEMASK_0, &src[1], VKD3DSP_WRITEMASK_0);
|
|
@@ -9380,7 +9384,7 @@ static void spirv_compiler_emit_store_tgsm(struct spirv_compiler *compiler,
|
|
if (!spirv_compiler_get_register_info(compiler, &dst->reg, ®_info))
|
|
return;
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, reg_info.storage_class, type_id);
|
|
base_coordinate_id = spirv_compiler_emit_raw_structured_addressing(compiler,
|
|
type_id, reg_info.structure_stride, &src[0], VKD3DSP_WRITEMASK_0, &src[1], VKD3DSP_WRITEMASK_0);
|
|
@@ -9438,7 +9442,7 @@ static void spirv_compiler_emit_ld_uav_typed(struct spirv_compiler *compiler,
|
|
|
|
if (spirv_compiler_use_storage_buffer(compiler, &resource_symbol->info.resource))
|
|
{
|
|
- type_id = spirv_get_type_id(builder, resource_symbol->info.resource.sampled_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, resource_symbol->info.resource.sampled_type, 1);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassUniform, type_id);
|
|
coordinate_id = spirv_compiler_emit_load_src(compiler, &src[0], VKD3DSP_WRITEMASK_0);
|
|
indices[0] = spirv_compiler_get_constant_uint(compiler, 0);
|
|
@@ -9453,7 +9457,7 @@ static void spirv_compiler_emit_ld_uav_typed(struct spirv_compiler *compiler,
|
|
else
|
|
{
|
|
spirv_compiler_prepare_image(compiler, &image, &src[1].reg, NULL, VKD3D_IMAGE_FLAG_NONE);
|
|
- type_id = spirv_get_type_id(builder, image.sampled_type, VKD3D_VEC4_SIZE);
|
|
+ type_id = spirv_get_type_id(compiler, image.sampled_type, VKD3D_VEC4_SIZE);
|
|
coordinate_mask = (1u << image.resource_type_info->coordinate_component_count) - 1;
|
|
coordinate_id = spirv_compiler_emit_load_src(compiler, &src[0], coordinate_mask);
|
|
|
|
@@ -9480,7 +9484,7 @@ static void spirv_compiler_emit_store_uav_typed(struct spirv_compiler *compiler,
|
|
|
|
if (spirv_compiler_use_storage_buffer(compiler, &resource_symbol->info.resource))
|
|
{
|
|
- type_id = spirv_get_type_id(builder, resource_symbol->info.resource.sampled_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, resource_symbol->info.resource.sampled_type, 1);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassUniform, type_id);
|
|
coordinate_id = spirv_compiler_emit_load_src(compiler, &src[0], VKD3DSP_WRITEMASK_0);
|
|
indices[0] = spirv_compiler_get_constant_uint(compiler, 0);
|
|
@@ -9525,7 +9529,7 @@ static void spirv_compiler_emit_uav_counter_instruction(struct spirv_compiler *c
|
|
counter_id = resource_symbol->info.resource.uav_counter_id;
|
|
VKD3D_ASSERT(counter_id);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
|
|
if (resource_symbol->info.resource.uav_counter_array)
|
|
{
|
|
@@ -9686,7 +9690,7 @@ static void spirv_compiler_emit_atomic_instruction(struct spirv_compiler *compil
|
|
}
|
|
}
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
if (structure_stride || raw)
|
|
{
|
|
VKD3D_ASSERT(!raw != !structure_stride);
|
|
@@ -9711,7 +9715,7 @@ static void spirv_compiler_emit_atomic_instruction(struct spirv_compiler *compil
|
|
if (spirv_compiler_use_storage_buffer(compiler, &resource_symbol->info.resource))
|
|
{
|
|
data_type = resource_symbol->info.resource.sampled_type;
|
|
- type_id = spirv_get_type_id(builder, data_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, 1);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassUniform, type_id);
|
|
operands[0] = spirv_compiler_get_constant_uint(compiler, 0);
|
|
operands[1] = coordinate_id;
|
|
@@ -9720,7 +9724,7 @@ static void spirv_compiler_emit_atomic_instruction(struct spirv_compiler *compil
|
|
else
|
|
{
|
|
data_type = image.sampled_type;
|
|
- type_id = spirv_get_type_id(builder, data_type, 1);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, 1);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassImage, type_id);
|
|
sample_id = spirv_compiler_get_constant_uint(compiler, 0);
|
|
pointer_id = vkd3d_spirv_build_op_image_texel_pointer(builder,
|
|
@@ -9769,7 +9773,7 @@ static void spirv_compiler_emit_bufinfo(struct spirv_compiler *compiler,
|
|
{
|
|
resource_symbol = spirv_compiler_find_resource(compiler, &src->reg);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
val_id = vkd3d_spirv_build_op_array_length(builder, type_id, resource_symbol->id, 0);
|
|
write_mask = VKD3DSP_WRITEMASK_0;
|
|
}
|
|
@@ -9779,7 +9783,7 @@ static void spirv_compiler_emit_bufinfo(struct spirv_compiler *compiler,
|
|
|
|
spirv_compiler_prepare_image(compiler, &image, &src->reg, NULL, VKD3D_IMAGE_FLAG_NONE);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
val_id = vkd3d_spirv_build_op_image_query_size(builder, type_id, image.image_id);
|
|
write_mask = VKD3DSP_WRITEMASK_0;
|
|
}
|
|
@@ -9789,7 +9793,7 @@ static void spirv_compiler_emit_bufinfo(struct spirv_compiler *compiler,
|
|
stride_id = spirv_compiler_get_constant_uint(compiler, image.structure_stride);
|
|
constituents[0] = vkd3d_spirv_build_op_udiv(builder, type_id, val_id, stride_id);
|
|
constituents[1] = stride_id;
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, ARRAY_SIZE(constituents));
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, ARRAY_SIZE(constituents));
|
|
val_id = vkd3d_spirv_build_op_composite_construct(builder,
|
|
type_id, constituents, ARRAY_SIZE(constituents));
|
|
write_mask |= VKD3DSP_WRITEMASK_1;
|
|
@@ -9828,14 +9832,14 @@ static void spirv_compiler_emit_resinfo(struct spirv_compiler *compiler,
|
|
size_component_count = image.resource_type_info->coordinate_component_count;
|
|
if (image.resource_type_info->dim == SpvDimCube)
|
|
--size_component_count;
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, size_component_count);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, size_component_count);
|
|
|
|
supports_mipmaps = src[1].reg.type != VKD3DSPR_UAV && !image.resource_type_info->ms;
|
|
if (supports_mipmaps)
|
|
{
|
|
lod_id = spirv_compiler_emit_load_src(compiler, &src[0], VKD3DSP_WRITEMASK_0);
|
|
val_id = vkd3d_spirv_build_op_image_query_size_lod(builder, type_id, image.image_id, lod_id);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
miplevel_count_id = vkd3d_spirv_build_op_image_query_levels(builder, type_id, image.image_id);
|
|
}
|
|
else
|
|
@@ -9849,13 +9853,13 @@ static void spirv_compiler_emit_resinfo(struct spirv_compiler *compiler,
|
|
for (i = 0; i < 3 - size_component_count; ++i)
|
|
constituents[i + 1] = spirv_compiler_get_constant_uint(compiler, 0);
|
|
constituents[i + 1] = miplevel_count_id;
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, VKD3D_VEC4_SIZE);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, VKD3D_VEC4_SIZE);
|
|
val_id = vkd3d_spirv_build_op_composite_construct(builder, type_id, constituents, i + 2);
|
|
|
|
if (!(instruction->flags & VKD3DSI_RESINFO_UINT))
|
|
{
|
|
data_type = VSIR_DATA_F32;
|
|
- type_id = spirv_get_type_id(builder, data_type, VKD3D_VEC4_SIZE);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, VKD3D_VEC4_SIZE);
|
|
val_id = vkd3d_spirv_build_op_convert_utof(builder, type_id, val_id);
|
|
if (instruction->flags & VKD3DSI_PRECISE_XYZW)
|
|
vkd3d_spirv_build_op_decorate(builder, val_id, SpvDecorationNoContraction, NULL, 0);
|
|
@@ -9883,7 +9887,7 @@ static uint32_t spirv_compiler_emit_query_sample_count(struct spirv_compiler *co
|
|
vkd3d_spirv_enable_capability(builder, SpvCapabilityImageQuery);
|
|
|
|
spirv_compiler_prepare_image(compiler, &image, &src->reg, NULL, VKD3D_IMAGE_FLAG_NONE);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
val_id = vkd3d_spirv_build_op_image_query_samples(builder, type_id, image.image_id);
|
|
}
|
|
|
|
@@ -9912,13 +9916,13 @@ static void spirv_compiler_emit_sample_info(struct spirv_compiler *compiler,
|
|
{
|
|
constituents[i] = spirv_compiler_get_constant_uint(compiler, 0);
|
|
}
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, VKD3D_VEC4_SIZE);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, VKD3D_VEC4_SIZE);
|
|
val_id = vkd3d_spirv_build_op_composite_construct(builder, type_id, constituents, VKD3D_VEC4_SIZE);
|
|
|
|
if (!(instruction->flags & VKD3DSI_SAMPLE_INFO_UINT))
|
|
{
|
|
data_type = VSIR_DATA_F32;
|
|
- type_id = spirv_get_type_id(builder, data_type, VKD3D_VEC4_SIZE);
|
|
+ type_id = spirv_get_type_id(compiler, data_type, VKD3D_VEC4_SIZE);
|
|
val_id = vkd3d_spirv_build_op_convert_utof(builder, type_id, val_id);
|
|
if (instruction->flags & VKD3DSI_PRECISE_XYZW)
|
|
vkd3d_spirv_build_op_decorate(builder, val_id, SpvDecorationNoContraction, NULL, 0);
|
|
@@ -9984,12 +9988,12 @@ static void spirv_compiler_emit_sample_position(struct spirv_compiler *compiler,
|
|
sample_count_id = spirv_compiler_emit_query_sample_count(compiler, &instruction->src[0]);
|
|
sample_index_id = spirv_compiler_emit_load_src(compiler, &instruction->src[1], VKD3DSP_WRITEMASK_0);
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
index_id = vkd3d_spirv_build_op_iadd(builder, type_id, sample_count_id, sample_index_id);
|
|
index_id = vkd3d_spirv_build_op_isub(builder, type_id, index_id, spirv_compiler_get_constant_uint(compiler, 1));
|
|
|
|
/* Validate sample index. */
|
|
- bool_id = spirv_get_type_id(builder, VSIR_DATA_BOOL, 1);
|
|
+ bool_id = spirv_get_type_id(compiler, VSIR_DATA_BOOL, 1);
|
|
id = vkd3d_spirv_build_op_logical_and(builder, bool_id,
|
|
vkd3d_spirv_build_op_uless_than(builder, bool_id, sample_index_id, sample_count_id),
|
|
vkd3d_spirv_build_op_uless_than_equal(builder,
|
|
@@ -9997,7 +10001,7 @@ static void spirv_compiler_emit_sample_position(struct spirv_compiler *compiler,
|
|
index_id = vkd3d_spirv_build_op_select(builder, type_id,
|
|
id, index_id, spirv_compiler_get_constant_uint(compiler, 0));
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32, 2);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_F32, 2);
|
|
if (!(id = compiler->sample_positions_id))
|
|
{
|
|
length_id = spirv_compiler_get_constant_uint(compiler, ARRAY_SIZE(standard_sample_positions));
|
|
@@ -10061,7 +10065,7 @@ static void spirv_compiler_emit_eval_attrib(struct spirv_compiler *compiler,
|
|
src_ids[src_count++] = spirv_compiler_emit_load_src(compiler, &src[1], VKD3DSP_WRITEMASK_0);
|
|
}
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32,
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_F32,
|
|
vsir_write_mask_component_count(register_info.write_mask));
|
|
|
|
instr_set_id = vkd3d_spirv_get_glsl_std450_instr_set(builder);
|
|
@@ -10196,8 +10200,8 @@ static void spirv_compiler_emit_quad_read_across(struct spirv_compiler *compiler
|
|
const struct vkd3d_shader_src_param *src = instruction->src;
|
|
uint32_t type_id, direction_type_id, direction_id, val_id;
|
|
|
|
- type_id = spirv_get_type_id(builder, dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask));
|
|
- direction_type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask));
|
|
+ direction_type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
val_id = spirv_compiler_emit_load_src(compiler, src, dst->write_mask);
|
|
direction_id = map_quad_read_across_direction(instruction->opcode);
|
|
direction_id = vkd3d_spirv_get_op_constant(builder, direction_type_id, direction_id);
|
|
@@ -10221,7 +10225,7 @@ static void spirv_compiler_emit_quad_read_lane_at(struct spirv_compiler *compile
|
|
return;
|
|
}
|
|
|
|
- type_id = spirv_get_type_id(builder, dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask));
|
|
+ type_id = spirv_get_type_id(compiler, dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask));
|
|
val_id = spirv_compiler_emit_load_src(compiler, &src[0], dst->write_mask);
|
|
lane_id = spirv_compiler_emit_load_src(compiler, &src[1], VKD3DSP_WRITEMASK_0);
|
|
val_id = vkd3d_spirv_build_op_group_nonuniform_quad_broadcast(builder, type_id, val_id, lane_id);
|
|
@@ -10270,7 +10274,7 @@ static uint32_t spirv_compiler_emit_group_nonuniform_ballot(struct spirv_compile
|
|
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
|
uint32_t type_id, val_id;
|
|
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, VKD3D_VEC4_SIZE);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, VKD3D_VEC4_SIZE);
|
|
val_id = spirv_compiler_emit_load_src(compiler, src, VKD3DSP_WRITEMASK_0);
|
|
val_id = vkd3d_spirv_build_op_group_nonuniform_ballot(builder, type_id, val_id);
|
|
|
|
@@ -10329,7 +10333,7 @@ static void spirv_compiler_emit_wave_alu_op(struct spirv_compiler *compiler,
|
|
|
|
op = map_wave_alu_op(instruction->opcode, data_type_is_floating_point(src->reg.data_type));
|
|
|
|
- type_id = spirv_get_type_id(builder, dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask));
|
|
+ type_id = spirv_get_type_id(compiler, dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask));
|
|
val_id = spirv_compiler_emit_load_src(compiler, &src[0], dst->write_mask);
|
|
|
|
vkd3d_spirv_enable_capability(builder, SpvCapabilityGroupNonUniformArithmetic);
|
|
@@ -10353,7 +10357,7 @@ static void spirv_compiler_emit_wave_bit_count(struct spirv_compiler *compiler,
|
|
: SpvGroupOperationReduce;
|
|
|
|
val_id = spirv_compiler_emit_group_nonuniform_ballot(compiler, instruction->src);
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_U32, 1);
|
|
+ type_id = spirv_get_type_id(compiler, VSIR_DATA_U32, 1);
|
|
val_id = vkd3d_spirv_build_op_group_nonuniform_ballot_bit_count(builder, type_id, group_op, val_id);
|
|
|
|
spirv_compiler_emit_store_dst(compiler, dst, val_id);
|
|
@@ -10378,7 +10382,7 @@ static void spirv_compiler_emit_wave_read_lane_at(struct spirv_compiler *compile
|
|
const struct vkd3d_shader_src_param *src = instruction->src;
|
|
uint32_t type_id, lane_id, val_id;
|
|
|
|
- type_id = spirv_get_type_id(builder, dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask));
|
|
+ type_id = spirv_get_type_id(compiler, dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask));
|
|
val_id = spirv_compiler_emit_load_src(compiler, &src[0], dst->write_mask);
|
|
lane_id = spirv_compiler_emit_load_src(compiler, &src[1], VKD3DSP_WRITEMASK_0);
|
|
|
|
@@ -10405,7 +10409,7 @@ static void spirv_compiler_emit_wave_read_lane_first(struct spirv_compiler *comp
|
|
const struct vkd3d_shader_src_param *src = instruction->src;
|
|
uint32_t type_id, val_id;
|
|
|
|
- type_id = spirv_get_type_id(builder, dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask));
|
|
+ type_id = spirv_get_type_id(compiler, dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask));
|
|
val_id = spirv_compiler_emit_load_src(compiler, src, dst->write_mask);
|
|
val_id = vkd3d_spirv_build_op_group_nonuniform_broadcast_first(builder, type_id, val_id);
|
|
|
|
@@ -10941,7 +10945,7 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler,
|
|
{
|
|
uint32_t type_id, struct_id, ptr_type_id, var_id;
|
|
|
|
- type_id = spirv_get_type_id(builder, parameter_data_type_map[parameter->data_type].type,
|
|
+ type_id = spirv_get_type_id(compiler, parameter_data_type_map[parameter->data_type].type,
|
|
parameter_data_type_map[parameter->data_type].component_count);
|
|
|
|
struct_id = vkd3d_spirv_build_op_type_struct(builder, &type_id, 1);
|
|
--
|
|
2.51.0
|
|
|