wined3d: Implement SM5 gather4_po_c opcode.

A combination of gather4_c and gather4_po.

Signed-off-by: Sven Hesse <drmccoy@drmccoy.de>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sven Hesse 2017-05-22 19:15:02 +02:00 committed by Alexandre Julliard
parent c9ea06e7a8
commit 4b376ba7d2
5 changed files with 14 additions and 5 deletions

View File

@ -5128,6 +5128,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
/* WINED3DSIH_GATHER4 */ NULL, /* WINED3DSIH_GATHER4 */ NULL,
/* WINED3DSIH_GATHER4_C */ NULL, /* WINED3DSIH_GATHER4_C */ NULL,
/* WINED3DSIH_GATHER4_PO */ NULL, /* WINED3DSIH_GATHER4_PO */ NULL,
/* WINED3DSIH_GATHER4_PO_C */ NULL,
/* WINED3DSIH_GE */ NULL, /* WINED3DSIH_GE */ NULL,
/* WINED3DSIH_HS_CONTROL_POINT_PHASE */ NULL, /* WINED3DSIH_HS_CONTROL_POINT_PHASE */ NULL,
/* WINED3DSIH_HS_DECLS */ NULL, /* WINED3DSIH_HS_DECLS */ NULL,

View File

@ -5877,9 +5877,11 @@ static void shader_glsl_gather4(const struct wined3d_shader_instruction *ins)
} }
has_offset = ins->handler_idx == WINED3DSIH_GATHER4_PO has_offset = ins->handler_idx == WINED3DSIH_GATHER4_PO
|| ins->handler_idx == WINED3DSIH_GATHER4_PO_C
|| wined3d_shader_instruction_has_texel_offset(ins); || wined3d_shader_instruction_has_texel_offset(ins);
resource_param_idx = ins->handler_idx == WINED3DSIH_GATHER4_PO ? 2 : 1; resource_param_idx =
(ins->handler_idx == WINED3DSIH_GATHER4_PO || ins->handler_idx == WINED3DSIH_GATHER4_PO_C) ? 2 : 1;
resource_idx = ins->src[resource_param_idx].reg.idx[0].offset; resource_idx = ins->src[resource_param_idx].reg.idx[0].offset;
sampler_idx = ins->src[resource_param_idx + 1].reg.idx[0].offset; sampler_idx = ins->src[resource_param_idx + 1].reg.idx[0].offset;
component_idx = shader_glsl_swizzle_get_component(ins->src[resource_param_idx + 1].swizzle, 0); component_idx = shader_glsl_swizzle_get_component(ins->src[resource_param_idx + 1].swizzle, 0);
@ -5902,12 +5904,12 @@ static void shader_glsl_gather4(const struct wined3d_shader_instruction *ins)
shader_addline(buffer, "textureGather%s(%s_sampler%u, %s", shader_addline(buffer, "textureGather%s(%s_sampler%u, %s",
has_offset ? "Offset" : "", prefix, sampler_bind_idx, coord_param.param_str); has_offset ? "Offset" : "", prefix, sampler_bind_idx, coord_param.param_str);
if (ins->handler_idx == WINED3DSIH_GATHER4_C) if (ins->handler_idx == WINED3DSIH_GATHER4_C || ins->handler_idx == WINED3DSIH_GATHER4_PO_C)
{ {
shader_glsl_add_src_param(ins, &ins->src[3], WINED3DSP_WRITEMASK_0, &compare_param); shader_glsl_add_src_param(ins, &ins->src[resource_param_idx + 2], WINED3DSP_WRITEMASK_0, &compare_param);
shader_addline(buffer, ", %s", compare_param.param_str); shader_addline(buffer, ", %s", compare_param.param_str);
} }
if (ins->handler_idx == WINED3DSIH_GATHER4_PO) if (ins->handler_idx == WINED3DSIH_GATHER4_PO || ins->handler_idx == WINED3DSIH_GATHER4_PO_C)
{ {
shader_glsl_add_src_param(ins, &ins->src[1], (1u << offset_size) - 1, &offset_param); shader_glsl_add_src_param(ins, &ins->src[1], (1u << offset_size) - 1, &offset_param);
shader_addline(buffer, ", %s", offset_param.param_str); shader_addline(buffer, ", %s", offset_param.param_str);
@ -10681,6 +10683,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_GATHER4 */ shader_glsl_gather4, /* WINED3DSIH_GATHER4 */ shader_glsl_gather4,
/* WINED3DSIH_GATHER4_C */ shader_glsl_gather4, /* WINED3DSIH_GATHER4_C */ shader_glsl_gather4,
/* WINED3DSIH_GATHER4_PO */ shader_glsl_gather4, /* WINED3DSIH_GATHER4_PO */ shader_glsl_gather4,
/* WINED3DSIH_GATHER4_PO_C */ shader_glsl_gather4,
/* WINED3DSIH_GE */ shader_glsl_relop, /* WINED3DSIH_GE */ shader_glsl_relop,
/* WINED3DSIH_HS_CONTROL_POINT_PHASE */ shader_glsl_nop, /* WINED3DSIH_HS_CONTROL_POINT_PHASE */ shader_glsl_nop,
/* WINED3DSIH_HS_DECLS */ shader_glsl_nop, /* WINED3DSIH_HS_DECLS */ shader_glsl_nop,

View File

@ -148,6 +148,7 @@ static const char * const shader_opcode_names[] =
/* WINED3DSIH_GATHER4 */ "gather4", /* WINED3DSIH_GATHER4 */ "gather4",
/* WINED3DSIH_GATHER4_C */ "gather4_c", /* WINED3DSIH_GATHER4_C */ "gather4_c",
/* WINED3DSIH_GATHER4_PO */ "gather4_po", /* WINED3DSIH_GATHER4_PO */ "gather4_po",
/* WINED3DSIH_GATHER4_PO_C */ "gather4_po_c",
/* WINED3DSIH_GE */ "ge", /* WINED3DSIH_GE */ "ge",
/* WINED3DSIH_HS_CONTROL_POINT_PHASE */ "hs_control_point_phase", /* WINED3DSIH_HS_CONTROL_POINT_PHASE */ "hs_control_point_phase",
/* WINED3DSIH_HS_DECLS */ "hs_decls", /* WINED3DSIH_HS_DECLS */ "hs_decls",
@ -1586,7 +1587,8 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
shader_record_sample(reg_maps, ins.src[1].reg.idx[0].offset, shader_record_sample(reg_maps, ins.src[1].reg.idx[0].offset,
ins.src[2].reg.idx[0].offset, reg_maps->sampler_map.count); ins.src[2].reg.idx[0].offset, reg_maps->sampler_map.count);
} }
else if (ins.handler_idx == WINED3DSIH_GATHER4_PO) else if (ins.handler_idx == WINED3DSIH_GATHER4_PO
|| ins.handler_idx == WINED3DSIH_GATHER4_PO_C)
{ {
shader_record_sample(reg_maps, ins.src[2].reg.idx[0].offset, shader_record_sample(reg_maps, ins.src[2].reg.idx[0].offset,
ins.src[3].reg.idx[0].offset, reg_maps->sampler_map.count); ins.src[3].reg.idx[0].offset, reg_maps->sampler_map.count);

View File

@ -235,6 +235,7 @@ enum wined3d_sm4_opcode
WINED3D_SM5_OP_DERIV_RTY_FINE = 0x7d, WINED3D_SM5_OP_DERIV_RTY_FINE = 0x7d,
WINED3D_SM5_OP_GATHER4_C = 0x7e, WINED3D_SM5_OP_GATHER4_C = 0x7e,
WINED3D_SM5_OP_GATHER4_PO = 0x7f, WINED3D_SM5_OP_GATHER4_PO = 0x7f,
WINED3D_SM5_OP_GATHER4_PO_C = 0x80,
WINED3D_SM5_OP_RCP = 0x81, WINED3D_SM5_OP_RCP = 0x81,
WINED3D_SM5_OP_F32TOF16 = 0x82, WINED3D_SM5_OP_F32TOF16 = 0x82,
WINED3D_SM5_OP_F16TOF32 = 0x83, WINED3D_SM5_OP_F16TOF32 = 0x83,
@ -1014,6 +1015,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] =
{WINED3D_SM5_OP_DERIV_RTY_FINE, WINED3DSIH_DSY_FINE, "f", "f"}, {WINED3D_SM5_OP_DERIV_RTY_FINE, WINED3DSIH_DSY_FINE, "f", "f"},
{WINED3D_SM5_OP_GATHER4_C, WINED3DSIH_GATHER4_C, "f", "fRSf"}, {WINED3D_SM5_OP_GATHER4_C, WINED3DSIH_GATHER4_C, "f", "fRSf"},
{WINED3D_SM5_OP_GATHER4_PO, WINED3DSIH_GATHER4_PO, "f", "fiRS"}, {WINED3D_SM5_OP_GATHER4_PO, WINED3DSIH_GATHER4_PO, "f", "fiRS"},
{WINED3D_SM5_OP_GATHER4_PO_C, WINED3DSIH_GATHER4_PO_C, "f", "fiRSf"},
{WINED3D_SM5_OP_RCP, WINED3DSIH_RCP, "f", "f"}, {WINED3D_SM5_OP_RCP, WINED3DSIH_RCP, "f", "f"},
{WINED3D_SM5_OP_F32TOF16, WINED3DSIH_F32TOF16, "u", "f"}, {WINED3D_SM5_OP_F32TOF16, WINED3DSIH_F32TOF16, "u", "f"},
{WINED3D_SM5_OP_F16TOF32, WINED3DSIH_F16TOF32, "f", "u"}, {WINED3D_SM5_OP_F16TOF32, WINED3DSIH_F16TOF32, "f", "u"},

View File

@ -773,6 +773,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
WINED3DSIH_GATHER4, WINED3DSIH_GATHER4,
WINED3DSIH_GATHER4_C, WINED3DSIH_GATHER4_C,
WINED3DSIH_GATHER4_PO, WINED3DSIH_GATHER4_PO,
WINED3DSIH_GATHER4_PO_C,
WINED3DSIH_GE, WINED3DSIH_GE,
WINED3DSIH_HS_CONTROL_POINT_PHASE, WINED3DSIH_HS_CONTROL_POINT_PHASE,
WINED3DSIH_HS_DECLS, WINED3DSIH_HS_DECLS,