Skip to content

Commit

Permalink
Removed AA and changed filtering to Nearest in MiniMap
Browse files Browse the repository at this point in the history
  • Loading branch information
bcdrme committed Jan 14, 2025
1 parent bc1e79f commit e517e43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 39 deletions.
45 changes: 7 additions & 38 deletions rts/Game/UI/MiniMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,48 +1071,23 @@ void CMiniMap::ResizeTextureCache()
{
RECOIL_DETAILED_TRACY_ZONE;
minimapTexSize = curDim;
multisampledFBO = (FBO::GetMaxSamples() > 1);

if (multisampledFBO) {
// multisampled FBO we are render to
fbo.Detach(GL_COLOR_ATTACHMENT0_EXT); // delete old RBO
fbo.CreateRenderBufferMultisample(GL_COLOR_ATTACHMENT0_EXT, GL_RGBA8, minimapTexSize.x, minimapTexSize.y, 4);
//fbo.CreateRenderBuffer(GL_DEPTH_ATTACHMENT_EXT, GL_DEPTH_COMPONENT16, minimapTexSize.x, minimapTexSize.y);

if (!fbo.CheckStatus("MINIMAP")) {
fbo.Detach(GL_COLOR_ATTACHMENT0_EXT);
multisampledFBO = false;
}
}

glDeleteTextures(1, &minimapTex);
glGenTextures(1, &minimapTex);

glBindTexture(GL_TEXTURE_2D, minimapTex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, minimapTexSize.x, minimapTexSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);

if (multisampledFBO) {
// resolve FBO with attached final texture target
fboResolve.Bind();
fboResolve.AttachTexture(minimapTex);

if (!fboResolve.CheckStatus("MINIMAP-RESOLVE")) {
renderToTexture = false;
return;
}
} else {
// directly render to texture without multisampling (fallback solution)
fbo.Bind();
fbo.AttachTexture(minimapTex);
fbo.Bind();
fbo.AttachTexture(minimapTex);

if (!fbo.CheckStatus("MINIMAP-RESOLVE")) {
renderToTexture = false;
return;
}
if (!fbo.CheckStatus("MINIMAP-RESOLVE")) {
renderToTexture = false;
return;
}
}

Expand Down Expand Up @@ -1145,12 +1120,6 @@ void CMiniMap::UpdateTextureCache()
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();

// resolve multisampled FBO if there is one
if (multisampledFBO) {
const std::array rect = { 0, 0, minimapTexSize.x, minimapTexSize.y };
FBO::Blit(fbo.fboId, fboResolve.fboId, rect, rect, GL_COLOR_BUFFER_BIT, GL_LINEAR);
}
}


Expand Down
1 change: 0 additions & 1 deletion rts/Game/UI/MiniMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ class CMiniMap : public CInputReceiver {
CMatrix44f projMats[3];

FBO fbo;
FBO fboResolve;
GLuint minimapTex = 0;
int2 minimapTexSize;

Expand Down

0 comments on commit e517e43

Please sign in to comment.