mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Allocate registers for stream output objects.
All stream output objects need to have a stream index allocated, whether they are used or not. We allocate stream outputs here, before other objects are allocated, because the stream index is needed to create the appropriate output semantic variables during append_output_copy(), which will be called in a lowering pass for the Append() method.
This commit is contained in:
Notes:
Henri Verbeet
2025-04-23 18:18:33 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1458
@@ -6881,6 +6881,28 @@ static void allocate_objects(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl
|
||||
}
|
||||
}
|
||||
|
||||
static void allocate_stream_outputs(struct hlsl_ctx *ctx)
|
||||
{
|
||||
struct hlsl_ir_var *var;
|
||||
uint32_t index = 0;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry)
|
||||
{
|
||||
if (!var->data_type->reg_size[HLSL_REGSET_STREAM_OUTPUTS])
|
||||
continue;
|
||||
|
||||
/* We should have ensured that all stream output objects are single-element. */
|
||||
VKD3D_ASSERT(var->data_type->reg_size[HLSL_REGSET_STREAM_OUTPUTS] == 1);
|
||||
|
||||
var->regs[HLSL_REGSET_STREAM_OUTPUTS].space = 0;
|
||||
var->regs[HLSL_REGSET_STREAM_OUTPUTS].index = index;
|
||||
var->regs[HLSL_REGSET_STREAM_OUTPUTS].id = index;
|
||||
var->regs[HLSL_REGSET_STREAM_OUTPUTS].allocated = true;
|
||||
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
bool hlsl_component_index_range_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref,
|
||||
unsigned int *start, unsigned int *count)
|
||||
{
|
||||
@@ -13265,7 +13287,7 @@ static void process_entry_function(struct hlsl_ctx *ctx,
|
||||
|
||||
/* TODO: check that maxvertexcount * component_count(element_type) <= 1024. */
|
||||
|
||||
continue;
|
||||
prepend_uniform_copy(ctx, body, var);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -13379,6 +13401,9 @@ static void process_entry_function(struct hlsl_ctx *ctx,
|
||||
else
|
||||
sort_synthetic_separated_samplers_first(ctx);
|
||||
|
||||
if (profile->type == VKD3D_SHADER_TYPE_GEOMETRY)
|
||||
allocate_stream_outputs(ctx);
|
||||
|
||||
if (profile->major_version < 4)
|
||||
{
|
||||
while (lower_ir(ctx, lower_nonconstant_array_loads, body));
|
||||
|
Reference in New Issue
Block a user