mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 06:21:26 +12:00
gl: Fixup for D24S8 readback
This commit is contained in:
parent
9c64318e8a
commit
35e61c77e0
2 changed files with 40 additions and 13 deletions
|
@ -380,7 +380,7 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool sk
|
||||||
const auto depth_format_gl = rsx::internals::surface_depth_format_to_gl(surface->get_surface_depth_format());
|
const auto depth_format_gl = rsx::internals::surface_depth_format_to_gl(surface->get_surface_depth_format());
|
||||||
format = depth_format_gl.format;
|
format = depth_format_gl.format;
|
||||||
type = depth_format_gl.type;
|
type = depth_format_gl.type;
|
||||||
swap_bytes = true;
|
swap_bytes = (type != gl::texture::type::uint_24_8);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
@ -357,24 +357,51 @@ namespace gl
|
||||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, GL_NONE);
|
glBindBuffer(GL_PIXEL_PACK_BUFFER, GL_NONE);
|
||||||
|
|
||||||
// Shuffle
|
|
||||||
bool require_manual_shuffle = false;
|
|
||||||
if (pack_unpack_swap_bytes)
|
|
||||||
{
|
|
||||||
if (type == gl::texture::type::sbyte || type == gl::texture::type::ubyte)
|
|
||||||
require_manual_shuffle = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto valid_range = get_confirmed_range_delta();
|
const auto valid_range = get_confirmed_range_delta();
|
||||||
const u32 valid_offset = valid_range.first;
|
const u32 valid_offset = valid_range.first;
|
||||||
const u32 valid_length = valid_range.second;
|
const u32 valid_length = valid_range.second;
|
||||||
void *dst = get_ptr(get_section_base() + valid_offset);
|
void *dst = get_ptr(get_section_base() + valid_offset);
|
||||||
|
|
||||||
if (require_manual_shuffle)
|
if (pack_unpack_swap_bytes)
|
||||||
|
{
|
||||||
|
// Shuffle
|
||||||
|
// TODO: Do this with a compute shader
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case gl::texture::type::sbyte:
|
||||||
|
case gl::texture::type::ubyte:
|
||||||
|
{
|
||||||
|
if (pack_unpack_swap_bytes)
|
||||||
{
|
{
|
||||||
// byte swapping does not work on byte types, use uint_8_8_8_8 for rgba8 instead to avoid penalty
|
// byte swapping does not work on byte types, use uint_8_8_8_8 for rgba8 instead to avoid penalty
|
||||||
rsx::shuffle_texel_data_wzyx<u8>(dst, rsx_pitch, width, align(valid_length, rsx_pitch) / rsx_pitch);
|
rsx::shuffle_texel_data_wzyx<u8>(dst, rsx_pitch, width, align(valid_length, rsx_pitch) / rsx_pitch);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case gl::texture::type::uint_24_8:
|
||||||
|
{
|
||||||
|
verify(HERE), pack_unpack_swap_bytes == false;
|
||||||
|
verify(HERE), real_pitch == (width * 4);
|
||||||
|
if (LIKELY(rsx_pitch == real_pitch))
|
||||||
|
{
|
||||||
|
rsx::convert_le_d24x8_to_be_d24x8(dst, dst, valid_length / 4, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const u32 num_rows = align(valid_length, rsx_pitch) / rsx_pitch;
|
||||||
|
u8* data = static_cast<u8*>(dst);
|
||||||
|
for (u32 row = 0; row < num_rows; ++row)
|
||||||
|
{
|
||||||
|
rsx::convert_le_d24x8_to_be_d24x8(data, data, width, 1);
|
||||||
|
data += rsx_pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (context == rsx::texture_upload_context::framebuffer_storage)
|
if (context == rsx::texture_upload_context::framebuffer_storage)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue