mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-23 18:19:21 +01:00
gl_rasterizer_cache: Make use of if constexpr in MortonCopyTile()
A trivial change that allows compilers to more rigorously optimize out code blocks that will never be executed in some scenarios.
This commit is contained in:
parent
36809b2e2e
commit
38c8fecb81
@ -174,8 +174,8 @@ static void MortonCopyTile(u32 stride, u8* tile_buffer, u8* gl_buffer) {
|
|||||||
for (u32 x = 0; x < 8; ++x) {
|
for (u32 x = 0; x < 8; ++x) {
|
||||||
u8* tile_ptr = tile_buffer + VideoCore::MortonInterleave(x, y) * bytes_per_pixel;
|
u8* tile_ptr = tile_buffer + VideoCore::MortonInterleave(x, y) * bytes_per_pixel;
|
||||||
u8* gl_ptr = gl_buffer + ((7 - y) * stride + x) * gl_bytes_per_pixel;
|
u8* gl_ptr = gl_buffer + ((7 - y) * stride + x) * gl_bytes_per_pixel;
|
||||||
if (morton_to_gl) {
|
if constexpr (morton_to_gl) {
|
||||||
if (format == PixelFormat::D24S8) {
|
if constexpr (format == PixelFormat::D24S8) {
|
||||||
gl_ptr[0] = tile_ptr[3];
|
gl_ptr[0] = tile_ptr[3];
|
||||||
std::memcpy(gl_ptr + 1, tile_ptr, 3);
|
std::memcpy(gl_ptr + 1, tile_ptr, 3);
|
||||||
} else if (format == PixelFormat::RGBA8 && GLES) {
|
} else if (format == PixelFormat::RGBA8 && GLES) {
|
||||||
@ -193,7 +193,7 @@ static void MortonCopyTile(u32 stride, u8* tile_buffer, u8* gl_buffer) {
|
|||||||
std::memcpy(gl_ptr, tile_ptr, bytes_per_pixel);
|
std::memcpy(gl_ptr, tile_ptr, bytes_per_pixel);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (format == PixelFormat::D24S8) {
|
if constexpr (format == PixelFormat::D24S8) {
|
||||||
std::memcpy(tile_ptr, gl_ptr + 1, 3);
|
std::memcpy(tile_ptr, gl_ptr + 1, 3);
|
||||||
tile_ptr[3] = gl_ptr[0];
|
tile_ptr[3] = gl_ptr[0];
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user