mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
libs/vkd3d-shader: Implement "absneg" source modifiers.
This commit is contained in:
parent
5ae7e3d9d0
commit
0633cfc55d
@ -1367,6 +1367,23 @@ static uint32_t vkd3d_dxbc_compiler_emit_load_reg(struct vkd3d_dxbc_compiler *co
|
||||
return val_id;
|
||||
}
|
||||
|
||||
static uint32_t vkd3d_dxbc_compiler_emit_abs(struct vkd3d_dxbc_compiler *compiler,
|
||||
const struct vkd3d_shader_register *reg, DWORD write_mask, uint32_t val_id)
|
||||
{
|
||||
unsigned int component_count = vkd3d_write_mask_component_count(write_mask);
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
uint32_t type_id;
|
||||
|
||||
if (reg->data_type == VKD3D_DATA_FLOAT)
|
||||
{
|
||||
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_TYPE_FLOAT, component_count);
|
||||
return vkd3d_spirv_build_op_glsl_std450_fabs(builder, type_id, val_id);
|
||||
}
|
||||
|
||||
FIXME("Unhandled data type %#x.\n", reg->data_type);
|
||||
return val_id;
|
||||
}
|
||||
|
||||
static uint32_t vkd3d_dxbc_compiler_emit_neg(struct vkd3d_dxbc_compiler *compiler,
|
||||
const struct vkd3d_shader_register *reg, DWORD write_mask, uint32_t val_id)
|
||||
{
|
||||
@ -1389,10 +1406,6 @@ static uint32_t vkd3d_dxbc_compiler_emit_src_modifier(struct vkd3d_dxbc_compiler
|
||||
const struct vkd3d_shader_register *reg, DWORD write_mask,
|
||||
enum vkd3d_shader_src_modifier modifier, uint32_t val_id)
|
||||
{
|
||||
unsigned int component_count = vkd3d_write_mask_component_count(write_mask);
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
uint32_t type_id;
|
||||
|
||||
switch (modifier)
|
||||
{
|
||||
case VKD3DSPSM_NONE:
|
||||
@ -1400,14 +1413,10 @@ static uint32_t vkd3d_dxbc_compiler_emit_src_modifier(struct vkd3d_dxbc_compiler
|
||||
case VKD3DSPSM_NEG:
|
||||
return vkd3d_dxbc_compiler_emit_neg(compiler, reg, write_mask, val_id);
|
||||
case VKD3DSPSM_ABS:
|
||||
if (reg->data_type != VKD3D_DATA_FLOAT)
|
||||
{
|
||||
FIXME("Unhandled data type %#x.\n", reg->data_type);
|
||||
return val_id;
|
||||
}
|
||||
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_TYPE_FLOAT, component_count);
|
||||
return vkd3d_spirv_build_op_glsl_std450_fabs(builder, type_id, val_id);
|
||||
break;
|
||||
return vkd3d_dxbc_compiler_emit_abs(compiler, reg, write_mask, val_id);
|
||||
case VKD3DSPSM_ABSNEG:
|
||||
val_id = vkd3d_dxbc_compiler_emit_abs(compiler, reg, write_mask, val_id);
|
||||
return vkd3d_dxbc_compiler_emit_neg(compiler, reg, write_mask, val_id);
|
||||
default:
|
||||
FIXME("Unhandled src modifier %#x.\n", modifier);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user