Goes atop !489. The last 7 commits belong to this MR. Many of these patches are small, but the series can be split further if necessary.
-- v4: vkd3d-shader/spirv: Handle ITOI and UTOU in spirv_compiler_map_alu_instruction(). vkd3d-shader/spirv: Support UINT64 source in spirv_compiler_emit_bool_cast(). vkd3d-shader/spirv: Support 64-bit sources in spirv_compiler_emit_int_div(). vkd3d-shader/spirv: Introduce a UINT64 component type. vkd3d-shader/spirv: Introduce a data_type_is_64_bit() helper function. vkd3d-shader/spirv: Use data_type_is_integer() in spirv_compiler_emit_neg(). vkd3d: Pass int64 capability info to vkd3d-shader.
From: Conor McCarthy cmccarthy@codeweavers.com
--- libs/vkd3d/state.c | 2 ++ tests/hlsl/bitwise.shader_test | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index fc3187f4b..8139e0a29 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -2145,6 +2145,8 @@ static HRESULT create_shader_stage(struct d3d12_device *device, {VKD3D_SHADER_COMPILE_OPTION_API_VERSION, VKD3D_SHADER_API_VERSION_1_10}, {VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV, typed_uav_compile_option(device)}, {VKD3D_SHADER_COMPILE_OPTION_WRITE_TESS_GEOM_POINT_SIZE, 0}, + {VKD3D_SHADER_COMPILE_OPTION_FEATURE, device->feature_options1.Int64ShaderOps + ? VKD3D_SHADER_COMPILE_OPTION_FEATURE_INT64 : 0}, };
stage_desc->sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; diff --git a/tests/hlsl/bitwise.shader_test b/tests/hlsl/bitwise.shader_test index 6b4515e27..7b5b4f6ba 100644 --- a/tests/hlsl/bitwise.shader_test +++ b/tests/hlsl/bitwise.shader_test @@ -243,5 +243,5 @@ float4 main() : sv_target
[test] uniform 0 uint64_t2 0x300000000 0x500000000 -todo draw quad -probe all rgba (25769803776.0, 4294967296.0, 30064771072.0, 1.844674404e19) 1 +draw quad +todo probe all rgba (25769803776.0, 4294967296.0, 30064771072.0, 1.844674404e19) 1
From: Conor McCarthy cmccarthy@codeweavers.com
--- libs/vkd3d-shader/spirv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 62ee1bef3..0f2bdd56d 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -3992,7 +3992,7 @@ static uint32_t spirv_compiler_emit_neg(struct spirv_compiler *compiler, type_id = spirv_compiler_get_type_id_for_reg(compiler, reg, write_mask); if (reg->data_type == VKD3D_DATA_FLOAT || reg->data_type == VKD3D_DATA_DOUBLE) return vkd3d_spirv_build_op_fnegate(builder, type_id, val_id); - else if (reg->data_type == VKD3D_DATA_INT || reg->data_type == VKD3D_DATA_UINT) + else if (data_type_is_integer(reg->data_type)) return vkd3d_spirv_build_op_snegate(builder, type_id, val_id);
FIXME("Unhandled data type %#x.\n", reg->data_type);
From: Conor McCarthy cmccarthy@codeweavers.com
--- libs/vkd3d-shader/spirv.c | 4 ++-- libs/vkd3d-shader/vkd3d_shader_private.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 0f2bdd56d..8d48041ee 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -3924,7 +3924,7 @@ static uint32_t spirv_compiler_emit_load_reg(struct spirv_compiler *compiler, assert(reg_info.component_type != VKD3D_SHADER_COMPONENT_DOUBLE); spirv_compiler_emit_dereference_register(compiler, reg, ®_info);
- write_mask32 = (reg->data_type == VKD3D_DATA_DOUBLE) ? vkd3d_write_mask_32_from_64(write_mask) : write_mask; + write_mask32 = data_type_is_64_bit(reg->data_type) ? vkd3d_write_mask_32_from_64(write_mask) : write_mask;
/* Intermediate value (no storage class). */ if (reg_info.storage_class == SpvStorageClassMax) @@ -4140,7 +4140,7 @@ static void spirv_compiler_emit_store_reg(struct spirv_compiler *compiler, component_type = vkd3d_component_type_from_data_type(reg->data_type); if (component_type != reg_info.component_type) { - if (reg->data_type == VKD3D_DATA_DOUBLE) + if (data_type_is_64_bit(reg->data_type)) src_write_mask = vkd3d_write_mask_32_from_64(write_mask); type_id = vkd3d_spirv_get_type_id(builder, reg_info.component_type, vkd3d_write_mask_component_count(src_write_mask)); diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 74f3e9905..b25b65a19 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -619,6 +619,11 @@ static inline bool data_type_is_bool(enum vkd3d_data_type data_type) return data_type == VKD3D_DATA_BOOL; }
+static inline bool data_type_is_64_bit(enum vkd3d_data_type data_type) +{ + return data_type == VKD3D_DATA_DOUBLE; +} + enum vsir_dimension { VSIR_DIMENSION_NONE,
From: Conor McCarthy cmccarthy@codeweavers.com
--- include/vkd3d_shader.h | 2 ++ libs/vkd3d-shader/spirv.c | 6 +++++- libs/vkd3d-shader/vkd3d_shader_private.h | 4 +++- tests/hlsl/bitwise.shader_test | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index a6bf89641..b1a1fff64 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -1569,6 +1569,8 @@ enum vkd3d_shader_component_type VKD3D_SHADER_COMPONENT_BOOL = 0x4, /** 64-bit IEEE floating-point. */ VKD3D_SHADER_COMPONENT_DOUBLE = 0x5, + /** 64-bit unsigned integer. \since 1.11 */ + VKD3D_SHADER_COMPONENT_UINT64 = 0x6,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPONENT_TYPE), }; diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 8d48041ee..8c83911b8 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -1793,6 +1793,8 @@ static uint32_t vkd3d_spirv_get_type_id(struct vkd3d_spirv_builder *builder, break; case VKD3D_SHADER_COMPONENT_DOUBLE: return vkd3d_spirv_get_op_type_float(builder, 64); + case VKD3D_SHADER_COMPONENT_UINT64: + return vkd3d_spirv_get_op_type_int(builder, 64, 0); default: FIXME("Unhandled component type %#x.\n", component_type); return 0; @@ -1826,6 +1828,8 @@ static uint32_t vkd3d_spirv_get_type_id_for_data_type(struct vkd3d_spirv_builder break; case VKD3D_DATA_DOUBLE: return vkd3d_spirv_get_op_type_float(builder, 64); + case VKD3D_DATA_UINT64: + return vkd3d_spirv_get_op_type_int(builder, 64, 0); case VKD3D_DATA_BOOL: return vkd3d_spirv_get_op_type_bool(builder); default: @@ -2980,7 +2984,7 @@ static uint32_t spirv_compiler_get_constant64(struct spirv_compiler *compiler, assert(0 < component_count && component_count <= VKD3D_DVEC2_SIZE); type_id = vkd3d_spirv_get_type_id(builder, component_type, component_count);
- if (component_type != VKD3D_SHADER_COMPONENT_DOUBLE) + if (component_type != VKD3D_SHADER_COMPONENT_DOUBLE && component_type != VKD3D_SHADER_COMPONENT_UINT64) { FIXME("Unhandled component_type %#x.\n", component_type); return vkd3d_spirv_get_op_undef(builder, type_id); diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index b25b65a19..3567eafac 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -621,7 +621,7 @@ static inline bool data_type_is_bool(enum vkd3d_data_type data_type)
static inline bool data_type_is_64_bit(enum vkd3d_data_type data_type) { - return data_type == VKD3D_DATA_DOUBLE; + return data_type == VKD3D_DATA_DOUBLE || data_type == VKD3D_DATA_UINT64; }
enum vsir_dimension @@ -1459,6 +1459,8 @@ static inline enum vkd3d_shader_component_type vkd3d_component_type_from_data_ty return VKD3D_SHADER_COMPONENT_INT; case VKD3D_DATA_DOUBLE: return VKD3D_SHADER_COMPONENT_DOUBLE; + case VKD3D_DATA_UINT64: + return VKD3D_SHADER_COMPONENT_UINT64; case VKD3D_DATA_BOOL: return VKD3D_SHADER_COMPONENT_BOOL; default: diff --git a/tests/hlsl/bitwise.shader_test b/tests/hlsl/bitwise.shader_test index 7b5b4f6ba..7fc8f7448 100644 --- a/tests/hlsl/bitwise.shader_test +++ b/tests/hlsl/bitwise.shader_test @@ -244,4 +244,4 @@ float4 main() : sv_target [test] uniform 0 uint64_t2 0x300000000 0x500000000 draw quad -todo probe all rgba (25769803776.0, 4294967296.0, 30064771072.0, 1.844674404e19) 1 +probe all rgba (25769803776.0, 4294967296.0, 30064771072.0, 1.844674404e19) 1
From: Conor McCarthy cmccarthy@codeweavers.com
--- libs/vkd3d-shader/spirv.c | 45 +++++++++++-------- tests/hlsl/arithmetic-int-uniform.shader_test | 8 ++-- 2 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 8c83911b8..9980e0d7f 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -3044,6 +3044,13 @@ static uint32_t spirv_compiler_get_constant_double_vector(struct spirv_compiler component_count, (const uint64_t *)values); }
+static uint32_t spirv_compiler_get_constant_uint64_vector(struct spirv_compiler *compiler, + uint64_t value, unsigned int component_count) +{ + const uint64_t values[] = {value, value}; + return spirv_compiler_get_constant64(compiler, VKD3D_SHADER_COMPONENT_UINT64, component_count, values); +} + static uint32_t spirv_compiler_get_type_id_for_reg(struct spirv_compiler *compiler, const struct vkd3d_shader_register *reg, DWORD write_mask) { @@ -4318,7 +4325,8 @@ static void spirv_compiler_emit_interpolation_decorations(struct spirv_compiler }
static uint32_t spirv_compiler_emit_int_to_bool(struct spirv_compiler *compiler, - enum vkd3d_shader_conditional_op condition, unsigned int component_count, uint32_t val_id) + enum vkd3d_shader_conditional_op condition, enum vkd3d_data_type data_type, + unsigned int component_count, uint32_t val_id) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; uint32_t type_id; @@ -4329,7 +4337,9 @@ static uint32_t spirv_compiler_emit_int_to_bool(struct spirv_compiler *compiler, type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_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, - spirv_compiler_get_constant_uint_vector(compiler, 0, component_count)); + data_type == VKD3D_DATA_UINT64 + ? spirv_compiler_get_constant_uint64_vector(compiler, 0, component_count) + : spirv_compiler_get_constant_uint_vector(compiler, 0, component_count)); }
static uint32_t spirv_compiler_emit_bool_to_int(struct spirv_compiler *compiler, @@ -6976,7 +6986,7 @@ static void spirv_compiler_emit_movc(struct spirv_compiler *compiler,
if (src[0].reg.data_type != VKD3D_DATA_BOOL) condition_id = spirv_compiler_emit_int_to_bool(compiler, - VKD3D_SHADER_CONDITIONAL_OP_NZ, component_count, condition_id); + VKD3D_SHADER_CONDITIONAL_OP_NZ, src[0].reg.data_type, component_count, condition_id); val_id = vkd3d_spirv_build_op_select(builder, type_id, condition_id, src1_id, src2_id);
spirv_compiler_emit_store_dst(compiler, dst, val_id); @@ -7001,7 +7011,7 @@ static void spirv_compiler_emit_swapc(struct spirv_compiler *compiler, type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_FLOAT, component_count);
condition_id = spirv_compiler_emit_int_to_bool(compiler, - VKD3D_SHADER_CONDITIONAL_OP_NZ, component_count, condition_id); + VKD3D_SHADER_CONDITIONAL_OP_NZ, src[0].reg.data_type, component_count, condition_id);
val_id = vkd3d_spirv_build_op_select(builder, type_id, condition_id, src2_id, src1_id); spirv_compiler_emit_store_dst(compiler, &dst[0], val_id); @@ -7163,13 +7173,6 @@ static void spirv_compiler_emit_int_div(struct spirv_compiler *compiler, div_op = instruction->handler_idx == VKD3DSIH_IDIV ? SpvOpSDiv : SpvOpUDiv; mod_op = instruction->handler_idx == VKD3DSIH_IDIV ? SpvOpSRem : SpvOpUMod;
- if (dst[0].reg.data_type == VKD3D_DATA_UINT64 || dst[1].reg.data_type == VKD3D_DATA_UINT64) - { - FIXME("Unsupported 64-bit result.\n"); - spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_UNSUPPORTED_FEATURE, - "Bool cast to 64-bit integer is not supported."); - } - if (dst[0].reg.type != VKD3DSPR_NULL) { component_count = vkd3d_write_mask_component_count(dst[0].write_mask); @@ -7179,9 +7182,11 @@ static void spirv_compiler_emit_int_div(struct spirv_compiler *compiler, src1_id = spirv_compiler_emit_load_src(compiler, &src[1], dst[0].write_mask);
condition_id = spirv_compiler_emit_int_to_bool(compiler, - VKD3D_SHADER_CONDITIONAL_OP_NZ, component_count, src1_id); - uint_max_id = spirv_compiler_get_constant_uint_vector(compiler, - 0xffffffff, component_count); + VKD3D_SHADER_CONDITIONAL_OP_NZ, src[1].reg.data_type, component_count, src1_id); + if (dst[0].reg.data_type == VKD3D_DATA_UINT64) + uint_max_id = spirv_compiler_get_constant_uint64_vector(compiler, 0xffffffffffffffff, component_count); + else + uint_max_id = spirv_compiler_get_constant_uint_vector(compiler, 0xffffffff, component_count);
val_id = vkd3d_spirv_build_op_tr2(builder, &builder->function_stream, div_op, type_id, src0_id, src1_id); /* The SPIR-V spec says: "The resulting value is undefined if Operand 2 is 0." */ @@ -7201,9 +7206,11 @@ static void spirv_compiler_emit_int_div(struct spirv_compiler *compiler, src1_id = spirv_compiler_emit_load_src(compiler, &src[1], dst[1].write_mask);
condition_id = spirv_compiler_emit_int_to_bool(compiler, - VKD3D_SHADER_CONDITIONAL_OP_NZ, component_count, src1_id); - uint_max_id = spirv_compiler_get_constant_uint_vector(compiler, - 0xffffffff, component_count); + VKD3D_SHADER_CONDITIONAL_OP_NZ, src[1].reg.data_type, component_count, src1_id); + if (dst[1].reg.data_type == VKD3D_DATA_UINT64) + uint_max_id = spirv_compiler_get_constant_uint64_vector(compiler, 0xffffffffffffffff, component_count); + else + uint_max_id = spirv_compiler_get_constant_uint_vector(compiler, 0xffffffff, component_count); }
val_id = vkd3d_spirv_build_op_tr2(builder, &builder->function_stream, mod_op, type_id, src0_id, src1_id); @@ -7494,7 +7501,7 @@ static uint32_t spirv_compiler_emit_conditional_branch(struct spirv_compiler *co uint32_t condition_id, merge_block_id;
condition_id = spirv_compiler_emit_load_src(compiler, src, VKD3DSP_WRITEMASK_0); - condition_id = spirv_compiler_emit_int_to_bool(compiler, instruction->flags, 1, condition_id); + condition_id = spirv_compiler_emit_int_to_bool(compiler, instruction->flags, src->reg.data_type, 1, condition_id);
merge_block_id = vkd3d_spirv_alloc_id(builder);
@@ -7627,7 +7634,7 @@ static int spirv_compiler_emit_control_flow_instruction(struct spirv_compiler *c return VKD3D_ERROR_OUT_OF_MEMORY;
val_id = spirv_compiler_emit_load_src(compiler, src, VKD3DSP_WRITEMASK_0); - condition_id = spirv_compiler_emit_int_to_bool(compiler, instruction->flags, 1, val_id); + condition_id = spirv_compiler_emit_int_to_bool(compiler, instruction->flags, src->reg.data_type, 1, val_id);
true_label = vkd3d_spirv_alloc_id(builder); merge_block_id = vkd3d_spirv_alloc_id(builder); diff --git a/tests/hlsl/arithmetic-int-uniform.shader_test b/tests/hlsl/arithmetic-int-uniform.shader_test index 0463b27e7..6ddb06f72 100644 --- a/tests/hlsl/arithmetic-int-uniform.shader_test +++ b/tests/hlsl/arithmetic-int-uniform.shader_test @@ -136,7 +136,7 @@ float4 main() : SV_TARGET
[test] uniform 0 int64_t2 5000000000 16000000000 -todo draw quad +draw quad probe all rgba (21.0e9, -11.0e9, 5.0e18, 0.0) 1
[pixel shader] @@ -151,7 +151,7 @@ float4 main() : SV_TARGET
[test] uniform 0 int64_t2 5000000000 16000000000 -todo draw quad +draw quad probe all rgba (5.0e9, 5.0e9, -5.0e9, 3.0)
[pixel shader] @@ -166,7 +166,7 @@ float4 main() : SV_TARGET
[test] uniform 0 int64_t2 42000000000 5000000000 -todo draw quad +draw quad probe all rgba (8.0, -8.0, -8.0, 8.0)
[pixel shader] @@ -181,7 +181,7 @@ float4 main() : SV_TARGET
[test] uniform 0 int64_t2 42000000000 5000000000 -todo draw quad +draw quad probe all rgba (2.0e9, -2.0e9, 2.0e9, -2.0e9)
[pixel shader]
From: Conor McCarthy cmccarthy@codeweavers.com
--- libs/vkd3d-shader/spirv.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 9980e0d7f..60747bbc2 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -4354,6 +4354,19 @@ static uint32_t spirv_compiler_emit_bool_to_int(struct spirv_compiler *compiler, return vkd3d_spirv_build_op_select(builder, type_id, val_id, true_id, false_id); }
+static uint32_t spirv_compiler_emit_bool_to_int64(struct spirv_compiler *compiler, + unsigned int component_count, uint32_t val_id, bool signedness) +{ + struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; + uint32_t type_id, true_id, false_id; + + true_id = spirv_compiler_get_constant_uint64_vector(compiler, signedness ? 0xffffffffffffffffull : 1, + component_count); + false_id = spirv_compiler_get_constant_uint64_vector(compiler, 0, component_count); + type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_UINT64, component_count); + return vkd3d_spirv_build_op_select(builder, type_id, val_id, true_id, false_id); +} + static uint32_t spirv_compiler_emit_bool_to_float(struct spirv_compiler *compiler, unsigned int component_count, uint32_t val_id, bool signedness) { @@ -6733,6 +6746,10 @@ static void spirv_compiler_emit_bool_cast(struct spirv_compiler *compiler, { val_id = spirv_compiler_emit_bool_to_int(compiler, 1, val_id, instruction->handler_idx == VKD3DSIH_ITOI); } + else if (dst->reg.data_type == VKD3D_DATA_UINT64) + { + val_id = spirv_compiler_emit_bool_to_int64(compiler, 1, val_id, instruction->handler_idx == VKD3DSIH_ITOI); + } else { WARN("Unhandled data type %u.\n", dst->reg.data_type);
From: Conor McCarthy cmccarthy@codeweavers.com
These instructions perform integer casts to/from 64 bits. --- libs/vkd3d-shader/spirv.c | 2 ++ tests/hlsl/bitwise.shader_test | 8 ++++---- tests/hlsl/cast-64-bit.shader_test | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 60747bbc2..7a2a20127 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -6689,12 +6689,14 @@ static SpvOp spirv_compiler_map_alu_instruction(const struct vkd3d_shader_instru {VKD3DSIH_ISHR, SpvOpShiftRightArithmetic}, {VKD3DSIH_ITOD, SpvOpConvertSToF}, {VKD3DSIH_ITOF, SpvOpConvertSToF}, + {VKD3DSIH_ITOI, SpvOpSConvert}, {VKD3DSIH_MUL, SpvOpFMul}, {VKD3DSIH_NOT, SpvOpNot}, {VKD3DSIH_OR, SpvOpBitwiseOr}, {VKD3DSIH_USHR, SpvOpShiftRightLogical}, {VKD3DSIH_UTOD, SpvOpConvertUToF}, {VKD3DSIH_UTOF, SpvOpConvertUToF}, + {VKD3DSIH_UTOU, SpvOpUConvert}, {VKD3DSIH_XOR, SpvOpBitwiseXor}, }; unsigned int i; diff --git a/tests/hlsl/bitwise.shader_test b/tests/hlsl/bitwise.shader_test index 7fc8f7448..34362feda 100644 --- a/tests/hlsl/bitwise.shader_test +++ b/tests/hlsl/bitwise.shader_test @@ -183,11 +183,11 @@ float4 main() : sv_target [test] uniform 0 int64_t2 9223372036854775807 -1 uniform 4 int4 34 66 0 0 -todo draw quad +draw quad probe all rgba (0.0, 4.611686018e18, 536870912.0, 2.305843009e18) 1 uniform 0 int64_t2 -1 -1 uniform 4 int4 34 66 0 0 -todo draw quad +draw quad probe all rgba (-1.0, -1.0, -1.0, -1.0) 1
[pixel shader] @@ -207,7 +207,7 @@ float4 main() : sv_target [test] uniform 0 uint64_t2 0xffffffffffffffff 1 uniform 4 uint4 34 66 0 0 -todo draw quad +draw quad probe all rgba (9.223372036e18, 1.0, 1073741823.0, 4.611686018e18) 1
[pixel shader] @@ -227,7 +227,7 @@ float4 main() : sv_target [test] uniform 0 uint64_t2 0x83 1 uniform 4 uint4 34 66 0 0 -todo draw quad +draw quad probe all rgba (262.0, 9.223372036e18, 2250562863104.0, 524.0) 1
[pixel shader] diff --git a/tests/hlsl/cast-64-bit.shader_test b/tests/hlsl/cast-64-bit.shader_test index f2a0468b3..aa558ec9e 100644 --- a/tests/hlsl/cast-64-bit.shader_test +++ b/tests/hlsl/cast-64-bit.shader_test @@ -37,8 +37,8 @@ float4 main() : sv_target [test] uniform 0 uint64_t2 0x500000001 0x100000002 uniform 4 uint4 10 4 0 0 -todo draw quad -todo probe all rgba (1.0, 2.0, 2147483648.0, 1073741824.0) +draw quad +probe all rgba (1.0, 2.0, 2147483648.0, 1073741824.0)
[pixel shader] @@ -55,5 +55,5 @@ float4 main() : sv_target [test] uniform 0 int64_t2 -21474836481 0x100000002 uniform 4 int4 -20 8 0 0 -todo draw quad -todo probe all rgba (-1.0, 2.0, 1073741824.0, 536870912.0) +draw quad +probe all rgba (-1.0, 2.0, 1073741824.0, 536870912.0)
+ if (dst[0].reg.data_type == VKD3D_DATA_UINT64) + uint_max_id = spirv_compiler_get_constant_uint64_vector(compiler, 0xffffffffffffffff, component_count);
I don't think "0xffffffffffffffff" is portable/reliable as a 64-bit constant. We should probably use "UINT64_C(0xffffffffffffffff)", although you could probably make a case for either "UINT64_MAX" or "~(uint64_t)0" as well.
On Thu Dec 14 15:56:17 2023 +0000, Henri Verbeet wrote:
+ if (dst[0].reg.data_type == VKD3D_DATA_UINT64) + uint_max_id =
spirv_compiler_get_constant_uint64_vector(compiler, 0xffffffffffffffff, component_count);
I don't think "0xffffffffffffffff" is portable/reliable as a 64-bit constant. We should probably use "UINT64_C(0xffffffffffffffff)", although you could probably make a case for either "UINT64_MAX" or "~(uint64_t)0" as well.
I'd vote for one of the last two, which are already used widely in the code base. Specifically, `UINT64_MAX` is my favourite.
This merge request was approved by Giovanni Mascellani.