mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-09 16:31:19 +12:00
Latte+GL+VK: Improve handling of gfx pack texture overwrite format
Graphic packs can overwrite the format of a texture (e.g. for higher bitdepth to lessen banding) but the code for this wasn't correctly working anymore. - Fixes overwrite format being ignored for texture views on Vulkan backend - Fixes overwrite format not being used for texture views on OpenGL Format aliasing is complicated enough as it is, even without overwrites, so this adds a new rule to make behavior more well defined: If two textures share memory but only one uses an overwrite format, then they are no longer synchronized and are considered separate textures. Bonus fixes for OpenGL: - Use fbo 0 instead of -1 as the default. This silences some warnings in debug output - On OpenGL, bind new framebuffers on handle generation so they are considered created
This commit is contained in:
parent
8bc444bb97
commit
bc04662525
6 changed files with 48 additions and 25 deletions
|
@ -55,12 +55,16 @@ LatteTextureViewGL::~LatteTextureViewGL()
|
|||
void LatteTextureViewGL::InitAliasView()
|
||||
{
|
||||
const auto texture = (LatteTextureGL*)baseTexture;
|
||||
// get internal format
|
||||
if (baseTexture->isDepth)
|
||||
// compute internal format
|
||||
if(texture->overwriteInfo.hasFormatOverwrite)
|
||||
{
|
||||
cemu_assert_debug(format == texture->format);
|
||||
glInternalFormat = texture->glInternalFormat; // for format overwrite no aliasing is allowed and thus we always inherit the internal format of the base texture
|
||||
}
|
||||
else if (baseTexture->isDepth)
|
||||
{
|
||||
// depth is handled differently
|
||||
cemuLog_logDebug(LogType::Force, "Creating depth view");
|
||||
cemu_assert(format == texture->format); // todo
|
||||
cemu_assert(format == texture->format); // is depth alias with different format intended?
|
||||
glInternalFormat = texture->glInternalFormat;
|
||||
}
|
||||
else
|
||||
|
@ -73,7 +77,7 @@ void LatteTextureViewGL::InitAliasView()
|
|||
catchOpenGLError();
|
||||
if (firstMip >= texture->maxPossibleMipLevels)
|
||||
{
|
||||
cemuLog_logDebug(LogType::Force, "_createNewView: Out of bounds mip level requested");
|
||||
cemuLog_logDebug(LogType::Force, "InitAliasView(): Out of bounds mip level requested");
|
||||
glTextureView(glTexId, glTexTarget, texture->glId_texture, glInternalFormat, texture->maxPossibleMipLevels - 1, numMip, firstSlice, this->numSlice);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue