mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
vkd3d-shader/dxil: Implement DX intrinsics SampleBias and SampleLevel.
This commit is contained in:
parent
87b1de94da
commit
2330ffdeda
Notes:
Alexandre Julliard
2024-02-22 23:04:21 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/665
@ -379,6 +379,8 @@ enum dx_intrinsic_opcode
|
||||
DX_CREATE_HANDLE = 57,
|
||||
DX_CBUFFER_LOAD_LEGACY = 59,
|
||||
DX_SAMPLE = 60,
|
||||
DX_SAMPLE_B = 61,
|
||||
DX_SAMPLE_LOD = 62,
|
||||
DX_SAMPLE_GRAD = 63,
|
||||
DX_TEXTURE_LOAD = 66,
|
||||
DX_TEXTURE_STORE = 67,
|
||||
@ -4338,7 +4340,7 @@ static void sm6_parser_emit_dx_sample(struct sm6_parser *sm6, enum dx_intrinsic_
|
||||
const struct sm6_value *resource, *sampler;
|
||||
struct vkd3d_shader_src_param *src_params;
|
||||
struct vkd3d_shader_instruction *ins;
|
||||
unsigned int clamp_idx;
|
||||
unsigned int clamp_idx = 0;
|
||||
|
||||
resource = operands[0];
|
||||
sampler = operands[1];
|
||||
@ -4367,6 +4369,15 @@ static void sm6_parser_emit_dx_sample(struct sm6_parser *sm6, enum dx_intrinsic_
|
||||
src_params = instruction_src_params_alloc(ins, 3, sm6);
|
||||
clamp_idx = 9;
|
||||
break;
|
||||
case DX_SAMPLE_B:
|
||||
clamp_idx = 10;
|
||||
/* fall through */
|
||||
case DX_SAMPLE_LOD:
|
||||
instruction_init_with_resource(ins, (op == DX_SAMPLE_B) ? VKD3DSIH_SAMPLE_B : VKD3DSIH_SAMPLE_LOD,
|
||||
resource, sm6);
|
||||
src_params = instruction_src_params_alloc(ins, 4, sm6);
|
||||
src_param_init_from_value(&src_params[3], operands[9]);
|
||||
break;
|
||||
case DX_SAMPLE_GRAD:
|
||||
instruction_init_with_resource(ins, VKD3DSIH_SAMPLE_GRAD, resource, sm6);
|
||||
src_params = instruction_src_params_alloc(ins, 5, sm6);
|
||||
@ -4381,7 +4392,7 @@ static void sm6_parser_emit_dx_sample(struct sm6_parser *sm6, enum dx_intrinsic_
|
||||
if (!src_params)
|
||||
return;
|
||||
|
||||
if (!sm6_value_is_undef(operands[clamp_idx]))
|
||||
if (clamp_idx && !sm6_value_is_undef(operands[clamp_idx]))
|
||||
{
|
||||
FIXME("Ignoring LOD clamp value.\n");
|
||||
vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_IGNORING_OPERANDS,
|
||||
@ -4654,7 +4665,9 @@ static const struct sm6_dx_opcode_info sm6_dx_op_table[] =
|
||||
[DX_ROUND_Z ] = {"g", "R", sm6_parser_emit_dx_unary},
|
||||
[DX_RSQRT ] = {"g", "R", sm6_parser_emit_dx_unary},
|
||||
[DX_SAMPLE ] = {"o", "HHffffiiif", sm6_parser_emit_dx_sample},
|
||||
[DX_SAMPLE_B ] = {"o", "HHffffiiiff", sm6_parser_emit_dx_sample},
|
||||
[DX_SAMPLE_GRAD ] = {"o", "HHffffiiifffffff", sm6_parser_emit_dx_sample},
|
||||
[DX_SAMPLE_LOD ] = {"o", "HHffffiiif", sm6_parser_emit_dx_sample},
|
||||
[DX_SIN ] = {"g", "R", sm6_parser_emit_dx_sincos},
|
||||
[DX_SPLIT_DOUBLE ] = {"S", "d", sm6_parser_emit_dx_split_double},
|
||||
[DX_SQRT ] = {"g", "R", sm6_parser_emit_dx_unary},
|
||||
|
@ -32,13 +32,13 @@ float4 main(float2 coord : texcoord) : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 6.5 0.0 0.0 0.0
|
||||
todo(sm<4 | sm>=6) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe all rgba (10.0, 0.0, 10.0, 0.0)
|
||||
|
||||
uniform 0 float4 7.5 0.0 0.0 0.0
|
||||
todo(sm<4 | sm>=6) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe all rgba (4.0, 0.0, 10.0, 0.0)
|
||||
|
||||
uniform 0 float4 8.5 0.0 0.0 0.0
|
||||
todo(sm<4 | sm>=6) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe all rgba (0.0, 0.0, 10.0, 0.0)
|
||||
|
@ -26,13 +26,13 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 0.0 0.0 0.0 0.0
|
||||
todo(sm<4 | sm>=6) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe all rgba (1.0, 0.0, 1.0, 0.0)
|
||||
uniform 0 float4 0.5 0.0 0.0 0.0
|
||||
todo(sm<4 | sm>=6) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe all rgba (0.5, 0.0, 1.0, 0.0)
|
||||
uniform 0 float4 1.0 0.0 0.0 0.0
|
||||
todo(sm<4 | sm>=6) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe all rgba (0.0, 0.0, 1.0, 0.0)
|
||||
|
||||
[require]
|
||||
|
Loading…
Reference in New Issue
Block a user