Correct drawing functions to take into account full geoshader support
This commit is contained in:
parent
a5d68c7557
commit
6361febd3c
@ -15,7 +15,7 @@ void C3D_DrawArrays(GPU_Primitive_t primitive, int first, int size)
|
|||||||
// First vertex
|
// First vertex
|
||||||
GPUCMD_AddWrite(GPUREG_VERTEX_OFFSET, first);
|
GPUCMD_AddWrite(GPUREG_VERTEX_OFFSET, first);
|
||||||
// Enable array drawing mode
|
// Enable array drawing mode
|
||||||
GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 3, 0x001);
|
GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 1, 1);
|
||||||
// Enable drawing mode
|
// Enable drawing mode
|
||||||
GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 0);
|
GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 0);
|
||||||
// Trigger array drawing
|
// Trigger array drawing
|
||||||
|
@ -19,15 +19,24 @@ void C3D_DrawElements(GPU_Primitive_t primitive, int count, int type, const void
|
|||||||
GPUCMD_AddWrite(GPUREG_NUMVERTICES, count);
|
GPUCMD_AddWrite(GPUREG_NUMVERTICES, count);
|
||||||
// First vertex
|
// First vertex
|
||||||
GPUCMD_AddWrite(GPUREG_VERTEX_OFFSET, 0);
|
GPUCMD_AddWrite(GPUREG_VERTEX_OFFSET, 0);
|
||||||
// Disable "triangles" mode (otherwise stuff breaks)
|
// Enable triangle element drawing mode if necessary
|
||||||
GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG, 2, 0x000);
|
if (primitive == GPU_TRIANGLES)
|
||||||
GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 3, 0x000);
|
{
|
||||||
|
GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG, 2, 0x100);
|
||||||
|
GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 2, 0x100);
|
||||||
|
}
|
||||||
// Enable drawing mode
|
// Enable drawing mode
|
||||||
GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 0);
|
GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 0);
|
||||||
// Trigger element drawing
|
// Trigger element drawing
|
||||||
GPUCMD_AddWrite(GPUREG_DRAWELEMENTS, 1);
|
GPUCMD_AddWrite(GPUREG_DRAWELEMENTS, 1);
|
||||||
// Go back to configuration mode
|
// Go back to configuration mode
|
||||||
GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 1);
|
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
|
// Clear the post-vertex cache
|
||||||
GPUCMD_AddWrite(GPUREG_VTX_FUNC, 1);
|
GPUCMD_AddWrite(GPUREG_VTX_FUNC, 1);
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ void C3D_ImmDrawBegin(GPU_Primitive_t primitive)
|
|||||||
GPUCMD_AddWrite(GPUREG_RESTART_PRIMITIVE, 1);
|
GPUCMD_AddWrite(GPUREG_RESTART_PRIMITIVE, 1);
|
||||||
// Not sure if this command is necessary
|
// Not sure if this command is necessary
|
||||||
GPUCMD_AddWrite(GPUREG_INDEXBUFFER_CONFIG, 0x80000000);
|
GPUCMD_AddWrite(GPUREG_INDEXBUFFER_CONFIG, 0x80000000);
|
||||||
// Enable submitting vertex data
|
// Enable vertex submission mode
|
||||||
GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 3, 0x001);
|
GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 1, 1);
|
||||||
// Enable drawing mode
|
// Enable drawing mode
|
||||||
GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 0);
|
GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 0);
|
||||||
// Begin immediate-mode vertex submission
|
// Begin immediate-mode vertex submission
|
||||||
@ -58,7 +58,7 @@ void C3D_ImmDrawEnd(void)
|
|||||||
{
|
{
|
||||||
// Go back to configuration mode
|
// Go back to configuration mode
|
||||||
GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 1);
|
GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 1);
|
||||||
// Disable array drawing mode
|
// Disable vertex submission mode
|
||||||
GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 1, 0);
|
GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 1, 0);
|
||||||
// Clear the post-vertex cache
|
// Clear the post-vertex cache
|
||||||
GPUCMD_AddWrite(GPUREG_VTX_FUNC, 1);
|
GPUCMD_AddWrite(GPUREG_VTX_FUNC, 1);
|
||||||
|
@ -99,15 +99,18 @@ void C3Di_DirtyUniforms(GPU_SHADER_TYPE type)
|
|||||||
void C3Di_LoadShaderUniforms(shaderInstance_s* si)
|
void C3Di_LoadShaderUniforms(shaderInstance_s* si)
|
||||||
{
|
{
|
||||||
GPU_SHADER_TYPE type = si->dvle->type;
|
GPU_SHADER_TYPE type = si->dvle->type;
|
||||||
int i;
|
|
||||||
if (si->boolUniformMask)
|
if (si->boolUniformMask)
|
||||||
{
|
{
|
||||||
C3D_BoolUnifs[type] &= ~si->boolUniformMask;
|
C3D_BoolUnifs[type] &= ~si->boolUniformMask;
|
||||||
C3D_BoolUnifs[type] |= si->boolUniforms;
|
C3D_BoolUnifs[type] |= si->boolUniforms;
|
||||||
C3D_BoolUnifsDirty[type] = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
C3D_BoolUnifs[type] &= ~BIT(15);
|
||||||
|
C3D_BoolUnifsDirty[type] = true;
|
||||||
|
|
||||||
if (si->intUniformMask)
|
if (si->intUniformMask)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
for (i = 0; i < 4; i ++)
|
for (i = 0; i < 4; i ++)
|
||||||
{
|
{
|
||||||
if (si->intUniformMask & BIT(i))
|
if (si->intUniformMask & BIT(i))
|
||||||
|
Loading…
Reference in New Issue
Block a user