renderTarget->release();\r
}\r
\r
+void Texture2D::setImage(egl::Image *sharedImage)\r
+{\r
+ sharedImage->addRef();\r
+\r
+ if(image[0])\r
+ {\r
+ image[0]->unbind();\r
+ }\r
+\r
+ image[0] = sharedImage;\r
+}\r
+\r
// Tests for 2D texture sampling completeness. [OpenGL ES 2.0.24] section 3.8.2 page 85.\r
bool Texture2D::isSamplerComplete() const\r
{\r
return GL_TEXTURE_EXTERNAL_OES;\r
}\r
\r
-void TextureExternal::setImage(Image *sharedImage)\r
-{\r
- if(image[0])\r
- {\r
- image[0]->release();\r
- }\r
-\r
- sharedImage->addRef();\r
- image[0] = sharedImage;\r
-}\r
-\r
}\r
\r
// Exported functions for use by EGL\r
extern "C"\r
{\r
- es1::Image *createBackBuffer(int width, int height, const egl::Config *config)\r
+ egl::Image *createBackBuffer(int width, int height, const egl::Config *config)\r
{\r
if(config)\r
{\r
return 0;\r
}\r
\r
- es1::Image *createDepthStencil(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard)\r
+ egl::Image *createDepthStencil(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard)\r
{\r
if(width == 0 || height == 0 || height > OUTLINE_RESOLUTION)\r
{\r
void copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);\r
void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);\r
\r
+ void setImage(egl::Image *image);\r
+\r
virtual bool isSamplerComplete() const;\r
virtual bool isCompressed(GLenum target, GLint level) const;\r
virtual bool isDepth(GLenum target, GLint level) const;\r
virtual ~TextureExternal();\r
\r
virtual GLenum getTarget() const;\r
-\r
- void setImage(Image *image);\r
};\r
}\r
\r
{\r
switch(target)\r
{\r
+ case GL_TEXTURE_2D:\r
case GL_TEXTURE_EXTERNAL_OES:\r
break;\r
default:\r
\r
if(context)\r
{\r
- es1::TextureExternal *texture = context->getTextureExternal();\r
+ es1::Texture2D *texture = 0;\r
+ \r
+ switch(target)\r
+ {\r
+ case GL_TEXTURE_2D: texture = context->getTexture2D(); break;\r
+ case GL_TEXTURE_EXTERNAL_OES: texture = context->getTextureExternal(); break;\r
+ default: UNREACHABLE();\r
+ }\r
\r
if(!texture)\r
{\r
return error(GL_INVALID_OPERATION);\r
}\r
\r
- es1::Image *glImage = static_cast<es1::Image*>(image);\r
+ egl::Image *glImage = static_cast<egl::Image*>(image);\r
\r
texture->setImage(glImage);\r
}\r
renderTarget->release();\r
}\r
\r
+void Texture2D::setImage(egl::Image *sharedImage)\r
+{\r
+ sharedImage->addRef();\r
+\r
+ if(image[0])\r
+ {\r
+ image[0]->unbind();\r
+ }\r
+\r
+ image[0] = sharedImage;\r
+}\r
+\r
// Tests for 2D texture sampling completeness. [OpenGL ES 2.0.24] section 3.8.2 page 85.\r
bool Texture2D::isSamplerComplete() const\r
{\r
return GL_TEXTURE_EXTERNAL_OES;\r
}\r
\r
-void TextureExternal::setImage(Image *sharedImage)\r
-{\r
- if(image[0])\r
- {\r
- image[0]->release();\r
- }\r
-\r
- sharedImage->addRef();\r
- image[0] = sharedImage;\r
-}\r
-\r
}\r
\r
// Exported functions for use by EGL\r
extern "C"\r
{\r
- es2::Image *createBackBuffer(int width, int height, const egl::Config *config)\r
+ egl::Image *createBackBuffer(int width, int height, const egl::Config *config)\r
{\r
if(config)\r
{\r
return 0;\r
}\r
\r
- es2::Image *createDepthStencil(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard)\r
+ egl::Image *createDepthStencil(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard)\r
{\r
if(width == 0 || height == 0 || height > OUTLINE_RESOLUTION)\r
{\r
void copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);\r
void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);\r
\r
+ void setImage(egl::Image *image);\r
+\r
virtual bool isSamplerComplete() const;\r
virtual bool isCompressed(GLenum target, GLint level) const;\r
virtual bool isDepth(GLenum target, GLint level) const;\r
virtual ~TextureExternal();\r
\r
virtual GLenum getTarget() const;\r
-\r
- void setImage(Image *image);\r
};\r
}\r
\r
{\r
switch(target)\r
{\r
+ case GL_TEXTURE_2D:\r
case GL_TEXTURE_EXTERNAL_OES:\r
break;\r
default:\r
\r
if(context)\r
{\r
- es2::TextureExternal *texture = context->getTextureExternal();\r
+ es2::Texture2D *texture = 0;\r
+ \r
+ switch(target)\r
+ {\r
+ case GL_TEXTURE_2D: texture = context->getTexture2D(); break;\r
+ case GL_TEXTURE_EXTERNAL_OES: texture = context->getTextureExternal(); break;\r
+ default: UNREACHABLE();\r
+ }\r
\r
if(!texture)\r
{\r
return error(GL_INVALID_OPERATION);\r
}\r
\r
- es2::Image *glImage = static_cast<es2::Image*>(image);\r
+ egl::Image *glImage = static_cast<egl::Image*>(image);\r
\r
texture->setImage(glImage);\r
}\r