Fix #118868: Metal render pass output for EEVEE Next

Resolves render pass export for EEVEE Next on Metal.
Reads from texture views was previously utilising the
root texture rather than the view variant, resulting
in views into texture arrays being incorrectly sampled.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/119563
This commit is contained in:
Jason Fielder 2024-03-16 20:16:37 +01:00 committed by Clément Foucault
parent bec9b4bc4b
commit 6768ded895

@ -1689,11 +1689,16 @@ void gpu::MTLTexture::read_internal(int mip,
* happen after work with associated texture is finished. */
GPU_finish();
/* Texture View for SRGB special case. */
/** Determine source read texture handle. */
id<MTLTexture> read_texture = texture_;
/* Use textureview handle if reading from a GPU texture view. */
if (resource_mode_ == MTL_TEXTURE_MODE_TEXTURE_VIEW) {
read_texture = this->get_metal_handle();
}
/* Create Texture View for SRGB special case to bypass internal type conversion. */
if (format_ == GPU_SRGB8_A8) {
BLI_assert(gpu_image_usage_flags_ & GPU_TEXTURE_USAGE_FORMAT_VIEW);
read_texture = [texture_ newTextureViewWithPixelFormat:MTLPixelFormatRGBA8Unorm];
read_texture = [read_texture newTextureViewWithPixelFormat:MTLPixelFormatRGBA8Unorm];
}
/* Perform per-texture type read. */