[1/2] wined3d: Implement SM5 gather4_po_c opcode.
Sven Hesse
drmccoy at drmccoy.de
Thu May 18 19:50:25 CDT 2017
A combination of gather4_c and gather4_po.
Signed-off-by: Sven Hesse <drmccoy at drmccoy.de>
---
dlls/wined3d/arb_program_shader.c | 1 +
dlls/wined3d/glsl_shader.c | 10 ++++++++--
dlls/wined3d/shader.c | 5 ++++-
dlls/wined3d/shader_sm4.c | 2 ++
dlls/wined3d/wined3d_private.h | 1 +
5 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index aa17fb1126..c2a337cef7 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -5128,6 +5128,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
/* WINED3DSIH_GATHER4 */ NULL,
/* WINED3DSIH_GATHER4_C */ NULL,
/* WINED3DSIH_GATHER4_PO */ NULL,
+ /* WINED3DSIH_GATHER4_PO_C */ NULL,
/* WINED3DSIH_GE */ NULL,
/* WINED3DSIH_HS_CONTROL_POINT_PHASE */ NULL,
/* WINED3DSIH_HS_DECLS */ NULL,
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 6f51939895..237cb9c7f5 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -5849,9 +5849,10 @@ static void shader_glsl_gather4(const struct wined3d_shader_instruction *ins)
}
has_offset = ins->handler_idx == WINED3DSIH_GATHER4_PO
+ || ins->handler_idx == WINED3DSIH_GATHER4_PO_C
|| 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;
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);
@@ -5878,8 +5879,12 @@ static void shader_glsl_gather4(const struct wined3d_shader_instruction *ins)
{
shader_glsl_add_src_param(ins, &ins->src[3], WINED3DSP_WRITEMASK_0, &compare_param);
shader_addline(buffer, ", %s", compare_param.param_str);
+ } else if (ins->handler_idx == WINED3DSIH_GATHER4_PO_C)
+ {
+ shader_glsl_add_src_param(ins, &ins->src[4], WINED3DSP_WRITEMASK_0, &compare_param);
+ 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_addline(buffer, ", %s", offset_param.param_str);
@@ -10347,6 +10352,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_GATHER4 */ shader_glsl_gather4,
/* WINED3DSIH_GATHER4_C */ shader_glsl_gather4,
/* WINED3DSIH_GATHER4_PO */ shader_glsl_gather4,
+ /* WINED3DSIH_GATHER4_PO_C */ shader_glsl_gather4,
/* WINED3DSIH_GE */ shader_glsl_relop,
/* WINED3DSIH_HS_CONTROL_POINT_PHASE */ NULL,
/* WINED3DSIH_HS_DECLS */ shader_glsl_nop,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index bbd6718a26..03e0fd196b 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -148,6 +148,7 @@ static const char * const shader_opcode_names[] =
/* WINED3DSIH_GATHER4 */ "gather4",
/* WINED3DSIH_GATHER4_C */ "gather4_c",
/* WINED3DSIH_GATHER4_PO */ "gather4_po",
+ /* WINED3DSIH_GATHER4_PO_C */ "gather4_po_c",
/* WINED3DSIH_GE */ "ge",
/* WINED3DSIH_HS_CONTROL_POINT_PHASE */ "hs_control_point_phase",
/* WINED3DSIH_HS_DECLS */ "hs_decls",
@@ -1500,7 +1501,9 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
shader_record_sample(reg_maps, ins.src[1].reg.idx[0].offset,
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,
ins.src[3].reg.idx[0].offset, reg_maps->sampler_map.count);
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index 384a744499..a9fedbc44f 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -235,6 +235,7 @@ enum wined3d_sm4_opcode
WINED3D_SM5_OP_DERIV_RTY_FINE = 0x7d,
WINED3D_SM5_OP_GATHER4_C = 0x7e,
WINED3D_SM5_OP_GATHER4_PO = 0x7f,
+ WINED3D_SM5_OP_GATHER4_PO_C = 0x80,
WINED3D_SM5_OP_RCP = 0x81,
WINED3D_SM5_OP_F32TOF16 = 0x82,
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_GATHER4_C, WINED3DSIH_GATHER4_C, "f", "fRSf"},
{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_F32TOF16, WINED3DSIH_F32TOF16, "u", "f"},
{WINED3D_SM5_OP_F16TOF32, WINED3DSIH_F16TOF32, "f", "u"},
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 70dd8edc96..6a4bd32feb 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -773,6 +773,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
WINED3DSIH_GATHER4,
WINED3DSIH_GATHER4_C,
WINED3DSIH_GATHER4_PO,
+ WINED3DSIH_GATHER4_PO_C,
WINED3DSIH_GE,
WINED3DSIH_HS_CONTROL_POINT_PHASE,
WINED3DSIH_HS_DECLS,
--
2.11.0
More information about the wine-patches
mailing list