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