2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #6553 from FernandoS27/bite-a-bat-change-the-world

TextureCache: Fix 1D to 2D overlapps.
This commit is contained in:
Ameer J 2021-07-04 13:20:40 -04:00 committed by GitHub
commit eb0e10cff2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 3 deletions

View file

@ -341,6 +341,20 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
[[nodiscard]] CopyOrigin MakeCopyOrigin(VideoCommon::Offset3D offset, [[nodiscard]] CopyOrigin MakeCopyOrigin(VideoCommon::Offset3D offset,
VideoCommon::SubresourceLayers subresource, GLenum target) { VideoCommon::SubresourceLayers subresource, GLenum target) {
switch (target) { switch (target) {
case GL_TEXTURE_1D:
return CopyOrigin{
.level = static_cast<GLint>(subresource.base_level),
.x = static_cast<GLint>(offset.x),
.y = static_cast<GLint>(0),
.z = static_cast<GLint>(0),
};
case GL_TEXTURE_1D_ARRAY:
return CopyOrigin{
.level = static_cast<GLint>(subresource.base_level),
.x = static_cast<GLint>(offset.x),
.y = static_cast<GLint>(0),
.z = static_cast<GLint>(subresource.base_layer),
};
case GL_TEXTURE_2D_ARRAY: case GL_TEXTURE_2D_ARRAY:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
return CopyOrigin{ return CopyOrigin{
@ -366,6 +380,18 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
VideoCommon::SubresourceLayers dst_subresource, VideoCommon::SubresourceLayers dst_subresource,
GLenum target) { GLenum target) {
switch (target) { switch (target) {
case GL_TEXTURE_1D:
return CopyRegion{
.width = static_cast<GLsizei>(extent.width),
.height = static_cast<GLsizei>(1),
.depth = static_cast<GLsizei>(1),
};
case GL_TEXTURE_1D_ARRAY:
return CopyRegion{
.width = static_cast<GLsizei>(extent.width),
.height = static_cast<GLsizei>(1),
.depth = static_cast<GLsizei>(dst_subresource.num_layers),
};
case GL_TEXTURE_2D_ARRAY: case GL_TEXTURE_2D_ARRAY:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
return CopyRegion{ return CopyRegion{

View file

@ -1057,9 +1057,6 @@ ImageId TextureCache<P>::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, VA
std::vector<ImageId> right_aliased_ids; std::vector<ImageId> right_aliased_ids;
std::vector<ImageId> bad_overlap_ids; std::vector<ImageId> bad_overlap_ids;
ForEachImageInRegion(cpu_addr, size_bytes, [&](ImageId overlap_id, ImageBase& overlap) { ForEachImageInRegion(cpu_addr, size_bytes, [&](ImageId overlap_id, ImageBase& overlap) {
if (info.type != overlap.info.type) {
return;
}
if (info.type == ImageType::Linear) { if (info.type == ImageType::Linear) {
if (info.pitch == overlap.info.pitch && gpu_addr == overlap.gpu_addr) { if (info.pitch == overlap.info.pitch && gpu_addr == overlap.gpu_addr) {
// Alias linear images with the same pitch // Alias linear images with the same pitch