Metal: Ensure MTLBatch uses context bound shader
Previously the shader associated with a batch was assigned separately. This meant on occasion, the incorrect shader was used with the Metal backend. Updating the shader fetch to use the context bound shader instead of the batch shader member as per OpenGL/Vulkan backends. Also include state change check to be consistent with OpenGL. Authored by Apple: Michael Parkin-White Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com> Pull Request: https://projects.blender.org/blender/blender/pulls/111112
This commit is contained in:
committed by
Clément Foucault
parent
cf43477839
commit
ca527efb9f
@@ -418,8 +418,8 @@ id<MTLRenderCommandEncoder> MTLBatch::bind(uint v_count)
|
||||
return nil;
|
||||
}
|
||||
|
||||
/* Verify Shader. */
|
||||
active_shader_ = (shader) ? static_cast<MTLShader *>(unwrap(shader)) : nullptr;
|
||||
/* Fetch bound shader from context. */
|
||||
active_shader_ = static_cast<MTLShader *>(ctx->shader);
|
||||
|
||||
if (active_shader_ == nullptr || !active_shader_->is_valid()) {
|
||||
/* Skip drawing if there is no valid Metal shader.
|
||||
|
||||
@@ -143,7 +143,7 @@ void MTLStateManager::set_mutable_state(const GPUStateMutable &state)
|
||||
pipeline_state.dirty_flags |= MTL_PIPELINE_STATE_PSO_FLAG;
|
||||
}
|
||||
|
||||
if (changed.depth_range[0] != 0 || changed.depth_range[1] != 0) {
|
||||
if (float_as_uint(changed.depth_range[0]) != 0 || float_as_uint(changed.depth_range[1]) != 0) {
|
||||
/* TODO remove, should modify the projection matrix instead. */
|
||||
mtl_depth_range(state.depth_range[0], state.depth_range[1]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user