Use vertex buffer objects instead of client side arrays in fixed-function codepaths

Pass vertices to the fixed-function shaders in vertex buffer object
stored at attribute 0. This is specified in OpenGL Compatibility
Profile Section 10.8.2 (Transferring Vertices With Vertex Attribute
Zero).

This makes future integration to Chromium command buffer better, since
the command buffer already has code for vertex buffer objects but not
vertex arrays.

Delete unused function pointers related to fixed-function codepaths.

R=bsalomon@google.com

Author: kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/130423013

git-svn-id: http://skia.googlecode.com/svn/trunk@13557 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-02-24 12:05:02 +00:00
parent 39ce33a1fa
commit 6ebfbf9968
15 changed files with 26 additions and 185 deletions

View File

@ -106,14 +106,12 @@ extern "C" {
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDeleteVertexArraysProc)(GrGLsizei n, const GrGLuint *arrays);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDepthMaskProc)(GrGLboolean flag);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDisableProc)(GrGLenum cap);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDisableClientStateProc)(GrGLenum cap);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDisableVertexAttribArrayProc)(GrGLuint index);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawArraysProc)(GrGLenum mode, GrGLint first, GrGLsizei count);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawBufferProc)(GrGLenum mode);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawBuffersProc)(GrGLsizei n, const GrGLenum* bufs);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawElementsProc)(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid* indices);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEnableProc)(GrGLenum cap);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEnableClientStateProc)(GrGLenum cap);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEnableVertexAttribArrayProc)(GrGLuint index);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEndQueryProc)(GrGLenum target);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFinishProc)();
@ -206,7 +204,6 @@ extern "C" {
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLUseProgramProc)(GrGLuint program);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexAttrib4fvProc)(GrGLuint indx, const GrGLfloat* values);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexAttribPointerProc)(GrGLuint indx, GrGLint size, GrGLenum type, GrGLboolean normalized, GrGLsizei stride, const GrGLvoid* ptr);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexPointerProc)(GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* pointer);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLViewportProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
// Experimental: Functions for GL_NV_path_rendering. These will be

View File

