Commit eef2c973 by Nicolas Capens Committed by Nicolas Capens

Abstract the use of textures in EGL.

BUG=18110152 Change-Id: I02e85817532de599109a9e3938badc5e48bb29c0 Reviewed-on: https://swiftshader-review.googlesource.com/1261Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 6bfaaf2c
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
#include "main.h" #include "main.h"
#include "Display.h" #include "Display.h"
#include "libGLESv2/Texture.h" #include "Texture2D.hpp"
#include "libGLESv2/Image.hpp"
#include "libGLESv2/Device.hpp" #include "libGLESv2/Device.hpp"
#include "common/debug.h" #include "common/debug.h"
#include "Main/FrameBuffer.hpp" #include "Main/FrameBuffer.hpp"
...@@ -268,12 +269,12 @@ EGLenum Surface::getTextureTarget() const ...@@ -268,12 +269,12 @@ EGLenum Surface::getTextureTarget() const
return mTextureTarget; return mTextureTarget;
} }
void Surface::setBoundTexture(gl::Texture2D *texture) void Surface::setBoundTexture(egl::Texture2D *texture)
{ {
mTexture = texture; mTexture = texture;
} }
gl::Texture2D *Surface::getBoundTexture() const egl::Texture2D *Surface::getBoundTexture() const
{ {
return mTexture; return mTexture;
} }
......
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
namespace gl namespace gl
{ {
class Image; class Image;
class Texture2D;
} }
namespace egl namespace egl
{ {
class Display; class Display;
class Config; class Config;
class Texture2D;
class Surface class Surface
{ {
...@@ -60,8 +60,8 @@ public: ...@@ -60,8 +60,8 @@ public:
virtual EGLenum getTextureTarget() const; virtual EGLenum getTextureTarget() const;
virtual sw::Format getInternalFormat() const; virtual sw::Format getInternalFormat() const;
virtual void setBoundTexture(gl::Texture2D *texture); virtual void setBoundTexture(egl::Texture2D *texture);
virtual gl::Texture2D *getBoundTexture() const; virtual egl::Texture2D *getBoundTexture() const;
bool checkForResize(); // Returns true if surface changed due to resize bool checkForResize(); // Returns true if surface changed due to resize
...@@ -73,6 +73,7 @@ private: ...@@ -73,6 +73,7 @@ private:
gl::Image *mDepthStencil; gl::Image *mDepthStencil;
sw::FrameBuffer *frameBuffer; sw::FrameBuffer *frameBuffer;
gl::Image *backBuffer; gl::Image *backBuffer;
egl::Texture2D *mTexture;
bool reset(int backbufferWidth, int backbufferHeight); bool reset(int backbufferWidth, int backbufferHeight);
...@@ -95,7 +96,6 @@ private: ...@@ -95,7 +96,6 @@ private:
// EGLenum vgAlphaFormat; // Alpha format for OpenVG // EGLenum vgAlphaFormat; // Alpha format for OpenVG
// EGLenum vgColorSpace; // Color space for OpenVG // EGLenum vgColorSpace; // Color space for OpenVG
EGLint mSwapInterval; EGLint mSwapInterval;
gl::Texture2D *mTexture;
}; };
} }
......
#ifndef egl_Texture2D_hpp
#define egl_Texture2D_hpp
namespace egl
{
class Texture2D
{
public:
virtual void releaseTexImage() = 0;
};
}
#endif // egl_Texture2D_hpp
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "main.h" #include "main.h"
#include "Display.h" #include "Display.h"
#include "Surface.h" #include "Surface.h"
#include "Texture2D.hpp"
#include "libGLESv2/Context.h" #include "libGLESv2/Context.h"
#include "libGLESv2/Texture.h" #include "libGLESv2/Texture.h"
#include "common/debug.h" #include "common/debug.h"
...@@ -708,7 +709,7 @@ EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EG ...@@ -708,7 +709,7 @@ EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EG
return error(EGL_BAD_MATCH, EGL_FALSE); return error(EGL_BAD_MATCH, EGL_FALSE);
} }
gl::Texture2D *texture = eglSurface->getBoundTexture(); egl::Texture2D *texture = eglSurface->getBoundTexture();
if(texture) if(texture)
{ {
......
...@@ -166,6 +166,7 @@ copy "$(OutDir)libEGL.dll" "$(ProjectDir)..\..\..\lib\$(Configuration)\"</Comman ...@@ -166,6 +166,7 @@ copy "$(OutDir)libEGL.dll" "$(ProjectDir)..\..\..\lib\$(Configuration)\"</Comman
<ClInclude Include="main.h" /> <ClInclude Include="main.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="Surface.h" /> <ClInclude Include="Surface.h" />
<ClInclude Include="Texture2D.hpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="libEGL.def" /> <None Include="libEGL.def" />
......
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
<ClInclude Include="Context.hpp"> <ClInclude Include="Context.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Texture2D.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="libEGL.rc" /> <ResourceCompile Include="libEGL.rc" />
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "Renderbuffer.h" #include "Renderbuffer.h"
#include "RefCountObject.h" #include "RefCountObject.h"
#include "utilities.h" #include "utilities.h"
#include "libEGL/Texture2D.hpp"
#include "common/debug.h" #include "common/debug.h"
#define GL_API #define GL_API
...@@ -109,7 +110,7 @@ protected: ...@@ -109,7 +110,7 @@ protected:
sw::Resource *resource; sw::Resource *resource;
}; };
class Texture2D : public Texture class Texture2D : public Texture, public egl::Texture2D
{ {
public: public:
explicit Texture2D(GLuint id); explicit Texture2D(GLuint id);
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "Renderbuffer.h" #include "Renderbuffer.h"
#include "RefCountObject.h" #include "RefCountObject.h"
#include "utilities.h" #include "utilities.h"
#include "libEGL/Texture2D.hpp"
#include "common/debug.h" #include "common/debug.h"
#define GL_APICALL #define GL_APICALL
...@@ -109,7 +110,7 @@ protected: ...@@ -109,7 +110,7 @@ protected:
sw::Resource *resource; sw::Resource *resource;
}; };
class Texture2D : public Texture class Texture2D : public Texture, public egl::Texture2D
{ {
public: public:
explicit Texture2D(GLuint id); explicit Texture2D(GLuint id);
......
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