Commit 7c3fe555 authored by Jonah Ryan-Davis's avatar Jonah Ryan-Davis Committed by Commit Bot

Fix tile ordering issues with SwANGLE/Mac

SwANGLE needs to be told when to lock/unlock the IOSurfaces that
are being rendered to. This is accomplished via wrapping shared
GL image Begin/EndAccess in calls to Bind/ReleaseTexImage.

Bug: swiftshader:154
Change-Id: I9994dd6a2f01682b212175c353c0cb89c5b51d2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2378539Reviewed-by: default avatarGeoff Lang <geofflang@chromium.org>
Reviewed-by: default avatarccameron <ccameron@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Cr-Commit-Position: refs/heads/master@{#802408}
parent 7cba29c9
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "ui/gl/gl_context.h" #include "ui/gl/gl_context.h"
#include "ui/gl/gl_fence.h" #include "ui/gl/gl_fence.h"
#include "ui/gl/gl_gl_api_implementation.h" #include "ui/gl/gl_gl_api_implementation.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/scoped_binders.h"
#include "ui/gl/trace_util.h" #include "ui/gl/trace_util.h"
#if defined(OS_MAC) #if defined(OS_MAC)
...@@ -569,6 +571,22 @@ void SharedImageBackingGLImage::SharedImageRepresentationGLTextureEndAccess() { ...@@ -569,6 +571,22 @@ void SharedImageBackingGLImage::SharedImageRepresentationGLTextureEndAccess() {
gl::GLApi* api = gl::g_current_gl_context; gl::GLApi* api = gl::g_current_gl_context;
api->glFlushFn(); api->glFlushFn();
} }
// When SwANGLE is used as the GL implementation, we have to call
// ReleaseTexImage to signal an UnlockIOSurface call to sync the surface
// between the CPU and GPU. The next time this texture is accessed we will
// call BindTexImage to signal a LockIOSurface call before rendering to it via
// the CPU.
if (IsPassthrough() &&
gl::GetANGLEImplementation() == gl::ANGLEImplementation::kSwiftShader &&
image_->ShouldBindOrCopy() == gl::GLImage::BIND) {
const GLenum target = GetGLTarget();
gl::ScopedTextureBinder binder(target, passthrough_texture_->service_id());
if (!passthrough_texture_->is_bind_pending()) {
image_->ReleaseTexImage(target);
image_bind_or_copy_needed_ = true;
}
}
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment