summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libANGLE/State.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE/State.h')
-rw-r--r--src/3rdparty/angle/src/libANGLE/State.h175
1 files changed, 148 insertions, 27 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/State.h b/src/3rdparty/angle/src/libANGLE/State.h
index 4370a2f16f..e822d7e679 100644
--- a/src/3rdparty/angle/src/libANGLE/State.h
+++ b/src/3rdparty/angle/src/libANGLE/State.h
@@ -9,15 +9,19 @@
#ifndef LIBANGLE_STATE_H_
#define LIBANGLE_STATE_H_
+#include <bitset>
+#include <memory>
+
#include "common/angleutils.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Program.h"
#include "libANGLE/RefCountObject.h"
-#include "libANGLE/angletypes.h"
-#include "libANGLE/VertexAttribute.h"
#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Sampler.h"
#include "libANGLE/Texture.h"
#include "libANGLE/TransformFeedback.h"
-#include "libANGLE/Program.h"
-#include "libANGLE/Sampler.h"
+#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/angletypes.h"
namespace gl
{
@@ -27,7 +31,7 @@ class Context;
struct Caps;
struct Data;
-typedef std::map< GLenum, BindingPointer<Texture> > TextureMap;
+typedef std::map<GLenum, BindingPointer<Texture>> TextureMap;
class State : angle::NonCopyable
{
@@ -35,7 +39,10 @@ class State : angle::NonCopyable
State();
~State();
- void initialize(const Caps& caps, GLuint clientVersion);
+ void initialize(const Caps &caps,
+ const Extensions &extensions,
+ GLuint clientVersion,
+ bool debug);
void reset();
// State chunk getters
@@ -75,7 +82,8 @@ class State : angle::NonCopyable
void setDepthTest(bool enabled);
void setDepthFunc(GLenum depthFunc);
void setDepthRange(float zNear, float zFar);
- void getDepthRange(float *zNear, float *zFar) const;
+ float getNearPlane() const;
+ float getFarPlane() const;
// Blend state manipulation
bool isBlendEnabled() const;
@@ -108,7 +116,8 @@ class State : angle::NonCopyable
bool isSampleCoverageEnabled() const;
void setSampleCoverage(bool enabled);
void setSampleCoverageParams(GLclampf value, bool invert);
- void getSampleCoverageParams(GLclampf *value, bool *invert) const;
+ GLclampf getSampleCoverageValue() const;
+ bool getSampleCoverageInvert() const;
// Scissor test state toggle & query
bool isScissorTestEnabled() const;
@@ -126,6 +135,7 @@ class State : angle::NonCopyable
// Line width state setter
void setLineWidth(GLfloat width);
+ float getLineWidth() const;
// Hint setters
void setGenerateMipmapHint(GLenum hint);
@@ -139,6 +149,7 @@ class State : angle::NonCopyable
void setActiveSampler(unsigned int active);
unsigned int getActiveSampler() const;
void setSamplerTexture(GLenum type, Texture *texture);
+ Texture *getTargetTexture(GLenum target) const;
Texture *getSamplerTexture(unsigned int sampler, GLenum type) const;
GLuint getSamplerTextureId(unsigned int sampler, GLenum type) const;
void detachTexture(const TextureMap &zeroTextures, GLuint texture);
@@ -185,6 +196,7 @@ class State : angle::NonCopyable
// Query binding manipulation
bool isQueryActive() const;
+ bool isQueryActive(Query *query) const;
void setActiveQuery(GLenum target, Query *query);
GLuint getActiveQueryId(GLenum target) const;
Query *getActiveQuery(GLenum target) const;
@@ -193,23 +205,11 @@ class State : angle::NonCopyable
// GL_ARRAY_BUFFER
void setArrayBufferBinding(Buffer *buffer);
GLuint getArrayBufferId() const;
- bool removeArrayBufferBinding(GLuint buffer);
// GL_UNIFORM_BUFFER - Both indexed and generic targets
void setGenericUniformBufferBinding(Buffer *buffer);
void setIndexedUniformBufferBinding(GLuint index, Buffer *buffer, GLintptr offset, GLsizeiptr size);
- GLuint getIndexedUniformBufferId(GLuint index) const;
- Buffer *getIndexedUniformBuffer(GLuint index) const;
- GLintptr getIndexedUniformBufferOffset(GLuint index) const;
- GLsizeiptr getIndexedUniformBufferSize(GLuint index) const;
-
- // GL_TRANSFORM_FEEDBACK_BUFFER - Both indexed and generic targets
- void setGenericTransformFeedbackBufferBinding(Buffer *buffer);
- void setIndexedTransformFeedbackBufferBinding(GLuint index, Buffer *buffer, GLintptr offset, GLsizeiptr size);
- GLuint getIndexedTransformFeedbackBufferId(GLuint index) const;
- Buffer *getIndexedTransformFeedbackBuffer(GLuint index) const;
- GLuint getIndexedTransformFeedbackBufferOffset(GLuint index) const;
- size_t getTransformFeedbackBufferIndexRange() const;
+ const OffsetBindingPointer<Buffer> &getIndexedUniformBuffer(size_t index) const;
// GL_COPY_[READ/WRITE]_BUFFER
void setCopyReadBufferBinding(Buffer *buffer);
@@ -221,6 +221,8 @@ class State : angle::NonCopyable
// Retrieve typed buffer by target (non-indexed)
Buffer *getTargetBuffer(GLenum target) const;
+ // Detach a buffer from all bindings
+ void detachBuffer(GLuint bufferName);
// Vertex attrib manipulation
void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
@@ -229,6 +231,7 @@ class State : angle::NonCopyable
void setVertexAttribi(GLuint index, const GLint values[4]);
void setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type,
bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
+ void setVertexAttribDivisor(GLuint index, GLuint divisor);
const VertexAttribCurrentValueData &getVertexAttribCurrentValue(unsigned int attribNum) const;
const void *getVertexAttribPointer(unsigned int attribNum) const;
@@ -237,6 +240,12 @@ class State : angle::NonCopyable
GLint getPackAlignment() const;
void setPackReverseRowOrder(bool reverseRowOrder);
bool getPackReverseRowOrder() const;
+ void setPackRowLength(GLint rowLength);
+ GLint getPackRowLength() const;
+ void setPackSkipRows(GLint skipRows);
+ GLint getPackSkipRows() const;
+ void setPackSkipPixels(GLint skipPixels);
+ GLint getPackSkipPixels() const;
const PixelPackState &getPackState() const;
PixelPackState &getPackState();
@@ -245,18 +254,122 @@ class State : angle::NonCopyable
GLint getUnpackAlignment() const;
void setUnpackRowLength(GLint rowLength);
GLint getUnpackRowLength() const;
+ void setUnpackImageHeight(GLint imageHeight);
+ GLint getUnpackImageHeight() const;
+ void setUnpackSkipImages(GLint skipImages);
+ GLint getUnpackSkipImages() const;
+ void setUnpackSkipRows(GLint skipRows);
+ GLint getUnpackSkipRows() const;
+ void setUnpackSkipPixels(GLint skipPixels);
+ GLint getUnpackSkipPixels() const;
const PixelUnpackState &getUnpackState() const;
PixelUnpackState &getUnpackState();
+ // Debug state
+ const Debug &getDebug() const;
+ Debug &getDebug();
+
// State query functions
void getBooleanv(GLenum pname, GLboolean *params);
void getFloatv(GLenum pname, GLfloat *params);
void getIntegerv(const gl::Data &data, GLenum pname, GLint *params);
+ void getPointerv(GLenum pname, void **params) const;
bool getIndexedIntegerv(GLenum target, GLuint index, GLint *data);
bool getIndexedInteger64v(GLenum target, GLuint index, GLint64 *data);
bool hasMappedBuffer(GLenum target) const;
+ enum DirtyBitType
+ {
+ DIRTY_BIT_SCISSOR_TEST_ENABLED,
+ DIRTY_BIT_SCISSOR,
+ DIRTY_BIT_VIEWPORT,
+ DIRTY_BIT_DEPTH_RANGE,
+ DIRTY_BIT_BLEND_ENABLED,
+ DIRTY_BIT_BLEND_COLOR,
+ DIRTY_BIT_BLEND_FUNCS,
+ DIRTY_BIT_BLEND_EQUATIONS,
+ DIRTY_BIT_COLOR_MASK,
+ DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED,
+ DIRTY_BIT_SAMPLE_COVERAGE_ENABLED,
+ DIRTY_BIT_SAMPLE_COVERAGE,
+ DIRTY_BIT_DEPTH_TEST_ENABLED,
+ DIRTY_BIT_DEPTH_FUNC,
+ DIRTY_BIT_DEPTH_MASK,
+ DIRTY_BIT_STENCIL_TEST_ENABLED,
+ DIRTY_BIT_STENCIL_FUNCS_FRONT,
+ DIRTY_BIT_STENCIL_FUNCS_BACK,
+ DIRTY_BIT_STENCIL_OPS_FRONT,
+ DIRTY_BIT_STENCIL_OPS_BACK,
+ DIRTY_BIT_STENCIL_WRITEMASK_FRONT,
+ DIRTY_BIT_STENCIL_WRITEMASK_BACK,
+ DIRTY_BIT_CULL_FACE_ENABLED,
+ DIRTY_BIT_CULL_FACE,
+ DIRTY_BIT_FRONT_FACE,
+ DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED,
+ DIRTY_BIT_POLYGON_OFFSET,
+ DIRTY_BIT_RASTERIZER_DISCARD_ENABLED,
+ DIRTY_BIT_LINE_WIDTH,
+ DIRTY_BIT_PRIMITIVE_RESTART_ENABLED,
+ DIRTY_BIT_CLEAR_COLOR,
+ DIRTY_BIT_CLEAR_DEPTH,
+ DIRTY_BIT_CLEAR_STENCIL,
+ DIRTY_BIT_UNPACK_ALIGNMENT,
+ DIRTY_BIT_UNPACK_ROW_LENGTH,
+ DIRTY_BIT_UNPACK_IMAGE_HEIGHT,
+ DIRTY_BIT_UNPACK_SKIP_IMAGES,
+ DIRTY_BIT_UNPACK_SKIP_ROWS,
+ DIRTY_BIT_UNPACK_SKIP_PIXELS,
+ DIRTY_BIT_PACK_ALIGNMENT,
+ DIRTY_BIT_PACK_REVERSE_ROW_ORDER,
+ DIRTY_BIT_PACK_ROW_LENGTH,
+ DIRTY_BIT_PACK_SKIP_ROWS,
+ DIRTY_BIT_PACK_SKIP_PIXELS,
+ DIRTY_BIT_DITHER_ENABLED,
+ DIRTY_BIT_GENERATE_MIPMAP_HINT,
+ DIRTY_BIT_SHADER_DERIVATIVE_HINT,
+ DIRTY_BIT_READ_FRAMEBUFFER_BINDING,
+ DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING,
+ DIRTY_BIT_RENDERBUFFER_BINDING,
+ DIRTY_BIT_VERTEX_ARRAY_BINDING,
+ DIRTY_BIT_PROGRAM_BINDING,
+ DIRTY_BIT_CURRENT_VALUE_0,
+ DIRTY_BIT_CURRENT_VALUE_MAX = DIRTY_BIT_CURRENT_VALUE_0 + MAX_VERTEX_ATTRIBS,
+ DIRTY_BIT_INVALID = DIRTY_BIT_CURRENT_VALUE_MAX,
+ DIRTY_BIT_MAX = DIRTY_BIT_INVALID,
+ };
+
+ // TODO(jmadill): Consider storing dirty objects in a list instead of by binding.
+ enum DirtyObjectType
+ {
+ DIRTY_OBJECT_READ_FRAMEBUFFER,
+ DIRTY_OBJECT_DRAW_FRAMEBUFFER,
+ DIRTY_OBJECT_VERTEX_ARRAY,
+ DIRTY_OBJECT_PROGRAM,
+ DIRTY_OBJECT_UNKNOWN,
+ DIRTY_OBJECT_MAX = DIRTY_OBJECT_UNKNOWN,
+ };
+
+ typedef std::bitset<DIRTY_BIT_MAX> DirtyBits;
+ const DirtyBits &getDirtyBits() const { return mDirtyBits; }
+ void clearDirtyBits() { mDirtyBits.reset(); }
+ void clearDirtyBits(const DirtyBits &bitset) { mDirtyBits &= ~bitset; }
+ void setAllDirtyBits() { mDirtyBits.set(); }
+
+ typedef std::bitset<DIRTY_OBJECT_MAX> DirtyObjects;
+ void clearDirtyObjects() { mDirtyObjects.reset(); }
+ void setAllDirtyObjects() { mDirtyObjects.set(); }
+ void syncDirtyObjects();
+ void syncDirtyObjects(const DirtyObjects &bitset);
+ void syncDirtyObject(GLenum target);
+ void setObjectDirty(GLenum target);
+
+ // Dirty bit masks
+ const DirtyBits &unpackStateBitMask() const { return mUnpackStateBitMask; }
+ const DirtyBits &packStateBitMask() const { return mPackStateBitMask; }
+ const DirtyBits &clearStateBitMask() const { return mClearStateBitMask; }
+ const DirtyBits &blitStateBitMask() const { return mBlitStateBitMask; }
+
private:
// Cached values from Context's caps
GLuint mMaxDrawBuffers;
@@ -302,23 +415,21 @@ class State : angle::NonCopyable
// Texture and sampler bindings
size_t mActiveSampler; // Active texture unit selector - GL_TEXTURE0
- typedef std::vector< BindingPointer<Texture> > TextureBindingVector;
+ typedef std::vector<BindingPointer<Texture>> TextureBindingVector;
typedef std::map<GLenum, TextureBindingVector> TextureBindingMap;
TextureBindingMap mSamplerTextures;
- typedef std::vector< BindingPointer<Sampler> > SamplerBindingVector;
+ typedef std::vector<BindingPointer<Sampler>> SamplerBindingVector;
SamplerBindingVector mSamplers;
- typedef std::map< GLenum, BindingPointer<Query> > ActiveQueryMap;
+ typedef std::map<GLenum, BindingPointer<Query>> ActiveQueryMap;
ActiveQueryMap mActiveQueries;
BindingPointer<Buffer> mGenericUniformBuffer;
- typedef std::vector< OffsetBindingPointer<Buffer> > BufferVector;
+ typedef std::vector<OffsetBindingPointer<Buffer>> BufferVector;
BufferVector mUniformBuffers;
BindingPointer<TransformFeedback> mTransformFeedback;
- BindingPointer<Buffer> mGenericTransformFeedbackBuffer;
- BufferVector mTransformFeedbackBuffers;
BindingPointer<Buffer> mCopyReadBuffer;
BindingPointer<Buffer> mCopyWriteBuffer;
@@ -327,6 +438,16 @@ class State : angle::NonCopyable
PixelPackState mPack;
bool mPrimitiveRestart;
+
+ Debug mDebug;
+
+ DirtyBits mDirtyBits;
+ DirtyBits mUnpackStateBitMask;
+ DirtyBits mPackStateBitMask;
+ DirtyBits mClearStateBitMask;
+ DirtyBits mBlitStateBitMask;
+
+ DirtyObjects mDirtyObjects;
};
}