On Sun, Feb 16, 2020 at 10:01 PM Connor McAdams conmanx360@gmail.com wrote:
Implement SetMatrix/SetMatrixArray and SetMatrixTranspose/SetMatrixTransposeArray methods for the matrix effect variable interface.
Signed-off-by: Connor McAdams conmanx360@gmail.com
dlls/d3d10/d3d10_private.h | 5 ++ dlls/d3d10/effect.c | 107 ++++++++++++++++++++++++++++++++++--- 2 files changed, 104 insertions(+), 8 deletions(-)
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h index 5c6c7a2d72..2be381f608 100644 --- a/dlls/d3d10/d3d10_private.h +++ b/dlls/d3d10/d3d10_private.h @@ -61,6 +61,11 @@ enum d3d10_effect_object_operation D3D10_EOO_ANONYMOUS_SHADER = 7, };
+struct d3d10_effect_matrix +{
- float m[4][4];
+};
Let's just call it d3d10_matrix. It's not like it has anything specific to effects.
struct d3d10_effect_object { struct d3d10_effect_pass *pass; diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 93be257b81..1bc7968499 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -4967,8 +4967,87 @@ static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_ d3d10_effect_vector_variable_GetFloatVectorArray, };
+static void write_matrix_to_buffer(struct d3d10_effect_variable *variable, float *buf,
struct d3d10_effect_matrix *matrix, BOOL transpose)
+{
- unsigned int row, col;
- if (variable->type->type_class == D3D10_SVC_MATRIX_COLUMNS)
- {
for (col = 0; col < variable->type->column_count; col++)
{
for (row = 0; row < variable->type->row_count; row++)
{
if (transpose)
buf[(col * 4) + row] = matrix->m[col][row];
else
buf[(col * 4) + row] = matrix->m[row][col];
}
}
- }
- else
- {
for (col = 0; col < variable->type->column_count; col++)
{
for (row = 0; row < variable->type->row_count; row++)
{
if (transpose)
buf[(row * 4) + col] = matrix->m[col][row];
else
buf[(row * 4) + col] = matrix->m[row][col];
}
}
- }
+}
So this means matrices are stored as 4-wide rows / columns independently of the matrix dimensions, right? In that case you don't need the outer if / else, you can just pick one and flip the transpose variable if type_class is D3D10_SVC_MATRIX_ROWS / D3D10_SVC_MATRIX_COLUMNS (depending on which side of the "if" you keep).