mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-25 16:24:53 +02:00
GLES: Use aligned memory for textures.
We use SSE on them, and they used to be aligned, and must be aligned in PSP RAM, so keep them aligned. This only really affects 32-bit, since allocs will typically be aligned on 64-bit anyway. Fixes #10601.
This commit is contained in:
@@ -95,7 +95,7 @@ GLRTexture *DepalShaderCacheGLES::GetClutTexture(GEPaletteFormat clutFormat, con
|
||||
|
||||
uint8_t *clutCopy = new uint8_t[1024];
|
||||
memcpy(clutCopy, rawClut, 1024);
|
||||
render_->TextureImage(tex->texture, 0, texturePixels, 1, components, components2, dstFmt, clutCopy, false);
|
||||
render_->TextureImage(tex->texture, 0, texturePixels, 1, components, components2, dstFmt, clutCopy, GLRAllocType::NEW, false);
|
||||
|
||||
tex->lastFrame = gpuStats.numFlips;
|
||||
texCache_[clutId] = tex;
|
||||
|
||||
@@ -777,7 +777,7 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
|
||||
uint8_t *pos_data = new uint8_t[size * sizeof(float) * 4];
|
||||
memcpy(pos_data, pos, size * sizeof(float) * 4);
|
||||
data_tex[0] = renderManager_->CreateTexture(GL_TEXTURE_2D);
|
||||
renderManager_->TextureImage(data_tex[0], 0, size, 1, GL_RGBA32F, GL_RGBA, GL_FLOAT, pos_data, false);
|
||||
renderManager_->TextureImage(data_tex[0], 0, size, 1, GL_RGBA32F, GL_RGBA, GL_FLOAT, pos_data, GLRAllocType::NEW, false);
|
||||
renderManager_->FinalizeTexture(data_tex[0], 0, false);
|
||||
renderManager_->BindTexture(4, data_tex[0]);
|
||||
|
||||
@@ -788,7 +788,7 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
|
||||
uint8_t *tex_data = new uint8_t[size * sizeof(float) * 4];
|
||||
memcpy(tex_data, pos, size * sizeof(float) * 4);
|
||||
data_tex[1] = renderManager_->CreateTexture(GL_TEXTURE_2D);
|
||||
renderManager_->TextureImage(data_tex[1], 0, size, 1, GL_RGBA32F, GL_RGBA, GL_FLOAT, tex_data, false);
|
||||
renderManager_->TextureImage(data_tex[1], 0, size, 1, GL_RGBA32F, GL_RGBA, GL_FLOAT, tex_data, GLRAllocType::NEW, false);
|
||||
renderManager_->FinalizeTexture(data_tex[1], 0, false);
|
||||
renderManager_->BindTexture(5, data_tex[1]);
|
||||
}
|
||||
@@ -800,7 +800,7 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
|
||||
uint8_t *col_data = new uint8_t[sizeColor * sizeof(float) * 4];
|
||||
memcpy(col_data, col, sizeColor * sizeof(float) * 4);
|
||||
|
||||
renderManager_->TextureImage(data_tex[2], 0, sizeColor, 1, GL_RGBA32F, GL_RGBA, GL_FLOAT, col_data, false);
|
||||
renderManager_->TextureImage(data_tex[2], 0, sizeColor, 1, GL_RGBA32F, GL_RGBA, GL_FLOAT, col_data, GLRAllocType::NEW, false);
|
||||
renderManager_->FinalizeTexture(data_tex[2], 0, false);
|
||||
renderManager_->BindTexture(6, data_tex[2]);
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ void FramebufferManagerGLES::MakePixelTexture(const u8 *srcPixels, GEBufferForma
|
||||
break;
|
||||
}
|
||||
}
|
||||
render_->TextureImage(drawPixelsTex_, 0, texWidth, height, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, convBuf, false);
|
||||
render_->TextureImage(drawPixelsTex_, 0, texWidth, height, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, convBuf, GLRAllocType::NEW, false);
|
||||
render_->FinalizeTexture(drawPixelsTex_, 0, false);
|
||||
|
||||
// TODO: Return instead?
|
||||
|
||||
@@ -714,7 +714,7 @@ u8 *TextureCacheGLES::DecodeTextureLevelOld(GETextureFormat format, GEPaletteFor
|
||||
decPitch = bufw * pixelSize;
|
||||
}
|
||||
|
||||
uint8_t *texBuf = new uint8_t[std::max(w, bufw) * h * pixelSize];
|
||||
uint8_t *texBuf = (uint8_t *)AllocateAlignedMemory(std::max(w, bufw) * h * pixelSize, 16);
|
||||
DecodeTextureLevel(texBuf, decPitch, format, clutformat, texaddr, level, bufw, true, false, false);
|
||||
return texBuf;
|
||||
}
|
||||
@@ -755,7 +755,7 @@ void TextureCacheGLES::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &r
|
||||
PROFILE_THIS_SCOPE("replacetex");
|
||||
|
||||
int bpp = replaced.Format(level) == ReplacedTextureFormat::F_8888 ? 4 : 2;
|
||||
uint8_t *rearrange = new uint8_t[w * h * bpp];
|
||||
uint8_t *rearrange = (uint8_t *)AllocateAlignedMemory(w * h * bpp, 16);
|
||||
replaced.Load(level, rearrange, bpp * w);
|
||||
pixelData = rearrange;
|
||||
|
||||
@@ -785,7 +785,7 @@ void TextureCacheGLES::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &r
|
||||
}
|
||||
|
||||
if (scaleFactor > 1) {
|
||||
uint8_t *rearrange = new uint8_t[w * scaleFactor * h * scaleFactor * 4];
|
||||
uint8_t *rearrange = (uint8_t *)AllocateAlignedMemory(w * scaleFactor * h * scaleFactor * 4, 16);
|
||||
scaler.ScaleAlways((u32 *)rearrange, (u32 *)pixelData, dstFmt, w, h, scaleFactor);
|
||||
pixelData = rearrange;
|
||||
delete [] finalBuf;
|
||||
@@ -817,9 +817,9 @@ void TextureCacheGLES::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &r
|
||||
} else {
|
||||
PROFILE_THIS_SCOPE("loadtex");
|
||||
if (IsFakeMipmapChange())
|
||||
render_->TextureImage(entry.textureName, 0, w, h, components, components2, dstFmt, pixelData);
|
||||
render_->TextureImage(entry.textureName, 0, w, h, components, components2, dstFmt, pixelData, GLRAllocType::ALIGNED);
|
||||
else
|
||||
render_->TextureImage(entry.textureName, level, w, h, components, components2, dstFmt, pixelData);
|
||||
render_->TextureImage(entry.textureName, level, w, h, components, components2, dstFmt, pixelData, GLRAllocType::ALIGNED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user