video_core: renderer_opengl: addressed comments...
use indexing to make code more concise; use const bool instead of bool
This commit is contained in:
parent
476df9debf
commit
71b0eab85c
1 changed files with 10 additions and 10 deletions
|
@ -730,7 +730,7 @@ void RasterizerCacheOpenGL::CopySurface(const Surface& src_surface, const Surfac
|
||||||
MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 192, 64));
|
MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 192, 64));
|
||||||
void CachedSurface::LoadGLBuffer(PAddr load_start, PAddr load_end) {
|
void CachedSurface::LoadGLBuffer(PAddr load_start, PAddr load_end) {
|
||||||
ASSERT(type != SurfaceType::Fill);
|
ASSERT(type != SurfaceType::Fill);
|
||||||
bool need_swap =
|
const bool need_swap =
|
||||||
GLES && (pixel_format == PixelFormat::RGBA8 || pixel_format == PixelFormat::RGB8);
|
GLES && (pixel_format == PixelFormat::RGBA8 || pixel_format == PixelFormat::RGB8);
|
||||||
|
|
||||||
const u8* const texture_src_data = VideoCore::g_memory->GetPhysicalPointer(addr);
|
const u8* const texture_src_data = VideoCore::g_memory->GetPhysicalPointer(addr);
|
||||||
|
@ -760,17 +760,17 @@ void CachedSurface::LoadGLBuffer(PAddr load_start, PAddr load_end) {
|
||||||
// TODO(liushuyu): check if the byteswap here is 100% correct
|
// TODO(liushuyu): check if the byteswap here is 100% correct
|
||||||
// cannot fully test this
|
// cannot fully test this
|
||||||
if (pixel_format == PixelFormat::RGBA8) {
|
if (pixel_format == PixelFormat::RGBA8) {
|
||||||
for (size_t i = start_offset; i < load_end - addr; i += 4) {
|
for (std::size_t i = start_offset; i < load_end - addr; i += 4) {
|
||||||
gl_buffer[i] = *(texture_src_data + i + 3);
|
gl_buffer[i] = texture_src_data[i + 3];
|
||||||
gl_buffer[i + 1] = *(texture_src_data + i + 2);
|
gl_buffer[i + 1] = texture_src_data[i + 2];
|
||||||
gl_buffer[i + 2] = *(texture_src_data + i + 1);
|
gl_buffer[i + 2] = texture_src_data[i + 1];
|
||||||
gl_buffer[i + 3] = *(texture_src_data + i);
|
gl_buffer[i + 3] = texture_src_data[i];
|
||||||
}
|
}
|
||||||
} else if (pixel_format == PixelFormat::RGB8) {
|
} else if (pixel_format == PixelFormat::RGB8) {
|
||||||
for (size_t i = start_offset; i < load_end - addr; i += 3) {
|
for (std::size_t i = start_offset; i < load_end - addr; i += 3) {
|
||||||
gl_buffer[i] = *(texture_src_data + i + 2);
|
gl_buffer[i] = texture_src_data[i + 2];
|
||||||
gl_buffer[i + 1] = *(texture_src_data + i + 1);
|
gl_buffer[i + 1] = texture_src_data[i + 1];
|
||||||
gl_buffer[i + 2] = *(texture_src_data + i);
|
gl_buffer[i + 2] = texture_src_data[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue