Fix: Metal: EEVEE Next viewport motion blur
Resolves assertion for EEVEE Next motion blur wherein a swizzled texture used in an image binding loses write-access. We instead must bind the source texture for image write operations. This is now consistent with expected behaviour in other APIs. Authored by Apple: Michael Parkin-White Pull Request: https://projects.blender.org/blender/blender/pulls/117479
This commit is contained in:
committed by
Clément Foucault
parent
c958910e54
commit
d1a9c2f650
@@ -1883,6 +1883,12 @@ void MTLContext::ensure_texture_bindings(
|
||||
* shader. */
|
||||
id<MTLTexture> tex = bound_texture->get_metal_handle();
|
||||
|
||||
/* If texture resource is an image binding and has a non-default swizzle mask, we need
|
||||
* to bind the source texture resource to retain image write access. */
|
||||
if (!is_resource_sampler && bound_texture->has_custom_swizzle()) {
|
||||
tex = bound_texture->get_metal_handle_base();
|
||||
}
|
||||
|
||||
if (bool(shader_texture_info.stage_mask & ShaderStage::COMPUTE)) {
|
||||
cs.bind_compute_texture(tex, slot);
|
||||
cs.bind_compute_sampler(bound_sampler, use_argument_buffer_for_samplers, slot);
|
||||
|
||||
@@ -291,6 +291,14 @@ class MTLTexture : public Texture {
|
||||
return name_;
|
||||
}
|
||||
|
||||
bool has_custom_swizzle()
|
||||
{
|
||||
return (mtl_swizzle_mask_.red != MTLTextureSwizzleRed ||
|
||||
mtl_swizzle_mask_.green != MTLTextureSwizzleGreen ||
|
||||
mtl_swizzle_mask_.blue != MTLTextureSwizzleBlue ||
|
||||
mtl_swizzle_mask_.alpha != MTLTextureSwizzleAlpha);
|
||||
}
|
||||
|
||||
id<MTLBuffer> get_vertex_buffer() const
|
||||
{
|
||||
if (resource_mode_ == MTL_TEXTURE_MODE_VBO) {
|
||||
|
||||
Reference in New Issue
Block a user