Commit a284f2ff by Geoff Lang Committed by Commit Bot

Add stubs for EGL_EXT_swap_buffers_with_damage.

BUG=512090 Change-Id: I9413d6f5c13b9ea59ab9c923dc6c5d157f344166 Reviewed-on: https://chromium-review.googlesource.com/291652 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent f0173153
......@@ -785,7 +785,8 @@ DisplayExtensions::DisplayExtensions()
streamProducerD3DTextureNV12(false),
createContextWebGLCompatibility(false),
createContextBindGeneratesResource(false),
getSyncValues(false)
getSyncValues(false),
swapBuffersWithDamage(false)
{
}
......@@ -822,6 +823,7 @@ std::vector<std::string> DisplayExtensions::getStrings() const
InsertExtensionString("EGL_ANGLE_create_context_webgl_compatibility", createContextWebGLCompatibility, &extensionStrings);
InsertExtensionString("EGL_CHROMIUM_create_context_bind_generates_resource", createContextBindGeneratesResource, &extensionStrings);
InsertExtensionString("EGL_CHROMIUM_sync_control", getSyncValues, &extensionStrings);
InsertExtensionString("EGL_EXT_swap_buffers_with_damage", swapBuffersWithDamage, &extensionStrings);
// TODO(jmadill): Enable this when complete.
//InsertExtensionString("KHR_create_context_no_error", createContextNoError, &extensionStrings);
// clang-format on
......
......@@ -607,6 +607,9 @@ struct DisplayExtensions
// EGL_CHROMIUM_get_sync_values
bool getSyncValues;
// EGL_EXT_swap_buffers_with_damage
bool swapBuffersWithDamage;
};
struct DeviceExtensions
......
......@@ -839,14 +839,15 @@ bool Display::isValidConfig(const Config *config) const
return mConfigSet.contains(config);
}
bool Display::isValidContext(gl::Context *context) const
bool Display::isValidContext(const gl::Context *context) const
{
return mContextSet.find(context) != mContextSet.end();
return mContextSet.find(const_cast<gl::Context *>(context)) != mContextSet.end();
}
bool Display::isValidSurface(Surface *surface) const
bool Display::isValidSurface(const Surface *surface) const
{
return mImplementation->getSurfaceSet().find(surface) != mImplementation->getSurfaceSet().end();
return mImplementation->getSurfaceSet().find(const_cast<Surface *>(surface)) !=
mImplementation->getSurfaceSet().end();
}
bool Display::isValidImage(const Image *image) const
......
......@@ -82,8 +82,8 @@ class Display final : angle::NonCopyable
bool isInitialized() const;
bool isValidConfig(const Config *config) const;
bool isValidContext(gl::Context *context) const;
bool isValidSurface(egl::Surface *surface) const;
bool isValidContext(const gl::Context *context) const;
bool isValidSurface(const egl::Surface *surface) const;
bool isValidImage(const Image *image) const;
bool isValidStream(const Stream *stream) const;
bool isValidNativeWindow(EGLNativeWindowType window) const;
......
......@@ -138,6 +138,11 @@ Error Surface::swap()
return mImplementation->swap();
}
Error Surface::swapWithDamage(EGLint *rects, EGLint n_rects)
{
return mImplementation->swapWithDamage(rects, n_rects);
}
Error Surface::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
{
return mImplementation->postSubBuffer(x, y, width, height);
......
......@@ -55,6 +55,7 @@ class Surface : public gl::FramebufferAttachmentObject
Error initialize();
Error swap();
Error swapWithDamage(EGLint *rects, EGLint n_rects);
Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height);
Error querySurfacePointerANGLE(EGLint attribute, void **value);
Error bindTexImage(gl::Texture *texture, EGLint buffer);
......
......@@ -31,6 +31,7 @@ class MockSurfaceImpl : public rx::SurfaceImpl
MOCK_METHOD0(initialize, egl::Error());
MOCK_METHOD1(createDefaultFramebuffer, rx::FramebufferImpl *(const gl::FramebufferState &data));
MOCK_METHOD0(swap, egl::Error());
MOCK_METHOD2(swapWithDamage, egl::Error(EGLint *, EGLint));
MOCK_METHOD4(postSubBuffer, egl::Error(EGLint, EGLint, EGLint, EGLint));
MOCK_METHOD2(querySurfacePointerANGLE, egl::Error(EGLint, void**));
MOCK_METHOD2(bindTexImage, egl::Error(gl::Texture*, EGLint));
......
......@@ -19,4 +19,10 @@ SurfaceImpl::~SurfaceImpl()
{
}
egl::Error SurfaceImpl::swapWithDamage(EGLint *rects, EGLint n_rects)
{
UNREACHABLE();
return egl::Error(EGL_BAD_SURFACE, "swapWithDamage implementation missing.");
}
} // namespace rx
......@@ -42,6 +42,7 @@ class SurfaceImpl : public FramebufferAttachmentObjectImpl
virtual egl::Error initialize() = 0;
virtual FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) = 0;
virtual egl::Error swap() = 0;
virtual egl::Error swapWithDamage(EGLint *rects, EGLint n_rects);
virtual egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) = 0;
virtual egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) = 0;
virtual egl::Error bindTexImage(gl::Texture *texture, EGLint buffer) = 0;
......
......@@ -182,7 +182,7 @@ Error ValidateDisplay(const Display *display)
return Error(EGL_SUCCESS);
}
Error ValidateSurface(const Display *display, Surface *surface)
Error ValidateSurface(const Display *display, const Surface *surface)
{
ANGLE_TRY(ValidateDisplay(display));
......@@ -206,7 +206,7 @@ Error ValidateConfig(const Display *display, const Config *config)
return Error(EGL_SUCCESS);
}
Error ValidateContext(const Display *display, gl::Context *context)
Error ValidateContext(const Display *display, const gl::Context *context)
{
ANGLE_TRY(ValidateDisplay(display));
......@@ -1624,4 +1624,41 @@ Error ValidateGetSyncValuesCHROMIUM(const Display *display,
return Error(EGL_SUCCESS);
}
Error ValidateSwapBuffersWithDamageEXT(const Display *display,
const Surface *surface,
EGLint *rects,
EGLint n_rects)
{
Error error = ValidateSurface(display, surface);
if (error.isError())
{
return error;
}
if (!display->getExtensions().swapBuffersWithDamage)
{
// It is out of spec what happens when calling an extension function when the extension is
// not available. EGL_BAD_DISPLAY seems like a reasonable error.
return Error(EGL_BAD_DISPLAY, "EGL_EXT_swap_buffers_with_damage is not available.");
}
if (surface == EGL_NO_SURFACE)
{
return Error(EGL_BAD_SURFACE, "Swap surface cannot be EGL_NO_SURFACE.");
}
if (n_rects < 0)
{
return Error(EGL_BAD_PARAMETER, "n_rects cannot be negative.");
}
if (n_rects > 0 && rects == nullptr)
{
return Error(EGL_BAD_PARAMETER, "n_rects cannot be greater than zero when rects is NULL.");
}
return Error(EGL_SUCCESS);
}
} // namespace gl
......@@ -32,9 +32,9 @@ class Surface;
// Object validation
Error ValidateDisplay(const Display *display);
Error ValidateSurface(const Display *display, Surface *surface);
Error ValidateSurface(const Display *display, const Surface *surface);
Error ValidateConfig(const Display *display, const Config *config);
Error ValidateContext(const Display *display, gl::Context *context);
Error ValidateContext(const Display *display, const gl::Context *context);
Error ValidateImage(const Display *display, const Image *image);
// Entry point validation
......@@ -94,12 +94,18 @@ Error ValidateStreamPostD3DTextureNV12ANGLE(const Display *display,
const Stream *stream,
void *texture,
const AttributeMap &attribs);
Error ValidateGetSyncValuesCHROMIUM(const Display *display,
const Surface *surface,
const EGLuint64KHR *ust,
const EGLuint64KHR *msc,
const EGLuint64KHR *sbc);
Error ValidateSwapBuffersWithDamageEXT(const Display *display,
const Surface *surface,
EGLint *rects,
EGLint n_rects);
// Other validation
Error ValidateCompatibleConfigs(const Display *display,
const Config *config1,
......
......@@ -367,4 +367,12 @@ EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy,
{
return egl::GetSyncValuesCHROMIUM(dpy, surface, ust, msc, sbc);
}
EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT(EGLDisplay dpy,
EGLSurface surface,
EGLint *rects,
EGLint n_rects)
{
return egl::SwapBuffersWithDamageEXT(dpy, surface, rects, n_rects);
}
}
......@@ -58,6 +58,7 @@ EXPORTS
eglCreateStreamProducerD3DTextureNV12ANGLE @64
eglStreamPostD3DTextureNV12ANGLE @65
eglGetSyncValuesCHROMIUM @66
eglSwapBuffersWithDamageEXT @67
; 1.5 entry points
eglCreateSync @38
......
......@@ -1814,6 +1814,10 @@ __eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *
// EGL_CHROMIUM_get_sync_values
INSERT_PROC_ADDRESS(egl, GetSyncValuesCHROMIUM);
// EGL_EXT_swap_buffers_with_damage
INSERT_PROC_ADDRESS(egl, SwapBuffersWithDamageEXT);
#undef INSERT_PROC_ADDRESS
return map;
};
......
......@@ -927,4 +927,34 @@ EGLBoolean EGLAPIENTRY GetSyncValuesCHROMIUM(EGLDisplay dpy,
SetGlobalError(error);
return EGL_TRUE;
}
ANGLE_EXPORT EGLBoolean SwapBuffersWithDamageEXT(EGLDisplay dpy,
EGLSurface surface,
EGLint *rects,
EGLint n_rects)
{
EVENT(
"(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint *rects = 0x%0.8p, EGLint "
"n_rects = %d)",
dpy, surface, rects, n_rects);
Display *display = static_cast<Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
Error error = ValidateSwapBuffersWithDamageEXT(display, eglSurface, rects, n_rects);
if (error.isError())
{
SetGlobalError(error);
return EGL_FALSE;
}
error = eglSurface->swapWithDamage(rects, n_rects);
if (error.isError())
{
SetGlobalError(error);
return EGL_FALSE;
}
return EGL_TRUE;
}
}
......@@ -87,6 +87,12 @@ ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetSyncValuesCHROMIUM(EGLDisplay dpy,
EGLuint64KHR *msc,
EGLuint64KHR *sbc);
// EGL_EXT_swap_buffers_with_damage
ANGLE_EXPORT EGLBoolean SwapBuffersWithDamageEXT(EGLDisplay dpy,
EGLSurface surface,
EGLint *rects,
EGLint n_rects);
} // namespace egl
#endif // LIBGLESV2_ENTRYPOINTSEGLEXT_H_
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