Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / angle / src / libGLESv2 / renderer / Renderer.h
index b2a05d9..9e1a6f4 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "libGLESv2/Uniform.h"
 #include "libGLESv2/angletypes.h"
+#include "libGLESv2/Caps.h"
 
 #if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
 // WARNING: D3DCOMPILE_OPTIMIZATION_LEVEL3 may lead to a DX9 shader compiler hang.
@@ -29,7 +30,7 @@ namespace gl
 class InfoLog;
 class ProgramBinary;
 struct LinkedVarying;
-class VertexAttribute;
+struct VertexAttribute;
 class Buffer;
 class Texture;
 class Framebuffer;
@@ -46,6 +47,8 @@ class VertexBuffer;
 class IndexBuffer;
 class QueryImpl;
 class FenceImpl;
+class BufferImpl;
+class VertexArrayImpl;
 class BufferStorage;
 struct TranslatedIndexData;
 class ShaderExecutable;
@@ -54,6 +57,10 @@ class RenderTarget;
 class Image;
 class TextureStorage;
 class UniformStorage;
+class Texture2DImpl;
+class TextureCubeImpl;
+class Texture3DImpl;
+class Texture2DArrayImpl;
 
 struct ConfigDesc
 {
@@ -117,10 +124,11 @@ class Renderer
                              bool ignoreViewport) = 0;
 
     virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer) = 0;
-    virtual void applyShaders(gl::ProgramBinary *programBinary, bool rasterizerDiscard, bool transformFeedbackActive, const gl::VertexFormat inputLayout[]) = 0;
+    virtual void applyShaders(gl::ProgramBinary *programBinary, const gl::VertexFormat inputLayout[], const gl::Framebuffer *framebuffer,
+                              bool rasterizerDiscard, bool transformFeedbackActive) = 0;
     virtual void applyUniforms(const gl::ProgramBinary &programBinary) = 0;
     virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount) = 0;
-    virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], gl::VertexAttribCurrentValueData currentValues[],
+    virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], const gl::VertexAttribCurrentValueData currentValues[],
                                      GLint first, GLsizei count, GLsizei instances) = 0;
     virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo) = 0;
     virtual void applyTransformFeedbackBuffers(gl::Buffer *transformFeedbackBuffers[], GLintptr offsets[]) = 0;
@@ -139,26 +147,15 @@ class Renderer
     virtual bool testDeviceLost(bool notify) = 0;
     virtual bool testDeviceResettable() = 0;
 
-    // Renderer capabilities
+    // Renderer capabilities (virtual because it is used by egl::Display, do not override)
+    virtual const gl::Caps &getRendererCaps() const;
+    virtual const gl::TextureCapsMap &getRendererTextureCaps() const;
+    virtual const gl::Extensions &getRendererExtensions() const;
+
     virtual DWORD getAdapterVendor() const = 0;
     virtual std::string getRendererDescription() const = 0;
     virtual GUID getAdapterIdentifier() const = 0;
 
-    virtual bool getBGRATextureSupport() const = 0;
-    virtual bool getDXT1TextureSupport() const = 0;
-    virtual bool getDXT3TextureSupport() const = 0;
-    virtual bool getDXT5TextureSupport() const = 0;
-    virtual bool getEventQuerySupport() const = 0;
-    virtual bool getFloat32TextureSupport() const = 0;
-    virtual bool getFloat32TextureFilteringSupport() const= 0;
-    virtual bool getFloat32TextureRenderingSupport() const= 0;
-    virtual bool getFloat16TextureSupport()  const= 0;
-    virtual bool getFloat16TextureFilteringSupport() const= 0;
-    virtual bool getFloat16TextureRenderingSupport() const = 0;
-    virtual bool getRGB565TextureSupport() const = 0;
-    virtual bool getLuminanceTextureSupport() const = 0;
-    virtual bool getLuminanceAlphaTextureSupport() const = 0;
-    virtual bool getRGTextureSupport() const = 0;
     bool getVertexTextureSupport() const { return getMaxVertexTextureImageUnits() > 0; }
     virtual unsigned int getMaxVertexTextureImageUnits() const = 0;
     virtual unsigned int getMaxCombinedTextureImageUnits() const = 0;