@ -176,7 +176,6 @@ public:
GLPtr<GrGLClearProc> fClear;
GLPtr<GrGLClearColorProc> fClearColor;
GLPtr<GrGLClearStencilProc> fClearStencil;
GLPtr<GrGLClientActiveTextureProc> fClientActiveTexture;
GLPtr<GrGLColorMaskProc> fColorMask;
GLPtr<GrGLCompileShaderProc> fCompileShader;
GLPtr<GrGLCompressedTexImage2DProc> fCompressedTexImage2D;
@ -194,14 +193,12 @@ public:
GLPtr<GrGLDeleteVertexArraysProc> fDeleteVertexArrays;
GLPtr<GrGLDepthMaskProc> fDepthMask;
GLPtr<GrGLDisableProc> fDisable;
GLPtr<GrGLDisableClientStateProc> fDisableClientState;
GLPtr<GrGLDisableVertexAttribArrayProc> fDisableVertexAttribArray;
GLPtr<GrGLDrawArraysProc> fDrawArrays;
GLPtr<GrGLDrawBufferProc> fDrawBuffer;
GLPtr<GrGLDrawBuffersProc> fDrawBuffers;
GLPtr<GrGLDrawElementsProc> fDrawElements;
GLPtr<GrGLEnableProc> fEnable;
GLPtr<GrGLEnableClientStateProc> fEnableClientState;
GLPtr<GrGLEnableVertexAttribArrayProc> fEnableVertexAttribArray;
GLPtr<GrGLEndQueryProc> fEndQuery;
GLPtr<GrGLFinishProc> fFinish;
@ -285,7 +282,6 @@ public:
GLPtr<GrGLStencilMaskSeparateProc> fStencilMaskSeparate;
GLPtr<GrGLStencilOpProc> fStencilOp;
GLPtr<GrGLStencilOpSeparateProc> fStencilOpSeparate;
GLPtr<GrGLTexGenfProc> fTexGenf;
GLPtr<GrGLTexGenfvProc> fTexGenfv;
GLPtr<GrGLTexGeniProc> fTexGeni;
GLPtr<GrGLTexImage2DProc> fTexImage2D;
@ -317,7 +313,6 @@ public:
GLPtr<GrGLUseProgramProc> fUseProgram;
GLPtr<GrGLVertexAttrib4fvProc> fVertexAttrib4fv;
GLPtr<GrGLVertexAttribPointerProc> fVertexAttribPointer;
GLPtr<GrGLVertexPointerProc> fVertexPointer;
GLPtr<GrGLViewportProc> fViewport;
// Experimental: Functions for GL_NV_path_rendering. These will be
@ -396,7 +391,6 @@ public:
GLPtrAlias<GrGLClearProc> fClear;
GLPtrAlias<GrGLClearColorProc> fClearColor;
GLPtrAlias<GrGLClearStencilProc> fClearStencil;
GLPtrAlias<GrGLClientActiveTextureProc> fClientActiveTexture;
GLPtrAlias<GrGLColorMaskProc> fColorMask;
GLPtrAlias<GrGLCompileShaderProc> fCompileShader;
GLPtrAlias<GrGLCompressedTexImage2DProc> fCompressedTexImage2D;
@ -414,14 +408,12 @@ public:
GLPtrAlias<GrGLDeleteVertexArraysProc> fDeleteVertexArrays;
GLPtrAlias<GrGLDepthMaskProc> fDepthMask;
GLPtrAlias<GrGLDisableProc> fDisable;
GLPtrAlias<GrGLDisableClientStateProc> fDisableClientState;
GLPtrAlias<GrGLDisableVertexAttribArrayProc> fDisableVertexAttribArray;
GLPtrAlias<GrGLDrawArraysProc> fDrawArrays;
GLPtrAlias<GrGLDrawBufferProc> fDrawBuffer;
GLPtrAlias<GrGLDrawBuffersProc> fDrawBuffers;
GLPtrAlias<GrGLDrawElementsProc> fDrawElements;
GLPtrAlias<GrGLEnableProc> fEnable;
GLPtrAlias<GrGLEnableClientStateProc> fEnableClientState;
GLPtrAlias<GrGLEnableVertexAttribArrayProc> fEnableVertexAttribArray;
GLPtrAlias<GrGLEndQueryProc> fEndQuery;
GLPtrAlias<GrGLFinishProc> fFinish;
@ -482,7 +474,6 @@ public:
GLPtrAlias<GrGLStencilMaskSeparateProc> fStencilMaskSeparate;
GLPtrAlias<GrGLStencilOpProc> fStencilOp;
GLPtrAlias<GrGLStencilOpSeparateProc> fStencilOpSeparate;
GLPtrAlias<GrGLTexGenfProc> fTexGenf;
GLPtrAlias<GrGLTexGenfvProc> fTexGenfv;
GLPtrAlias<GrGLTexGeniProc> fTexGeni;
GLPtrAlias<GrGLTexImage2DProc> fTexImage2D;
@ -514,7 +505,6 @@ public:
GLPtrAlias<GrGLUseProgramProc> fUseProgram;
GLPtrAlias<GrGLVertexAttrib4fvProc> fVertexAttrib4fv;
GLPtrAlias<GrGLVertexAttribPointerProc> fVertexAttribPointer;
GLPtrAlias<GrGLVertexPointerProc> fVertexPointer;
GLPtrAlias<GrGLViewportProc> fViewport;
GLPtrAlias<GrGLPathCommandsProc> fPathCommands;
GLPtrAlias<GrGLPathCoordsProc> fPathCoords;

View File

