Commit f7b619d7 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Implement SM5 bfi instruction.

parent 71fbaba4
...@@ -10731,29 +10731,28 @@ static void test_uint_shader_instructions(void) ...@@ -10731,29 +10731,28 @@ static void test_uint_shader_instructions(void)
const struct shader *ps; const struct shader *ps;
unsigned int bits[4]; unsigned int bits[4];
struct uvec4 expected_result; struct uvec4 expected_result;
BOOL todo;
} }
tests[] = tests[] =
{ {
{&ps_bfi, { 0, 0, 0, 0}, { 0, 0, 0, 0}, TRUE}, {&ps_bfi, { 0, 0, 0, 0}, { 0, 0, 0, 0}},
{&ps_bfi, { 0, 0, 0, 1}, { 1, 1, 1, 1}, TRUE}, {&ps_bfi, { 0, 0, 0, 1}, { 1, 1, 1, 1}},
{&ps_bfi, { ~0u, 0, ~0u, 0}, {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}, TRUE}, {&ps_bfi, { ~0u, 0, ~0u, 0}, {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}},
{&ps_bfi, { ~0u, ~0u, ~0u, 0}, {0x80000000, 0x80000000, 0x80000000, 0x80000000}, TRUE}, {&ps_bfi, { ~0u, ~0u, ~0u, 0}, {0x80000000, 0x80000000, 0x80000000, 0x80000000}},
{&ps_bfi, { ~0u, 0x1fu, ~0u, 0}, {0x80000000, 0x80000000, 0x80000000, 0x80000000}, TRUE}, {&ps_bfi, { ~0u, 0x1fu, ~0u, 0}, {0x80000000, 0x80000000, 0x80000000, 0x80000000}},
{&ps_bfi, { ~0u, ~0x1fu, ~0u, 0}, {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}, TRUE}, {&ps_bfi, { ~0u, ~0x1fu, ~0u, 0}, {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}},
{&ps_bfi, { 0, 0, 0xff, 1}, { 1, 1, 1, 1}, TRUE}, {&ps_bfi, { 0, 0, 0xff, 1}, { 1, 1, 1, 1}},
{&ps_bfi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}, { 1, 1, 1, 1}, TRUE}, {&ps_bfi, {~0x1fu, ~0x1fu, ~0u, 1}, { 1, 1, 1, 1}},
{&ps_bfi, {~0x1fu, ~0x1fu, ~0u, 2}, { 2, 2, 2, 2}, TRUE}, {&ps_bfi, {~0x1fu, ~0x1fu, ~0u, 2}, { 2, 2, 2, 2}},
{&ps_bfrev, {0x12345678}, {0x1e6a2c48, 0x12345678, 0x1e6a0000, 0x2c480000}}, {&ps_bfrev, {0x12345678}, {0x1e6a2c48, 0x12345678, 0x1e6a0000, 0x2c480000}},
{&ps_bfrev, {0xffff0000}, {0x0000ffff, 0xffff0000, 0x00000000, 0xffff0000}}, {&ps_bfrev, {0xffff0000}, {0x0000ffff, 0xffff0000, 0x00000000, 0xffff0000}},
...@@ -10809,7 +10808,6 @@ static void test_uint_shader_instructions(void) ...@@ -10809,7 +10808,6 @@ static void test_uint_shader_instructions(void)
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, tests[i].bits, 0, 0); ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, tests[i].bits, 0, 0);
draw_quad(&test_context); draw_quad(&test_context);
todo_wine_if(tests[i].todo)
check_texture_uvec4(texture, &tests[i].expected_result); check_texture_uvec4(texture, &tests[i].expected_result);
ID3D11PixelShader_Release(ps); ID3D11PixelShader_Release(ps);
......
...@@ -3791,6 +3791,30 @@ static void shader_glsl_float16(const struct wined3d_shader_instruction *ins) ...@@ -3791,6 +3791,30 @@ static void shader_glsl_float16(const struct wined3d_shader_instruction *ins)
} }
} }
static void shader_glsl_bitwise_op(const struct wined3d_shader_instruction *ins)
{
struct wined3d_shader_dst_param dst;
struct glsl_src_param src[4];
unsigned int i, j;
DWORD write_mask;
dst = ins->dst[0];
for (i = 0; i < 4; ++i)
{
write_mask = WINED3DSP_WRITEMASK_0 << i;
dst.write_mask = ins->dst[0].write_mask & write_mask;
if (!(write_mask = shader_glsl_append_dst_ext(ins->ctx->buffer, ins,
&dst, dst.reg.data_type)))
continue;
for (j = 0; j < ARRAY_SIZE(src); ++j)
shader_glsl_add_src_param(ins, &ins->src[j], write_mask, &src[j]);
shader_addline(ins->ctx->buffer, "bitfieldInsert(%s, %s, %s & 0x1f, %s & 0x1f));\n",
src[3].param_str, src[2].param_str, src[1].param_str, src[0].param_str);
}
}
static void shader_glsl_nop(const struct wined3d_shader_instruction *ins) {} static void shader_glsl_nop(const struct wined3d_shader_instruction *ins) {}
static void shader_glsl_nrm(const struct wined3d_shader_instruction *ins) static void shader_glsl_nrm(const struct wined3d_shader_instruction *ins)
...@@ -8844,7 +8868,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB ...@@ -8844,7 +8868,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_ATOMIC_UMIN */ NULL, /* WINED3DSIH_ATOMIC_UMIN */ NULL,
/* WINED3DSIH_ATOMIC_XOR */ NULL, /* WINED3DSIH_ATOMIC_XOR */ NULL,
/* WINED3DSIH_BEM */ shader_glsl_bem, /* WINED3DSIH_BEM */ shader_glsl_bem,
/* WINED3DSIH_BFI */ NULL, /* WINED3DSIH_BFI */ shader_glsl_bitwise_op,
/* WINED3DSIH_BFREV */ shader_glsl_map2gl, /* WINED3DSIH_BFREV */ shader_glsl_map2gl,
/* WINED3DSIH_BREAK */ shader_glsl_break, /* WINED3DSIH_BREAK */ shader_glsl_break,
/* WINED3DSIH_BREAKC */ shader_glsl_breakc, /* WINED3DSIH_BREAKC */ shader_glsl_breakc,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment