diff options
author | bunnei <bunneidev@gmail.com> | 2018-09-30 20:28:36 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-09-30 21:10:14 +0200 |
commit | df3799a00899a76a0b4adc9f93af403101b2332d (patch) | |
tree | bd3b39861e43814cfab9c917fbacaff63fc94394 /src | |
parent | gl_rasterizer_cache: Add check for array rendering to cubemap texture. (diff) | |
download | yuzu-df3799a00899a76a0b4adc9f93af403101b2332d.tar yuzu-df3799a00899a76a0b4adc9f93af403101b2332d.tar.gz yuzu-df3799a00899a76a0b4adc9f93af403101b2332d.tar.bz2 yuzu-df3799a00899a76a0b4adc9f93af403101b2332d.tar.lz yuzu-df3799a00899a76a0b4adc9f93af403101b2332d.tar.xz yuzu-df3799a00899a76a0b4adc9f93af403101b2332d.tar.zst yuzu-df3799a00899a76a0b4adc9f93af403101b2332d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 14 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 23 |
2 files changed, 5 insertions, 32 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 249b0061a..ce967c4d6 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -1058,9 +1058,6 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& old_surface, } break; case SurfaceParams::SurfaceTarget::TextureCubemap: { - const u32 byte_stride{old_params.rt.layer_stride * - (SurfaceParams::GetFormatBpp(old_params.pixel_format) / CHAR_BIT)}; - if (old_params.rt.array_mode != 1) { // TODO(bunnei): This is used by Breath of the Wild, I'm not sure how to implement this // yet (array rendering used as a cubemap texture). @@ -1070,15 +1067,14 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& old_surface, } // This seems to be used for render-to-cubemap texture - const std::size_t size_with_mipmaps{new_params.SizeInBytes2DWithMipmap()}; - ASSERT_MSG(size_with_mipmaps == byte_stride, "Unexpected"); ASSERT_MSG(old_params.target == SurfaceParams::SurfaceTarget::Texture2D, "Unexpected"); ASSERT_MSG(old_params.pixel_format == new_params.pixel_format, "Unexpected"); - ASSERT_MSG(old_params.width == new_params.width, "Unexpected"); - ASSERT_MSG(old_params.height == new_params.height, "Unexpected"); - ASSERT_MSG(old_params.rt.array_mode == 1, "Unexpected"); ASSERT_MSG(old_params.rt.base_layer == 0, "Unimplemented"); + // TODO(bunnei): Verify the below - this stride seems to be in 32-bit words, not pixels. + // Tested with Splatoon 2, Super Mario Odyssey, and Breath of the Wild. + const std::size_t byte_stride{old_params.rt.layer_stride * sizeof(u32)}; + for (std::size_t index = 0; index < new_params.depth; ++index) { Surface face_surface{TryGetReservedSurface(old_params)}; ASSERT_MSG(face_surface, "Unexpected"); @@ -1092,7 +1088,7 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& old_surface, face_surface->GetSurfaceParams().rt.index, new_params.rt.index, index); } - old_params.addr += size_with_mipmaps; + old_params.addr += byte_stride; } break; } diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 51eb9b6dd..49025a3fe 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -707,29 +707,6 @@ struct SurfaceParams { return SizeInBytes2D() * depth; } - /** - * Returns the size in bytes of the 2D surface with mipmaps. Each mipmap level proceeds the - * previous with half the width and half the height. Once the size of the next mip reaches 0, we - * are done. - */ - std::size_t SizeInBytes2DWithMipmap() const { - std::size_t size_in_bytes{}; - auto mip_params{*this}; - for (std::size_t level = 0; level < max_mip_level; level++) { - size_in_bytes += mip_params.SizeInBytes2D(); - - mip_params.width /= 2; - mip_params.height /= 2; - - if (!mip_params.width || !mip_params.height) { - break; - } - } - - // TODO(bunnei): This alignup is unverified, but necessary in games tested (e.g. in SMO) - return Common::AlignUp(size_in_bytes, 0x1000); - } - /// Creates SurfaceParams from a texture configuration static SurfaceParams CreateForTexture(const Tegra::Texture::FullTextureInfo& config, const GLShader::SamplerEntry& entry); |