@ -100,7 +100,6 @@ GrGLvoid GR_GL_FUNCTION_TYPE nullGLBeginQuery(GrGLenum target, GrGLuint id) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindAttribLocation(GrGLuint program, GrGLuint index, const char* name) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindTexture(GrGLenum target, GrGLuint texture) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindVertexArray(GrGLuint id) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLClientActiveTexture(GrGLenum) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLGenBuffers(GrGLsizei n, GrGLuint* ids) {
@ -285,7 +284,6 @@ const GrGLInterface* GrGLCreateNullInterface() {
functions->fClear = noOpGLClear;
functions->fClearColor = noOpGLClearColor;
functions->fClearStencil = noOpGLClearStencil;
functions->fClientActiveTexture = nullGLClientActiveTexture;
functions->fColorMask = noOpGLColorMask;
functions->fCompileShader = noOpGLCompileShader;
functions->fCompressedTexImage2D = noOpGLCompressedTexImage2D;
@ -301,14 +299,12 @@ const GrGLInterface* GrGLCreateNullInterface() {
functions->fDeleteVertexArrays = noOpGLDeleteIds;
functions->fDepthMask = noOpGLDepthMask;
functions->fDisable = noOpGLDisable;
functions->fDisableClientState = noOpGLDisableClientState;
functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray;
functions->fDrawArrays = noOpGLDrawArrays;
functions->fDrawBuffer = noOpGLDrawBuffer;
functions->fDrawBuffers = noOpGLDrawBuffers;
functions->fDrawElements = noOpGLDrawElements;
functions->fEnable = noOpGLEnable;
functions->fEnableClientState = noOpGLEnableClientState;
functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray;
functions->fEndQuery = noOpGLEndQuery;
functions->fFinish = noOpGLFinish;
@ -355,7 +351,6 @@ const GrGLInterface* GrGLCreateNullInterface() {
functions->fStencilMaskSeparate = noOpGLStencilMaskSeparate;
functions->fStencilOp = noOpGLStencilOp;
functions->fStencilOpSeparate = noOpGLStencilOpSeparate;
functions->fTexGenf = noOpGLTexGenf;
functions->fTexGenfv = noOpGLTexGenfv;
functions->fTexGeni = noOpGLTexGeni;
functions->fTexImage2D = noOpGLTexImage2D;
@ -386,7 +381,6 @@ const GrGLInterface* GrGLCreateNullInterface() {
functions->fUseProgram = nullGLUseProgram;
functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv;
functions->fVertexAttribPointer = noOpGLVertexAttribPointer;
functions->fVertexPointer = noOpGLVertexPointer;
functions->fViewport = nullGLViewport;
functions->fBindFramebuffer = nullGLBindFramebuffer;
functions->fBindRenderbuffer = nullGLBindRenderbuffer;

View File

@ -115,7 +115,6 @@ GrGLInterface::GrGLInterface()
, fClear(&fFunctions.fClear)
, fClearColor(&fFunctions.fClearColor)
, fClearStencil(&fFunctions.fClearStencil)
, fClientActiveTexture(&fFunctions.fClientActiveTexture)
, fColorMask(&fFunctions.fColorMask)
, fCompileShader(&fFunctions.fCompileShader)
, fCompressedTexImage2D(&fFunctions.fCompressedTexImage2D)
@ -133,14 +132,12 @@ GrGLInterface::GrGLInterface()
, fDeleteVertexArrays(&fFunctions.fDeleteVertexArrays)
, fDepthMask(&fFunctions.fDepthMask)
, fDisable(&fFunctions.fDisable)
, fDisableClientState(&fFunctions.fDisableClientState)
, fDisableVertexAttribArray(&fFunctions.fDisableVertexAttribArray)
, fDrawArrays(&fFunctions.fDrawArrays)
, fDrawBuffer(&fFunctions.fDrawBuffer)
, fDrawBuffers(&fFunctions.fDrawBuffers)
, fDrawElements(&fFunctions.fDrawElements)
, fEnable(&fFunctions.fEnable)
, fEnableClientState(&fFunctions.fEnableClientState)
, fEnableVertexAttribArray(&fFunctions.fEnableVertexAttribArray)
, fEndQuery(&fFunctions.fEndQuery)
, fFinish(&fFunctions.fFinish)
@ -201,7 +198,6 @@ GrGLInterface::GrGLInterface()
, fStencilMaskSeparate(&fFunctions.fStencilMaskSeparate)
, fStencilOp(&fFunctions.fStencilOp)
, fStencilOpSeparate(&fFunctions.fStencilOpSeparate)
, fTexGenf(&fFunctions.fTexGenf)
, fTexGenfv(&fFunctions.fTexGenfv)
, fTexGeni(&fFunctions.fTexGeni)
, fTexImage2D(&fFunctions.fTexImage2D)
@ -233,7 +229,6 @@ GrGLInterface::GrGLInterface()
, fUseProgram(&fFunctions.fUseProgram)
, fVertexAttrib4fv(&fFunctions.fVertexAttrib4fv)
, fVertexAttribPointer(&fFunctions.fVertexAttribPointer)
, fVertexPointer(&fFunctions.fVertexPointer)
, fViewport(&fFunctions.fViewport)
, fPathCommands(&fFunctions.fPathCommands)
, fPathCoords(&fFunctions.fPathCoords)
@ -483,16 +478,11 @@ bool GrGLInterface::validate() const {
}
}
if (!isCoreProfile) {
if (NULL == fFunctions.fClientActiveTexture ||
NULL == fFunctions.fDisableClientState ||
NULL == fFunctions.fEnableClientState ||
NULL == fFunctions.fLoadIdentity ||
if (NULL == fFunctions.fLoadIdentity ||
NULL == fFunctions.fLoadMatrixf ||
NULL == fFunctions.fMatrixMode ||
NULL == fFunctions.fTexGenf ||
NULL == fFunctions.fTexGenfv ||
NULL == fFunctions.fTexGeni ||
NULL == fFunctions.fVertexPointer) {
NULL == fFunctions.fTexGeni) {
return false;
}
}

View File

@ -119,9 +119,6 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDepthMask(GrGLboolean flag) {
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisable(GrGLenum cap) {
}
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisableClientState(GrGLenum) {
}
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisableVertexAttribArray(GrGLuint index) {
}
@ -146,9 +143,6 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawElements(GrGLenum mode,
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnable(GrGLenum cap) {
}
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnableClientState(GrGLenum cap) {
}
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnableVertexAttribArray(GrGLuint index) {
}
@ -385,9 +379,6 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttribPointer(GrGLuint indx,
const GrGLvoid* ptr) {
}
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexPointer(GrGLint, GrGLenum, GrGLsizei, const GrGLvoid*) {
}
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLViewport(GrGLint x,
GrGLint y,
GrGLsizei width,

View File

@ -70,8 +70,6 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDepthMask(GrGLboolean flag);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisable(GrGLenum cap);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisableClientState(GrGLenum);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisableVertexAttribArray(GrGLuint index);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawArrays(GrGLenum mode, GrGLint first, GrGLsizei count);
@ -88,8 +86,6 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawElements(GrGLenum mode,
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnable(GrGLenum cap);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnableClientState(GrGLenum cap);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnableVertexAttribArray(GrGLuint index);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEndQuery(GrGLenum target);
@ -277,8 +273,6 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttribPointer(GrGLuint indx,
GrGLsizei stride,
const GrGLvoid* ptr);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexPointer(GrGLint, GrGLenum, GrGLsizei, const GrGLvoid*);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLViewport(GrGLint x,
GrGLint y,
GrGLsizei width,

View File

@ -49,39 +49,7 @@ void GrGLAttribArrayState::set(const GrGpuGL* gpu,
}
}
void GrGLAttribArrayState::setFixedFunctionVertexArray(const GrGpuGL* gpu,
GrGLVertexBuffer* buffer,
GrGLint size,
GrGLenum type,
GrGLsizei stride,
GrGLvoid* offset) {
SkASSERT(gpu->glCaps().fixedFunctionSupport());
AttribArrayState* array = &fFixedFunctionVertexArray;
if (!array->fEnableIsValid || !array->fEnabled) {
GR_GL_CALL(gpu->glInterface(), EnableClientState(GR_GL_VERTEX_ARRAY));
array->fEnableIsValid = true;
array->fEnabled = true;
}
if (!array->fAttribPointerIsValid ||
array->fVertexBufferID != buffer->bufferID() ||
array->fSize != size ||
array->fStride != stride ||
array->fOffset != offset) {
buffer->bind();
GR_GL_CALL(gpu->glInterface(), VertexPointer(size,
type,
stride,
offset));
array->fAttribPointerIsValid = true;
array->fVertexBufferID = buffer->bufferID();
array->fSize = size;
array->fStride = stride;
array->fOffset = offset;
}
}
void GrGLAttribArrayState::disableUnusedArrays(const GrGpuGL* gpu, uint64_t usedMask, bool usingFFVertexArray) {
void GrGLAttribArrayState::disableUnusedArrays(const GrGpuGL* gpu, uint64_t usedMask) {
int count = fAttribArrayStates.count();
for (int i = 0; i < count; ++i) {
if (!(usedMask & 0x1)) {
@ -96,35 +64,6 @@ void GrGLAttribArrayState::disableUnusedArrays(const GrGpuGL* gpu, uint64_t used
// if the count is greater than 64 then this will become 0 and we will disable arrays 64+.
usedMask >>= 1;
}
// Deal with fixed-function vertex arrays.
if (gpu->glCaps().fixedFunctionSupport()) {
if (!usingFFVertexArray) {
if (!fFixedFunctionVertexArray.fEnableIsValid || fFixedFunctionVertexArray.fEnabled) {
GR_GL_CALL(gpu->glInterface(), DisableClientState(GR_GL_VERTEX_ARRAY));
fFixedFunctionVertexArray.fEnableIsValid = true;
fFixedFunctionVertexArray.fEnabled = false;
}
} else {
SkASSERT(fFixedFunctionVertexArray.fEnableIsValid && fFixedFunctionVertexArray.fEnabled);
}
// When we use fixed function vertex processing we always use the vertex array and none of
// the other arrays.
if (!fUnusedFixedFunctionArraysDisabled) {
GR_GL_CALL(gpu->glInterface(), DisableClientState(GR_GL_NORMAL_ARRAY));
GR_GL_CALL(gpu->glInterface(), DisableClientState(GR_GL_COLOR_ARRAY));
GR_GL_CALL(gpu->glInterface(), DisableClientState(GR_GL_SECONDARY_COLOR_ARRAY));
GR_GL_CALL(gpu->glInterface(), DisableClientState(GR_GL_INDEX_ARRAY));
GR_GL_CALL(gpu->glInterface(), DisableClientState(GR_GL_EDGE_FLAG_ARRAY));
for (int i = 0; i < gpu->glCaps().maxFixedFunctionTextureCoords(); ++i) {
GR_GL_CALL(gpu->glInterface(), ClientActiveTexture(GR_GL_TEXTURE0 + i));
GR_GL_CALL(gpu->glInterface(), DisableClientState(GR_GL_TEXTURE_COORD_ARRAY));
}
fUnusedFixedFunctionArraysDisabled = true;
}
} else {
SkASSERT(!usingFFVertexArray);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -51,9 +51,6 @@ class GrGLAttribArrayState {
public:
explicit GrGLAttribArrayState(int arrayCount = 0) {
this->resize(arrayCount);
// glVertexPointer doesn't have a normalization param.
fFixedFunctionVertexArray.fNormalized = false;
fUnusedFixedFunctionArraysDisabled = false;
}
void resize(int newCount) {
@ -77,26 +74,17 @@ public:
GrGLsizei stride,
GrGLvoid* offset);
void setFixedFunctionVertexArray(const GrGpuGL*,
GrGLVertexBuffer*,
GrGLint size,
GrGLenum type,
GrGLsizei stride,
GrGLvoid* offset);
/**
* This function disables vertex attribs not present in the mask. It is assumed that the
* GrGLAttribArrayState is tracking the state of the currently bound vertex array object.
*/
void disableUnusedArrays(const GrGpuGL*, uint64_t usedAttribArrayMask, bool usingFFVertexArray);
void disableUnusedArrays(const GrGpuGL*, uint64_t usedAttribArrayMask);
void invalidate() {
int count = fAttribArrayStates.count();
for (int i = 0; i < count; ++i) {
fAttribArrayStates[i].invalidate();
}
fFixedFunctionVertexArray.invalidate();
fUnusedFixedFunctionArraysDisabled = false;
}
void notifyVertexBufferDelete(GrGLuint id) {
@ -107,10 +95,6 @@ public:
fAttribArrayStates[i].invalidate();
}
}
if (fFixedFunctionVertexArray.fAttribPointerIsValid &&
id == fFixedFunctionVertexArray.fVertexBufferID) {
fFixedFunctionVertexArray.invalidate();
}
}
/**
@ -140,13 +124,6 @@ private:
};
SkSTArray<16, AttribArrayState, true> fAttribArrayStates;
// Tracks the array specified by glVertexPointer.
AttribArrayState fFixedFunctionVertexArray;
// Tracks whether we've disabled the other fixed function arrays that we don't
// use (e.g. glNormalPointer).
bool fUnusedFixedFunctionArraysDisabled;
};
/**

View File

@ -344,22 +344,29 @@ void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) {
if (!fCurrentProgram->hasVertexShader()) {
int posIdx = this->getDrawState().positionAttributeIndex();
const GrVertexAttrib* vertexArray = this->getDrawState().getVertexAttribs() + posIdx;
GrVertexAttribType vertexArrayType = vertexArray->fType;
SkASSERT(!GrGLAttribTypeToLayout(vertexArrayType).fNormalized);
SkASSERT(GrGLAttribTypeToLayout(vertexArrayType).fCount == 2);
attribState->setFixedFunctionVertexArray(this,
vbuf,
2,
GrGLAttribTypeToLayout(vertexArrayType).fType,
stride,
reinterpret_cast<GrGLvoid*>(
vertexOffsetInBytes + vertexArray->fOffset));
attribState->disableUnusedArrays(this, 0, true);
const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttribs() + posIdx;
GrVertexAttribType attribType = vertexAttrib->fType;
SkASSERT(!GrGLAttribTypeToLayout(attribType).fNormalized);
SkASSERT(GrGLAttribTypeToLayout(attribType).fCount == 2);
// Attrib at location 0 is defined to be bound to vertex in fixed-function pipe. Asserts
// above should make sure position attribute goes to location 0 when below code is executed.
attribState->set(this,
0,
vbuf,
GrGLAttribTypeToLayout(attribType).fCount,
GrGLAttribTypeToLayout(attribType).fType,
GrGLAttribTypeToLayout(attribType).fNormalized,
stride,
reinterpret_cast<GrGLvoid*>(
vertexOffsetInBytes + vertexAttrib->fOffset));
attribState->disableUnusedArrays(this, 1);
} else {
int vertexAttribCount = this->getDrawState().getVertexAttribCount();
uint32_t usedAttribArraysMask = 0;
const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttribs();
int vertexAttribCount = this->getDrawState().getVertexAttribCount();
for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount;
++vertexAttribIndex, ++vertexAttrib) {
@ -373,9 +380,8 @@ void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) {
GrGLAttribTypeToLayout(attribType).fNormalized,
stride,
reinterpret_cast<GrGLvoid*>(
vertexOffsetInBytes + vertexAttrib->fOffset));
vertexOffsetInBytes + vertexAttrib->fOffset));
}
attribState->disableUnusedArrays(this, usedAttribArraysMask, false);
attribState->disableUnusedArrays(this, usedAttribArraysMask);
}
}

View File

@ -231,7 +231,6 @@ static GrGLInterface* create_desktop_interface(GrGLVersion version,
functions->fClear = (GrGLClearProc) eglGetProcAddress("glClear");
functions->fClearColor = (GrGLClearColorProc) eglGetProcAddress("glClearColor");
functions->fClearStencil = (GrGLClearStencilProc) eglGetProcAddress("glClearStencil");
functions->fClientActiveTexture = (GrGLClientActiveTextureProc) eglGetProcAddress("glClientActiveTexture");
functions->fColorMask = (GrGLColorMaskProc) eglGetProcAddress("glColorMask");
functions->fCompileShader = (GrGLCompileShaderProc) eglGetProcAddress("glCompileShader");
functions->fCompressedTexImage2D = (GrGLCompressedTexImage2DProc) eglGetProcAddress("glCompressedTexImage2D");
@ -249,14 +248,12 @@ static GrGLInterface* create_desktop_interface(GrGLVersion version,
functions->fDeleteVertexArrays = (GrGLDeleteVertexArraysProc) eglGetProcAddress("glDeleteVertexArrays");
functions->fDepthMask = (GrGLDepthMaskProc) eglGetProcAddress("glDepthMask");
functions->fDisable = (GrGLDisableProc) eglGetProcAddress("glDisable");
functions->fDisableClientState = (GrGLDisableClientStateProc) eglGetProcAddress("glDisableClientState");
functions->fDisableVertexAttribArray = (GrGLDisableVertexAttribArrayProc) eglGetProcAddress("glDisableVertexAttribArray");
functions->fDrawArrays = (GrGLDrawArraysProc) eglGetProcAddress("glDrawArrays");
functions->fDrawBuffer = (GrGLDrawBufferProc) eglGetProcAddress("glDrawBuffer");
functions->fDrawBuffers = (GrGLDrawBuffersProc) eglGetProcAddress("glDrawBuffers");
functions->fDrawElements = (GrGLDrawElementsProc) eglGetProcAddress("glDrawElements");
functions->fEnable = (GrGLEnableProc) eglGetProcAddress("glEnable");
functions->fEnableClientState = (GrGLEnableClientStateProc) eglGetProcAddress("glEnableClientState");
functions->fEnableVertexAttribArray = (GrGLEnableVertexAttribArrayProc) eglGetProcAddress("glEnableVertexAttribArray");
functions->fEndQuery = (GrGLEndQueryProc) eglGetProcAddress("glEndQuery");
functions->fFinish = (GrGLFinishProc) eglGetProcAddress("glFinish");
@ -309,7 +306,6 @@ static GrGLInterface* create_desktop_interface(GrGLVersion version,
functions->fStencilMaskSeparate = (GrGLStencilMaskSeparateProc) eglGetProcAddress("glStencilMaskSeparate");
functions->fStencilOp = (GrGLStencilOpProc) eglGetProcAddress("glStencilOp");
functions->fStencilOpSeparate = (GrGLStencilOpSeparateProc) eglGetProcAddress("glStencilOpSeparate");
functions->fTexGenf = (GrGLTexGenfProc) eglGetProcAddress("glTexGenf");
functions->fTexGenfv = (GrGLTexGenfvProc) eglGetProcAddress("glTexGenfv");
functions->fTexGeni = (GrGLTexGeniProc) eglGetProcAddress("glTexGeni");
functions->fTexImage2D = (GrGLTexImage2DProc) eglGetProcAddress("glTexImage2D");
@ -340,7 +336,6 @@ static GrGLInterface* create_desktop_interface(GrGLVersion version,
functions->fUseProgram = (GrGLUseProgramProc) eglGetProcAddress("glUseProgram");
functions->fVertexAttrib4fv = (GrGLVertexAttrib4fvProc) eglGetProcAddress("glVertexAttrib4fv");
functions->fVertexAttribPointer = (GrGLVertexAttribPointerProc) eglGetProcAddress("glVertexAttribPointer");
functions->fVertexPointer = (GrGLVertexPointerProc) eglGetProcAddress("glVertexPointer");
functions->fViewport = (GrGLViewportProc) eglGetProcAddress("glViewport");
if (extensions.has("GL_NV_path_rendering")) {

View File

@ -32,13 +32,6 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLActiveTexture(GrGLenum texture) {
GrDebugGL::getInstance()->setCurTextureUnit(texture);
}
GrGLvoid GR_GL_FUNCTION_TYPE debugGLClientActiveTexture(GrGLenum texture) {
// Ganesh offsets the texture unit indices
texture -= GR_GL_TEXTURE0;
GrAlwaysAssert(texture < GrDebugGL::getInstance()->getMaxTextureUnits());
}
////////////////////////////////////////////////////////////////////////////////
GrGLvoid GR_GL_FUNCTION_TYPE debugGLAttachShader(GrGLuint programID,
GrGLuint shaderID) {
@ -808,7 +801,6 @@ const GrGLInterface* GrGLCreateDebugInterface() {
functions->fClear = noOpGLClear;
functions->fClearColor = noOpGLClearColor;
functions->fClearStencil = noOpGLClearStencil;
functions->fClientActiveTexture = debugGLClientActiveTexture;
functions->fColorMask = noOpGLColorMask;
functions->fCompileShader = noOpGLCompileShader;
functions->fCompressedTexImage2D = noOpGLCompressedTexImage2D;
@ -824,14 +816,12 @@ const GrGLInterface* GrGLCreateDebugInterface() {
functions->fDeleteVertexArrays = debugGLDeleteVertexArrays;
functions->fDepthMask = noOpGLDepthMask;
functions->fDisable = noOpGLDisable;
functions->fDisableClientState = noOpGLDisableClientState;
functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray;
functions->fDrawArrays = noOpGLDrawArrays;
functions->fDrawBuffer = noOpGLDrawBuffer;
functions->fDrawBuffers = noOpGLDrawBuffers;
functions->fDrawElements = noOpGLDrawElements;
functions->fEnable = noOpGLEnable;
functions->fEnableClientState = noOpGLEnableClientState;
functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray;
functions->fEndQuery = noOpGLEndQuery;
functions->fFinish = noOpGLFinish;
@ -875,7 +865,6 @@ const GrGLInterface* GrGLCreateDebugInterface() {
functions->fStencilMaskSeparate = noOpGLStencilMaskSeparate;
functions->fStencilOp = noOpGLStencilOp;
functions->fStencilOpSeparate = noOpGLStencilOpSeparate;
functions->fTexGenf = noOpGLTexGenf;
functions->fTexGenfv = noOpGLTexGenfv;
functions->fTexGeni = noOpGLTexGeni;
functions->fTexImage2D = noOpGLTexImage2D;
@ -906,7 +895,6 @@ const GrGLInterface* GrGLCreateDebugInterface() {
functions->fUseProgram = debugGLUseProgram;
functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv;
functions->fVertexAttribPointer = noOpGLVertexAttribPointer;
functions->fVertexPointer = noOpGLVertexPointer;
functions->fViewport = noOpGLViewport;
functions->fBindFramebuffer = debugGLBindFramebuffer;
functions->fBindRenderbuffer = debugGLBindRenderbuffer;

View File

@ -79,7 +79,6 @@ const GrGLInterface* GrGLCreateNativeInterface() {
GET_PROC(Clear);
GET_PROC(ClearColor);
GET_PROC(ClearStencil);
GET_PROC(ClientActiveTexture);
GET_PROC(ColorMask);
GET_PROC(CompileShader);
GET_PROC(CompressedTexImage2D);
@ -94,14 +93,12 @@ const GrGLInterface* GrGLCreateNativeInterface() {
GET_PROC(DeleteTextures);
GET_PROC(DepthMask);
GET_PROC(Disable);
GET_PROC(DisableClientState);
GET_PROC(DisableVertexAttribArray);
GET_PROC(DrawArrays);
GET_PROC(DrawBuffer);
GET_PROC(DrawBuffers);
GET_PROC(DrawElements);
GET_PROC(Enable);
GET_PROC(EnableClientState);
GET_PROC(EnableVertexAttribArray);
GET_PROC(EndQuery);
GET_PROC(Finish);
@ -142,7 +139,6 @@ const GrGLInterface* GrGLCreateNativeInterface() {
GET_PROC(StencilMaskSeparate);
GET_PROC(StencilOp);
GET_PROC(StencilOpSeparate);
GET_PROC(TexGenf);
GET_PROC(TexGenfv);
GET_PROC(TexGeni);
GET_PROC(TexImage2D);
@ -178,7 +174,6 @@ const GrGLInterface* GrGLCreateNativeInterface() {
GET_PROC(UseProgram);
GET_PROC(VertexAttrib4fv);
GET_PROC(VertexAttribPointer);
GET_PROC(VertexPointer);
GET_PROC(Viewport);
if (ver >= GR_GL_VER(3,0) || extensions.has("GL_ARB_vertex_array_object")) {

View File

@ -63,7 +63,6 @@ const GrGLInterface* GrGLCreateMesaInterface() {
GR_GL_GET_PROC(Clear);
GR_GL_GET_PROC(ClearColor);
GR_GL_GET_PROC(ClearStencil);
GR_GL_GET_PROC(ClientActiveTexture);
GR_GL_GET_PROC(ColorMask);
GR_GL_GET_PROC(CompileShader);
GR_GL_GET_PROC(CompressedTexImage2D);
@ -78,14 +77,12 @@ const GrGLInterface* GrGLCreateMesaInterface() {
GR_GL_GET_PROC(DeleteTextures);
GR_GL_GET_PROC(DepthMask);
GR_GL_GET_PROC(Disable);
GR_GL_GET_PROC(DisableClientState);
GR_GL_GET_PROC(DisableVertexAttribArray);
GR_GL_GET_PROC(DrawArrays);
GR_GL_GET_PROC(DrawBuffer);
GR_GL_GET_PROC(DrawBuffers);
GR_GL_GET_PROC(DrawElements);
GR_GL_GET_PROC(Enable);
GR_GL_GET_PROC(EnableClientState);
GR_GL_GET_PROC(EnableVertexAttribArray);
GR_GL_GET_PROC(EndQuery);
GR_GL_GET_PROC(Finish);
@ -134,7 +131,6 @@ const GrGLInterface* GrGLCreateMesaInterface() {
GR_GL_GET_PROC(StencilMaskSeparate);
GR_GL_GET_PROC(StencilOp);
GR_GL_GET_PROC(StencilOpSeparate);
GR_GL_GET_PROC(TexGenf);
GR_GL_GET_PROC(TexGenfv);
GR_GL_GET_PROC(TexGeni);
GR_GL_GET_PROC(TexImage2D)
@ -168,7 +164,6 @@ const GrGLInterface* GrGLCreateMesaInterface() {
GR_GL_GET_PROC(UseProgram);
GR_GL_GET_PROC(VertexAttrib4fv);
GR_GL_GET_PROC(VertexAttribPointer);
GR_GL_GET_PROC(VertexPointer);
GR_GL_GET_PROC(Viewport);
if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_vertex_array_object")) {

View File

@ -63,7 +63,6 @@ const GrGLInterface* GrGLCreateNativeInterface() {
functions->fClear = glClear;
functions->fClearColor = glClearColor;
functions->fClearStencil = glClearStencil;
functions->fClientActiveTexture = glClientActiveTexture;
functions->fColorMask = glColorMask;
GR_GL_GET_PROC(CompileShader);
functions->fCompressedTexImage2D = glCompressedTexImage2D;
@ -78,14 +77,12 @@ const GrGLInterface* GrGLCreateNativeInterface() {
functions->fDeleteTextures = glDeleteTextures;
functions->fDepthMask = glDepthMask;
functions->fDisable = glDisable;
functions->fDisableClientState = glDisableClientState;
GR_GL_GET_PROC(DisableVertexAttribArray);
functions->fDrawArrays = glDrawArrays;
functions->fDrawBuffer = glDrawBuffer;
GR_GL_GET_PROC(DrawBuffers);
functions->fDrawElements = glDrawElements;
functions->fEnable = glEnable;
functions->fEnableClientState = glEnableClientState;
GR_GL_GET_PROC(EnableVertexAttribArray);
GR_GL_GET_PROC(EndQuery);
functions->fFinish = glFinish;
@ -132,7 +129,6 @@ const GrGLInterface* GrGLCreateNativeInterface() {
functions->fStencilOp = glStencilOp;
GR_GL_GET_PROC(StencilOpSeparate);
functions->fTexImage2D = glTexImage2D;
functions->fTexGenf = glTexGenf;
functions->fTexGenfv = glTexGenfv;
functions->fTexGeni = glTexGeni;
functions->fTexParameteri = glTexParameteri;
@ -166,7 +162,6 @@ const GrGLInterface* GrGLCreateNativeInterface() {
GR_GL_GET_PROC(UseProgram);
GR_GL_GET_PROC(VertexAttrib4fv);
GR_GL_GET_PROC(VertexAttribPointer);
GR_GL_GET_PROC(VertexPointer);
functions->fViewport = glViewport;
GR_GL_GET_PROC(BindFragDataLocationIndexed);

View File

@ -90,12 +90,10 @@ const GrGLInterface* GrGLCreateNativeInterface() {
SET_PROC(DeleteTextures)
SET_PROC(DepthMask)
SET_PROC(Disable)
SET_PROC(DisableClientState)
SET_PROC(DrawArrays)
SET_PROC(DrawElements)
SET_PROC(DrawBuffer)
SET_PROC(Enable)
SET_PROC(EnableClientState)
SET_PROC(FrontFace)
SET_PROC(Finish)
SET_PROC(Flush)
@ -115,7 +113,6 @@ const GrGLInterface* GrGLCreateNativeInterface() {
SET_PROC(StencilFunc)
SET_PROC(StencilMask)
SET_PROC(StencilOp)
SET_PROC(TexGenf)
SET_PROC(TexGenfv)
SET_PROC(TexGeni)
SET_PROC(TexImage2D)
@ -128,7 +125,6 @@ const GrGLInterface* GrGLCreateNativeInterface() {
}
SET_PROC(TexSubImage2D)
SET_PROC(Viewport)
SET_PROC(VertexPointer)
WGL_SET_PROC(ActiveTexture);
WGL_SET_PROC(AttachShader);
@ -138,7 +134,6 @@ const GrGLInterface* GrGLCreateNativeInterface() {
WGL_SET_PROC(BindFragDataLocation);
WGL_SET_PROC(BufferData);
WGL_SET_PROC(BufferSubData);
WGL_SET_PROC(ClientActiveTexture);
WGL_SET_PROC(CompileShader);
WGL_SET_PROC(CompressedTexImage2D);
WGL_SET_PROC(CreateProgram);