diff --git a/source/drawArrays.c b/source/drawArrays.c index 11e85e5..07b7720 100644 --- a/source/drawArrays.c +++ b/source/drawArrays.c @@ -15,7 +15,7 @@ void C3D_DrawArrays(GPU_Primitive_t primitive, int first, int size) // First vertex GPUCMD_AddWrite(GPUREG_VERTEX_OFFSET, first); // Enable array drawing mode - GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 3, 0x001); + GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 1, 1); // Enable drawing mode GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 0); // Trigger array drawing diff --git a/source/drawElements.c b/source/drawElements.c index 99c5b7c..ed06d87 100644 --- a/source/drawElements.c +++ b/source/drawElements.c @@ -19,15 +19,24 @@ void C3D_DrawElements(GPU_Primitive_t primitive, int count, int type, const void GPUCMD_AddWrite(GPUREG_NUMVERTICES, count); // First vertex GPUCMD_AddWrite(GPUREG_VERTEX_OFFSET, 0); - // Disable "triangles" mode (otherwise stuff breaks) - GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG, 2, 0x000); - GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 3, 0x000); + // Enable triangle element drawing mode if necessary + if (primitive == GPU_TRIANGLES) + { + GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG, 2, 0x100); + GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 2, 0x100); + } // Enable drawing mode GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 0); // Trigger element drawing GPUCMD_AddWrite(GPUREG_DRAWELEMENTS, 1); // Go back to configuration mode GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 1); + // Disable triangle element drawing mode if necessary + if (primitive == GPU_TRIANGLES) + { + GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG, 2, 0); + GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 2, 0); + } // Clear the post-vertex cache GPUCMD_AddWrite(GPUREG_VTX_FUNC, 1); diff --git a/source/immediate.c b/source/immediate.c index 6f7cf16..6ba39ab 100644 --- a/source/immediate.c +++ b/source/immediate.c @@ -10,8 +10,8 @@ void C3D_ImmDrawBegin(GPU_Primitive_t primitive) GPUCMD_AddWrite(GPUREG_RESTART_PRIMITIVE, 1); // Not sure if this command is necessary GPUCMD_AddWrite(GPUREG_INDEXBUFFER_CONFIG, 0x80000000); - // Enable submitting vertex data - GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 3, 0x001); + // Enable vertex submission mode + GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 1, 1); // Enable drawing mode GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 0); // Begin immediate-mode vertex submission @@ -58,7 +58,7 @@ void C3D_ImmDrawEnd(void) { // Go back to configuration mode GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 1); - // Disable array drawing mode + // Disable vertex submission mode GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 1, 0); // Clear the post-vertex cache GPUCMD_AddWrite(GPUREG_VTX_FUNC, 1); diff --git a/source/uniforms.c b/source/uniforms.c index 4427d4e..ce3efed 100644 --- a/source/uniforms.c +++ b/source/uniforms.c @@ -99,15 +99,18 @@ void C3Di_DirtyUniforms(GPU_SHADER_TYPE type) void C3Di_LoadShaderUniforms(shaderInstance_s* si) { GPU_SHADER_TYPE type = si->dvle->type; - int i; if (si->boolUniformMask) { C3D_BoolUnifs[type] &= ~si->boolUniformMask; C3D_BoolUnifs[type] |= si->boolUniforms; - C3D_BoolUnifsDirty[type] = true; } + + C3D_BoolUnifs[type] &= ~BIT(15); + C3D_BoolUnifsDirty[type] = true; + if (si->intUniformMask) { + int i; for (i = 0; i < 4; i ++) { if (si->intUniformMask & BIT(i))