Makes the State struct a member of Context, rather than its parent.

Signed-off-by: Andrew Lewycky Signed-off-by: Daniel Koch Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/trunk@226 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 19ffc24b
...@@ -198,7 +198,7 @@ struct State ...@@ -198,7 +198,7 @@ struct State
GLint packAlignment; GLint packAlignment;
}; };
class Context : public State class Context
{ {
public: public:
Context(const egl::Config *config); Context(const egl::Config *config);
...@@ -207,10 +207,95 @@ class Context : public State ...@@ -207,10 +207,95 @@ class Context : public State
void makeCurrent(egl::Display *display, egl::Surface *surface); void makeCurrent(egl::Display *display, egl::Surface *surface);
// State manipulation
void setClearColor(float red, float green, float blue, float alpha); void setClearColor(float red, float green, float blue, float alpha);
void setClearDepth(float depth); void setClearDepth(float depth);
void setClearStencil(int stencil); void setClearStencil(int stencil);
void setCullFace(bool enabled);
bool isCullFaceEnabled() const;
void setCullMode(GLenum mode);
void setFrontFace(GLenum front);
void setDepthTest(bool enabled);
bool isDepthTestEnabled() const;
void setDepthFunc(GLenum depthFunc);
void setDepthRange(float zNear, float zFar);
void setBlend(bool enabled);
bool isBlendEnabled() const;
void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha);
void setBlendColor(float red, float green, float blue, float alpha);
void setBlendEquation(GLenum rgbEquation, GLenum alphaEquation);
void setStencilTest(bool enabled);
bool isStencilTestEnabled() const;
void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask);
void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask);
void setStencilWritemask(GLuint stencilWritemask);
void setStencilBackWritemask(GLuint stencilBackWritemask);
void setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass);
void setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass);
void setPolygonOffsetFill(bool enabled);
bool isPolygonOffsetFillEnabled() const;
void setPolygonOffsetParams(GLfloat factor, GLfloat units);
void setSampleAlphaToCoverage(bool enabled);
bool isSampleAlphaToCoverageEnabled() const;
void setSampleCoverage(bool enabled);
bool isSampleCoverageEnabled() const;
void setSampleCoverageParams(GLclampf value, GLboolean invert);
void setScissorTest(bool enabled);
bool isScissorTestEnabled() const;
void setDither(bool enabled);
bool isDitherEnabled() const;
void setLineWidth(GLfloat width);
void setGenerateMipmapHint(GLenum hint);
void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height);
void setColorMask(bool red, bool green, bool blue, bool alpha);
void setDepthMask(bool mask);
void setActiveSampler(int active);
GLuint getFramebufferHandle() const;
GLuint getRenderbufferHandle() const;
GLuint getArrayBufferHandle() const;
void setVertexAttribEnabled(unsigned int attribNum, bool enabled);
const AttributeState &getVertexAttribState(unsigned int attribNum);
void setVertexAttribState(unsigned int attribNum, GLuint boundBuffer, GLint size, GLenum type,
bool normalized, GLsizei stride, const void *pointer);
const void *getVertexAttribPointer(unsigned int attribNum) const;
const AttributeState *getVertexAttribBlock();
void setUnpackAlignment(GLint alignment);
GLint getUnpackAlignment() const;
void setPackAlignment(GLint alignment);
GLint getPackAlignment() const;
GLuint createBuffer(); GLuint createBuffer();
GLuint createShader(GLenum type); GLuint createShader(GLenum type);
GLuint createProgram(); GLuint createProgram();
...@@ -311,6 +396,8 @@ class Context : public State ...@@ -311,6 +396,8 @@ class Context : public State
const egl::Config *const mConfig; const egl::Config *const mConfig;
State mState;
Texture2D *mTexture2DZero; Texture2D *mTexture2DZero;
TextureCubeMap *mTextureCubeMapZero; TextureCubeMap *mTextureCubeMapZero;
......
...@@ -85,7 +85,7 @@ GLenum VertexDataManager::preRenderValidate(GLint start, GLsizei count, ...@@ -85,7 +85,7 @@ GLenum VertexDataManager::preRenderValidate(GLint start, GLsizei count,
{ {
ArrayTranslationHelper translationHelper(start, count); ArrayTranslationHelper translationHelper(start, count);
return internalPreRenderValidate(mContext->vertexAttribute, activeAttribs(), start, start+count-1, &translationHelper, outAttribs); return internalPreRenderValidate(mContext->getVertexAttribBlock(), activeAttribs(), start, start+count-1, &translationHelper, outAttribs);
} }
GLenum VertexDataManager::preRenderValidate(const TranslatedIndexData &indexInfo, GLenum VertexDataManager::preRenderValidate(const TranslatedIndexData &indexInfo,
...@@ -93,7 +93,7 @@ GLenum VertexDataManager::preRenderValidate(const TranslatedIndexData &indexInfo ...@@ -93,7 +93,7 @@ GLenum VertexDataManager::preRenderValidate(const TranslatedIndexData &indexInfo
{ {
IndexedTranslationHelper translationHelper(indexInfo.indices, indexInfo.minIndex, indexInfo.count); IndexedTranslationHelper translationHelper(indexInfo.indices, indexInfo.minIndex, indexInfo.count);
return internalPreRenderValidate(mContext->vertexAttribute, activeAttribs(), indexInfo.minIndex, indexInfo.maxIndex, &translationHelper, outAttribs); return internalPreRenderValidate(mContext->getVertexAttribBlock(), activeAttribs(), indexInfo.minIndex, indexInfo.maxIndex, &translationHelper, outAttribs);
} }
GLenum VertexDataManager::internalPreRenderValidate(const AttributeState *attribs, GLenum VertexDataManager::internalPreRenderValidate(const AttributeState *attribs,
......
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