mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-04 03:33:44 +01:00
Spline: Simplify uniforms/dirty to one check.
This makes backends more consistent in which values they use, and reduces the (relatively uncommon compared to other drawcalls) dirty checks for splines.
This commit is contained in:
1 parent
92b0f00cd8
commit
d4ff7cc928
8 files changed
+33
-71
No files matched your search
@@ -88,11 +88,7 @@ enum : uint64_t {
|
||||
DIRTY_BONEMATRIX7 = 1ULL << 31,
|
||||
|
||||
// These are for hardware tessellation
|
||||
DIRTY_BEZIERCOUNTU = 1ULL << 32,
|
||||
DIRTY_SPLINECOUNTU = 1ULL << 33,
|
||||
DIRTY_SPLINECOUNTV = 1ULL << 34,
|
||||
DIRTY_SPLINETYPEU = 1ULL << 35,
|
||||
DIRTY_SPLINETYPEV = 1ULL << 36,
|
||||
DIRTY_BEZIERSPLINE = 1ULL << 32,
|
||||
|
||||
DIRTY_BONE_UNIFORMS = 0xFF000000ULL,
|
||||
|
||||
|
||||
@@ -197,18 +197,11 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView
|
||||
ub->depthRange[3] = viewZInvScale;
|
||||
}
|
||||
|
||||
if (gstate_c.bezier) {
|
||||
if (dirtyUniforms & DIRTY_BEZIERCOUNTU)
|
||||
ub->spline_count_u = gstate_c.spline_count_u;
|
||||
} else if (gstate_c.spline) {
|
||||
if (dirtyUniforms & DIRTY_SPLINECOUNTU)
|
||||
ub->spline_count_u = gstate_c.spline_count_u;
|
||||
if (dirtyUniforms & DIRTY_SPLINECOUNTV)
|
||||
ub->spline_count_v = gstate_c.spline_count_v;
|
||||
if (dirtyUniforms & DIRTY_SPLINETYPEU)
|
||||
ub->spline_type_u = gstate_c.spline_type_u;
|
||||
if (dirtyUniforms & DIRTY_SPLINETYPEV)
|
||||
ub->spline_type_v = gstate_c.spline_type_v;
|
||||
if (dirtyUniforms & DIRTY_BEZIERSPLINE) {
|
||||
ub->spline_count_u = gstate_c.spline_count_u;
|
||||
ub->spline_count_v = gstate_c.spline_count_v;
|
||||
ub->spline_type_u = gstate_c.spline_type_u;
|
||||
ub->spline_type_v = gstate_c.spline_type_v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ enum : uint64_t {
|
||||
DIRTY_WORLDMATRIX | DIRTY_PROJTHROUGHMATRIX | DIRTY_VIEWMATRIX | DIRTY_TEXMATRIX | DIRTY_ALPHACOLORREF |
|
||||
DIRTY_PROJMATRIX | DIRTY_FOGCOLOR | DIRTY_FOGCOEF | DIRTY_TEXENV | DIRTY_STENCILREPLACEVALUE |
|
||||
DIRTY_ALPHACOLORMASK | DIRTY_SHADERBLEND | DIRTY_UVSCALEOFFSET | DIRTY_TEXCLAMP | DIRTY_DEPTHRANGE | DIRTY_MATAMBIENTALPHA |
|
||||
DIRTY_BEZIERCOUNTU | DIRTY_SPLINECOUNTU | DIRTY_SPLINECOUNTV | DIRTY_SPLINETYPEU | DIRTY_SPLINETYPEV,
|
||||
DIRTY_BEZIERSPLINE,
|
||||
DIRTY_LIGHT_UNIFORMS =
|
||||
DIRTY_LIGHT0 | DIRTY_LIGHT1 | DIRTY_LIGHT2 | DIRTY_LIGHT3 |
|
||||
DIRTY_MATDIFFUSE | DIRTY_MATSPECULAR | DIRTY_MATEMISSIVE | DIRTY_AMBIENT,
|
||||
|
||||
+5
-12
@@ -596,7 +596,7 @@ void GPU_D3D11::Execute_Bezier(u32 op, u32 diff) {
|
||||
if (g_Config.bHardwareTessellation && g_Config.bHardwareTransform && !g_Config.bSoftwareRendering) {
|
||||
gstate_c.bezier = true;
|
||||
if (gstate_c.spline_count_u != bz_ucount) {
|
||||
gstate_c.Dirty(DIRTY_BEZIERCOUNTU);
|
||||
gstate_c.Dirty(DIRTY_BEZIERSPLINE);
|
||||
gstate_c.spline_count_u = bz_ucount;
|
||||
}
|
||||
}
|
||||
@@ -657,20 +657,13 @@ void GPU_D3D11::Execute_Spline(u32 op, u32 diff) {
|
||||
|
||||
if (g_Config.bHardwareTessellation && g_Config.bHardwareTransform && !g_Config.bSoftwareRendering) {
|
||||
gstate_c.spline = true;
|
||||
if (gstate_c.spline_count_u != sp_ucount) {
|
||||
gstate_c.Dirty(DIRTY_SPLINECOUNTU);
|
||||
bool countsChanged = gstate_c.spline_count_u != sp_ucount || gstate_c.spline_count_v != sp_vcount;
|
||||
bool typesChanged = gstate_c.spline_type_u != sp_utype || gstate_c.spline_type_v != sp_vtype;
|
||||
if (countsChanged || typesChanged) {
|
||||
gstate_c.Dirty(DIRTY_BEZIERSPLINE);
|
||||
gstate_c.spline_count_u = sp_ucount;
|
||||
}
|
||||
if (gstate_c.spline_count_v != sp_vcount) {
|
||||
gstate_c.Dirty(DIRTY_SPLINECOUNTV);
|
||||
gstate_c.spline_count_v = sp_vcount;
|
||||
}
|
||||
if (gstate_c.spline_type_u != sp_utype) {
|
||||
gstate_c.Dirty(DIRTY_SPLINETYPEU);
|
||||
gstate_c.spline_type_u = sp_utype;
|
||||
}
|
||||
if (gstate_c.spline_type_v != sp_vtype) {
|
||||
gstate_c.Dirty(DIRTY_SPLINETYPEV);
|
||||
gstate_c.spline_type_v = sp_vtype;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-14
@@ -769,9 +769,9 @@ void GPU_GLES::Execute_Bezier(u32 op, u32 diff) {
|
||||
|
||||
if (g_Config.bHardwareTessellation && g_Config.bHardwareTransform && !g_Config.bSoftwareRendering) {
|
||||
gstate_c.bezier = true;
|
||||
if (gstate_c.bezier_count_u != bz_ucount) {
|
||||
gstate_c.Dirty(DIRTY_BEZIERCOUNTU);
|
||||
gstate_c.bezier_count_u = bz_ucount;
|
||||
if (gstate_c.spline_count_u != bz_ucount) {
|
||||
gstate_c.Dirty(DIRTY_BEZIERSPLINE);
|
||||
gstate_c.spline_count_u = bz_ucount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,20 +831,13 @@ void GPU_GLES::Execute_Spline(u32 op, u32 diff) {
|
||||
|
||||
if (g_Config.bHardwareTessellation && g_Config.bHardwareTransform && !g_Config.bSoftwareRendering) {
|
||||
gstate_c.spline = true;
|
||||
if (gstate_c.spline_count_u != sp_ucount) {
|
||||
gstate_c.Dirty(DIRTY_SPLINECOUNTU);
|
||||
bool countsChanged = gstate_c.spline_count_u != sp_ucount || gstate_c.spline_count_v != sp_vcount;
|
||||
bool typesChanged = gstate_c.spline_type_u != sp_utype || gstate_c.spline_type_v != sp_vtype;
|
||||
if (countsChanged || typesChanged) {
|
||||
gstate_c.Dirty(DIRTY_BEZIERSPLINE);
|
||||
gstate_c.spline_count_u = sp_ucount;
|
||||
}
|
||||
if (gstate_c.spline_count_v != sp_vcount) {
|
||||
gstate_c.Dirty(DIRTY_SPLINECOUNTV);
|
||||
gstate_c.spline_count_v = sp_vcount;
|
||||
}
|
||||
if (gstate_c.spline_type_u != sp_utype) {
|
||||
gstate_c.Dirty(DIRTY_SPLINETYPEU);
|
||||
gstate_c.spline_type_u = sp_utype;
|
||||
}
|
||||
if (gstate_c.spline_type_v != sp_vtype) {
|
||||
gstate_c.Dirty(DIRTY_SPLINETYPEV);
|
||||
gstate_c.spline_type_v = sp_vtype;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,11 +292,10 @@ LinkedShader::LinkedShader(ShaderID VSID, Shader *vs, ShaderID FSID, Shader *fs,
|
||||
u_lightpos[i] != -1)
|
||||
availableUniforms |= DIRTY_LIGHT0 << i;
|
||||
}
|
||||
if (u_spline_count_u != -1) availableUniforms |= DIRTY_BEZIERCOUNTU;
|
||||
if (u_spline_count_u != -1) availableUniforms |= DIRTY_SPLINECOUNTU;
|
||||
if (u_spline_count_v != -1) availableUniforms |= DIRTY_SPLINECOUNTV;
|
||||
if (u_spline_type_u != -1) availableUniforms |= DIRTY_SPLINETYPEU;
|
||||
if (u_spline_type_v != -1) availableUniforms |= DIRTY_SPLINETYPEV;
|
||||
if (u_spline_count_u != -1) availableUniforms |= DIRTY_BEZIERSPLINE;
|
||||
if (u_spline_count_v != -1) availableUniforms |= DIRTY_BEZIERSPLINE;
|
||||
if (u_spline_type_u != -1) availableUniforms |= DIRTY_BEZIERSPLINE;
|
||||
if (u_spline_type_v != -1) availableUniforms |= DIRTY_BEZIERSPLINE;
|
||||
|
||||
glUseProgram(program);
|
||||
|
||||
@@ -735,17 +734,13 @@ void LinkedShader::UpdateUniforms(u32 vertType, const ShaderID &vsid) {
|
||||
}
|
||||
}
|
||||
|
||||
if (gstate_c.bezier) {
|
||||
if (dirty & DIRTY_BEZIERCOUNTU)
|
||||
glUniform1i(u_spline_count_u, gstate_c.bezier_count_u);
|
||||
} else if (gstate_c.spline) {
|
||||
if (dirty & DIRTY_SPLINECOUNTU)
|
||||
glUniform1i(u_spline_count_u, gstate_c.spline_count_u);
|
||||
if (dirty & DIRTY_SPLINECOUNTV)
|
||||
if (dirty & DIRTY_BEZIERSPLINE) {
|
||||
glUniform1i(u_spline_count_u, gstate_c.spline_count_u);
|
||||
if (u_spline_count_v != -1)
|
||||
glUniform1i(u_spline_count_v, gstate_c.spline_count_v);
|
||||
if (dirty & DIRTY_SPLINETYPEU)
|
||||
if (u_spline_type_u != -1)
|
||||
glUniform1i(u_spline_type_u, gstate_c.spline_type_u);
|
||||
if (dirty & DIRTY_SPLINETYPEV)
|
||||
if (u_spline_type_v != -1)
|
||||
glUniform1i(u_spline_type_v, gstate_c.spline_type_v);
|
||||
}
|
||||
CHECK_GL_ERROR_IF_DEBUG();
|
||||
|
||||
@@ -553,7 +553,6 @@ struct GPUStateCache {
|
||||
|
||||
bool bezier;
|
||||
bool spline;
|
||||
int bezier_count_u;
|
||||
int spline_count_u;
|
||||
int spline_count_v;
|
||||
int spline_type_u;
|
||||
|
||||
@@ -584,7 +584,7 @@ void GPU_Vulkan::Execute_Bezier(u32 op, u32 diff) {
|
||||
if (g_Config.bHardwareTessellation && g_Config.bHardwareTransform && !g_Config.bSoftwareRendering) {
|
||||
gstate_c.bezier = true;
|
||||
if (gstate_c.spline_count_u != bz_ucount) {
|
||||
gstate_c.Dirty(DIRTY_BEZIERCOUNTU);
|
||||
gstate_c.Dirty(DIRTY_BEZIERSPLINE);
|
||||
gstate_c.spline_count_u = bz_ucount;
|
||||
}
|
||||
}
|
||||
@@ -644,20 +644,13 @@ void GPU_Vulkan::Execute_Spline(u32 op, u32 diff) {
|
||||
|
||||
if (g_Config.bHardwareTessellation && g_Config.bHardwareTransform && !g_Config.bSoftwareRendering) {
|
||||
gstate_c.spline = true;
|
||||
if (gstate_c.spline_count_u != sp_ucount) {
|
||||
gstate_c.Dirty(DIRTY_SPLINECOUNTU);
|
||||
bool countsChanged = gstate_c.spline_count_u != sp_ucount || gstate_c.spline_count_v != sp_vcount;
|
||||
bool typesChanged = gstate_c.spline_type_u != sp_utype || gstate_c.spline_type_v != sp_vtype;
|
||||
if (countsChanged || typesChanged) {
|
||||
gstate_c.Dirty(DIRTY_BEZIERSPLINE);
|
||||
gstate_c.spline_count_u = sp_ucount;
|
||||
}
|
||||
if (gstate_c.spline_count_v != sp_vcount) {
|
||||
gstate_c.Dirty(DIRTY_SPLINECOUNTV);
|
||||
gstate_c.spline_count_v = sp_vcount;
|
||||
}
|
||||
if (gstate_c.spline_type_u != sp_utype) {
|
||||
gstate_c.Dirty(DIRTY_SPLINETYPEU);
|
||||
gstate_c.spline_type_u = sp_utype;
|
||||
}
|
||||
if (gstate_c.spline_type_v != sp_vtype) {
|
||||
gstate_c.Dirty(DIRTY_SPLINETYPEV);
|
||||
gstate_c.spline_type_v = sp_vtype;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user