@@ -175,37 +172,15 @@ class Renderer
     virtual unsigned int getMaxTransformFeedbackSeparateComponents() const = 0;
     virtual unsigned int getMaxTransformFeedbackInterleavedComponents() const = 0;
     virtual unsigned int getMaxUniformBufferSize() const = 0;
-    virtual bool getNonPower2TextureSupport() const = 0;
-    virtual bool getDepthTextureSupport() const = 0;
-    virtual bool getOcclusionQuerySupport() const = 0;
-    virtual bool getInstancingSupport() const = 0;
-    virtual bool getTextureFilterAnisotropySupport() const = 0;
-    virtual bool getPBOSupport() const = 0;
-    virtual float getTextureMaxAnisotropy() const = 0;
     virtual bool getShareHandleSupport() const = 0;
-    virtual bool getDerivativeInstructionSupport() const = 0;
     virtual bool getPostSubBufferSupport() const = 0;
     virtual int getMaxRecommendedElementsIndices() const = 0;
     virtual int getMaxRecommendedElementsVertices() const = 0;
 
     virtual int getMajorShaderModel() const = 0;
-    virtual float getMaxPointSize() const = 0;
-    virtual int getMaxViewportDimension() const = 0;
-    virtual int getMaxTextureWidth() const = 0;
-    virtual int getMaxTextureHeight() const = 0;
-    virtual int getMaxTextureDepth() const = 0;
-    virtual int getMaxTextureArrayLayers() const = 0;
-    virtual bool get32BitIndexSupport() const = 0;
     virtual int getMinSwapInterval() const = 0;
     virtual int getMaxSwapInterval() const = 0;
 
-    virtual GLsizei getMaxSupportedSamples() const = 0;
-    virtual GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const = 0;
-    virtual GLsizei getNumSampleCounts(GLenum internalFormat) const = 0;
-    virtual void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const = 0;
-
-    virtual unsigned int getMaxRenderTargets() const = 0;
-
     // Pixel operations
     virtual bool copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source) = 0;
     virtual bool copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source) = 0;
@@ -248,10 +223,19 @@ class Renderer
     virtual TextureStorage *createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels) = 0;
     virtual TextureStorage *createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels) = 0;
 
+    // Texture creation
+    virtual Texture2DImpl *createTexture2D() = 0;
+    virtual TextureCubeImpl *createTextureCube() = 0;
+    virtual Texture3DImpl *createTexture3D() = 0;
+    virtual Texture2DArrayImpl *createTexture2DArray() = 0;
+
     // Buffer creation
+    virtual BufferImpl *createBuffer() = 0;
     virtual VertexBuffer *createVertexBuffer() = 0;
     virtual IndexBuffer *createIndexBuffer() = 0;
-    virtual BufferStorage *createBufferStorage() = 0;
+
+    // Vertex Array creation
+    virtual VertexArrayImpl *createVertexArray() = 0;
 
     // Query and Fence creation
     virtual QueryImpl *createQuery(GLenum type) = 0;
@@ -267,7 +251,6 @@ class Renderer
                                          GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea) = 0;
 
     virtual bool getLUID(LUID *adapterLuid) const = 0;
-    virtual GLenum getNativeTextureFormat(GLenum internalFormat) const = 0;
     virtual rx::VertexConversionType getVertexConversionType(const gl::VertexFormat &vertexFormat) const = 0;
     virtual GLenum getVertexComponentType(const gl::VertexFormat &vertexFormat) const = 0;
 
@@ -277,6 +260,13 @@ class Renderer
   private:
     DISALLOW_COPY_AND_ASSIGN(Renderer);
 
+    virtual void generateCaps(gl::Caps *outCaps, gl::TextureCapsMap* outTextureCaps, gl::Extensions *outExtensions) const = 0;
+
+    mutable bool mCapsInitialized;
+    mutable gl::Caps mCaps;
+    mutable gl::TextureCapsMap mTextureCaps;
+    mutable gl::Extensions mExtensions;
+
     int mCurrentClientVersion;
 };