Commit ae05d655 by Nicolas Capens

Fix glReadPixels and glClear memory leaks.

Bug 26486408 Change-Id: Iec34ee0034695950163e8e40082d1ad7128490f8 Reviewed-on: https://swiftshader-review.googlesource.com/4533Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 7ce62b76
#define MAJOR_VERSION 3 #define MAJOR_VERSION 3
#define MINOR_VERSION 2 #define MINOR_VERSION 2
#define BUILD_VERSION 10 #define BUILD_VERSION 10
#define BUILD_REVISION 47660 #define BUILD_REVISION 47661
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -367,6 +367,7 @@ EGLNativeWindowType PBufferSurface::getWindowHandle() const ...@@ -367,6 +367,7 @@ EGLNativeWindowType PBufferSurface::getWindowHandle() const
void PBufferSurface::deleteResources() void PBufferSurface::deleteResources()
{ {
Surface::deleteResources();
} }
} }
...@@ -3300,6 +3300,8 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, ...@@ -3300,6 +3300,8 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
sw::SliceRect sliceRect(rect); sw::SliceRect sliceRect(rect);
sw::SliceRect dstSliceRect(dstRect); sw::SliceRect dstSliceRect(dstRect);
device->blit(renderTarget, sliceRect, &externalSurface, dstSliceRect, false); device->blit(renderTarget, sliceRect, &externalSurface, dstSliceRect, false);
renderTarget->release();
} }
void Context::clear(GLbitfield mask) void Context::clear(GLbitfield mask)
...@@ -3358,6 +3360,8 @@ void Context::clearColorBuffer(GLint drawbuffer, void *value, sw::Format format) ...@@ -3358,6 +3360,8 @@ void Context::clearColorBuffer(GLint drawbuffer, void *value, sw::Format format)
{ {
device->clear(value, format, image, sliceRect, rgbaMask); device->clear(value, format, image, sliceRect, rgbaMask);
} }
image->release();
} }
} }
...@@ -3385,6 +3389,8 @@ void Context::clearDepthBuffer(GLint drawbuffer, const GLfloat *value) ...@@ -3385,6 +3389,8 @@ void Context::clearDepthBuffer(GLint drawbuffer, const GLfloat *value)
float depth = clamp01(value[0]); float depth = clamp01(value[0]);
image->clearDepthBuffer(depth, x0, y0, width, height); image->clearDepthBuffer(depth, x0, y0, width, height);
image->release();
} }
} }
...@@ -3397,6 +3403,8 @@ void Context::clearStencilBuffer(GLint drawbuffer, const GLint *value) ...@@ -3397,6 +3403,8 @@ void Context::clearStencilBuffer(GLint drawbuffer, const GLint *value)
unsigned char stencil = value[0] < 0 ? 0 : static_cast<unsigned char>(value[0] & 0x000000FF); unsigned char stencil = value[0] < 0 ? 0 : static_cast<unsigned char>(value[0] & 0x000000FF);
image->clearStencilBuffer(stencil, static_cast<unsigned char>(mState.stencilWritemask), x0, y0, width, height); image->clearStencilBuffer(stencil, static_cast<unsigned char>(mState.stencilWritemask), x0, y0, width, height);
image->release();
} }
} }
...@@ -3416,6 +3424,8 @@ void Context::clearDepthStencilBuffer(GLint drawbuffer, GLfloat depth, GLint ste ...@@ -3416,6 +3424,8 @@ void Context::clearDepthStencilBuffer(GLint drawbuffer, GLfloat depth, GLint ste
{ {
image->clearDepthBuffer(clamp01(depth), x0, y0, width, height); image->clearDepthBuffer(clamp01(depth), x0, y0, width, height);
} }
image->release();
} }
} }
......
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