mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader: Add array index field to private output variable info.
Needed to support dynamically indexed output arrays. Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
04ec461fb4
commit
3fe9997010
@ -2068,6 +2068,7 @@ struct vkd3d_dxbc_compiler
|
||||
uint32_t array_element_mask;
|
||||
} *output_info;
|
||||
uint32_t private_output_variable[MAX_REG_OUTPUT + 1]; /* 1 entry for oDepth */
|
||||
uint32_t private_output_variable_array_idx[MAX_REG_OUTPUT + 1]; /* 1 entry for oDepth */
|
||||
uint32_t private_output_variable_write_mask[MAX_REG_OUTPUT + 1]; /* 1 entry for oDepth */
|
||||
uint32_t epilogue_function_id;
|
||||
|
||||
@ -4551,6 +4552,7 @@ static void vkd3d_dxbc_compiler_emit_shader_epilogue_function(struct vkd3d_dxbc_
|
||||
|
||||
STATIC_ASSERT(ARRAY_SIZE(compiler->private_output_variable) == ARRAY_SIZE(param_id));
|
||||
STATIC_ASSERT(ARRAY_SIZE(compiler->private_output_variable) == ARRAY_SIZE(param_type_id));
|
||||
STATIC_ASSERT(ARRAY_SIZE(compiler->private_output_variable) == ARRAY_SIZE(compiler->private_output_variable_array_idx));
|
||||
STATIC_ASSERT(ARRAY_SIZE(compiler->private_output_variable) == ARRAY_SIZE(compiler->private_output_variable_write_mask));
|
||||
|
||||
phase = vkd3d_dxbc_compiler_get_current_shader_phase(compiler);
|
||||
@ -4607,6 +4609,7 @@ static void vkd3d_dxbc_compiler_emit_shader_epilogue_function(struct vkd3d_dxbc_
|
||||
vkd3d_spirv_build_op_function_end(builder);
|
||||
|
||||
memset(compiler->private_output_variable, 0, sizeof(compiler->private_output_variable));
|
||||
memset(compiler->private_output_variable_array_idx, 0, sizeof(compiler->private_output_variable_array_idx));
|
||||
memset(compiler->private_output_variable_write_mask, 0, sizeof(compiler->private_output_variable_write_mask));
|
||||
compiler->epilogue_function_id = 0;
|
||||
}
|
||||
@ -5554,6 +5557,7 @@ static void vkd3d_dxbc_compiler_leave_shader_phase(struct vkd3d_dxbc_compiler *c
|
||||
* Control point phase has separate output registers. */
|
||||
memset(compiler->output_info, 0, signature->element_count * sizeof(*compiler->output_info));
|
||||
memset(compiler->private_output_variable, 0, sizeof(compiler->private_output_variable));
|
||||
memset(compiler->private_output_variable_array_idx, 0, sizeof(compiler->private_output_variable_array_idx));
|
||||
memset(compiler->private_output_variable_write_mask, 0, sizeof(compiler->private_output_variable_write_mask));
|
||||
|
||||
for (i = 0; i < signature->element_count; ++i)
|
||||
@ -6454,16 +6458,28 @@ static uint32_t vkd3d_dxbc_compiler_emit_conditional_branch(struct vkd3d_dxbc_co
|
||||
static void vkd3d_dxbc_compiler_emit_shader_epilogue_invocation(struct vkd3d_dxbc_compiler *compiler)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
uint32_t void_id, function_id, arguments[MAX_REG_OUTPUT];
|
||||
uint32_t void_id, type_id, ptr_type_id, function_id;
|
||||
uint32_t arguments[MAX_REG_OUTPUT];
|
||||
unsigned int i, count;
|
||||
|
||||
if ((function_id = compiler->epilogue_function_id))
|
||||
{
|
||||
void_id = vkd3d_spirv_get_op_type_void(builder);
|
||||
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_TYPE_FLOAT, 4);
|
||||
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassPrivate, type_id);
|
||||
for (i = 0, count = 0; i < ARRAY_SIZE(compiler->private_output_variable); ++i)
|
||||
{
|
||||
if (compiler->private_output_variable[i])
|
||||
arguments[count++] = compiler->private_output_variable[i];
|
||||
{
|
||||
unsigned int argument_idx = count++;
|
||||
arguments[argument_idx] = compiler->private_output_variable[i];
|
||||
|
||||
if (compiler->private_output_variable_array_idx[i])
|
||||
{
|
||||
arguments[argument_idx] = vkd3d_spirv_build_op_access_chain1(builder, ptr_type_id,
|
||||
arguments[argument_idx], compiler->private_output_variable_array_idx[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vkd3d_spirv_build_op_function_call(builder, void_id, function_id, arguments, count);
|
||||
|
Loading…
x
Reference in New Issue
Block a user