From bb232fb08211a0a7ec62395192a6bc0a3d70c1fa Mon Sep 17 00:00:00 2001 From: Jannik Vogel Date: Thu, 16 Jul 2015 11:09:38 +0200 Subject: [PATCH] Skinning registers --- hw/xbox/nv2a.c | 17 +++++++++++++++++ hw/xbox/nv2a_vsh.h | 10 ++++++++++ 2 files changed, 27 insertions(+) diff --git a/hw/xbox/nv2a.c b/hw/xbox/nv2a.c index fd773d87d5..58f20aa3bc 100644 --- a/hw/xbox/nv2a.c +++ b/hw/xbox/nv2a.c @@ -779,6 +779,14 @@ static void gl_debug_label(GLenum target, GLuint name, const char *fmt, ...) # define NV097_SET_ALPHA_TEST_ENABLE 0x00970300 # define NV097_SET_BLEND_ENABLE 0x00970304 # define NV097_SET_DEPTH_TEST_ENABLE 0x0097030C +# define NV097_SET_SKIN_MODE 0x00970328 +# define NV097_SET_SKIN_MODE_OFF 0 +# define NV097_SET_SKIN_MODE_2G 1 +# define NV097_SET_SKIN_MODE_2 2 +# define NV097_SET_SKIN_MODE_3G 3 +# define NV097_SET_SKIN_MODE_3 4 +# define NV097_SET_SKIN_MODE_4G 5 +# define NV097_SET_SKIN_MODE_4 6 # define NV097_SET_STENCIL_TEST_ENABLE 0x0097032C # define NV097_SET_ALPHA_FUNC 0x0097033C # define NV097_SET_ALPHA_REF 0x00970340 @@ -1328,6 +1336,8 @@ typedef struct ShaderState { enum Texgen texgen[4][4]; + enum Skinning skinning; + bool normalization; bool fixed_function; @@ -2862,6 +2872,9 @@ static void pgraph_bind_shaders(PGRAPHState *pg) .alpha_func = GET_MASK(pg->regs[NV_PGRAPH_CONTROL_0], NV_PGRAPH_CONTROL_0_ALPHAFUNC), + .skinning = GET_MASK(pg->regs[NV_PGRAPH_CSV0_D], + NV_PGRAPH_CSV0_D_SKIN), + .normalization = pg->regs[NV_PGRAPH_CSV0_C] & NV_PGRAPH_CSV0_C_NORMALIZATION_ENABLE, @@ -4006,6 +4019,10 @@ static void pgraph_method(NV2AState *d, SET_MASK(pg->regs[NV_PGRAPH_CONTROL_0], NV_PGRAPH_CONTROL_0_ZENABLE, parameter); break; + case NV097_SET_SKIN_MODE: + SET_MASK(pg->regs[NV_PGRAPH_CSV0_D], NV_PGRAPH_CSV0_D_SKIN, + parameter); + break; case NV097_SET_STENCIL_TEST_ENABLE: SET_MASK(pg->regs[NV_PGRAPH_CONTROL_1], NV_PGRAPH_CONTROL_1_STENCIL_TEST_ENABLE, parameter); diff --git a/hw/xbox/nv2a_vsh.h b/hw/xbox/nv2a_vsh.h index b64ff11536..c41069ee30 100644 --- a/hw/xbox/nv2a_vsh.h +++ b/hw/xbox/nv2a_vsh.h @@ -33,6 +33,16 @@ enum Texgen { TEXGEN_REFLECTION_MAP, }; +enum Skinning { + SKINNING_OFF, + SKINNING_1WEIGHTS, + SKINNING_2WEIGHTS, + SKINNING_3WEIGHTS, + SKINNING_2WEIGHTS2MATRICES, + SKINNING_3WEIGHTS3MATRICES, + SKINNING_4WEIGHTS4MATRICES, +}; + // vs.1.1, not an official value #define VSH_VERSION_VS 0xF078