// See the License for the specific language governing permissions and
// limitations under the License.
-// Surface.cpp: Implements the egl::Surface class, representing a drawing surface
-// such as the client area of a window, including any back buffers.
-// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
-
#include "FrameBufferX11.hpp"
#include "libX11.hpp"
// See the License for the specific language governing permissions and
// limitations under the License.
-// Surface.cpp: Implements the egl::Surface class, representing a drawing surface
-// such as the client area of a window, including any back buffers.
-// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
-
#ifndef sw_FrameBufferX11_hpp
#define sw_FrameBufferX11_hpp
--- /dev/null
+// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Surface.hpp: Defines the gl::Surface class, which is the abstract interface
+// for an EGL surface as viewed by the GL implementation.
+
+#ifndef INCLUDE_SURFACE_H_
+#define INCLUDE_SURFACE_H_
+
+#include "Renderer/Surface.hpp"
+
+#include <EGL/egl.h>
+
+namespace egl
+{
+class Texture;
+class Image;
+}
+
+namespace gl
+{
+class [[clang::lto_visibility_public]] Surface
+{
+protected:
+ Surface();
+ virtual ~Surface() = 0;
+
+public:
+ virtual egl::Image *getRenderTarget() = 0;
+ virtual egl::Image *getDepthStencil() = 0;
+
+ virtual sw::Format getInternalFormat() const = 0;
+
+ virtual EGLint getWidth() const = 0;
+ virtual EGLint getHeight() const = 0;
+
+ virtual void setBoundTexture(egl::Texture *texture) = 0;
+};
+}
+
+#endif // INCLUDE_SURFACE_H_
COMMON_SRC_FILES := \
Config.cpp \
Display.cpp \
- EGLSurface.cpp \
+ Surface.cpp \
libEGL.cpp \
main.cpp
"../common/Object.cpp",
"Config.cpp",
"Display.cpp",
- "EGLSurface.cpp",
+ "Surface.cpp",
"libEGL.cpp",
"libEGL.def",
"libEGL.rc",
#include <EGL/egl.h>
#include <GLES/gl.h>
+namespace gl { class Surface; }
+
namespace egl
{
class Display;
-class Surface;
class Image;
class [[clang::lto_visibility_public]] Context : public gl::Object
{
public:
- Context(egl::Display *display) : display(display) {}
-
- virtual void makeCurrent(Surface *surface) = 0;
- virtual void bindTexImage(Surface *surface) = 0;
+ virtual void makeCurrent(gl::Surface *surface) = 0;
+ virtual void bindTexImage(gl::Surface *surface) = 0;
virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel) = 0;
virtual Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel) = 0;
virtual EGLint getClientVersion() const = 0;
virtual void finish() = 0;
protected:
+ Context(egl::Display *display) : display(display) {}
virtual ~Context() {};
egl::Display *const display;
#include "Display.h"
#include "main.h"
-#include "libEGL/EGLSurface.h"
+#include "libEGL/Surface.hpp"
#include "libEGL/Context.hpp"
#include "common/Image.hpp"
#include "common/debug.h"
// such as the client area of a window, including any back buffers.
// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
-#include "EGLSurface.h"
+#include "Surface.hpp"
#include "main.h"
#include "Display.h"
#include <algorithm>
-namespace egl
+namespace gl
+{
+Surface::Surface()
+{
+}
+
+Surface::~Surface()
{
+}
+}
+namespace egl
+{
Surface::Surface(const Display *display, const Config *config) : display(display), config(config)
{
backBuffer = nullptr;
// See the License for the specific language governing permissions and
// limitations under the License.
-// Surface.h: Defines the egl::Surface class, representing a drawing surface
+// Surface.hpp: Defines the egl::Surface class, representing a rendering surface
// such as the client area of a window, including any back buffers.
// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
-#ifndef INCLUDE_SURFACE_H_
-#define INCLUDE_SURFACE_H_
+#ifndef INCLUDE_EGL_SURFACE_H_
+#define INCLUDE_EGL_SURFACE_H_
-#include "Main/FrameBuffer.hpp"
#include "common/Object.hpp"
+#include "common/Surface.hpp"
+
+#include "Main/FrameBuffer.hpp"
#include <EGL/egl.h>
{
class Display;
class Config;
-class Texture;
-class Image;
-class [[clang::lto_visibility_public]] Surface : public gl::Object
+class Surface : public gl::Surface, public gl::Object
{
public:
virtual bool initialize();
virtual void swap() = 0;
- virtual egl::Image *getRenderTarget();
- virtual egl::Image *getDepthStencil();
+ egl::Image *getRenderTarget() override;
+ egl::Image *getDepthStencil() override;
void setSwapBehavior(EGLenum swapBehavior);
void setSwapInterval(EGLint interval);
virtual EGLint getConfigID() const;
virtual EGLenum getSurfaceType() const;
- virtual sw::Format getInternalFormat() const;
+ sw::Format getInternalFormat() const override;
- virtual EGLint getWidth() const;
- virtual EGLint getHeight() const;
+ EGLint getWidth() const override;
+ EGLint getHeight() const override;
virtual EGLint getPixelAspectRatio() const;
virtual EGLenum getRenderBuffer() const;
virtual EGLenum getSwapBehavior() const;
virtual EGLBoolean getLargestPBuffer() const;
virtual EGLNativeWindowType getWindowHandle() const = 0;
- virtual void setBoundTexture(egl::Texture *texture);
+ void setBoundTexture(egl::Texture *texture) override;
virtual egl::Texture *getBoundTexture() const;
virtual bool isWindowSurface() const { return false; }
protected:
Surface(const Display *display, const Config *config);
- virtual ~Surface();
+ ~Surface() override;
virtual void deleteResources();
};
}
-#endif // INCLUDE_SURFACE_H_
+#endif // INCLUDE_EGL_SURFACE_H_
#include "main.h"
#include "Display.h"
-#include "EGLSurface.h"
+#include "Surface.hpp"
#include "Texture.hpp"
#include "Context.hpp"
#include "common/Image.hpp"
<ClCompile Include="Display.cpp" />\r
<ClCompile Include="libEGL.cpp" />\r
<ClCompile Include="main.cpp" />\r
- <ClCompile Include="EGLSurface.cpp" />\r
+ <ClCompile Include="Surface.cpp" />\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\common\debug.h" />\r
<ClInclude Include="..\common\Image.hpp" />\r
<ClInclude Include="..\common\NameSpace.hpp" />\r
<ClInclude Include="..\common\Object.hpp" />\r
+ <ClInclude Include="..\common\Surface.hpp" />\r
<ClInclude Include="..\include\EGL\egl.h" />\r
<ClInclude Include="..\include\EGL\eglext.h" />\r
<ClInclude Include="..\include\EGL\eglplatform.h" />\r
<ClInclude Include="libEGL.hpp" />\r
<ClInclude Include="main.h" />\r
<ClInclude Include="resource.h" />\r
- <ClInclude Include="EGLSurface.h" />\r
+ <ClInclude Include="Surface.hpp" />\r
<ClInclude Include="Sync.hpp" />\r
<ClInclude Include="Texture.hpp" />\r
</ItemGroup>\r
<ClCompile Include="..\common\Object.cpp">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="EGLSurface.cpp">\r
+ <ClCompile Include="Surface.cpp">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
</ItemGroup>\r
<ClInclude Include="..\common\NameSpace.hpp">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
- <ClInclude Include="EGLSurface.h">\r
+ <ClInclude Include="..\common\Surface.hpp">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="Surface.hpp">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
</ItemGroup>\r
#include "libEGL.hpp"
#include "Context.hpp"
-#include "EGLSurface.h"
+#include "Surface.hpp"
#include "resource.h"
#include "Common/Thread.hpp"
class Display;
class Context;
class Surface;
+ class Config;
+ class Image;
struct Current
{
return returnValue;
}
-
- class Config;
- class Surface;
- class Display;
- class Context;
- class Image;
}
extern LibGLES_CM libGLES_CM;
#include "VertexDataManager.h"
#include "IndexDataManager.h"
#include "libEGL/Display.h"
-#include "libEGL/EGLSurface.h"
+#include "common/Surface.hpp"
#include "Common/Half.hpp"
#include <EGL/eglext.h>
delete device;
}
-void Context::makeCurrent(egl::Surface *surface)
+void Context::makeCurrent(gl::Surface *surface)
{
if(!mHasBeenCurrent)
{
mVertexDataManager->dirtyCurrentValue(index);
}
-void Context::bindTexImage(egl::Surface *surface)
+void Context::bindTexImage(gl::Surface *surface)
{
es1::Texture2D *textureObject = getTexture2D();
#include <map>
#include <string>
+namespace gl { class Surface; }
+
namespace egl
{
class Display;
-class Surface;
class Config;
}
public:
Context(egl::Display *display, const Context *shareContext, const egl::Config *config);
- void makeCurrent(egl::Surface *surface) override;
+ void makeCurrent(gl::Surface *surface) override;
EGLint getClientVersion() const override;
EGLint getConfigID() const override;
static int getSupportedMultisampleCount(int requested);
- virtual void bindTexImage(egl::Surface *surface);
- virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel);
- virtual egl::Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel);
+ void bindTexImage(gl::Surface *surface) override;
+ EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel) override;
+ egl::Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel) override;
egl::Image *getSharedImage(GLeglImageOES image);
Device *getDevice();
void setPointFadeThresholdSize(float threshold);
private:
- virtual ~Context();
+ ~Context() override;
bool applyRenderTarget();
void applyState(GLenum drawMode);
#include "Framebuffer.h"
#include "Device.hpp"
#include "libEGL/Display.h"
-#include "libEGL/EGLSurface.h"
+#include "common/Surface.hpp"
#include "common/debug.h"
#include <algorithm>
Texture::setImage(format, type, unpackAlignment, pixels, image[level]);
}
-void Texture2D::bindTexImage(egl::Surface *surface)
+void Texture2D::bindTexImage(gl::Surface *surface)
{
GLenum format;
#include <vector>
-namespace egl
-{
-class Surface;
-class Config;
-}
+namespace gl { class Surface; }
+namespace egl { class Config; }
namespace es1
{
virtual bool isSamplerComplete() const;
virtual bool isCompressed(GLenum target, GLint level) const;
virtual bool isDepth(GLenum target, GLint level) const;
- virtual void bindTexImage(egl::Surface *surface);
+ virtual void bindTexImage(gl::Surface *surface);
virtual void releaseTexImage();
virtual void generateMipmaps();
egl::Image *image[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
- egl::Surface *mSurface;
+ gl::Surface *mSurface;
// A specific internal reference count is kept for colorbuffer proxy references,
// because, as the renderbuffer acting as proxy will maintain a binding pointer
#include "libGLES_CM.hpp"
#include "Framebuffer.h"
-#include "libEGL/EGLSurface.h"
+#include "common/Surface.hpp"
#include "Common/Thread.hpp"
#include "Common/SharedLibrary.hpp"
#include "common/debug.h"
#include "VertexDataManager.h"
#include "IndexDataManager.h"
#include "libEGL/Display.h"
-#include "libEGL/EGLSurface.h"
+#include "common/Surface.hpp"
#include "Common/Half.hpp"
#include <EGL/eglext.h>
delete device;
}
-void Context::makeCurrent(egl::Surface *surface)
+void Context::makeCurrent(gl::Surface *surface)
{
if(!mHasBeenCurrent)
{
}
}
-void Context::bindTexImage(egl::Surface *surface)
+void Context::bindTexImage(gl::Surface *surface)
{
es2::Texture2D *textureObject = getTexture2D();
namespace egl
{
class Display;
-class Surface;
class Config;
}
public:
Context(egl::Display *display, const Context *shareContext, EGLint clientVersion, const egl::Config *config);
- void makeCurrent(egl::Surface *surface) override;
+ void makeCurrent(gl::Surface *surface) override;
EGLint getClientVersion() const override;
EGLint getConfigID() const override;
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, bool filter, bool allowPartialDepthStencilBlit);
- void bindTexImage(egl::Surface *surface) override;
+ void bindTexImage(gl::Surface *surface) override;
EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel) override;
egl::Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel) override;
egl::Image *getSharedImage(GLeglImageOES image);
const GLubyte *getExtensions(GLuint index, GLuint *numExt = nullptr) const;
private:
- virtual ~Context();
+ ~Context() override;
void applyScissor(int width, int height);
bool applyRenderTarget();
#include "Framebuffer.h"
#include "Device.hpp"
#include "libEGL/Display.h"
-#include "libEGL/EGLSurface.h"
+#include "common/Surface.hpp"
#include "common/debug.h"
#include <algorithm>
Texture::setImage(format, type, unpackInfo, pixels, image[level]);
}
-void Texture2D::bindTexImage(egl::Surface *surface)
+void Texture2D::bindTexImage(gl::Surface *surface)
{
GLenum format;
Texture::setImage(format, type, unpackInfo, pixels, image[level]);
}
-void Texture3D::bindTexImage(egl::Surface *surface)
+void Texture3D::bindTexImage(gl::Surface *surface)
{
GLenum format;
#include <vector>
-namespace egl
-{
-class Surface;
-class Config;
-}
+namespace gl { class Surface; }
+namespace egl { class Config; }
namespace es2
{
virtual bool isSamplerComplete() const;
virtual bool isCompressed(GLenum target, GLint level) const;
virtual bool isDepth(GLenum target, GLint level) const;
- virtual void bindTexImage(egl::Surface *surface);
+ virtual void bindTexImage(gl::Surface *surface);
virtual void releaseTexImage();
virtual void generateMipmaps();
egl::Image *image[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
- egl::Surface *mSurface;
+ gl::Surface *mSurface;
// A specific internal reference count is kept for colorbuffer proxy references,
// because, as the renderbuffer acting as proxy will maintain a binding pointer
virtual bool isSamplerComplete() const;
virtual bool isCompressed(GLenum target, GLint level) const;
virtual bool isDepth(GLenum target, GLint level) const;
- virtual void bindTexImage(egl::Surface *surface);
+ virtual void bindTexImage(gl::Surface *surface);
virtual void releaseTexImage();
virtual void generateMipmaps();
egl::Image *image[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
- egl::Surface *mSurface;
+ gl::Surface *mSurface;
// A specific internal reference count is kept for colorbuffer proxy references,
// because, as the renderbuffer acting as proxy will maintain a binding pointer
<ClInclude Include="..\common\Image.hpp" />\r
<ClInclude Include="..\common\NameSpace.hpp" />\r
<ClInclude Include="..\common\Object.hpp" />\r
+ <ClInclude Include="..\common\Surface.hpp" />\r
<ClInclude Include="..\include\GLES2\gl2.h" />\r
<ClInclude Include="..\include\GLES2\gl2ext.h" />\r
<ClInclude Include="..\include\GLES2\gl2platform.h" />\r
<ClInclude Include="..\common\Image.hpp">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\common\Surface.hpp">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<ResourceCompile Include="libGLESv2.rc" />\r
#include "libGLESv2.hpp"
#include "Framebuffer.h"
#include "libEGL/main.h"
-#include "libEGL/EGLSurface.h"
+#include "common/Surface.hpp"
#include "Common/Thread.hpp"
#include "Common/SharedLibrary.hpp"
#include "common/debug.h"