mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-08-25 17:47:17 +02:00
gl_texture_cache: Round format conversion PBO to next power of 2
This commit is contained in:
parent
20ed7ba441
commit
f7e155d8b9
@ -396,6 +396,10 @@ OGLTexture MakeImage(const VideoCommon::ImageInfo& info, GLenum gl_internal_form
|
|||||||
UNREACHABLE_MSG("Invalid image format={}", format);
|
UNREACHABLE_MSG("Invalid image format={}", format);
|
||||||
return GL_R32UI;
|
return GL_R32UI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] u32 NextPow2(u32 value) {
|
||||||
|
return 1U << (32U - std::countl_zero(value - 1U));
|
||||||
|
}
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
ImageBufferMap::~ImageBufferMap() {
|
ImageBufferMap::~ImageBufferMap() {
|
||||||
@ -1304,7 +1308,7 @@ void FormatConversionPass::ConvertImage(Image& dst_image, Image& src_image,
|
|||||||
const u32 copy_size = region.width * region.height * region.depth * img_bpp;
|
const u32 copy_size = region.width * region.height * region.depth * img_bpp;
|
||||||
if (pbo_size < copy_size) {
|
if (pbo_size < copy_size) {
|
||||||
intermediate_pbo.Create();
|
intermediate_pbo.Create();
|
||||||
pbo_size = copy_size;
|
pbo_size = NextPow2(copy_size);
|
||||||
glNamedBufferData(intermediate_pbo.handle, pbo_size, nullptr, GL_STREAM_COPY);
|
glNamedBufferData(intermediate_pbo.handle, pbo_size, nullptr, GL_STREAM_COPY);
|
||||||
}
|
}
|
||||||
// Copy from source to PBO
|
// Copy from source to PBO
|
||||||
|
Loading…
Reference in New Issue
Block a user