Commit ead7ac56 by Nicolas Capens Committed by Nicolas Capens

Share the EGL image interface between implementations.

BUG=18110152 Change-Id: Ia36cc97c0f1b6609382ebaed7ef55231d22d9519 Reviewed-on: https://swiftshader-review.googlesource.com/1252Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent b0e93551
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "Config.h" #include "Config.h"
#include "common/debug.h" #include "common/debug.h"
#include "libGLESv2/Image.hpp"
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
......
...@@ -6,14 +6,10 @@ ...@@ -6,14 +6,10 @@
#define GL_API #define GL_API
#include <GLES/gl.h> #include <GLES/gl.h>
namespace gl
{
class Image;
}
namespace egl namespace egl
{ {
class Surface; class Surface;
class Image;
class Context class Context
{ {
...@@ -21,7 +17,7 @@ public: ...@@ -21,7 +17,7 @@ public:
virtual void destroy() = 0; virtual void destroy() = 0;
virtual void bindTexImage(Surface *surface) = 0; virtual void bindTexImage(Surface *surface) = 0;
virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel) = 0; virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel) = 0;
virtual gl::Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel) = 0; virtual Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel) = 0;
}; };
} }
......
#ifndef egl_Image_hpp
#define egl_Image_hpp
#include "Renderer/Surface.hpp"
namespace egl
{
// Types common between gl.h and gl2.h
// We can't include either header in EGL
typedef unsigned int GLenum;
typedef int GLint;
typedef int GLsizei;
class Image : public sw::Surface
{
public:
Image(sw::Resource *texture, int width, int height, int depth, sw::Format format, bool lockable, bool renderTarget)
: sw::Surface(texture, width, height, depth, format, lockable, renderTarget)
{
}
virtual void loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *input) = 0;
virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0;
virtual void *lock(unsigned int left, unsigned int top, sw::Lock lock) = 0;
virtual unsigned int getPitch() const = 0;
virtual void unlock() = 0;
virtual int getWidth() = 0;
virtual int getHeight() = 0;
virtual GLenum getFormat() = 0;
virtual GLenum getType() = 0;
virtual sw::Format getInternalFormat() = 0;
virtual int getMultiSampleDepth() = 0;
virtual void addRef() = 0;
virtual void release() = 0;
virtual void unbind() = 0; // Break parent ownership and release
virtual bool isShared() const = 0;
virtual void markShared() = 0;
};
}
#endif // egl_Image_hpp
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "main.h" #include "main.h"
#include "Display.h" #include "Display.h"
#include "Texture2D.hpp" #include "Texture2D.hpp"
#include "libGLESv2/Image.hpp" #include "Image.hpp"
#include "common/debug.h" #include "common/debug.h"
#include "Main/FrameBuffer.hpp" #include "Main/FrameBuffer.hpp"
...@@ -189,7 +189,7 @@ void Surface::swap() ...@@ -189,7 +189,7 @@ void Surface::swap()
} }
} }
gl::Image *Surface::getRenderTarget() egl::Image *Surface::getRenderTarget()
{ {
if(backBuffer) if(backBuffer)
{ {
...@@ -199,7 +199,7 @@ gl::Image *Surface::getRenderTarget() ...@@ -199,7 +199,7 @@ gl::Image *Surface::getRenderTarget()
return backBuffer; return backBuffer;
} }
gl::Image *Surface::getDepthStencil() egl::Image *Surface::getDepthStencil()
{ {
if(mDepthStencil) if(mDepthStencil)
{ {
......
...@@ -21,16 +21,12 @@ ...@@ -21,16 +21,12 @@
#define EGLAPI #define EGLAPI
#include <EGL/egl.h> #include <EGL/egl.h>
namespace gl
{
class Image;
}
namespace egl namespace egl
{ {
class Display; class Display;
class Config; class Config;
class Texture2D; class Texture2D;
class Image;
class Surface class Surface
{ {
...@@ -45,8 +41,8 @@ public: ...@@ -45,8 +41,8 @@ public:
EGLNativeWindowType getWindowHandle(); EGLNativeWindowType getWindowHandle();
virtual gl::Image *getRenderTarget(); virtual egl::Image *getRenderTarget();
virtual gl::Image *getDepthStencil(); virtual egl::Image *getDepthStencil();
void setSwapInterval(EGLint interval); void setSwapInterval(EGLint interval);
...@@ -70,9 +66,9 @@ private: ...@@ -70,9 +66,9 @@ private:
bool reset(); bool reset();
Display *const mDisplay; Display *const mDisplay;
gl::Image *mDepthStencil; egl::Image *mDepthStencil;
sw::FrameBuffer *frameBuffer; sw::FrameBuffer *frameBuffer;
gl::Image *backBuffer; egl::Image *backBuffer;
egl::Texture2D *mTexture; egl::Texture2D *mTexture;
bool reset(int backbufferWidth, int backbufferHeight); bool reset(int backbufferWidth, int backbufferHeight);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "Surface.h" #include "Surface.h"
#include "Texture2D.hpp" #include "Texture2D.hpp"
#include "Context.hpp" #include "Context.hpp"
#include "libGLESv2/Image.hpp" #include "Image.hpp"
#include "common/debug.h" #include "common/debug.h"
#include "Common/Version.h" #include "Common/Version.h"
...@@ -1117,7 +1117,7 @@ EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenu ...@@ -1117,7 +1117,7 @@ EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenu
return error(validationResult, EGL_NO_IMAGE_KHR); return error(validationResult, EGL_NO_IMAGE_KHR);
} }
gl::Image *image = context->createSharedImage(target, name, textureLevel); egl::Image *image = context->createSharedImage(target, name, textureLevel);
if(!image) if(!image)
{ {
...@@ -1155,7 +1155,7 @@ EGLBoolean EGLAPIENTRY eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image) ...@@ -1155,7 +1155,7 @@ EGLBoolean EGLAPIENTRY eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
return error(EGL_BAD_PARAMETER, EGL_FALSE); return error(EGL_BAD_PARAMETER, EGL_FALSE);
} }
gl::Image *glImage = static_cast<gl::Image*>(image); egl::Image *glImage = static_cast<egl::Image*>(image);
glImage->release(); glImage->release();
return success(EGL_TRUE); return success(EGL_TRUE);
......
...@@ -163,6 +163,7 @@ copy "$(OutDir)libEGL.dll" "$(ProjectDir)..\..\..\lib\$(Configuration)\"</Comman ...@@ -163,6 +163,7 @@ copy "$(OutDir)libEGL.dll" "$(ProjectDir)..\..\..\lib\$(Configuration)\"</Comman
<ClInclude Include="Config.h" /> <ClInclude Include="Config.h" />
<ClInclude Include="Context.hpp" /> <ClInclude Include="Context.hpp" />
<ClInclude Include="Display.h" /> <ClInclude Include="Display.h" />
<ClInclude Include="Image.hpp" />
<ClInclude Include="main.h" /> <ClInclude Include="main.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="Surface.h" /> <ClInclude Include="Surface.h" />
......
...@@ -64,6 +64,9 @@ ...@@ -64,6 +64,9 @@
<ClInclude Include="Texture2D.hpp"> <ClInclude Include="Texture2D.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Image.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="libEGL.rc" /> <ResourceCompile Include="libEGL.rc" />
......
...@@ -92,8 +92,8 @@ CONSTRUCTOR static bool eglAttachProcess() ...@@ -92,8 +92,8 @@ CONSTRUCTOR static bool eglAttachProcess()
gl::createContext = (egl::Context *(*)(const egl::Config*, const egl::Context*))getProcAddress(libGLESv2, "glCreateContext"); gl::createContext = (egl::Context *(*)(const egl::Config*, const egl::Context*))getProcAddress(libGLESv2, "glCreateContext");
gl::makeCurrent = (void (*)(egl::Context*, egl::Display*, egl::Surface*))getProcAddress(libGLESv2, "glMakeCurrent"); gl::makeCurrent = (void (*)(egl::Context*, egl::Display*, egl::Surface*))getProcAddress(libGLESv2, "glMakeCurrent");
gl::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLESv2, "glGetProcAddress"); gl::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLESv2, "glGetProcAddress");
gl::createBackBuffer = (gl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLESv2, "createBackBuffer"); gl::createBackBuffer = (egl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLESv2, "createBackBuffer");
gl::createDepthStencil = (gl::Image *(*)(unsigned int, unsigned int, sw::Format, int, bool))getProcAddress(libGLESv2, "createDepthStencil"); gl::createDepthStencil = (egl::Image *(*)(unsigned int, unsigned int, sw::Format, int, bool))getProcAddress(libGLESv2, "createDepthStencil");
gl::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLESv2, "createFrameBuffer"); gl::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLESv2, "createFrameBuffer");
return libGLESv2 != 0; return libGLESv2 != 0;
...@@ -263,8 +263,8 @@ namespace gl ...@@ -263,8 +263,8 @@ namespace gl
egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext) = 0; egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext) = 0;
void (*makeCurrent)(egl::Context *context, egl::Display *display, egl::Surface *surface) = 0; void (*makeCurrent)(egl::Context *context, egl::Display *display, egl::Surface *surface) = 0;
__eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname) = 0; __eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname) = 0;
Image *(*createBackBuffer)(int width, int height, const egl::Config *config) = 0; egl::Image *(*createBackBuffer)(int width, int height, const egl::Config *config) = 0;
Image *(*createDepthStencil)(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard) = 0; egl::Image *(*createDepthStencil)(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard) = 0;
sw::FrameBuffer *(*createFrameBuffer)(EGLNativeDisplayType display, EGLNativeWindowType window, int width, int height) = 0; sw::FrameBuffer *(*createFrameBuffer)(EGLNativeDisplayType display, EGLNativeWindowType window, int width, int height) = 0;
} }
......
...@@ -73,6 +73,7 @@ namespace egl ...@@ -73,6 +73,7 @@ namespace egl
class Surface; class Surface;
class Display; class Display;
class Context; class Context;
class Image;
} }
namespace sw namespace sw
...@@ -84,13 +85,11 @@ namespace sw ...@@ -84,13 +85,11 @@ namespace sw
// libGLESv2 dependencies // libGLESv2 dependencies
namespace gl namespace gl
{ {
class Image;
extern egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext); extern egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext);
extern void (*makeCurrent)(egl::Context *context, egl::Display *display, egl::Surface *surface); extern void (*makeCurrent)(egl::Context *context, egl::Display *display, egl::Surface *surface);
extern __eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname); extern __eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname);
extern Image *(*createBackBuffer)(int width, int height, const egl::Config *config); extern egl::Image *(*createBackBuffer)(int width, int height, const egl::Config *config);
extern Image *(*createDepthStencil)(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard); extern egl::Image *(*createDepthStencil)(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard);
extern sw::FrameBuffer *(*createFrameBuffer)(EGLNativeDisplayType display, EGLNativeWindowType window, int width, int height); extern sw::FrameBuffer *(*createFrameBuffer)(EGLNativeDisplayType display, EGLNativeWindowType window, int width, int height);
} }
......
...@@ -205,8 +205,8 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface) ...@@ -205,8 +205,8 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
} }
// Wrap the existing resources into GL objects and assign them to the '0' names // Wrap the existing resources into GL objects and assign them to the '0' names
Image *defaultRenderTarget = surface->getRenderTarget(); egl::Image *defaultRenderTarget = surface->getRenderTarget();
Image *depthStencil = surface->getDepthStencil(); egl::Image *depthStencil = surface->getDepthStencil();
Colorbuffer *colorbufferZero = new Colorbuffer(defaultRenderTarget); Colorbuffer *colorbufferZero = new Colorbuffer(defaultRenderTarget);
DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(depthStencil); DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(depthStencil);
...@@ -1303,11 +1303,11 @@ bool Context::applyRenderTarget() ...@@ -1303,11 +1303,11 @@ bool Context::applyRenderTarget()
return error(GL_INVALID_FRAMEBUFFER_OPERATION_OES, false); return error(GL_INVALID_FRAMEBUFFER_OPERATION_OES, false);
} }
Image *renderTarget = framebuffer->getRenderTarget(); egl::Image *renderTarget = framebuffer->getRenderTarget();
device->setRenderTarget(renderTarget); device->setRenderTarget(renderTarget);
if(renderTarget) renderTarget->release(); if(renderTarget) renderTarget->release();
Image *depthStencil = framebuffer->getDepthStencil(); egl::Image *depthStencil = framebuffer->getDepthStencil();
device->setDepthStencilSurface(depthStencil); device->setDepthStencilSurface(depthStencil);
if(depthStencil) depthStencil->release(); if(depthStencil) depthStencil->release();
...@@ -1634,7 +1634,7 @@ void Context::applyTexture(int index, Texture *baseTexture) ...@@ -1634,7 +1634,7 @@ void Context::applyTexture(int index, Texture *baseTexture)
surfaceLevel = levelCount - 1; surfaceLevel = levelCount - 1;
} }
Image *surface = texture->getImage(surfaceLevel); egl::Image *surface = texture->getImage(surfaceLevel);
device->setTextureLevel(index, 0, mipmapLevel, surface, sw::TEXTURE_2D); device->setTextureLevel(index, 0, mipmapLevel, surface, sw::TEXTURE_2D);
} }
} }
...@@ -1674,7 +1674,7 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, ...@@ -1674,7 +1674,7 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
} }
} }
Image *renderTarget = framebuffer->getRenderTarget(); egl::Image *renderTarget = framebuffer->getRenderTarget();
if(!renderTarget) if(!renderTarget)
{ {
...@@ -2277,7 +2277,7 @@ EGLenum Context::validateSharedImage(EGLenum target, GLuint name, GLuint texture ...@@ -2277,7 +2277,7 @@ EGLenum Context::validateSharedImage(EGLenum target, GLuint name, GLuint texture
return EGL_SUCCESS; return EGL_SUCCESS;
} }
Image *Context::createSharedImage(EGLenum target, GLuint name, GLuint textureLevel) egl::Image *Context::createSharedImage(EGLenum target, GLuint name, GLuint textureLevel)
{ {
if(target == EGL_GL_TEXTURE_2D_KHR) if(target == EGL_GL_TEXTURE_2D_KHR)
{ {
......
...@@ -370,7 +370,7 @@ public: ...@@ -370,7 +370,7 @@ public:
virtual void bindTexImage(egl::Surface *surface); virtual void bindTexImage(egl::Surface *surface);
virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel); virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel);
virtual Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel); virtual egl::Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel);
Device *getDevice(); Device *getDevice();
......
...@@ -355,7 +355,7 @@ namespace gl ...@@ -355,7 +355,7 @@ namespace gl
draw(drawType, 0, primitiveCount); draw(drawType, 0, primitiveCount);
} }
void Device::setDepthStencilSurface(Image *depthStencil) void Device::setDepthStencilSurface(egl::Image *depthStencil)
{ {
if(this->depthStencil == depthStencil) if(this->depthStencil == depthStencil)
{ {
...@@ -382,7 +382,7 @@ namespace gl ...@@ -382,7 +382,7 @@ namespace gl
scissorEnable = enable; scissorEnable = enable;
} }
void Device::setRenderTarget(Image *renderTarget) void Device::setRenderTarget(egl::Image *renderTarget)
{ {
if(renderTarget) if(renderTarget)
{ {
...@@ -409,7 +409,7 @@ namespace gl ...@@ -409,7 +409,7 @@ namespace gl
this->viewport = viewport; this->viewport = viewport;
} }
bool Device::stretchRect(Image *source, const sw::Rect *sourceRect, Image *dest, const sw::Rect *destRect, bool filter) bool Device::stretchRect(egl::Image *source, const sw::Rect *sourceRect, egl::Image *dest, const sw::Rect *destRect, bool filter)
{ {
if(!source || !dest || !validRectangle(sourceRect, source) || !validRectangle(destRect, dest)) if(!source || !dest || !validRectangle(sourceRect, source) || !validRectangle(destRect, dest))
{ {
...@@ -615,7 +615,7 @@ namespace gl ...@@ -615,7 +615,7 @@ namespace gl
return true; return true;
} }
bool Device::validRectangle(const sw::Rect *rect, Image *surface) bool Device::validRectangle(const sw::Rect *rect, egl::Image *surface)
{ {
if(!rect) if(!rect)
{ {
......
...@@ -14,13 +14,14 @@ ...@@ -14,13 +14,14 @@
#include "Renderer/Renderer.hpp" #include "Renderer/Renderer.hpp"
namespace gl namespace egl
{ {
class Texture; class Image;
} }
namespace gl namespace gl
{ {
class Texture;
class Image; class Image;
enum PrimitiveType enum PrimitiveType
...@@ -58,13 +59,13 @@ namespace gl ...@@ -58,13 +59,13 @@ namespace gl
virtual Image *createRenderTarget(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool lockable); virtual Image *createRenderTarget(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool lockable);
virtual void drawIndexedPrimitive(PrimitiveType type, unsigned int indexOffset, unsigned int primitiveCount, int indexSize); virtual void drawIndexedPrimitive(PrimitiveType type, unsigned int indexOffset, unsigned int primitiveCount, int indexSize);
virtual void drawPrimitive(PrimitiveType primitiveType, unsigned int primiveCount); virtual void drawPrimitive(PrimitiveType primitiveType, unsigned int primiveCount);
virtual void setDepthStencilSurface(Image *newDepthStencil); virtual void setDepthStencilSurface(egl::Image *newDepthStencil);
virtual void setScissorEnable(bool enable); virtual void setScissorEnable(bool enable);
virtual void setRenderTarget(Image *renderTarget); virtual void setRenderTarget(egl::Image *renderTarget);
virtual void setScissorRect(const sw::Rect &rect); virtual void setScissorRect(const sw::Rect &rect);
virtual void setViewport(const Viewport &viewport); virtual void setViewport(const Viewport &viewport);
virtual bool stretchRect(Image *sourceSurface, const sw::Rect *sourceRect, Image *destSurface, const sw::Rect *destRect, bool filter); virtual bool stretchRect(egl::Image *sourceSurface, const sw::Rect *sourceRect, egl::Image *destSurface, const sw::Rect *destRect, bool filter);
virtual void finish(); virtual void finish();
private: private:
...@@ -73,14 +74,14 @@ namespace gl ...@@ -73,14 +74,14 @@ namespace gl
bool bindResources(); bool bindResources();
bool bindViewport(); // Also adjusts for scissoring bool bindViewport(); // Also adjusts for scissoring
bool validRectangle(const sw::Rect *rect, Image *surface); bool validRectangle(const sw::Rect *rect, egl::Image *surface);
Viewport viewport; Viewport viewport;
sw::Rect scissorRect; sw::Rect scissorRect;
bool scissorEnable; bool scissorEnable;
Image *renderTarget; egl::Image *renderTarget;
Image *depthStencil; egl::Image *depthStencil;
}; };
} }
......
...@@ -123,7 +123,7 @@ void Framebuffer::detachRenderbuffer(GLuint renderbuffer) ...@@ -123,7 +123,7 @@ void Framebuffer::detachRenderbuffer(GLuint renderbuffer)
// Increments refcount on surface. // Increments refcount on surface.
// caller must Release() the returned surface // caller must Release() the returned surface
Image *Framebuffer::getRenderTarget() egl::Image *Framebuffer::getRenderTarget()
{ {
Renderbuffer *colorbuffer = mColorbufferPointer.get(); Renderbuffer *colorbuffer = mColorbufferPointer.get();
...@@ -137,7 +137,7 @@ Image *Framebuffer::getRenderTarget() ...@@ -137,7 +137,7 @@ Image *Framebuffer::getRenderTarget()
// Increments refcount on surface. // Increments refcount on surface.
// caller must Release() the returned surface // caller must Release() the returned surface
Image *Framebuffer::getDepthStencil() egl::Image *Framebuffer::getDepthStencil()
{ {
Renderbuffer *depthstencilbuffer = mDepthbufferPointer.get(); Renderbuffer *depthstencilbuffer = mDepthbufferPointer.get();
......
...@@ -43,8 +43,8 @@ public: ...@@ -43,8 +43,8 @@ public:
void detachTexture(GLuint texture); void detachTexture(GLuint texture);
void detachRenderbuffer(GLuint renderbuffer); void detachRenderbuffer(GLuint renderbuffer);
Image *getRenderTarget(); egl::Image *getRenderTarget();
Image *getDepthStencil(); egl::Image *getDepthStencil();
Renderbuffer *getColorbuffer(); Renderbuffer *getColorbuffer();
Renderbuffer *getDepthbuffer(); Renderbuffer *getDepthbuffer();
......
...@@ -34,7 +34,7 @@ namespace gl ...@@ -34,7 +34,7 @@ namespace gl
Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type) Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type)
: parentTexture(parentTexture), width(width), height(height), format(format), type(type) : parentTexture(parentTexture), width(width), height(height), format(format), type(type)
, internalFormat(selectInternalFormat(format, type)), multiSampleDepth(1) , internalFormat(selectInternalFormat(format, type)), multiSampleDepth(1)
, sw::Surface(getParentResource(parentTexture), width, height, 1, selectInternalFormat(format, type), true, true) , egl::Image(getParentResource(parentTexture), width, height, 1, selectInternalFormat(format, type), true, true)
{ {
shared = false; shared = false;
referenceCount = 1; referenceCount = 1;
...@@ -42,7 +42,7 @@ namespace gl ...@@ -42,7 +42,7 @@ namespace gl
Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, GLenum format, GLenum type, int multiSampleDepth, bool lockable, bool renderTarget) 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) : parentTexture(parentTexture), width(width), height(height), internalFormat(internalFormat), format(format), type(type), multiSampleDepth(multiSampleDepth)
, sw::Surface(getParentResource(parentTexture), width, height, multiSampleDepth, internalFormat, lockable, renderTarget) , egl::Image(getParentResource(parentTexture), width, height, multiSampleDepth, internalFormat, lockable, renderTarget)
{ {
shared = false; shared = false;
referenceCount = 1; referenceCount = 1;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define gl_Image_hpp #define gl_Image_hpp
#include "Renderer/Surface.hpp" #include "Renderer/Surface.hpp"
#include "libEGL/Image.hpp"
#define GL_API #define GL_API
#include <GLES/gl.h> #include <GLES/gl.h>
...@@ -21,7 +22,7 @@ namespace gl ...@@ -21,7 +22,7 @@ namespace gl
{ {
class Texture; class Texture;
class Image : public sw::Surface class Image : public egl::Image
{ {
public: public:
Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type); Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type);
......
...@@ -92,14 +92,14 @@ void RenderbufferTexture2D::releaseProxy(const Renderbuffer *proxy) ...@@ -92,14 +92,14 @@ void RenderbufferTexture2D::releaseProxy(const Renderbuffer *proxy)
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *RenderbufferTexture2D::getRenderTarget() egl::Image *RenderbufferTexture2D::getRenderTarget()
{ {
return mTexture2D->getRenderTarget(GL_TEXTURE_2D, 0); return mTexture2D->getRenderTarget(GL_TEXTURE_2D, 0);
} }
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *RenderbufferTexture2D::createSharedImage() egl::Image *RenderbufferTexture2D::createSharedImage()
{ {
return mTexture2D->createSharedImage(GL_TEXTURE_2D, 0); return mTexture2D->createSharedImage(GL_TEXTURE_2D, 0);
} }
...@@ -165,14 +165,14 @@ void Renderbuffer::release() ...@@ -165,14 +165,14 @@ void Renderbuffer::release()
// Increments refcount on image. // Increments refcount on image.
// caller must Release() the returned image // caller must Release() the returned image
Image *Renderbuffer::getRenderTarget() egl::Image *Renderbuffer::getRenderTarget()
{ {
return mInstance->getRenderTarget(); return mInstance->getRenderTarget();
} }
// Increments refcount on image. // Increments refcount on image.
// caller must Release() the returned image // caller must Release() the returned image
Image *Renderbuffer::createSharedImage() egl::Image *Renderbuffer::createSharedImage()
{ {
return mInstance->createSharedImage(); return mInstance->createSharedImage();
} }
...@@ -283,7 +283,7 @@ GLsizei RenderbufferStorage::getSamples() const ...@@ -283,7 +283,7 @@ GLsizei RenderbufferStorage::getSamples() const
return mSamples; return mSamples;
} }
Colorbuffer::Colorbuffer(Image *renderTarget) : mRenderTarget(renderTarget) Colorbuffer::Colorbuffer(egl::Image *renderTarget) : mRenderTarget(renderTarget)
{ {
if(renderTarget) if(renderTarget)
{ {
...@@ -332,7 +332,7 @@ Colorbuffer::~Colorbuffer() ...@@ -332,7 +332,7 @@ Colorbuffer::~Colorbuffer()
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *Colorbuffer::getRenderTarget() egl::Image *Colorbuffer::getRenderTarget()
{ {
if(mRenderTarget) if(mRenderTarget)
{ {
...@@ -344,7 +344,7 @@ Image *Colorbuffer::getRenderTarget() ...@@ -344,7 +344,7 @@ Image *Colorbuffer::getRenderTarget()
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *Colorbuffer::createSharedImage() egl::Image *Colorbuffer::createSharedImage()
{ {
if(mRenderTarget) if(mRenderTarget)
{ {
...@@ -360,7 +360,7 @@ bool Colorbuffer::isShared() const ...@@ -360,7 +360,7 @@ bool Colorbuffer::isShared() const
return mRenderTarget->isShared(); return mRenderTarget->isShared();
} }
DepthStencilbuffer::DepthStencilbuffer(Image *depthStencil) : mDepthStencil(depthStencil) DepthStencilbuffer::DepthStencilbuffer(egl::Image *depthStencil) : mDepthStencil(depthStencil)
{ {
if(depthStencil) if(depthStencil)
{ {
...@@ -410,7 +410,7 @@ DepthStencilbuffer::~DepthStencilbuffer() ...@@ -410,7 +410,7 @@ DepthStencilbuffer::~DepthStencilbuffer()
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *DepthStencilbuffer::getRenderTarget() egl::Image *DepthStencilbuffer::getRenderTarget()
{ {
if(mDepthStencil) if(mDepthStencil)
{ {
...@@ -422,7 +422,7 @@ Image *DepthStencilbuffer::getRenderTarget() ...@@ -422,7 +422,7 @@ Image *DepthStencilbuffer::getRenderTarget()
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *DepthStencilbuffer::createSharedImage() egl::Image *DepthStencilbuffer::createSharedImage()
{ {
if(mDepthStencil) if(mDepthStencil)
{ {
...@@ -438,7 +438,7 @@ bool DepthStencilbuffer::isShared() const ...@@ -438,7 +438,7 @@ bool DepthStencilbuffer::isShared() const
return mDepthStencil->isShared(); return mDepthStencil->isShared();
} }
Depthbuffer::Depthbuffer(Image *depthStencil) : DepthStencilbuffer(depthStencil) Depthbuffer::Depthbuffer(egl::Image *depthStencil) : DepthStencilbuffer(depthStencil)
{ {
if(depthStencil) if(depthStencil)
{ {
...@@ -462,7 +462,7 @@ Depthbuffer::~Depthbuffer() ...@@ -462,7 +462,7 @@ Depthbuffer::~Depthbuffer()
{ {
} }
Stencilbuffer::Stencilbuffer(Image *depthStencil) : DepthStencilbuffer(depthStencil) Stencilbuffer::Stencilbuffer(egl::Image *depthStencil) : DepthStencilbuffer(depthStencil)
{ {
if(depthStencil) if(depthStencil)
{ {
......
...@@ -40,8 +40,8 @@ public: ...@@ -40,8 +40,8 @@ public:
virtual void addProxyRef(const Renderbuffer *proxy); virtual void addProxyRef(const Renderbuffer *proxy);
virtual void releaseProxy(const Renderbuffer *proxy); virtual void releaseProxy(const Renderbuffer *proxy);
virtual Image *getRenderTarget() = 0; virtual egl::Image *getRenderTarget() = 0;
virtual Image *createSharedImage() = 0; virtual egl::Image *createSharedImage() = 0;
virtual bool isShared() const = 0; virtual bool isShared() const = 0;
virtual GLsizei getWidth() const = 0; virtual GLsizei getWidth() const = 0;
...@@ -68,8 +68,8 @@ public: ...@@ -68,8 +68,8 @@ public:
virtual void addProxyRef(const Renderbuffer *proxy); virtual void addProxyRef(const Renderbuffer *proxy);
virtual void releaseProxy(const Renderbuffer *proxy); virtual void releaseProxy(const Renderbuffer *proxy);
virtual Image *getRenderTarget(); virtual egl::Image *getRenderTarget();
virtual Image *createSharedImage(); virtual egl::Image *createSharedImage();
virtual bool isShared() const; virtual bool isShared() const;
virtual GLsizei getWidth() const; virtual GLsizei getWidth() const;
...@@ -92,8 +92,8 @@ public: ...@@ -92,8 +92,8 @@ public:
virtual ~RenderbufferStorage() = 0; virtual ~RenderbufferStorage() = 0;
virtual Image *getRenderTarget() = 0; virtual egl::Image *getRenderTarget() = 0;
virtual Image *createSharedImage() = 0; virtual egl::Image *createSharedImage() = 0;
virtual bool isShared() const = 0; virtual bool isShared() const = 0;
virtual GLsizei getWidth() const; virtual GLsizei getWidth() const;
...@@ -127,8 +127,8 @@ public: ...@@ -127,8 +127,8 @@ public:
virtual void addRef(); virtual void addRef();
virtual void release(); virtual void release();
Image *getRenderTarget(); egl::Image *getRenderTarget();
virtual Image *createSharedImage(); virtual egl::Image *createSharedImage();
virtual bool isShared() const; virtual bool isShared() const;
GLsizei getWidth() const; GLsizei getWidth() const;
...@@ -152,39 +152,39 @@ private: ...@@ -152,39 +152,39 @@ private:
class Colorbuffer : public RenderbufferStorage class Colorbuffer : public RenderbufferStorage
{ {
public: public:
explicit Colorbuffer(Image *renderTarget); explicit Colorbuffer(egl::Image *renderTarget);
Colorbuffer(GLsizei width, GLsizei height, GLenum format, GLsizei samples); Colorbuffer(GLsizei width, GLsizei height, GLenum format, GLsizei samples);
virtual ~Colorbuffer(); virtual ~Colorbuffer();
virtual Image *getRenderTarget(); virtual egl::Image *getRenderTarget();
virtual Image *createSharedImage(); virtual egl::Image *createSharedImage();
virtual bool isShared() const; virtual bool isShared() const;
private: private:
Image *mRenderTarget; egl::Image *mRenderTarget;
}; };
class DepthStencilbuffer : public RenderbufferStorage class DepthStencilbuffer : public RenderbufferStorage
{ {
public: public:
explicit DepthStencilbuffer(Image *depthStencil); explicit DepthStencilbuffer(egl::Image *depthStencil);
DepthStencilbuffer(GLsizei width, GLsizei height, GLsizei samples); DepthStencilbuffer(GLsizei width, GLsizei height, GLsizei samples);
~DepthStencilbuffer(); ~DepthStencilbuffer();
virtual Image *getRenderTarget(); virtual egl::Image *getRenderTarget();
virtual Image *createSharedImage(); virtual egl::Image *createSharedImage();
virtual bool isShared() const; virtual bool isShared() const;
protected: protected:
Image *mDepthStencil; egl::Image *mDepthStencil;
}; };
class Depthbuffer : public DepthStencilbuffer class Depthbuffer : public DepthStencilbuffer
{ {
public: public:
explicit Depthbuffer(Image *depthStencil); explicit Depthbuffer(egl::Image *depthStencil);
Depthbuffer(GLsizei width, GLsizei height, GLsizei samples); Depthbuffer(GLsizei width, GLsizei height, GLsizei samples);
virtual ~Depthbuffer(); virtual ~Depthbuffer();
...@@ -193,7 +193,7 @@ public: ...@@ -193,7 +193,7 @@ public:
class Stencilbuffer : public DepthStencilbuffer class Stencilbuffer : public DepthStencilbuffer
{ {
public: public:
explicit Stencilbuffer(Image *depthStencil); explicit Stencilbuffer(egl::Image *depthStencil);
Stencilbuffer(GLsizei width, GLsizei height, GLsizei samples); Stencilbuffer(GLsizei width, GLsizei height, GLsizei samples);
virtual ~Stencilbuffer(); virtual ~Stencilbuffer();
......
...@@ -169,9 +169,9 @@ GLfloat Texture::getMaxAnisotropy() const ...@@ -169,9 +169,9 @@ GLfloat Texture::getMaxAnisotropy() const
return mMaxAnisotropy; return mMaxAnisotropy;
} }
Image *Texture::createSharedImage(GLenum target, unsigned int level) egl::Image *Texture::createSharedImage(GLenum target, unsigned int level)
{ {
Image *image = getRenderTarget(target, level); // Increments reference count egl::Image *image = getRenderTarget(target, level); // Increments reference count
if(image) if(image)
{ {
...@@ -181,7 +181,7 @@ Image *Texture::createSharedImage(GLenum target, unsigned int level) ...@@ -181,7 +181,7 @@ Image *Texture::createSharedImage(GLenum target, unsigned int level)
return image; return image;
} }
void Texture::setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image) void Texture::setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, egl::Image *image)
{ {
if(pixels && image) if(pixels && image)
{ {
...@@ -189,7 +189,7 @@ void Texture::setImage(GLenum format, GLenum type, GLint unpackAlignment, const ...@@ -189,7 +189,7 @@ void Texture::setImage(GLenum format, GLenum type, GLint unpackAlignment, const
} }
} }
void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, Image *image) void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, egl::Image *image)
{ {
if(pixels && image) if(pixels && image)
{ {
...@@ -197,7 +197,7 @@ void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, Image *i ...@@ -197,7 +197,7 @@ void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, Image *i
} }
} }
void Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image) void Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, egl::Image *image)
{ {
if(!image) if(!image)
{ {
...@@ -225,7 +225,7 @@ void Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heig ...@@ -225,7 +225,7 @@ void Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heig
} }
} }
void Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, Image *image) void Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, egl::Image *image)
{ {
if(!image) if(!image)
{ {
...@@ -248,7 +248,7 @@ void Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL ...@@ -248,7 +248,7 @@ void Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL
} }
} }
bool Texture::copy(Image *source, const sw::Rect &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, Image *dest) bool Texture::copy(egl::Image *source, const sw::Rect &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, egl::Image *dest)
{ {
Device *device = getDevice(); Device *device = getDevice();
...@@ -477,7 +477,7 @@ void Texture2D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GL ...@@ -477,7 +477,7 @@ void Texture2D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GL
void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
{ {
Image *renderTarget = source->getRenderTarget(); egl::Image *renderTarget = source->getRenderTarget();
if(!renderTarget) if(!renderTarget)
{ {
...@@ -520,7 +520,7 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo ...@@ -520,7 +520,7 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo
return error(GL_INVALID_VALUE); return error(GL_INVALID_VALUE);
} }
Image *renderTarget = source->getRenderTarget(); egl::Image *renderTarget = source->getRenderTarget();
if(!renderTarget) if(!renderTarget)
{ {
...@@ -639,7 +639,7 @@ void Texture2D::generateMipmaps() ...@@ -639,7 +639,7 @@ void Texture2D::generateMipmaps()
} }
} }
Image *Texture2D::getImage(unsigned int level) egl::Image *Texture2D::getImage(unsigned int level)
{ {
return image[level]; return image[level];
} }
...@@ -659,7 +659,7 @@ Renderbuffer *Texture2D::getRenderbuffer(GLenum target) ...@@ -659,7 +659,7 @@ Renderbuffer *Texture2D::getRenderbuffer(GLenum target)
return mColorbufferProxy; return mColorbufferProxy;
} }
Image *Texture2D::getRenderTarget(GLenum target, unsigned int level) egl::Image *Texture2D::getRenderTarget(GLenum target, unsigned int level)
{ {
ASSERT(target == GL_TEXTURE_2D); ASSERT(target == GL_TEXTURE_2D);
ASSERT(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS); ASSERT(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS);
......
...@@ -84,20 +84,20 @@ public: ...@@ -84,20 +84,20 @@ public:
virtual bool isDepth(GLenum target, GLint level) const = 0; virtual bool isDepth(GLenum target, GLint level) const = 0;
virtual Renderbuffer *getRenderbuffer(GLenum target) = 0; virtual Renderbuffer *getRenderbuffer(GLenum target) = 0;
virtual Image *getRenderTarget(GLenum target, unsigned int level) = 0; virtual egl::Image *getRenderTarget(GLenum target, unsigned int level) = 0;
virtual Image *createSharedImage(GLenum target, unsigned int level); virtual egl::Image *createSharedImage(GLenum target, unsigned int level);
virtual bool isShared(GLenum target, unsigned int level) const = 0; virtual bool isShared(GLenum target, unsigned int level) const = 0;
virtual void generateMipmaps() = 0; virtual void generateMipmaps() = 0;
virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0; virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
protected: protected:
void setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image); void setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, egl::Image *image);
void subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image); void subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, egl::Image *image);
void setCompressedImage(GLsizei imageSize, const void *pixels, Image *image); void setCompressedImage(GLsizei imageSize, const void *pixels, egl::Image *image);
void subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, Image *image); void subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, egl::Image *image);
bool copy(Image *source, const sw::Rect &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, Image *dest); bool copy(egl::Image *source, const sw::Rect &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, egl::Image *dest);
bool isMipmapFiltered() const; bool isMipmapFiltered() const;
...@@ -145,15 +145,15 @@ public: ...@@ -145,15 +145,15 @@ public:
virtual void generateMipmaps(); virtual void generateMipmaps();
virtual Renderbuffer *getRenderbuffer(GLenum target); virtual Renderbuffer *getRenderbuffer(GLenum target);
virtual Image *getRenderTarget(GLenum target, unsigned int level); virtual egl::Image *getRenderTarget(GLenum target, unsigned int level);
virtual bool isShared(GLenum target, unsigned int level) const; virtual bool isShared(GLenum target, unsigned int level) const;
Image *getImage(unsigned int level); egl::Image *getImage(unsigned int level);
protected: protected:
bool isMipmapComplete() const; bool isMipmapComplete() const;
Image *image[IMPLEMENTATION_MAX_TEXTURE_LEVELS]; egl::Image *image[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
egl::Surface *mSurface; egl::Surface *mSurface;
......
...@@ -253,8 +253,8 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface) ...@@ -253,8 +253,8 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
} }
// Wrap the existing resources into GL objects and assign them to the '0' names // Wrap the existing resources into GL objects and assign them to the '0' names
Image *defaultRenderTarget = surface->getRenderTarget(); egl::Image *defaultRenderTarget = surface->getRenderTarget();
Image *depthStencil = surface->getDepthStencil(); egl::Image *depthStencil = surface->getDepthStencil();
Colorbuffer *colorbufferZero = new Colorbuffer(defaultRenderTarget); Colorbuffer *colorbufferZero = new Colorbuffer(defaultRenderTarget);
DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(depthStencil); DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(depthStencil);
...@@ -1680,11 +1680,11 @@ bool Context::applyRenderTarget() ...@@ -1680,11 +1680,11 @@ bool Context::applyRenderTarget()
return error(GL_INVALID_FRAMEBUFFER_OPERATION, false); return error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
} }
Image *renderTarget = framebuffer->getRenderTarget(); egl::Image *renderTarget = framebuffer->getRenderTarget();
device->setRenderTarget(renderTarget); device->setRenderTarget(renderTarget);
if(renderTarget) renderTarget->release(); if(renderTarget) renderTarget->release();
Image *depthStencil = framebuffer->getDepthStencil(); egl::Image *depthStencil = framebuffer->getDepthStencil();
device->setDepthStencilSurface(depthStencil); device->setDepthStencilSurface(depthStencil);
if(depthStencil) depthStencil->release(); if(depthStencil) depthStencil->release();
...@@ -2115,7 +2115,7 @@ void Context::applyTexture(sw::SamplerType type, int index, Texture *baseTexture ...@@ -2115,7 +2115,7 @@ void Context::applyTexture(sw::SamplerType type, int index, Texture *baseTexture
surfaceLevel = levelCount - 1; surfaceLevel = levelCount - 1;
} }
Image *surface = texture->getImage(surfaceLevel); egl::Image *surface = texture->getImage(surfaceLevel);
device->setTextureLevel(sampler, 0, mipmapLevel, surface, sw::TEXTURE_2D); device->setTextureLevel(sampler, 0, mipmapLevel, surface, sw::TEXTURE_2D);
} }
} }
...@@ -2138,7 +2138,7 @@ void Context::applyTexture(sw::SamplerType type, int index, Texture *baseTexture ...@@ -2138,7 +2138,7 @@ void Context::applyTexture(sw::SamplerType type, int index, Texture *baseTexture
surfaceLevel = levelCount - 1; surfaceLevel = levelCount - 1;
} }
Image *surface = cubeTexture->getImage(face, surfaceLevel); egl::Image *surface = cubeTexture->getImage(face, surfaceLevel);
device->setTextureLevel(sampler, face, mipmapLevel, surface, sw::TEXTURE_CUBE); device->setTextureLevel(sampler, face, mipmapLevel, surface, sw::TEXTURE_CUBE);
} }
} }
...@@ -2179,7 +2179,7 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, ...@@ -2179,7 +2179,7 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
} }
} }
Image *renderTarget = framebuffer->getRenderTarget(); egl::Image *renderTarget = framebuffer->getRenderTarget();
if(!renderTarget) if(!renderTarget)
{ {
...@@ -2992,8 +2992,8 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 ...@@ -2992,8 +2992,8 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
{ {
if(blitRenderTarget) if(blitRenderTarget)
{ {
Image *readRenderTarget = readFramebuffer->getRenderTarget(); egl::Image *readRenderTarget = readFramebuffer->getRenderTarget();
Image *drawRenderTarget = drawFramebuffer->getRenderTarget(); egl::Image *drawRenderTarget = drawFramebuffer->getRenderTarget();
bool success = device->stretchRect(readRenderTarget, &sourceRect, drawRenderTarget, &destRect, false); bool success = device->stretchRect(readRenderTarget, &sourceRect, drawRenderTarget, &destRect, false);
...@@ -3101,7 +3101,7 @@ EGLenum Context::validateSharedImage(EGLenum target, GLuint name, GLuint texture ...@@ -3101,7 +3101,7 @@ EGLenum Context::validateSharedImage(EGLenum target, GLuint name, GLuint texture
return EGL_SUCCESS; return EGL_SUCCESS;
} }
Image *Context::createSharedImage(EGLenum target, GLuint name, GLuint textureLevel) egl::Image *Context::createSharedImage(EGLenum target, GLuint name, GLuint textureLevel)
{ {
GLenum textureTarget = GL_NONE; GLenum textureTarget = GL_NONE;
......
...@@ -422,7 +422,7 @@ public: ...@@ -422,7 +422,7 @@ public:
virtual void bindTexImage(egl::Surface *surface); virtual void bindTexImage(egl::Surface *surface);
virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel); virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel);
virtual gl::Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel); virtual egl::Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel);
Device *getDevice(); Device *getDevice();
......
...@@ -377,7 +377,7 @@ namespace gl ...@@ -377,7 +377,7 @@ namespace gl
draw(drawType, 0, primitiveCount); draw(drawType, 0, primitiveCount);
} }
void Device::setDepthStencilSurface(Image *depthStencil) void Device::setDepthStencilSurface(egl::Image *depthStencil)
{ {
if(this->depthStencil == depthStencil) if(this->depthStencil == depthStencil)
{ {
...@@ -424,7 +424,7 @@ namespace gl ...@@ -424,7 +424,7 @@ namespace gl
scissorEnable = enable; scissorEnable = enable;
} }
void Device::setRenderTarget(Image *renderTarget) void Device::setRenderTarget(egl::Image *renderTarget)
{ {
if(renderTarget) if(renderTarget)
{ {
...@@ -471,7 +471,7 @@ namespace gl ...@@ -471,7 +471,7 @@ namespace gl
this->viewport = viewport; this->viewport = viewport;
} }
bool Device::stretchRect(Image *source, const sw::Rect *sourceRect, Image *dest, const sw::Rect *destRect, bool filter) bool Device::stretchRect(egl::Image *source, const sw::Rect *sourceRect, egl::Image *dest, const sw::Rect *destRect, bool filter)
{ {
if(!source || !dest || !validRectangle(sourceRect, source) || !validRectangle(destRect, dest)) if(!source || !dest || !validRectangle(sourceRect, source) || !validRectangle(destRect, dest))
{ {
...@@ -722,7 +722,7 @@ namespace gl ...@@ -722,7 +722,7 @@ namespace gl
return true; return true;
} }
bool Device::validRectangle(const sw::Rect *rect, Image *surface) bool Device::validRectangle(const sw::Rect *rect, egl::Image *surface)
{ {
if(!rect) if(!rect)
{ {
......
...@@ -14,13 +14,14 @@ ...@@ -14,13 +14,14 @@
#include "Renderer/Renderer.hpp" #include "Renderer/Renderer.hpp"
namespace gl namespace egl
{ {
class Texture; class Image;
} }
namespace gl namespace gl
{ {
class Texture;
class Image; class Image;
enum PrimitiveType enum PrimitiveType
...@@ -58,17 +59,17 @@ namespace gl ...@@ -58,17 +59,17 @@ namespace gl
virtual Image *createRenderTarget(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool lockable); virtual Image *createRenderTarget(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool lockable);
virtual void drawIndexedPrimitive(PrimitiveType type, unsigned int indexOffset, unsigned int primitiveCount, int indexSize); virtual void drawIndexedPrimitive(PrimitiveType type, unsigned int indexOffset, unsigned int primitiveCount, int indexSize);
virtual void drawPrimitive(PrimitiveType primitiveType, unsigned int primiveCount); virtual void drawPrimitive(PrimitiveType primitiveType, unsigned int primiveCount);
virtual void setDepthStencilSurface(Image *newDepthStencil); virtual void setDepthStencilSurface(egl::Image *newDepthStencil);
virtual void setPixelShader(sw::PixelShader *shader); virtual void setPixelShader(sw::PixelShader *shader);
virtual void setPixelShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count); virtual void setPixelShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count);
virtual void setScissorEnable(bool enable); virtual void setScissorEnable(bool enable);
virtual void setRenderTarget(Image *renderTarget); virtual void setRenderTarget(egl::Image *renderTarget);
virtual void setScissorRect(const sw::Rect &rect); virtual void setScissorRect(const sw::Rect &rect);
virtual void setVertexShader(sw::VertexShader *shader); virtual void setVertexShader(sw::VertexShader *shader);
virtual void setVertexShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count); virtual void setVertexShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count);
virtual void setViewport(const Viewport &viewport); virtual void setViewport(const Viewport &viewport);
virtual bool stretchRect(Image *sourceSurface, const sw::Rect *sourceRect, Image *destSurface, const sw::Rect *destRect, bool filter); virtual bool stretchRect(egl::Image *sourceSurface, const sw::Rect *sourceRect, egl::Image *destSurface, const sw::Rect *destRect, bool filter);
virtual void finish(); virtual void finish();
private: private:
...@@ -78,7 +79,7 @@ namespace gl ...@@ -78,7 +79,7 @@ namespace gl
void bindShaderConstants(); void bindShaderConstants();
bool bindViewport(); // Also adjusts for scissoring bool bindViewport(); // Also adjusts for scissoring
bool validRectangle(const sw::Rect *rect, Image *surface); bool validRectangle(const sw::Rect *rect, egl::Image *surface);
Viewport viewport; Viewport viewport;
sw::Rect scissorRect; sw::Rect scissorRect;
...@@ -95,8 +96,8 @@ namespace gl ...@@ -95,8 +96,8 @@ namespace gl
float pixelShaderConstantF[224][4]; float pixelShaderConstantF[224][4];
float vertexShaderConstantF[256][4]; float vertexShaderConstantF[256][4];
Image *renderTarget; egl::Image *renderTarget;
Image *depthStencil; egl::Image *depthStencil;
}; };
} }
......
...@@ -123,7 +123,7 @@ void Framebuffer::detachRenderbuffer(GLuint renderbuffer) ...@@ -123,7 +123,7 @@ void Framebuffer::detachRenderbuffer(GLuint renderbuffer)
// Increments refcount on surface. // Increments refcount on surface.
// caller must Release() the returned surface // caller must Release() the returned surface
Image *Framebuffer::getRenderTarget() egl::Image *Framebuffer::getRenderTarget()
{ {
Renderbuffer *colorbuffer = mColorbufferPointer.get(); Renderbuffer *colorbuffer = mColorbufferPointer.get();
...@@ -137,7 +137,7 @@ Image *Framebuffer::getRenderTarget() ...@@ -137,7 +137,7 @@ Image *Framebuffer::getRenderTarget()
// Increments refcount on surface. // Increments refcount on surface.
// caller must Release() the returned surface // caller must Release() the returned surface
Image *Framebuffer::getDepthStencil() egl::Image *Framebuffer::getDepthStencil()
{ {
Renderbuffer *depthstencilbuffer = mDepthbufferPointer.get(); Renderbuffer *depthstencilbuffer = mDepthbufferPointer.get();
......
...@@ -43,8 +43,8 @@ public: ...@@ -43,8 +43,8 @@ public:
void detachTexture(GLuint texture); void detachTexture(GLuint texture);
void detachRenderbuffer(GLuint renderbuffer); void detachRenderbuffer(GLuint renderbuffer);
Image *getRenderTarget(); egl::Image *getRenderTarget();
Image *getDepthStencil(); egl::Image *getDepthStencil();
Renderbuffer *getColorbuffer(); Renderbuffer *getColorbuffer();
Renderbuffer *getDepthbuffer(); Renderbuffer *getDepthbuffer();
......
...@@ -33,7 +33,7 @@ namespace gl ...@@ -33,7 +33,7 @@ namespace gl
Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type) Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type)
: parentTexture(parentTexture), width(width), height(height), format(format), type(type) : parentTexture(parentTexture), width(width), height(height), format(format), type(type)
, internalFormat(selectInternalFormat(format, type)), multiSampleDepth(1) , internalFormat(selectInternalFormat(format, type)), multiSampleDepth(1)
, sw::Surface(getParentResource(parentTexture), width, height, 1, selectInternalFormat(format, type), true, true) , egl::Image(getParentResource(parentTexture), width, height, 1, selectInternalFormat(format, type), true, true)
{ {
shared = false; shared = false;
referenceCount = 1; referenceCount = 1;
...@@ -41,7 +41,7 @@ namespace gl ...@@ -41,7 +41,7 @@ namespace gl
Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, GLenum format, GLenum type, int multiSampleDepth, bool lockable, bool renderTarget) 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) : parentTexture(parentTexture), width(width), height(height), internalFormat(internalFormat), format(format), type(type), multiSampleDepth(multiSampleDepth)
, sw::Surface(getParentResource(parentTexture), width, height, multiSampleDepth, internalFormat, lockable, renderTarget) , egl::Image(getParentResource(parentTexture), width, height, multiSampleDepth, internalFormat, lockable, renderTarget)
{ {
shared = false; shared = false;
referenceCount = 1; referenceCount = 1;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define gl_Image_hpp #define gl_Image_hpp
#include "Renderer/Surface.hpp" #include "Renderer/Surface.hpp"
#include "libEGL/Image.hpp"
#define GL_APICALL #define GL_APICALL
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
...@@ -21,7 +22,7 @@ namespace gl ...@@ -21,7 +22,7 @@ namespace gl
{ {
class Texture; class Texture;
class Image : public sw::Surface class Image : public egl::Image
{ {
public: public:
Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type); Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type);
......
...@@ -92,14 +92,14 @@ void RenderbufferTexture2D::releaseProxy(const Renderbuffer *proxy) ...@@ -92,14 +92,14 @@ void RenderbufferTexture2D::releaseProxy(const Renderbuffer *proxy)
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *RenderbufferTexture2D::getRenderTarget() egl::Image *RenderbufferTexture2D::getRenderTarget()
{ {
return mTexture2D->getRenderTarget(GL_TEXTURE_2D, 0); return mTexture2D->getRenderTarget(GL_TEXTURE_2D, 0);
} }
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *RenderbufferTexture2D::createSharedImage() egl::Image *RenderbufferTexture2D::createSharedImage()
{ {
return mTexture2D->createSharedImage(GL_TEXTURE_2D, 0); return mTexture2D->createSharedImage(GL_TEXTURE_2D, 0);
} }
...@@ -167,7 +167,7 @@ Image *RenderbufferTextureCubeMap::getRenderTarget() ...@@ -167,7 +167,7 @@ Image *RenderbufferTextureCubeMap::getRenderTarget()
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *RenderbufferTextureCubeMap::createSharedImage() egl::Image *RenderbufferTextureCubeMap::createSharedImage()
{ {
return mTextureCubeMap->createSharedImage(mTarget, 0); return mTextureCubeMap->createSharedImage(mTarget, 0);
} }
...@@ -233,14 +233,14 @@ void Renderbuffer::release() ...@@ -233,14 +233,14 @@ void Renderbuffer::release()
// Increments refcount on image. // Increments refcount on image.
// caller must Release() the returned image // caller must Release() the returned image
Image *Renderbuffer::getRenderTarget() egl::Image *Renderbuffer::getRenderTarget()
{ {
return mInstance->getRenderTarget(); return mInstance->getRenderTarget();
} }
// Increments refcount on image. // Increments refcount on image.
// caller must Release() the returned image // caller must Release() the returned image
Image *Renderbuffer::createSharedImage() egl::Image *Renderbuffer::createSharedImage()
{ {
return mInstance->createSharedImage(); return mInstance->createSharedImage();
} }
...@@ -351,7 +351,7 @@ GLsizei RenderbufferStorage::getSamples() const ...@@ -351,7 +351,7 @@ GLsizei RenderbufferStorage::getSamples() const
return mSamples; return mSamples;
} }
Colorbuffer::Colorbuffer(Image *renderTarget) : mRenderTarget(renderTarget) Colorbuffer::Colorbuffer(egl::Image *renderTarget) : mRenderTarget(renderTarget)
{ {
if(renderTarget) if(renderTarget)
{ {
...@@ -400,7 +400,7 @@ Colorbuffer::~Colorbuffer() ...@@ -400,7 +400,7 @@ Colorbuffer::~Colorbuffer()
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *Colorbuffer::getRenderTarget() egl::Image *Colorbuffer::getRenderTarget()
{ {
if(mRenderTarget) if(mRenderTarget)
{ {
...@@ -412,7 +412,7 @@ Image *Colorbuffer::getRenderTarget() ...@@ -412,7 +412,7 @@ Image *Colorbuffer::getRenderTarget()
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *Colorbuffer::createSharedImage() egl::Image *Colorbuffer::createSharedImage()
{ {
if(mRenderTarget) if(mRenderTarget)
{ {
...@@ -428,7 +428,7 @@ bool Colorbuffer::isShared() const ...@@ -428,7 +428,7 @@ bool Colorbuffer::isShared() const
return mRenderTarget->isShared(); return mRenderTarget->isShared();
} }
DepthStencilbuffer::DepthStencilbuffer(Image *depthStencil) : mDepthStencil(depthStencil) DepthStencilbuffer::DepthStencilbuffer(egl::Image *depthStencil) : mDepthStencil(depthStencil)
{ {
if(depthStencil) if(depthStencil)
{ {
...@@ -478,7 +478,7 @@ DepthStencilbuffer::~DepthStencilbuffer() ...@@ -478,7 +478,7 @@ DepthStencilbuffer::~DepthStencilbuffer()
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *DepthStencilbuffer::getRenderTarget() egl::Image *DepthStencilbuffer::getRenderTarget()
{ {
if(mDepthStencil) if(mDepthStencil)
{ {
...@@ -490,7 +490,7 @@ Image *DepthStencilbuffer::getRenderTarget() ...@@ -490,7 +490,7 @@ Image *DepthStencilbuffer::getRenderTarget()
// Increments refcount on image. // Increments refcount on image.
// caller must release() the returned image // caller must release() the returned image
Image *DepthStencilbuffer::createSharedImage() egl::Image *DepthStencilbuffer::createSharedImage()
{ {
if(mDepthStencil) if(mDepthStencil)
{ {
...@@ -506,7 +506,7 @@ bool DepthStencilbuffer::isShared() const ...@@ -506,7 +506,7 @@ bool DepthStencilbuffer::isShared() const
return mDepthStencil->isShared(); return mDepthStencil->isShared();
} }
Depthbuffer::Depthbuffer(Image *depthStencil) : DepthStencilbuffer(depthStencil) Depthbuffer::Depthbuffer(egl::Image *depthStencil) : DepthStencilbuffer(depthStencil)
{ {
if(depthStencil) if(depthStencil)
{ {
...@@ -530,7 +530,7 @@ Depthbuffer::~Depthbuffer() ...@@ -530,7 +530,7 @@ Depthbuffer::~Depthbuffer()
{ {
} }
Stencilbuffer::Stencilbuffer(Image *depthStencil) : DepthStencilbuffer(depthStencil) Stencilbuffer::Stencilbuffer(egl::Image *depthStencil) : DepthStencilbuffer(depthStencil)
{ {
if(depthStencil) if(depthStencil)
{ {
......
...@@ -41,8 +41,8 @@ public: ...@@ -41,8 +41,8 @@ public:
virtual void addProxyRef(const Renderbuffer *proxy); virtual void addProxyRef(const Renderbuffer *proxy);
virtual void releaseProxy(const Renderbuffer *proxy); virtual void releaseProxy(const Renderbuffer *proxy);
virtual Image *getRenderTarget() = 0; virtual egl::Image *getRenderTarget() = 0;
virtual Image *createSharedImage() = 0; virtual egl::Image *createSharedImage() = 0;
virtual bool isShared() const = 0; virtual bool isShared() const = 0;
virtual GLsizei getWidth() const = 0; virtual GLsizei getWidth() const = 0;
...@@ -69,8 +69,8 @@ public: ...@@ -69,8 +69,8 @@ public:
virtual void addProxyRef(const Renderbuffer *proxy); virtual void addProxyRef(const Renderbuffer *proxy);
virtual void releaseProxy(const Renderbuffer *proxy); virtual void releaseProxy(const Renderbuffer *proxy);
virtual Image *getRenderTarget(); virtual egl::Image *getRenderTarget();
virtual Image *createSharedImage(); virtual egl::Image *createSharedImage();
virtual bool isShared() const; virtual bool isShared() const;
virtual GLsizei getWidth() const; virtual GLsizei getWidth() const;
...@@ -94,7 +94,7 @@ public: ...@@ -94,7 +94,7 @@ public:
virtual void releaseProxy(const Renderbuffer *proxy); virtual void releaseProxy(const Renderbuffer *proxy);
virtual Image *getRenderTarget(); virtual Image *getRenderTarget();
virtual Image *createSharedImage(); virtual egl::Image *createSharedImage();
virtual bool isShared() const; virtual bool isShared() const;
virtual GLsizei getWidth() const; virtual GLsizei getWidth() const;
...@@ -118,8 +118,8 @@ public: ...@@ -118,8 +118,8 @@ public:
virtual ~RenderbufferStorage() = 0; virtual ~RenderbufferStorage() = 0;
virtual Image *getRenderTarget() = 0; virtual egl::Image *getRenderTarget() = 0;
virtual Image *createSharedImage() = 0; virtual egl::Image *createSharedImage() = 0;
virtual bool isShared() const = 0; virtual bool isShared() const = 0;
virtual GLsizei getWidth() const; virtual GLsizei getWidth() const;
...@@ -153,8 +153,8 @@ public: ...@@ -153,8 +153,8 @@ public:
virtual void addRef(); virtual void addRef();
virtual void release(); virtual void release();
Image *getRenderTarget(); egl::Image *getRenderTarget();
virtual Image *createSharedImage(); virtual egl::Image *createSharedImage();
virtual bool isShared() const; virtual bool isShared() const;
GLsizei getWidth() const; GLsizei getWidth() const;
...@@ -178,39 +178,39 @@ private: ...@@ -178,39 +178,39 @@ private:
class Colorbuffer : public RenderbufferStorage class Colorbuffer : public RenderbufferStorage
{ {
public: public:
explicit Colorbuffer(Image *renderTarget); explicit Colorbuffer(egl::Image *renderTarget);
Colorbuffer(GLsizei width, GLsizei height, GLenum format, GLsizei samples); Colorbuffer(GLsizei width, GLsizei height, GLenum format, GLsizei samples);
virtual ~Colorbuffer(); virtual ~Colorbuffer();
virtual Image *getRenderTarget(); virtual egl::Image *getRenderTarget();
virtual Image *createSharedImage(); virtual egl::Image *createSharedImage();
virtual bool isShared() const; virtual bool isShared() const;
private: private:
Image *mRenderTarget; egl::Image *mRenderTarget;
}; };
class DepthStencilbuffer : public RenderbufferStorage class DepthStencilbuffer : public RenderbufferStorage
{ {
public: public:
explicit DepthStencilbuffer(Image *depthStencil); explicit DepthStencilbuffer(egl::Image *depthStencil);
DepthStencilbuffer(GLsizei width, GLsizei height, GLsizei samples); DepthStencilbuffer(GLsizei width, GLsizei height, GLsizei samples);
~DepthStencilbuffer(); ~DepthStencilbuffer();
virtual Image *getRenderTarget(); virtual egl::Image *getRenderTarget();
virtual Image *createSharedImage(); virtual egl::Image *createSharedImage();
virtual bool isShared() const; virtual bool isShared() const;
protected: protected:
Image *mDepthStencil; egl::Image *mDepthStencil;
}; };
class Depthbuffer : public DepthStencilbuffer class Depthbuffer : public DepthStencilbuffer
{ {
public: public:
explicit Depthbuffer(Image *depthStencil); explicit Depthbuffer(egl::Image *depthStencil);
Depthbuffer(GLsizei width, GLsizei height, GLsizei samples); Depthbuffer(GLsizei width, GLsizei height, GLsizei samples);
virtual ~Depthbuffer(); virtual ~Depthbuffer();
...@@ -219,7 +219,7 @@ public: ...@@ -219,7 +219,7 @@ public:
class Stencilbuffer : public DepthStencilbuffer class Stencilbuffer : public DepthStencilbuffer
{ {
public: public:
explicit Stencilbuffer(Image *depthStencil); explicit Stencilbuffer(egl::Image *depthStencil);
Stencilbuffer(GLsizei width, GLsizei height, GLsizei samples); Stencilbuffer(GLsizei width, GLsizei height, GLsizei samples);
virtual ~Stencilbuffer(); virtual ~Stencilbuffer();
......
...@@ -169,9 +169,9 @@ GLfloat Texture::getMaxAnisotropy() const ...@@ -169,9 +169,9 @@ GLfloat Texture::getMaxAnisotropy() const
return mMaxAnisotropy; return mMaxAnisotropy;
} }
Image *Texture::createSharedImage(GLenum target, unsigned int level) egl::Image *Texture::createSharedImage(GLenum target, unsigned int level)
{ {
Image *image = getRenderTarget(target, level); // Increments reference count egl::Image *image = getRenderTarget(target, level); // Increments reference count
if(image) if(image)
{ {
...@@ -181,7 +181,7 @@ Image *Texture::createSharedImage(GLenum target, unsigned int level) ...@@ -181,7 +181,7 @@ Image *Texture::createSharedImage(GLenum target, unsigned int level)
return image; return image;
} }
void Texture::setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image) void Texture::setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels,egl:: Image *image)
{ {
if(pixels && image) if(pixels && image)
{ {
...@@ -189,7 +189,7 @@ void Texture::setImage(GLenum format, GLenum type, GLint unpackAlignment, const ...@@ -189,7 +189,7 @@ void Texture::setImage(GLenum format, GLenum type, GLint unpackAlignment, const
} }
} }
void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, Image *image) void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, egl::Image *image)
{ {
if(pixels && image) if(pixels && image)
{ {
...@@ -197,7 +197,7 @@ void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, Image *i ...@@ -197,7 +197,7 @@ void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, Image *i
} }
} }
void Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image) void Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, egl::Image *image)
{ {
if(!image) if(!image)
{ {
...@@ -225,7 +225,7 @@ void Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heig ...@@ -225,7 +225,7 @@ void Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heig
} }
} }
void Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, Image *image) void Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, egl::Image *image)
{ {
if(!image) if(!image)
{ {
...@@ -248,7 +248,7 @@ void Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL ...@@ -248,7 +248,7 @@ void Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL
} }
} }
bool Texture::copy(Image *source, const sw::Rect &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, Image *dest) bool Texture::copy(egl::Image *source, const sw::Rect &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, egl::Image *dest)
{ {
Device *device = getDevice(); Device *device = getDevice();
...@@ -477,7 +477,7 @@ void Texture2D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GL ...@@ -477,7 +477,7 @@ void Texture2D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GL
void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
{ {
Image *renderTarget = source->getRenderTarget(); egl::Image *renderTarget = source->getRenderTarget();
if(!renderTarget) if(!renderTarget)
{ {
...@@ -520,7 +520,7 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo ...@@ -520,7 +520,7 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo
return error(GL_INVALID_VALUE); return error(GL_INVALID_VALUE);
} }
Image *renderTarget = source->getRenderTarget(); egl::Image *renderTarget = source->getRenderTarget();
if(!renderTarget) if(!renderTarget)
{ {
...@@ -639,7 +639,7 @@ void Texture2D::generateMipmaps() ...@@ -639,7 +639,7 @@ void Texture2D::generateMipmaps()
} }
} }
Image *Texture2D::getImage(unsigned int level) egl::Image *Texture2D::getImage(unsigned int level)
{ {
return image[level]; return image[level];
} }
...@@ -659,7 +659,7 @@ Renderbuffer *Texture2D::getRenderbuffer(GLenum target) ...@@ -659,7 +659,7 @@ Renderbuffer *Texture2D::getRenderbuffer(GLenum target)
return mColorbufferProxy; return mColorbufferProxy;
} }
Image *Texture2D::getRenderTarget(GLenum target, unsigned int level) egl::Image *Texture2D::getRenderTarget(GLenum target, unsigned int level)
{ {
ASSERT(target == GL_TEXTURE_2D); ASSERT(target == GL_TEXTURE_2D);
ASSERT(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS); ASSERT(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS);
...@@ -971,7 +971,7 @@ void TextureCubeMap::setImage(GLenum target, GLint level, GLsizei width, GLsizei ...@@ -971,7 +971,7 @@ void TextureCubeMap::setImage(GLenum target, GLint level, GLsizei width, GLsizei
void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
{ {
Image *renderTarget = source->getRenderTarget(); egl::Image *renderTarget = source->getRenderTarget();
if(!renderTarget) if(!renderTarget)
{ {
...@@ -1030,7 +1030,7 @@ void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLi ...@@ -1030,7 +1030,7 @@ void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLi
return error(GL_INVALID_VALUE); return error(GL_INVALID_VALUE);
} }
Image *renderTarget = source->getRenderTarget(); egl::Image *renderTarget = source->getRenderTarget();
if(!renderTarget) if(!renderTarget)
{ {
......
...@@ -84,20 +84,20 @@ public: ...@@ -84,20 +84,20 @@ public:
virtual bool isDepth(GLenum target, GLint level) const = 0; virtual bool isDepth(GLenum target, GLint level) const = 0;
virtual Renderbuffer *getRenderbuffer(GLenum target) = 0; virtual Renderbuffer *getRenderbuffer(GLenum target) = 0;
virtual Image *getRenderTarget(GLenum target, unsigned int level) = 0; virtual egl::Image *getRenderTarget(GLenum target, unsigned int level) = 0;
virtual Image *createSharedImage(GLenum target, unsigned int level); virtual egl::Image *createSharedImage(GLenum target, unsigned int level);
virtual bool isShared(GLenum target, unsigned int level) const = 0; virtual bool isShared(GLenum target, unsigned int level) const = 0;
virtual void generateMipmaps() = 0; virtual void generateMipmaps() = 0;
virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0; virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
protected: protected:
void setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image); void setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, egl::Image *image);
void subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image); void subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, egl::Image *image);
void setCompressedImage(GLsizei imageSize, const void *pixels, Image *image); void setCompressedImage(GLsizei imageSize, const void *pixels, egl::Image *image);
void subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, Image *image); void subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, egl::Image *image);
bool copy(Image *source, const sw::Rect &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, Image *dest); bool copy(egl::Image *source, const sw::Rect &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, egl::Image *dest);
bool isMipmapFiltered() const; bool isMipmapFiltered() const;
...@@ -145,15 +145,15 @@ public: ...@@ -145,15 +145,15 @@ public:
virtual void generateMipmaps(); virtual void generateMipmaps();
virtual Renderbuffer *getRenderbuffer(GLenum target); virtual Renderbuffer *getRenderbuffer(GLenum target);
virtual Image *getRenderTarget(GLenum target, unsigned int level); virtual egl::Image *getRenderTarget(GLenum target, unsigned int level);
virtual bool isShared(GLenum target, unsigned int level) const; virtual bool isShared(GLenum target, unsigned int level) const;
Image *getImage(unsigned int level); egl::Image *getImage(unsigned int level);
protected: protected:
bool isMipmapComplete() const; bool isMipmapComplete() const;
Image *image[IMPLEMENTATION_MAX_TEXTURE_LEVELS]; egl::Image *image[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
egl::Surface *mSurface; egl::Surface *mSurface;
......
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