diff --git a/src/xenia/gpu/gl4/gl4_command_processor.cc b/src/xenia/gpu/gl4/gl4_command_processor.cc index 2305b38b4..ab186b798 100644 --- a/src/xenia/gpu/gl4/gl4_command_processor.cc +++ b/src/xenia/gpu/gl4/gl4_command_processor.cc @@ -1968,20 +1968,6 @@ GLuint GL4CommandProcessor::GetColorRenderTarget( format = ColorRenderTargetFormat::k_8_8_8_8; } - for (auto it = cached_color_render_targets_.begin(); - it != cached_color_render_targets_.end(); ++it) { - if (it->base == base && it->width == width && it->height == height && - it->format == format) { - return it->texture; - } - } - cached_color_render_targets_.push_back(CachedColorRenderTarget()); - auto cached = &cached_color_render_targets_.back(); - cached->base = base; - cached->width = width; - cached->height = height; - cached->format = format; - GLenum internal_format; switch (format) { case ColorRenderTargetFormat::k_8_8_8_8: @@ -2019,6 +2005,21 @@ GLuint GL4CommandProcessor::GetColorRenderTarget( return 0; } + for (auto it = cached_color_render_targets_.begin(); + it != cached_color_render_targets_.end(); ++it) { + if (it->base == base && it->width == width && it->height == height && + it->internal_format == internal_format) { + return it->texture; + } + } + cached_color_render_targets_.push_back(CachedColorRenderTarget()); + auto cached = &cached_color_render_targets_.back(); + cached->base = base; + cached->width = width; + cached->height = height; + cached->format = format; + cached->internal_format = internal_format; + glCreateTextures(GL_TEXTURE_2D, 1, &cached->texture); glTextureStorage2D(cached->texture, 1, internal_format, width, height); @@ -2031,20 +2032,6 @@ GLuint GL4CommandProcessor::GetDepthRenderTarget( uint32_t width = 2560; uint32_t height = 2560; - for (auto it = cached_depth_render_targets_.begin(); - it != cached_depth_render_targets_.end(); ++it) { - if (it->base == base && it->width == width && it->height == height && - it->format == format) { - return it->texture; - } - } - cached_depth_render_targets_.push_back(CachedDepthRenderTarget()); - auto cached = &cached_depth_render_targets_.back(); - cached->base = base; - cached->width = width; - cached->height = height; - cached->format = format; - GLenum internal_format; switch (format) { case DepthRenderTargetFormat::kD24S8: @@ -2059,6 +2046,21 @@ GLuint GL4CommandProcessor::GetDepthRenderTarget( return 0; } + for (auto it = cached_depth_render_targets_.begin(); + it != cached_depth_render_targets_.end(); ++it) { + if (it->base == base && it->width == width && it->height == height && + it->format == format) { + return it->texture; + } + } + cached_depth_render_targets_.push_back(CachedDepthRenderTarget()); + auto cached = &cached_depth_render_targets_.back(); + cached->base = base; + cached->width = width; + cached->height = height; + cached->format = format; + cached->internal_format = internal_format; + glCreateTextures(GL_TEXTURE_2D, 1, &cached->texture); glTextureStorage2D(cached->texture, 1, internal_format, width, height); diff --git a/src/xenia/gpu/gl4/gl4_command_processor.h b/src/xenia/gpu/gl4/gl4_command_processor.h index 1ebd12a1e..702e9fc45 100644 --- a/src/xenia/gpu/gl4/gl4_command_processor.h +++ b/src/xenia/gpu/gl4/gl4_command_processor.h @@ -74,6 +74,7 @@ class GL4CommandProcessor : public CommandProcessor { uint32_t width; uint32_t height; ColorRenderTargetFormat format; + GLenum internal_format; GLuint texture; }; struct CachedDepthRenderTarget { @@ -81,6 +82,7 @@ class GL4CommandProcessor : public CommandProcessor { uint32_t width; uint32_t height; DepthRenderTargetFormat format; + GLenum internal_format; GLuint texture; }; struct CachedPipeline {