vkd3d-shader/hlsl: Add support for sample index argument in Load().
Merge request reports
Activity
3498 3498 } 3499 3499 if (multisampled) 3500 3500 { 3501 hlsl_fixme(ctx, loc, "Load() sampling index parameter."); 3501 struct hlsl_ir_node *sample_index = params->args[1]; 3502 3503 if (sample_index->type != HLSL_IR_CONSTANT && ctx->profile->major_version == 4 && ctx->profile->minor_version == 0) 3504 { 3505 hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, "Expected literal sample index."); 3506 } - Comment on lines +3503 to +3506
changed this line in version 2 of the diff
35 35 probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1) 36 36 probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8) 37 37 probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0) 38 39 [pixel shader] 40 Texture2DMS<float4, 1> t; 41 42 float4 main(float4 pos : sv_position) : sv_target 43 { 44 return t.Load(int3(pos.xy, 0), 0); 45 } added 1 commit
- e4cf2b34 - vkd3d-shader/hlsl: Add support for sample index argument in Load().
37 37 probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0) 38 39 [pixel shader] 40 Texture2DMS<float4, 1> t; 41 42 float4 main(float4 pos : sv_position) : sv_target 43 { 44 return t.Load(int3(pos.yx, 0), 0); 45 } 46 47 [test] 48 draw quad 49 probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) 50 probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1) 51 probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8) 52 probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0) You can't just upload data to a multisampled texture, no, and I believe that sample positions aren't fixed either, so just rendering a triangle over half of a pixel is not going to give reliable results. It is possible to use a sample frequency shader (i.e. SV_SampleIndex), which would basically amount to porting test_multisample_rendering() to a shader_test, although that requires model 4.1.
Ultimately I think we do want to port more d3d12 (or d3d11, or d3d9) tests to use the shader-runner infrastructure, so that they can target multiple backends without having to be rewritten. But that is probably reasonable to leave for later.
1464 1466 static void write_sm4_ld(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer, 1465 1467 const struct hlsl_type *resource_type, const struct hlsl_ir_node *dst, 1466 1468 const struct hlsl_deref *resource, const struct hlsl_ir_node *coords, 1467 const struct hlsl_ir_node *texel_offset) 1469 const struct hlsl_ir_node *sample_index, const struct hlsl_ir_node *texel_offset) 1468 1470 { 1469 1471 bool uav = (resource_type->base_type == HLSL_TYPE_UAV); 1472 bool multisampled = resource_type->base_type == HLSL_TYPE_TEXTURE 1473 && (resource_type->sampler_dim == HLSL_SAMPLER_DIM_2DMS || resource_type->sampler_dim == HLSL_SAMPLER_DIM_2DMSARRAY); 1470 1474 struct sm4_instruction instr; 1471 1475 unsigned int dim_count; 1472 1476 1473 1477 memset(&instr, 0, sizeof(instr)); 1474 instr.opcode = uav ? VKD3D_SM5_OP_LD_UAV_TYPED : VKD3D_SM4_OP_LD; 1478 instr.opcode = uav ? VKD3D_SM5_OP_LD_UAV_TYPED : (multisampled ? VKD3D_SM4_OP_LD2DMS : VKD3D_SM4_OP_LD); changed this line in version 3 of the diff
1516 1517 index = hlsl_ir_constant(sample_index); 1518 1519 memset(&instr.srcs[2], 0, sizeof(instr.srcs[2])); 1520 instr.srcs[2].swizzle_type = VKD3D_SM4_SWIZZLE_NONE; 1521 reg->type = VKD3D_SM4_RT_IMMCONST; 1522 reg->dim = VKD3D_SM4_DIMENSION_SCALAR; 1523 reg->immconst_uint[0] = index->value[0].u; 1524 } 1525 else if (ctx->profile->major_version == 4 && ctx->profile->minor_version == 0) 1526 { 1527 hlsl_error(ctx, &sample_index->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, "Expected literal sample index."); 1528 } 1529 else 1530 sm4_src_from_node(&instr.srcs[2], sample_index, 0); 1531 changed this line in version 8 of the diff
added 28 commits
-
e4cf2b34...d6d9aab3 - 27 commits from branch
wine:master
- a8bbde42 - vkd3d-shader/hlsl: Add support for sample index argument in Load().
-
e4cf2b34...d6d9aab3 - 27 commits from branch
35 35 probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1) 36 36 probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8) 37 37 probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0) 38 39 [pixel shader] 40 Texture2DMS<float4, 1> t; 41 42 float4 main(float4 pos : sv_position) : sv_target 43 { 44 return t.Load(int3(pos.yx, 0), 0); changed this line in version 4 of the diff
added 1 commit
- 26c8ba17 - vkd3d-shader/hlsl: Add support for sample index argument in Load().
3579 3581 3580 3582 /* +1 for the mipmap level */ 3581 3583 if (!(load_params.coords = add_implicit_conversion(ctx, instrs, params->args[0], 3582 hlsl_get_vector_type(ctx, HLSL_TYPE_INT, sampler_dim + 1), loc))) 3584 hlsl_get_vector_type(ctx, HLSL_TYPE_INT, sampler_dim + !multisampled), loc))) changed this line in version 10 of the diff
added 17 commits
-
26c8ba17...94ff9ba5 - 16 commits from branch
wine:master
- 395c7b18 - vkd3d-shader/hlsl: Add support for sample index argument in Load().
-
26c8ba17...94ff9ba5 - 16 commits from branch
added 28 commits
-
395c7b18...8ed74377 - 27 commits from branch
wine:master
- 23c1924d - vkd3d-shader/hlsl: Add support for sample index argument in Load().
-
395c7b18...8ed74377 - 27 commits from branch
added 15 commits
-
23c1924d...0ce55e8b - 14 commits from branch
wine:master
- 12b366a7 - vkd3d-shader/hlsl: Add support for sample index argument in Load().
-
23c1924d...0ce55e8b - 14 commits from branch
added 26 commits
-
12b366a7...8e0df3f7 - 25 commits from branch
wine:master
- 2a23a4be - vkd3d-shader/hlsl: Add support for sample index argument in Load().
-
12b366a7...8e0df3f7 - 25 commits from branch
added 3 commits
-
2a23a4be...b46df551 - 2 commits from branch
wine:master
- 82312fe2 - vkd3d-shader/hlsl: Add support for sample index argument in Load().
-
2a23a4be...b46df551 - 2 commits from branch
added 12 commits
-
82312fe2...af4bb037 - 11 commits from branch
wine:master
- 66aaf264 - vkd3d-shader/hlsl: Add support for sample index argument in Load().
-
82312fe2...af4bb037 - 11 commits from branch