mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
Expose the experimental "bPrescaleUV" as "Texture Coord Speedhack"
It's actually quite beneficial in some games, can substantially reduce glUniform4fv calls. Also throw in a second shot at glDrawRangeElements.
This commit is contained in:
parent
7a0b1e40c6
commit
4c2c015774
@ -242,8 +242,8 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename)
|
||||
debugConfig->Get("ShowBottomTabTitles",&bShowBottomTabTitles,true);
|
||||
debugConfig->Get("ShowDeveloperMenu", &bShowDeveloperMenu, false);
|
||||
|
||||
IniFile::Section *gleshacks = iniFile.GetOrCreateSection("GLESHacks");
|
||||
gleshacks->Get("PrescaleUV", &bPrescaleUV, false);
|
||||
IniFile::Section *speedhacks = iniFile.GetOrCreateSection("SpeedHacks");
|
||||
speedhacks->Get("PrescaleUV", &bPrescaleUV, false);
|
||||
|
||||
INFO_LOG(LOADER, "Loading controller config: %s", controllerIniFilename_.c_str());
|
||||
bSaveSettings = true;
|
||||
@ -399,6 +399,9 @@ void Config::Save() {
|
||||
debugConfig->Set("ShowBottomTabTitles",bShowBottomTabTitles);
|
||||
debugConfig->Set("ShowDeveloperMenu", bShowDeveloperMenu);
|
||||
|
||||
IniFile::Section *speedhacks = iniFile.GetOrCreateSection("SpeedHacks");
|
||||
speedhacks->Set("PrescaleUV", bPrescaleUV);
|
||||
|
||||
if (!iniFile.Save(iniFilename_.c_str())) {
|
||||
ERROR_LOG(LOADER, "Error saving config - can't write ini %s", iniFilename_.c_str());
|
||||
return;
|
||||
|
@ -977,8 +977,10 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
|
||||
case GE_CMD_TEXADDR5:
|
||||
case GE_CMD_TEXADDR6:
|
||||
case GE_CMD_TEXADDR7:
|
||||
gstate_c.textureChanged = true;
|
||||
shaderManager_->DirtyUniform(DIRTY_UVSCALEOFFSET);
|
||||
if (diff) {
|
||||
gstate_c.textureChanged = true;
|
||||
shaderManager_->DirtyUniform(DIRTY_UVSCALEOFFSET);
|
||||
}
|
||||
break;
|
||||
|
||||
case GE_CMD_TEXBUFWIDTH0:
|
||||
@ -989,13 +991,17 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
|
||||
case GE_CMD_TEXBUFWIDTH5:
|
||||
case GE_CMD_TEXBUFWIDTH6:
|
||||
case GE_CMD_TEXBUFWIDTH7:
|
||||
gstate_c.textureChanged = true;
|
||||
if (diff) {
|
||||
gstate_c.textureChanged = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case GE_CMD_CLUTADDR:
|
||||
case GE_CMD_CLUTADDRUPPER:
|
||||
case GE_CMD_CLUTFORMAT:
|
||||
gstate_c.textureChanged = true;
|
||||
if (diff) {
|
||||
gstate_c.textureChanged = true;
|
||||
}
|
||||
// This could be used to "dirty" textures with clut.
|
||||
break;
|
||||
|
||||
|
@ -93,8 +93,12 @@ LinkedShader::LinkedShader(Shader *vs, Shader *fs, u32 vertType, bool useHWTrans
|
||||
|
||||
glLinkProgram(program);
|
||||
|
||||
// Detaching shaders is annoying when debugging with gDebugger
|
||||
// so let's not do that on Windows.
|
||||
#ifdef USING_GLES
|
||||
glDetachShader(program, vs->shader);
|
||||
glDetachShader(program, fs->shader);
|
||||
#endif
|
||||
|
||||
GLint linkStatus = GL_FALSE;
|
||||
glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
|
||||
@ -197,6 +201,7 @@ LinkedShader::LinkedShader(Shader *vs, Shader *fs, u32 vertType, bool useHWTrans
|
||||
}
|
||||
|
||||
LinkedShader::~LinkedShader() {
|
||||
// Shaders are automatically detached by glDeleteProgram.
|
||||
glDeleteProgram(program);
|
||||
}
|
||||
|
||||
|
@ -794,11 +794,11 @@ void TransformDrawEngine::SoftwareTransformAndDraw(
|
||||
if (attrMask & (1 << ATTR_COLOR0)) glVertexAttribPointer(ATTR_COLOR0, 4, GL_UNSIGNED_BYTE, GL_TRUE, vertexSize, ((uint8_t*)drawBuffer) + 7 * 4);
|
||||
if (attrMask & (1 << ATTR_COLOR1)) glVertexAttribPointer(ATTR_COLOR1, 3, GL_UNSIGNED_BYTE, GL_TRUE, vertexSize, ((uint8_t*)drawBuffer) + 8 * 4);
|
||||
if (drawIndexed) {
|
||||
//#ifdef USING_GLES2
|
||||
#ifdef USING_GLES2
|
||||
glDrawElements(glprim[prim], numTrans, GL_UNSIGNED_SHORT, inds);
|
||||
//#else
|
||||
// glDrawRangeElements(glprim[prim], 0, indexGen.MaxIndex(), numTrans, GL_UNSIGNED_SHORT, inds);
|
||||
//#endif
|
||||
#else
|
||||
glDrawRangeElements(glprim[prim], 0, indexGen.MaxIndex(), numTrans, GL_UNSIGNED_SHORT, inds);
|
||||
#endif
|
||||
} else {
|
||||
glDrawArrays(glprim[prim], 0, numTrans);
|
||||
}
|
||||
@ -1066,6 +1066,7 @@ void TransformDrawEngine::DoFlush() {
|
||||
if (program->useHWTransform_) {
|
||||
GLuint vbo = 0, ebo = 0;
|
||||
int vertexCount = 0;
|
||||
int maxIndex = 0;
|
||||
bool useElements = true;
|
||||
// Cannot cache vertex data with morph enabled.
|
||||
if (g_Config.bVertexCache && !(lastVType_ & GE_VTYPE_MORPHCOUNT_MASK)) {
|
||||
@ -1091,6 +1092,7 @@ void TransformDrawEngine::DoFlush() {
|
||||
DecodeVerts(); // writes to indexGen
|
||||
vai->numVerts = indexGen.VertexCount();
|
||||
vai->prim = indexGen.Prim();
|
||||
vai->maxIndex = indexGen.MaxIndex();
|
||||
goto rotateVBO;
|
||||
}
|
||||
|
||||
@ -1137,10 +1139,12 @@ void TransformDrawEngine::DoFlush() {
|
||||
DecodeVerts();
|
||||
vai->numVerts = indexGen.VertexCount();
|
||||
vai->prim = indexGen.Prim();
|
||||
vai->maxIndex = indexGen.MaxIndex();
|
||||
useElements = !indexGen.SeenOnlyPurePrims();
|
||||
if (!useElements && indexGen.PureCount()) {
|
||||
vai->numVerts = indexGen.PureCount();
|
||||
}
|
||||
|
||||
glGenBuffers(1, &vai->vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vai->vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, dec_->GetDecVtxFmt().stride * indexGen.MaxIndex(), decoded, GL_STATIC_DRAW);
|
||||
@ -1166,6 +1170,7 @@ void TransformDrawEngine::DoFlush() {
|
||||
vbo = vai->vbo;
|
||||
ebo = vai->ebo;
|
||||
vertexCount = vai->numVerts;
|
||||
maxIndex = vai->maxIndex;
|
||||
prim = static_cast<GEPrimitiveType>(vai->prim);
|
||||
break;
|
||||
}
|
||||
@ -1185,6 +1190,7 @@ void TransformDrawEngine::DoFlush() {
|
||||
if (ebo)
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
|
||||
vertexCount = vai->numVerts;
|
||||
maxIndex = vai->maxIndex;
|
||||
prim = static_cast<GEPrimitiveType>(vai->prim);
|
||||
break;
|
||||
}
|
||||
@ -1207,6 +1213,7 @@ rotateVBO:
|
||||
gpuStats.numUncachedVertsDrawn += indexGen.VertexCount();
|
||||
useElements = !indexGen.SeenOnlyPurePrims();
|
||||
vertexCount = indexGen.VertexCount();
|
||||
maxIndex = indexGen.MaxIndex();
|
||||
if (!useElements && indexGen.PureCount()) {
|
||||
vertexCount = indexGen.PureCount();
|
||||
}
|
||||
@ -1220,11 +1227,11 @@ rotateVBO:
|
||||
|
||||
SetupDecFmtForDraw(program, dec_->GetDecVtxFmt(), vbo ? 0 : decoded);
|
||||
if (useElements) {
|
||||
//#ifdef USING_GLES2
|
||||
#ifdef USING_GLES2
|
||||
glDrawElements(glprim[prim], vertexCount, GL_UNSIGNED_SHORT, ebo ? 0 : (GLvoid*)decIndex);
|
||||
//#else
|
||||
// glDrawRangeElements(glprim[prim], 0, indexGen.MaxIndex(), vertexCount, GL_UNSIGNED_SHORT, ebo ? 0 : (GLvoid*)decIndex);
|
||||
//#endif
|
||||
#else
|
||||
glDrawRangeElements(glprim[prim], 0, maxIndex, vertexCount, GL_UNSIGNED_SHORT, ebo ? 0 : (GLvoid*)decIndex);
|
||||
#endif
|
||||
if (ebo)
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
} else {
|
||||
|
@ -80,6 +80,7 @@ public:
|
||||
|
||||
// Precalculated parameter for drawdrawElements
|
||||
u16 numVerts;
|
||||
u16 maxIndex;
|
||||
s8 prim;
|
||||
|
||||
// ID information
|
||||
|
@ -164,6 +164,7 @@ void GameSettingsScreen::CreateViews() {
|
||||
graphicsSettings->Add(new ItemHeader(gs->T("Hack Settings")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bDisableStencilTest, gs->T("Disable Stencil Test")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bAlwaysDepthWrite, gs->T("Always Depth Write")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bPrescaleUV, gs->T("Texture Coord Speedhack")));
|
||||
|
||||
// Developer tools are not accessible ingame, so it goes here.
|
||||
graphicsSettings->Add(new ItemHeader(gs->T("Debugging")));
|
||||
|
Loading…
Reference in New Issue
Block a user