mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Implement DRCP instruction.
Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6656a92c45
commit
c3363faba2
@ -812,6 +812,7 @@ static const struct vkd3d_sm4_opcode_info opcode_table[] =
|
|||||||
shader_sm4_read_declaration_count},
|
shader_sm4_read_declaration_count},
|
||||||
{VKD3D_SM5_OP_DDIV, VKD3DSIH_DDIV, "d", "dd"},
|
{VKD3D_SM5_OP_DDIV, VKD3DSIH_DDIV, "d", "dd"},
|
||||||
{VKD3D_SM5_OP_DFMA, VKD3DSIH_DFMA, "d", "ddd"},
|
{VKD3D_SM5_OP_DFMA, VKD3DSIH_DFMA, "d", "ddd"},
|
||||||
|
{VKD3D_SM5_OP_DRCP, VKD3DSIH_DRCP, "d", "d"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const enum vkd3d_shader_register_type register_type_table[] =
|
static const enum vkd3d_shader_register_type register_type_table[] =
|
||||||
|
@ -331,6 +331,7 @@ enum vkd3d_sm4_opcode
|
|||||||
VKD3D_SM5_OP_DCL_GS_INSTANCES = 0xce,
|
VKD3D_SM5_OP_DCL_GS_INSTANCES = 0xce,
|
||||||
VKD3D_SM5_OP_DDIV = 0xd2,
|
VKD3D_SM5_OP_DDIV = 0xd2,
|
||||||
VKD3D_SM5_OP_DFMA = 0xd3,
|
VKD3D_SM5_OP_DFMA = 0xd3,
|
||||||
|
VKD3D_SM5_OP_DRCP = 0xd4,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum vkd3d_sm4_instruction_modifier
|
enum vkd3d_sm4_instruction_modifier
|
||||||
|
@ -7078,15 +7078,18 @@ static void vkd3d_dxbc_compiler_emit_rcp(struct vkd3d_dxbc_compiler *compiler,
|
|||||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||||
const struct vkd3d_shader_dst_param *dst = instruction->dst;
|
const struct vkd3d_shader_dst_param *dst = instruction->dst;
|
||||||
const struct vkd3d_shader_src_param *src = instruction->src;
|
const struct vkd3d_shader_src_param *src = instruction->src;
|
||||||
uint32_t type_id, src_id, val_id;
|
uint32_t type_id, src_id, val_id, div_id;
|
||||||
unsigned int component_count;
|
unsigned int component_count;
|
||||||
|
|
||||||
component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||||
type_id = vkd3d_dxbc_compiler_get_type_id_for_dst(compiler, dst);
|
type_id = vkd3d_dxbc_compiler_get_type_id_for_dst(compiler, dst);
|
||||||
|
|
||||||
src_id = vkd3d_dxbc_compiler_emit_load_src(compiler, src, dst->write_mask);
|
src_id = vkd3d_dxbc_compiler_emit_load_src(compiler, src, dst->write_mask);
|
||||||
val_id = vkd3d_spirv_build_op_fdiv(builder, type_id,
|
if (src->reg.data_type == VKD3D_DATA_DOUBLE)
|
||||||
vkd3d_dxbc_compiler_get_constant_float_vector(compiler, 1.0f, component_count), src_id);
|
div_id = vkd3d_dxbc_compiler_get_constant_double_vector(compiler, 1.0, component_count);
|
||||||
|
else
|
||||||
|
div_id = vkd3d_dxbc_compiler_get_constant_float_vector(compiler, 1.0f, component_count);
|
||||||
|
val_id = vkd3d_spirv_build_op_fdiv(builder, type_id, div_id, src_id);
|
||||||
vkd3d_dxbc_compiler_emit_store_dst(compiler, dst, val_id);
|
vkd3d_dxbc_compiler_emit_store_dst(compiler, dst, val_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9568,6 +9571,7 @@ int vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler,
|
|||||||
case VKD3DSIH_DP2:
|
case VKD3DSIH_DP2:
|
||||||
vkd3d_dxbc_compiler_emit_dot(compiler, instruction);
|
vkd3d_dxbc_compiler_emit_dot(compiler, instruction);
|
||||||
break;
|
break;
|
||||||
|
case VKD3DSIH_DRCP:
|
||||||
case VKD3DSIH_RCP:
|
case VKD3DSIH_RCP:
|
||||||
vkd3d_dxbc_compiler_emit_rcp(compiler, instruction);
|
vkd3d_dxbc_compiler_emit_rcp(compiler, instruction);
|
||||||
break;
|
break;
|
||||||
|
@ -119,6 +119,7 @@ static const char * const shader_opcode_names[] =
|
|||||||
/* VKD3DSIH_DP2ADD */ "dp2add",
|
/* VKD3DSIH_DP2ADD */ "dp2add",
|
||||||
/* VKD3DSIH_DP3 */ "dp3",
|
/* VKD3DSIH_DP3 */ "dp3",
|
||||||
/* VKD3DSIH_DP4 */ "dp4",
|
/* VKD3DSIH_DP4 */ "dp4",
|
||||||
|
/* VKD3DSIH_DRCP */ "drcp",
|
||||||
/* VKD3DSIH_DST */ "dst",
|
/* VKD3DSIH_DST */ "dst",
|
||||||
/* VKD3DSIH_DSX */ "dsx",
|
/* VKD3DSIH_DSX */ "dsx",
|
||||||
/* VKD3DSIH_DSX_COARSE */ "deriv_rtx_coarse",
|
/* VKD3DSIH_DSX_COARSE */ "deriv_rtx_coarse",
|
||||||
|
@ -208,6 +208,7 @@ enum vkd3d_shader_opcode
|
|||||||
VKD3DSIH_DP2ADD,
|
VKD3DSIH_DP2ADD,
|
||||||
VKD3DSIH_DP3,
|
VKD3DSIH_DP3,
|
||||||
VKD3DSIH_DP4,
|
VKD3DSIH_DP4,
|
||||||
|
VKD3DSIH_DRCP,
|
||||||
VKD3DSIH_DST,
|
VKD3DSIH_DST,
|
||||||
VKD3DSIH_DSX,
|
VKD3DSIH_DSX,
|
||||||
VKD3DSIH_DSX_COARSE,
|
VKD3DSIH_DSX_COARSE,
|
||||||
|
@ -10010,7 +10010,7 @@ static void test_shader_instructions(void)
|
|||||||
{&ps_dmul, {.d = {{ 1.5, 3.0}}}, {.d = { 4.5, -4.5}}, true},
|
{&ps_dmul, {.d = {{ 1.5, 3.0}}}, {.d = { 4.5, -4.5}}, true},
|
||||||
{&ps_ddiv, {.d = {{ 2.0, 4.0}}}, {.d = { 0.5, 2.0}}, true},
|
{&ps_ddiv, {.d = {{ 2.0, 4.0}}}, {.d = { 0.5, 2.0}}, true},
|
||||||
{&ps_ddiv, {.d = {{ 2.0, -4.0}}}, {.d = {-0.5, -2.0}}, true},
|
{&ps_ddiv, {.d = {{ 2.0, -4.0}}}, {.d = {-0.5, -2.0}}, true},
|
||||||
{&ps_drcp, {.d = {{ 2.0, -0.5}}}, {.d = { 0.5, -2.0}}, true, true},
|
{&ps_drcp, {.d = {{ 2.0, -0.5}}}, {.d = { 0.5, -2.0}}, true},
|
||||||
|
|
||||||
{
|
{
|
||||||
&ps_swapc0,
|
&ps_swapc0,
|
||||||
|
Loading…
Reference in New Issue
Block a user