summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Ameer J2021-07-04 13:20:40 -0400
committerGravatar GitHub2021-07-04 13:20:40 -0400
commiteb0e10cff2496fbf91362aa1e399b1d0b9a1d808 (patch)
tree55a2fe0e232aa29390326d6d57d1bf3c4cb1a7b4 /src
parentMerge pull request #6498 from Kelebek1/Audio (diff)
parentTextureCacheOGL: Implement Image Copies for 1D and 1D Array. (diff)
downloadyuzu-eb0e10cff2496fbf91362aa1e399b1d0b9a1d808.tar.gz
yuzu-eb0e10cff2496fbf91362aa1e399b1d0b9a1d808.tar.xz
yuzu-eb0e10cff2496fbf91362aa1e399b1d0b9a1d808.zip
Merge pull request #6553 from FernandoS27/bite-a-bat-change-the-world
TextureCache: Fix 1D to 2D overlapps.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp26
-rw-r--r--src/video_core/texture_cache/texture_cache.h3
2 files changed, 26 insertions, 3 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index 23948feed..a2c1599f7 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -341,6 +341,20 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
341[[nodiscard]] CopyOrigin MakeCopyOrigin(VideoCommon::Offset3D offset, 341[[nodiscard]] CopyOrigin MakeCopyOrigin(VideoCommon::Offset3D offset,
342 VideoCommon::SubresourceLayers subresource, GLenum target) { 342 VideoCommon::SubresourceLayers subresource, GLenum target) {
343 switch (target) { 343 switch (target) {
344 case GL_TEXTURE_1D:
345 return CopyOrigin{
346 .level = static_cast<GLint>(subresource.base_level),
347 .x = static_cast<GLint>(offset.x),
348 .y = static_cast<GLint>(0),
349 .z = static_cast<GLint>(0),
350 };
351 case GL_TEXTURE_1D_ARRAY:
352 return CopyOrigin{
353 .level = static_cast<GLint>(subresource.base_level),
354 .x = static_cast<GLint>(offset.x),
355 .y = static_cast<GLint>(0),
356 .z = static_cast<GLint>(subresource.base_layer),
357 };
344 case GL_TEXTURE_2D_ARRAY: 358 case GL_TEXTURE_2D_ARRAY:
345 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: 359 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
346 return CopyOrigin{ 360 return CopyOrigin{
@@ -366,6 +380,18 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
366 VideoCommon::SubresourceLayers dst_subresource, 380 VideoCommon::SubresourceLayers dst_subresource,
367 GLenum target) { 381 GLenum target) {
368 switch (target) { 382 switch (target) {
383 case GL_TEXTURE_1D:
384 return CopyRegion{
385 .width = static_cast<GLsizei>(extent.width),
386 .height = static_cast<GLsizei>(1),
387 .depth = static_cast<GLsizei>(1),
388 };
389 case GL_TEXTURE_1D_ARRAY:
390 return CopyRegion{
391 .width = static_cast<GLsizei>(extent.width),
392 .height = static_cast<GLsizei>(1),
393 .depth = static_cast<GLsizei>(dst_subresource.num_layers),
394 };
369 case GL_TEXTURE_2D_ARRAY: 395 case GL_TEXTURE_2D_ARRAY:
370 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: 396 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
371 return CopyRegion{ 397 return CopyRegion{
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index c7cfd02b6..d8dbd3824 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -1057,9 +1057,6 @@ ImageId TextureCache<P>::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, VA
1057 std::vector<ImageId> right_aliased_ids; 1057 std::vector<ImageId> right_aliased_ids;
1058 std::vector<ImageId> bad_overlap_ids; 1058 std::vector<ImageId> bad_overlap_ids;
1059 ForEachImageInRegion(cpu_addr, size_bytes, [&](ImageId overlap_id, ImageBase& overlap) { 1059 ForEachImageInRegion(cpu_addr, size_bytes, [&](ImageId overlap_id, ImageBase& overlap) {
1060 if (info.type != overlap.info.type) {
1061 return;
1062 }
1063 if (info.type == ImageType::Linear) { 1060 if (info.type == ImageType::Linear) {
1064 if (info.pitch == overlap.info.pitch && gpu_addr == overlap.gpu_addr) { 1061 if (info.pitch == overlap.info.pitch && gpu_addr == overlap.gpu_addr) {
1065 // Alias linear images with the same pitch 1062 // Alias linear images with the same pitch