summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libGLESv2/Context.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libGLESv2/Context.h')
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Context.h248
1 files changed, 34 insertions, 214 deletions
diff --git a/src/3rdparty/angle/src/libGLESv2/Context.h b/src/3rdparty/angle/src/libGLESv2/Context.h
index 2bbae76ef8..9c222be24d 100644
--- a/src/3rdparty/angle/src/libGLESv2/Context.h
+++ b/src/3rdparty/angle/src/libGLESv2/Context.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -15,7 +15,6 @@
#include <GLES2/gl2ext.h>
#define EGLAPI
#include <EGL/egl.h>
-#include <d3d9.h>
#include <string>
#include <map>
@@ -27,22 +26,23 @@
#include "common/angleutils.h"
#include "common/RefCountObject.h"
-#include "libGLESv2/ResourceManager.h"
#include "libGLESv2/HandleAllocator.h"
+#include "libGLESv2/angletypes.h"
+#include "libGLESv2/Constants.h"
+
+namespace rx
+{
+class Renderer;
+}
namespace egl
{
class Display;
class Surface;
-class Config;
}
namespace gl
{
-struct TranslatedAttribute;
-struct TranslatedIndexData;
-
-class Buffer;
class Shader;
class Program;
class ProgramBinary;
@@ -54,35 +54,12 @@ class Renderbuffer;
class RenderbufferStorage;
class Colorbuffer;
class Depthbuffer;
-class StreamingIndexBuffer;
class Stencilbuffer;
class DepthStencilbuffer;
-class VertexDataManager;
-class IndexDataManager;
-class Blit;
class Fence;
class Query;
-
-enum
-{
- D3D9_MAX_FLOAT_CONSTANTS = 256,
- D3D9_MAX_BOOL_CONSTANTS = 16,
- D3D9_MAX_INT_CONSTANTS = 16,
-
- MAX_VERTEX_ATTRIBS = 16,
- MAX_VERTEX_UNIFORM_VECTORS = D3D9_MAX_FLOAT_CONSTANTS - 2, // Reserve space for dx_HalfPixelSize and dx_DepthRange.
- MAX_VARYING_VECTORS_SM2 = 8,
- MAX_VARYING_VECTORS_SM3 = 10,
- MAX_TEXTURE_IMAGE_UNITS = 16,
- MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF = 4, // For devices supporting vertex texture fetch
- MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF,
- MAX_FRAGMENT_UNIFORM_VECTORS_SM2 = 32 - 3, // Reserve space for dx_Coord, dx_Depth, and dx_DepthRange. dx_PointOrLines and dx_FrontCCW use separate bool registers.
- MAX_FRAGMENT_UNIFORM_VECTORS_SM3 = 224 - 3,
- MAX_DRAW_BUFFERS = 1,
-
- GL_BGRA4_ANGLEX = 0x6ABC,
- GL_BGR5_A1_ANGLEX = 0x6ABD
-};
+class ResourceManager;
+class Buffer;
enum QueryType
{
@@ -92,19 +69,6 @@ enum QueryType
QUERY_TYPE_COUNT
};
-const float ALIASED_LINE_WIDTH_RANGE_MIN = 1.0f;
-const float ALIASED_LINE_WIDTH_RANGE_MAX = 1.0f;
-const float ALIASED_POINT_SIZE_RANGE_MIN = 1.0f;
-const float ALIASED_POINT_SIZE_RANGE_MAX_SM2 = 1.0f;
-
-struct Color
-{
- float red;
- float green;
- float blue;
- float alpha;
-};
-
// Helper structure describing a single vertex attribute
class VertexAttribute
{
@@ -155,8 +119,6 @@ class VertexAttribute
unsigned int mDivisor;
};
-typedef VertexAttribute VertexAttributeArray[MAX_VERTEX_ATTRIBS];
-
// Helper structure to store all raw state
struct State
{
@@ -164,67 +126,29 @@ struct State
GLclampf depthClearValue;
int stencilClearValue;
- bool cullFace;
- GLenum cullMode;
- GLenum frontFace;
- bool depthTest;
- GLenum depthFunc;
- bool blend;
- GLenum sourceBlendRGB;
- GLenum destBlendRGB;
- GLenum sourceBlendAlpha;
- GLenum destBlendAlpha;
- GLenum blendEquationRGB;
- GLenum blendEquationAlpha;
+ RasterizerState rasterizer;
+ bool scissorTest;
+ Rectangle scissor;
+
+ BlendState blend;
Color blendColor;
- bool stencilTest;
- GLenum stencilFunc;
- GLint stencilRef;
- GLuint stencilMask;
- GLenum stencilFail;
- GLenum stencilPassDepthFail;
- GLenum stencilPassDepthPass;
- GLuint stencilWritemask;
- GLenum stencilBackFunc;
- GLint stencilBackRef;
- GLuint stencilBackMask;
- GLenum stencilBackFail;
- GLenum stencilBackPassDepthFail;
- GLenum stencilBackPassDepthPass;
- GLuint stencilBackWritemask;
- bool polygonOffsetFill;
- GLfloat polygonOffsetFactor;
- GLfloat polygonOffsetUnits;
- bool sampleAlphaToCoverage;
bool sampleCoverage;
GLclampf sampleCoverageValue;
bool sampleCoverageInvert;
- bool scissorTest;
- bool dither;
+
+ DepthStencilState depthStencil;
+ GLint stencilRef;
+ GLint stencilBackRef;
GLfloat lineWidth;
GLenum generateMipmapHint;
GLenum fragmentShaderDerivativeHint;
- GLint viewportX;
- GLint viewportY;
- GLsizei viewportWidth;
- GLsizei viewportHeight;
+ Rectangle viewport;
float zNear;
float zFar;
- GLint scissorX;
- GLint scissorY;
- GLsizei scissorWidth;
- GLsizei scissorHeight;
-
- bool colorMaskRed;
- bool colorMaskGreen;
- bool colorMaskBlue;
- bool colorMaskAlpha;
- bool depthMask;
-
unsigned int activeSampler; // Active texture unit selector - GL_TEXTURE0
BindingPointer<Buffer> arrayBuffer;
BindingPointer<Buffer> elementArrayBuffer;
@@ -234,7 +158,7 @@ struct State
GLuint currentProgram;
VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS];
- BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF];
+ BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS];
BindingPointer<Query> activeQuery[QUERY_TYPE_COUNT];
GLint unpackAlignment;
@@ -242,52 +166,14 @@ struct State
bool packReverseRowOrder;
};
-// Helper class to construct and cache vertex declarations
-class VertexDeclarationCache
-{
- public:
- VertexDeclarationCache();
- ~VertexDeclarationCache();
-
- GLenum applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], ProgramBinary *programBinary, GLsizei instances, GLsizei *repeatDraw);
-
- void markStateDirty();
-
- private:
- UINT mMaxLru;
-
- enum { NUM_VERTEX_DECL_CACHE_ENTRIES = 32 };
-
- struct VBData
- {
- unsigned int serial;
- unsigned int stride;
- unsigned int offset;
- };
-
- VBData mAppliedVBs[MAX_VERTEX_ATTRIBS];
- IDirect3DVertexDeclaration9 *mLastSetVDecl;
- bool mInstancingEnabled;
-
- struct VertexDeclCacheEntry
- {
- D3DVERTEXELEMENT9 cachedElements[MAX_VERTEX_ATTRIBS + 1];
- UINT lruCount;
- IDirect3DVertexDeclaration9 *vertexDeclaration;
- } mVertexDeclCache[NUM_VERTEX_DECL_CACHE_ENTRIES];
-};
-
class Context
{
public:
- Context(const egl::Config *config, const gl::Context *shareContext, bool notifyResets, bool robustAccess);
+ Context(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
~Context();
- void makeCurrent(egl::Display *display, egl::Surface *surface);
-
- virtual void markAllStateDirty();
- void markDxUniformsDirty();
+ void makeCurrent(egl::Surface *surface);
virtual void markContextLost();
bool isContextLost();
@@ -377,8 +263,6 @@ class Context
bool normalized, GLsizei stride, const void *pointer);
const void *getVertexAttribPointer(unsigned int attribNum) const;
- const VertexAttributeArray &getVertexAttributes();
-
void setUnpackAlignment(GLint alignment);
GLint getUnpackAlignment() const;
@@ -430,7 +314,7 @@ class Context
void setFramebufferZero(Framebuffer *framebuffer);
- void setRenderbufferStorage(RenderbufferStorage *renderbuffer);
+ void setRenderbufferStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples);
void setVertexAttrib(GLuint index, const GLfloat *values);
void setVertexAttribDivisor(GLuint index, GLuint divisor);
@@ -465,8 +349,6 @@ class Context
void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances);
void sync(bool block); // flush/finish
- void drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex);
-
void recordInvalidEnum();
void recordInvalidValue();
void recordInvalidOperation();
@@ -477,22 +359,20 @@ class Context
GLenum getResetStatus();
virtual bool isResetNotificationEnabled();
- bool supportsShaderModel3() const;
+ int getMajorShaderModel() const;
float getMaximumPointSize() const;
- int getMaximumVaryingVectors() const;
- unsigned int getMaximumVertexTextureImageUnits() const;
unsigned int getMaximumCombinedTextureImageUnits() const;
- int getMaximumFragmentUniformVectors() const;
int getMaximumRenderbufferDimension() const;
int getMaximumTextureDimension() const;
int getMaximumCubeTextureDimension() const;
int getMaximumTextureLevel() const;
+ unsigned int getMaximumRenderTargets() const;
GLsizei getMaxSupportedSamples() const;
- int getNearestSupportedSamples(D3DFORMAT format, int requested) const;
const char *getExtensionString() const;
const char *getRendererString() const;
bool supportsEventQueries() const;
bool supportsOcclusionQueries() const;
+ bool supportsBGRATextures() const;
bool supportsDXT1Textures() const;
bool supportsDXT3Textures() const;
bool supportsDXT5Textures() const;
@@ -518,17 +398,11 @@ class Context
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask);
- Blit *getBlitter() { return mBlit; }
-
- const D3DCAPS9 &getDeviceCaps() { return mDeviceCaps; }
-
private:
DISALLOW_COPY_AND_ASSIGN(Context);
- bool applyRenderTarget(bool ignoreViewport);
+ bool applyRenderTarget(GLenum drawMode, bool ignoreViewport);
void applyState(GLenum drawMode);
- GLenum applyVertexBuffer(GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw);
- GLenum applyIndexBuffer(const GLvoid *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
void applyShaders();
void applyTextures();
void applyTextures(SamplerType type);
@@ -541,14 +415,11 @@ class Context
Texture *getIncompleteTexture(TextureType type);
bool skipDraw(GLenum drawMode);
- bool isTriangleMode(GLenum drawMode);
void initExtensionString();
void initRendererString();
- const egl::Config *const mConfig;
- egl::Display *mDisplay;
- IDirect3DDevice9 *mDevice;
+ rx::Renderer *const mRenderer;
State mState;
@@ -575,15 +446,8 @@ class Context
QueryMap mQueryMap;
HandleAllocator mQueryHandleAllocator;
- std::string mExtensionString;
- std::string mRendererString;
-
- VertexDataManager *mVertexDataManager;
- IndexDataManager *mIndexDataManager;
-
- Blit *mBlit;
-
- StreamingIndexBuffer *mLineLoopIB;
+ const char *mExtensionString;
+ const char *mRendererString;
BindingPointer<Texture> mIncompleteTextures[TEXTURE_TYPE_COUNT];
@@ -601,36 +465,23 @@ class Context
GLenum mResetStrategy;
bool mRobustAccess;
- unsigned int mAppliedTextureSerialPS[MAX_TEXTURE_IMAGE_UNITS];
- unsigned int mAppliedTextureSerialVS[MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF];
- unsigned int mAppliedProgramBinarySerial;
- unsigned int mAppliedRenderTargetSerial;
- unsigned int mAppliedDepthbufferSerial;
- unsigned int mAppliedStencilbufferSerial;
- unsigned int mAppliedIBSerial;
- bool mDepthStencilInitialized;
- bool mViewportInitialized;
- D3DVIEWPORT9 mSetViewport;
- bool mRenderTargetDescInitialized;
- D3DSURFACE_DESC mRenderTargetDesc;
- bool mDxUniformsDirty;
BindingPointer<ProgramBinary> mCurrentProgramBinary;
Framebuffer *mBoundDrawFramebuffer;
- bool mSupportsShaderModel3;
+ int mMajorShaderModel;
float mMaximumPointSize;
bool mSupportsVertexTexture;
bool mSupportsNonPower2Texture;
bool mSupportsInstancing;
+ int mMaxViewportDimension;
int mMaxRenderbufferDimension;
int mMaxTextureDimension;
int mMaxCubeTextureDimension;
int mMaxTextureLevel;
float mMaxTextureAnisotropy;
- std::map<D3DFORMAT, bool *> mMultiSampleSupport;
- GLsizei mMaxSupportedSamples;
bool mSupportsEventQueries;
bool mSupportsOcclusionQueries;
+ bool mSupportsBGRATextures;
bool mSupportsDXT1Textures;
bool mSupportsDXT3Textures;
bool mSupportsDXT5Textures;
@@ -647,39 +498,8 @@ class Context
bool mSupportsTextureFilterAnisotropy;
int mNumCompressedTextureFormats;
- // state caching flags
- bool mClearStateDirty;
- bool mCullStateDirty;
- bool mDepthStateDirty;
- bool mMaskStateDirty;
- bool mPixelPackingStateDirty;
- bool mBlendStateDirty;
- bool mStencilStateDirty;
- bool mPolygonOffsetStateDirty;
- bool mScissorStateDirty;
- bool mSampleStateDirty;
- bool mFrontFaceDirty;
- bool mDitherStateDirty;
-
- IDirect3DStateBlock9 *mMaskedClearSavedState;
-
- D3DCAPS9 mDeviceCaps;
-
ResourceManager *mResourceManager;
-
- VertexDeclarationCache mVertexDeclarationCache;
};
}
-extern "C"
-{
-// Exported functions for use by EGL
-gl::Context *glCreateContext(const egl::Config *config, const gl::Context *shareContext, bool notifyResets, bool robustAccess);
-void glDestroyContext(gl::Context *context);
-void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
-gl::Context *glGetCurrentContext();
-__eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname);
-bool __stdcall glBindTexImage(egl::Surface *surface);
-}
-
#endif // INCLUDE_CONTEXT_H_