wined3d: Implement SM5 firstbit_* instructions.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-01-28 17:14:11 +01:00 committed by Alexandre Julliard
parent 8aed050396
commit ab6557fd97
5 changed files with 24 additions and 0 deletions

View File

@ -5109,6 +5109,9 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
/* WINED3DSIH_F16TOF32 */ NULL,
/* WINED3DSIH_F32TOF16 */ NULL,
/* WINED3DSIH_FCALL */ NULL,
/* WINED3DSIH_FIRSTBIT_HI */ NULL,
/* WINED3DSIH_FIRSTBIT_LO */ NULL,
/* WINED3DSIH_FIRSTBIT_SHI */ NULL,
/* WINED3DSIH_FRC */ shader_hw_map2gl,
/* WINED3DSIH_FTOI */ NULL,
/* WINED3DSIH_FTOU */ NULL,

View File

@ -3731,6 +3731,9 @@ static void shader_glsl_map2gl(const struct wined3d_shader_instruction *ins)
case WINED3DSIH_DSY: instruction = "ycorrection.y * dFdy"; break;
case WINED3DSIH_DSY_COARSE: instruction = "ycorrection.y * dFdyCoarse"; break;
case WINED3DSIH_DSY_FINE: instruction = "ycorrection.y * dFdyFine"; break;
case WINED3DSIH_FIRSTBIT_HI: instruction = "findMSB"; break;
case WINED3DSIH_FIRSTBIT_LO: instruction = "findLSB"; break;
case WINED3DSIH_FIRSTBIT_SHI: instruction = "findMSB"; break;
case WINED3DSIH_FRC: instruction = "fract"; break;
case WINED3DSIH_IMAX: instruction = "max"; break;
case WINED3DSIH_IMIN: instruction = "min"; break;
@ -3750,6 +3753,9 @@ static void shader_glsl_map2gl(const struct wined3d_shader_instruction *ins)
write_mask = shader_glsl_append_dst(buffer, ins);
/* In D3D bits are numbered from the most significant bit. */
if (ins->handler_idx == WINED3DSIH_FIRSTBIT_HI || ins->handler_idx == WINED3DSIH_FIRSTBIT_SHI)
shader_addline(buffer, "31 - ");
shader_addline(buffer, "%s(", instruction);
if (ins->src_count)
@ -8963,6 +8969,9 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_F16TOF32 */ shader_glsl_float16,
/* WINED3DSIH_F32TOF16 */ shader_glsl_float16,
/* WINED3DSIH_FCALL */ NULL,
/* WINED3DSIH_FIRSTBIT_HI */ shader_glsl_map2gl,
/* WINED3DSIH_FIRSTBIT_LO */ shader_glsl_map2gl,
/* WINED3DSIH_FIRSTBIT_SHI */ shader_glsl_map2gl,
/* WINED3DSIH_FRC */ shader_glsl_map2gl,
/* WINED3DSIH_FTOI */ shader_glsl_to_int,
/* WINED3DSIH_FTOU */ shader_glsl_to_uint,

View File

@ -134,6 +134,9 @@ static const char * const shader_opcode_names[] =
/* WINED3DSIH_F16TOF32 */ "f16tof32",
/* WINED3DSIH_F32TOF16 */ "f32tof16",
/* WINED3DSIH_FCALL */ "fcall",
/* WINED3DSIH_FIRSTBIT_HI */ "firstbit_hi",
/* WINED3DSIH_FIRSTBIT_LO */ "firstbit_lo",
/* WINED3DSIH_FIRSTBIT_SHI */ "firstbit_shi",
/* WINED3DSIH_FRC */ "frc",
/* WINED3DSIH_FTOI */ "ftoi",
/* WINED3DSIH_FTOU */ "ftou",

View File

@ -234,6 +234,9 @@ enum wined3d_sm4_opcode
WINED3D_SM5_OP_F32TOF16 = 0x82,
WINED3D_SM5_OP_F16TOF32 = 0x83,
WINED3D_SM5_OP_COUNTBITS = 0x86,
WINED3D_SM5_OP_FIRSTBIT_HI = 0x87,
WINED3D_SM5_OP_FIRSTBIT_LO = 0x88,
WINED3D_SM5_OP_FIRSTBIT_SHI = 0x89,
WINED3D_SM5_OP_UBFE = 0x8a,
WINED3D_SM5_OP_BFI = 0x8c,
WINED3D_SM5_OP_BFREV = 0x8d,
@ -928,6 +931,9 @@ static const struct wined3d_sm4_opcode_info opcode_table[] =
{WINED3D_SM5_OP_F32TOF16, WINED3DSIH_F32TOF16, "u", "f"},
{WINED3D_SM5_OP_F16TOF32, WINED3DSIH_F16TOF32, "f", "u"},
{WINED3D_SM5_OP_COUNTBITS, WINED3DSIH_COUNTBITS, "u", "u"},
{WINED3D_SM5_OP_FIRSTBIT_HI, WINED3DSIH_FIRSTBIT_HI, "u", "u"},
{WINED3D_SM5_OP_FIRSTBIT_LO, WINED3DSIH_FIRSTBIT_LO, "u", "u"},
{WINED3D_SM5_OP_FIRSTBIT_SHI, WINED3DSIH_FIRSTBIT_SHI, "u", "i"},
{WINED3D_SM5_OP_UBFE, WINED3DSIH_UBFE, "u", "iiu"},
{WINED3D_SM5_OP_BFI, WINED3DSIH_BFI, "u", "iiuu"},
{WINED3D_SM5_OP_BFREV, WINED3DSIH_BFREV, "u", "u"},

View File

@ -664,6 +664,9 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
WINED3DSIH_F16TOF32,
WINED3DSIH_F32TOF16,
WINED3DSIH_FCALL,
WINED3DSIH_FIRSTBIT_HI,
WINED3DSIH_FIRSTBIT_LO,
WINED3DSIH_FIRSTBIT_SHI,
WINED3DSIH_FRC,
WINED3DSIH_FTOI,
WINED3DSIH_FTOU,