mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Split matrices into multiple variables in append_output_copy().
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4647209f27
commit
d2d4bc24e9
@ -21,6 +21,22 @@
|
||||
#include "hlsl.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static unsigned int minor_size(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->modifiers & HLSL_MODIFIER_ROW_MAJOR)
|
||||
return type->dimx;
|
||||
else
|
||||
return type->dimy;
|
||||
}
|
||||
|
||||
static unsigned int major_size(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->modifiers & HLSL_MODIFIER_ROW_MAJOR)
|
||||
return type->dimy;
|
||||
else
|
||||
return type->dimx;
|
||||
}
|
||||
|
||||
/* Split uniforms into two variables representing the constant and temp
|
||||
* registers, and copy the former to the latter, so that writes to uniforms
|
||||
* work. */
|
||||
@ -141,6 +157,21 @@ static void append_output_copy(struct hlsl_ctx *ctx, struct list *instrs, struct
|
||||
struct hlsl_ir_var *output;
|
||||
struct hlsl_ir_load *load;
|
||||
|
||||
if (type->type == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
struct hlsl_type *vector_type = hlsl_get_vector_type(ctx, type->base_type, minor_size(type));
|
||||
struct hlsl_semantic vector_semantic = *semantic;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < major_size(type); ++i)
|
||||
{
|
||||
append_output_copy(ctx, instrs, var, vector_type, 4 * i, modifiers, &vector_semantic);
|
||||
++vector_semantic.index;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(name = hlsl_get_string_buffer(ctx)))
|
||||
return;
|
||||
vkd3d_string_buffer_printf(name, "<output-%s%u>", semantic->name, semantic->index);
|
||||
@ -847,22 +878,6 @@ static bool split_struct_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
|
||||
return true;
|
||||
}
|
||||
|
||||
static unsigned int minor_size(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->modifiers & HLSL_MODIFIER_ROW_MAJOR)
|
||||
return type->dimx;
|
||||
else
|
||||
return type->dimy;
|
||||
}
|
||||
|
||||
static unsigned int major_size(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->modifiers & HLSL_MODIFIER_ROW_MAJOR)
|
||||
return type->dimy;
|
||||
else
|
||||
return type->dimx;
|
||||
}
|
||||
|
||||
static bool split_matrix_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
|
||||
{
|
||||
const struct hlsl_ir_node *rhs;
|
||||
|
Loading…
x
Reference in New Issue
Block a user