Move common image implementations to EGL. BUG=18110152 Change-Id: Ic3bf93d61682985e56b1b22c9fafd8c6e63cf442 Reviewed-on: https://swiftshader-review.googlesource.com/1253 Reviewed-by: Nicolas Capens <nicolascapens@google.com> Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/GLES2/libGLESv2/Device.cpp b/src/GLES2/libGLESv2/Device.cpp index 7a0488b..dbd2bf5 100644 --- a/src/GLES2/libGLESv2/Device.cpp +++ b/src/GLES2/libGLESv2/Device.cpp
@@ -265,7 +265,7 @@ UNREACHABLE(); } - Image *surface = new Image(0, width, height, format, GL_NONE, GL_NONE, multiSampleDepth, lockable, true); + Image *surface = new Image(0, width, height, format, multiSampleDepth, lockable, true); if(!surface) { @@ -284,7 +284,7 @@ return 0; } - Image *surface = new Image(0, width, height, format, GL_NONE, GL_NONE, multiSampleDepth, lockable, true); + Image *surface = new Image(0, width, height, format, multiSampleDepth, lockable, true); if(!surface) {
diff --git a/src/GLES2/libGLESv2/Image.cpp b/src/GLES2/libGLESv2/Image.cpp index 85bfa1e..fb9976c 100644 --- a/src/GLES2/libGLESv2/Image.cpp +++ b/src/GLES2/libGLESv2/Image.cpp
@@ -31,19 +31,16 @@ } Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type) - : parentTexture(parentTexture), width(width), height(height), format(format), type(type) - , internalFormat(selectInternalFormat(format, type)), multiSampleDepth(1) - , egl::Image(getParentResource(parentTexture), width, height, 1, selectInternalFormat(format, type), true, true) + : parentTexture(parentTexture) + , egl::Image(getParentResource(parentTexture), width, height, format, type, selectInternalFormat(format, type)) { - shared = false; referenceCount = 1; } - Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, GLenum format, GLenum type, int multiSampleDepth, bool lockable, bool renderTarget) - : parentTexture(parentTexture), width(width), height(height), internalFormat(internalFormat), format(format), type(type), multiSampleDepth(multiSampleDepth) + Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, int multiSampleDepth, bool lockable, bool renderTarget) + : parentTexture(parentTexture) , egl::Image(getParentResource(parentTexture), width, height, multiSampleDepth, internalFormat, lockable, renderTarget) { - shared = false; referenceCount = 1; } @@ -52,51 +49,6 @@ ASSERT(referenceCount == 0); } - void *Image::lock(unsigned int left, unsigned int top, sw::Lock lock) - { - return lockExternal(left, top, 0, lock, sw::PUBLIC); - } - - unsigned int Image::getPitch() const - { - return getExternalPitchB(); - } - - void Image::unlock() - { - unlockExternal(); - } - - int Image::getWidth() - { - return width; - } - - int Image::getHeight() - { - return height; - } - - GLenum Image::getFormat() - { - return format; - } - - GLenum Image::getType() - { - return type; - } - - sw::Format Image::getInternalFormat() - { - return internalFormat; - } - - int Image::getMultiSampleDepth() - { - return multiSampleDepth; - } - void Image::addRef() { if(parentTexture) @@ -132,16 +84,6 @@ release(); } - bool Image::isShared() const - { - return shared; - } - - void Image::markShared() - { - shared = true; - } - sw::Format Image::selectInternalFormat(GLenum format, GLenum type) { #if S3TC_SUPPORT @@ -225,11 +167,6 @@ return sw::FORMAT_A8R8G8B8; } - int Image::bytes(sw::Format format) - { - return sw::Surface::bytes(format); - } - void Image::loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *input) { GLsizei inputPitch = ComputePitch(width, format, type, unpackAlignment);
diff --git a/src/GLES2/libGLESv2/Image.hpp b/src/GLES2/libGLESv2/Image.hpp index e796bcd..feea102 100644 --- a/src/GLES2/libGLESv2/Image.hpp +++ b/src/GLES2/libGLESv2/Image.hpp
@@ -26,31 +26,16 @@ { public: Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type); - Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, GLenum format, GLenum type, int multiSampleDepth, bool lockable, bool renderTarget); + Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, int multiSampleDepth, bool lockable, bool renderTarget); void loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *input); void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels); - void *lock(unsigned int left, unsigned int top, sw::Lock lock); - unsigned int getPitch() const; - void unlock(); - - int getWidth(); - int getHeight(); - GLenum getFormat(); - GLenum getType(); - virtual sw::Format getInternalFormat(); - virtual int getMultiSampleDepth(); - virtual void addRef(); virtual void release(); void unbind(); // Break parent ownership and release - virtual bool isShared() const; - void markShared(); - static sw::Format selectInternalFormat(GLenum format, GLenum type); - static int bytes(sw::Format format); private: virtual ~Image(); @@ -79,14 +64,6 @@ void loadD24S8ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer); Texture *parentTexture; - bool shared; // Used as an EGLImage - - const GLsizei width; - const GLsizei height; - const GLenum format; - const GLenum type; - const sw::Format internalFormat; - const int multiSampleDepth; volatile int referenceCount; };
diff --git a/src/GLES2/libGLESv2/Texture.cpp b/src/GLES2/libGLESv2/Texture.cpp index 30eebe4..09998ce 100644 --- a/src/GLES2/libGLESv2/Texture.cpp +++ b/src/GLES2/libGLESv2/Texture.cpp
@@ -1199,7 +1199,7 @@ UNREACHABLE(); } - gl::Image *surface = new gl::Image(0, width, height, format, GL_NONE, GL_NONE, multiSampleDepth, lockable, true); + gl::Image *surface = new gl::Image(0, width, height, format, multiSampleDepth, lockable, true); if(!surface) {