\r
#include "Renderer/Surface.hpp"\r
\r
+#include <assert.h>\r
+\r
namespace egl\r
{\r
// Types common between gl.h and gl2.h\r
return multiSampleDepth;\r
}\r
\r
- bool Image::isShared() const\r
+ bool isShared() const\r
{\r
return shared;\r
}\r
\r
- void Image::markShared()\r
+ void markShared()\r
{\r
shared = true;\r
}\r
\r
- void *Image::lock(unsigned int left, unsigned int top, sw::Lock lock)\r
+ void *lock(unsigned int left, unsigned int top, sw::Lock lock)\r
{\r
return lockExternal(left, top, 0, lock, sw::PUBLIC);\r
}\r
\r
- unsigned int Image::getPitch() const\r
+ unsigned int getPitch() const\r
{\r
return getExternalPitchB();\r
}\r
\r
- void Image::unlock()\r
+ void unlock()\r
{\r
unlockExternal();\r
}\r
virtual void release() = 0;\r
virtual void unbind() = 0; // Break parent ownership and release\r
\r
+ void destroyShared() // Release a shared image\r
+ {\r
+ assert(shared);\r
+ shared = false;\r
+ release();\r
+ }\r
+\r
virtual void loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *input) = 0;\r
virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0;\r
\r
protected:\r
+ virtual ~Image() = 0\r
+ {\r
+ }\r
+\r
const GLsizei width;\r
const GLsizei height;\r
const GLenum format;\r
const sw::Format internalFormat;\r
const int multiSampleDepth;\r
\r
-private:\r
bool shared; // Used as an EGLImage\r
};\r
}\r
\r
EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)\r
{\r
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p, EGLenum target = 0x%X, buffer = 0x%0.8p, const EGLint attrib_list = 0x%0.8p)", dpy, ctx, target, buffer, attrib_list);\r
+\r
try\r
{\r
egl::Display *display = static_cast<egl::Display*>(dpy);\r
\r
EGLBoolean EGLAPIENTRY eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)\r
{\r
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLImageKHR image = 0x%0.8p)", dpy, image);\r
+\r
try\r
{\r
egl::Display *display = static_cast<egl::Display*>(dpy);\r
}\r
\r
egl::Image *glImage = static_cast<egl::Image*>(image);\r
- glImage->release();\r
+ glImage->destroyShared();\r
\r
return success(EGL_TRUE);\r
}\r