Add glTexGen funcs to interface
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://chromiumcodereview.appspot.com/23513006
git-svn-id: http://skia.googlecode.com/svn/trunk@11032 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 497f938..2405679 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -615,7 +615,7 @@
kStencil_GrGLBackendState = 1 << 6,
kPixelStore_GrGLBackendState = 1 << 7,
kProgram_GrGLBackendState = 1 << 8,
- kPathStencil_GrGLBackendState = 1 << 9,
+ kFixedFunction_GrGLBackendState = 1 << 9,
kMisc_GrGLBackendState = 1 << 10,
kALL_GrGLBackendState = 0xffff
};
diff --git a/include/gpu/gl/GrGLFunctions.h b/include/gpu/gl/GrGLFunctions.h
index b30ef3a..b949d1d 100644
--- a/include/gpu/gl/GrGLFunctions.h
+++ b/include/gpu/gl/GrGLFunctions.h
@@ -61,6 +61,7 @@
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClearProc)(GrGLbitfield mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClearColorProc)(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClearStencilProc)(GrGLint s);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClientActiveTextureProc)(GrGLenum texture);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLColorMaskProc)(GrGLboolean red, GrGLboolean green, GrGLboolean blue, GrGLboolean alpha);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCompileShaderProc)(GrGLuint shader);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCompressedTexImage2DProc)(GrGLenum target, GrGLint level, GrGLenum internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid* data);
@@ -78,12 +79,14 @@
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)();
@@ -140,6 +143,9 @@
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilMaskSeparateProc)(GrGLenum face, GrGLuint mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilOpProc)(GrGLenum fail, GrGLenum zfail, GrGLenum zpass);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilOpSeparateProc)(GrGLenum face, GrGLenum fail, GrGLenum zfail, GrGLenum zpass);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexGenfProc)(GrGLenum coord, GrGLenum pname, GrGLfloat param);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexGenfvProc)(GrGLenum coord, GrGLenum pname, const GrGLfloat* params);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexGeniProc)(GrGLenum coord, GrGLenum pname, GrGLint param);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexImage2DProc)(GrGLenum target, GrGLint level, GrGLint internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid* pixels);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexParameteriProc)(GrGLenum target, GrGLenum pname, GrGLint param);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexParameterivProc)(GrGLenum target, GrGLenum pname, const GrGLint* params);
@@ -169,6 +175,7 @@
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
diff --git a/include/gpu/gl/GrGLInterface.h b/include/gpu/gl/GrGLInterface.h
index 3b388f5..4f2e3c4 100644
--- a/include/gpu/gl/GrGLInterface.h
+++ b/include/gpu/gl/GrGLInterface.h
@@ -159,6 +159,7 @@
GLPtr<GrGLClearProc> fClear;
GLPtr<GrGLClearColorProc> fClearColor;
GLPtr<GrGLClearStencilProc> fClearStencil;
+ GLPtr<GrGLClientActiveTextureProc> fClientActiveTexture;
GLPtr<GrGLColorMaskProc> fColorMask;
GLPtr<GrGLCompileShaderProc> fCompileShader;
GLPtr<GrGLCompressedTexImage2DProc> fCompressedTexImage2D;
@@ -176,12 +177,14 @@
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;
@@ -234,6 +237,9 @@
GLPtr<GrGLStencilMaskSeparateProc> fStencilMaskSeparate;
GLPtr<GrGLStencilOpProc> fStencilOp;
GLPtr<GrGLStencilOpSeparateProc> fStencilOpSeparate;
+ GLPtr<GrGLTexGenfProc> fTexGenf;
+ GLPtr<GrGLTexGenfvProc> fTexGenfv;
+ GLPtr<GrGLTexGeniProc> fTexGeni;
GLPtr<GrGLTexImage2DProc> fTexImage2D;
GLPtr<GrGLTexParameteriProc> fTexParameteri;
GLPtr<GrGLTexParameterivProc> fTexParameteriv;
@@ -263,6 +269,7 @@
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
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index e2ecfd7..a6740cc 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -29,6 +29,7 @@
fMaxFragmentUniformVectors = 0;
fMaxVertexAttributes = 0;
fMaxFragmentTextureUnits = 0;
+ fMaxFixedFunctionTextureCoords = 0;
fRGBA8RenderbufferSupport = false;
fBGRAFormatSupport = false;
fBGRAIsInternalFormat = false;
@@ -61,6 +62,7 @@
fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors;
fMaxVertexAttributes = caps.fMaxVertexAttributes;
fMaxFragmentTextureUnits = caps.fMaxFragmentTextureUnits;
+ fMaxFixedFunctionTextureCoords = caps.fMaxFixedFunctionTextureCoords;
fMSFBOType = caps.fMSFBOType;
fCoverageAAType = caps.fCoverageAAType;
fMSAACoverageModes = caps.fMSAACoverageModes;
@@ -109,6 +111,16 @@
GrGLint max;
GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max);
fMaxFragmentUniformVectors = max / 4;
+ if (version >= GR_GL_VER(3, 2)) {
+ GrGLint profileMask;
+ GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask);
+ fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT);
+ }
+ if (!fIsCoreProfile) {
+ GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_COORDS, &fMaxFixedFunctionTextureCoords);
+ // Sanity check
+ SkASSERT(fMaxFixedFunctionTextureCoords > 0 && fMaxFixedFunctionTextureCoords < 128);
+ }
}
GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes);
GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUnits);
@@ -210,12 +222,6 @@
fUseNonVBOVertexAndIndexDynamicData = true;
}
- if (kDesktop_GrGLBinding == binding && version >= GR_GL_VER(3, 2)) {
- GrGLint profileMask;
- GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask);
- fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT);
- }
-
fDiscardFBSupport = ctxInfo.hasExtension("GL_EXT_discard_framebuffer");
if (kDesktop_GrGLBinding == binding) {
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 0b625a5..79251b2 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -221,6 +221,9 @@
/// maximum number of texture units accessible in the fragment shader.
int maxFragmentTextureUnits() const { return fMaxFragmentTextureUnits; }
+ /// maximum number of fixed-function texture coords, or zero if no fixed-function.
+ int maxFixedFunctionTextureCoords() const { return fMaxFixedFunctionTextureCoords; }
+
/// ES requires an extension to support RGBA8 in RenderBufferStorage
bool rgba8RenderbufferSupport() const { return fRGBA8RenderbufferSupport; }
@@ -336,6 +339,7 @@
int fMaxFragmentUniformVectors;
int fMaxVertexAttributes;
int fMaxFragmentTextureUnits;
+ int fMaxFixedFunctionTextureCoords;
MSFBOType fMSFBOType;
CoverageAAType fCoverageAAType;
diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp
index d080cce..c169b1c 100644
--- a/src/gpu/gl/GrGLCreateNullInterface.cpp
+++ b/src/gpu/gl/GrGLCreateNullInterface.cpp
@@ -100,6 +100,7 @@
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) {
@@ -281,6 +282,7 @@
interface->fClear = noOpGLClear;
interface->fClearColor = noOpGLClearColor;
interface->fClearStencil = noOpGLClearStencil;
+ interface->fClientActiveTexture = nullGLClientActiveTexture;
interface->fColorMask = noOpGLColorMask;
interface->fCompileShader = noOpGLCompileShader;
interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D;
@@ -296,12 +298,14 @@
interface->fDeleteVertexArrays = noOpGLDeleteIds;
interface->fDepthMask = noOpGLDepthMask;
interface->fDisable = noOpGLDisable;
+ interface->fDisableClientState = noOpGLDisableClientState;
interface->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray;
interface->fDrawArrays = noOpGLDrawArrays;
interface->fDrawBuffer = noOpGLDrawBuffer;
interface->fDrawBuffers = noOpGLDrawBuffers;
interface->fDrawElements = noOpGLDrawElements;
interface->fEnable = noOpGLEnable;
+ interface->fEnableClientState = noOpGLEnableClientState;
interface->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray;
interface->fEndQuery = noOpGLEndQuery;
interface->fFinish = noOpGLFinish;
@@ -328,8 +332,11 @@
interface->fGetStringi = noOpGLGetStringi;
interface->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv;
interface->fGetUniformLocation = noOpGLGetUniformLocation;
+ interface->fLoadIdentity = noOpGLLoadIdentity;
+ interface->fLoadMatrixf = noOpGLLoadMatrixf;
interface->fLineWidth = noOpGLLineWidth;
interface->fLinkProgram = noOpGLLinkProgram;
+ interface->fMatrixMode = noOpGLMatrixMode;
interface->fPixelStorei = nullGLPixelStorei;
interface->fQueryCounter = noOpGLQueryCounter;
interface->fReadBuffer = noOpGLReadBuffer;
@@ -342,6 +349,9 @@
interface->fStencilMaskSeparate = noOpGLStencilMaskSeparate;
interface->fStencilOp = noOpGLStencilOp;
interface->fStencilOpSeparate = noOpGLStencilOpSeparate;
+ interface->fTexGenf = noOpGLTexGenf;
+ interface->fTexGenfv = noOpGLTexGenfv;
+ interface->fTexGeni = noOpGLTexGeni;
interface->fTexImage2D = noOpGLTexImage2D;
interface->fTexParameteri = noOpGLTexParameteri;
interface->fTexParameteriv = noOpGLTexParameteriv;
@@ -370,6 +380,7 @@
interface->fUseProgram = nullGLUseProgram;
interface->fVertexAttrib4fv = noOpGLVertexAttrib4fv;
interface->fVertexAttribPointer = noOpGLVertexAttribPointer;
+ interface->fVertexPointer = noOpGLVertexPointer;
interface->fViewport = nullGLViewport;
interface->fBindFramebuffer = nullGLBindFramebuffer;
interface->fBindRenderbuffer = nullGLBindRenderbuffer;
diff --git a/src/gpu/gl/GrGLDefines.h b/src/gpu/gl/GrGLDefines.h
index 2ab9570..a843953 100644
--- a/src/gpu/gl/GrGLDefines.h
+++ b/src/gpu/gl/GrGLDefines.h
@@ -439,6 +439,7 @@
#define GR_GL_TEXTURE31 0x84DF
#define GR_GL_ACTIVE_TEXTURE 0x84E0
#define GR_GL_MAX_TEXTURE_UNITS 0x84E2
+#define GR_GL_MAX_TEXTURE_COORDS 0x8871
/* TextureWrapMode */
#define GR_GL_REPEAT 0x2901
@@ -464,6 +465,8 @@
#define GR_GL_TEXTURE_ENV_COLOR 0x2201
#define GR_GL_TEXTURE_GEN_S 0x0C60
#define GR_GL_TEXTURE_GEN_T 0x0C61
+#define GR_GL_TEXTURE_GEN_R 0x0C62
+#define GR_GL_TEXTURE_GEN_Q 0x0C63
#define GR_GL_TEXTURE_GEN_MODE 0x2500
#define GR_GL_TEXTURE_BORDER_COLOR 0x1004
#define GR_GL_TEXTURE_WIDTH 0x1000
diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp
index a5ddd9f..38a7f9d 100644
--- a/src/gpu/gl/GrGLInterface.cpp
+++ b/src/gpu/gl/GrGLInterface.cpp
@@ -44,6 +44,16 @@
return false;
}
+ bool isCoreProfile = false;
+ if (kDesktop_GrGLBinding == binding) {
+ if (NULL == this->fGetIntegerv) {
+ return false;
+ }
+ GrGLint profileMask = 0;
+ fGetIntegerv(GR_GL_CONTEXT_PROFILE_MASK, &profileMask);
+ isCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT);
+ }
+
// functions that are always required
if (NULL == fActiveTexture ||
NULL == fAttachShader ||
@@ -199,14 +209,19 @@
return false;
}
}
- // The below two blocks are checks for functions used with
- // GL_NV_path_rendering. We're not enforcing that they be non-NULL
- // because they aren't actually called at this time.
- if (false &&
- (NULL == fMatrixMode ||
- NULL == fLoadIdentity ||
- NULL == fLoadMatrixf)) {
- return false;
+ if (!isCoreProfile) {
+ if (NULL == fClientActiveTexture ||
+ NULL == fDisableClientState ||
+ NULL == fEnableClientState ||
+ NULL == fLoadIdentity ||
+ NULL == fLoadMatrixf ||
+ NULL == fMatrixMode ||
+ NULL == fTexGenf ||
+ NULL == fTexGenfv ||
+ NULL == fTexGeni ||
+ NULL == fVertexPointer) {
+ return false;
+ }
}
if (false && extensions.has("GL_NV_path_rendering")) {
if (NULL == fPathCommands ||
diff --git a/src/gpu/gl/GrGLNoOpInterface.cpp b/src/gpu/gl/GrGLNoOpInterface.cpp
index db7b8e3..0641af8 100644
--- a/src/gpu/gl/GrGLNoOpInterface.cpp
+++ b/src/gpu/gl/GrGLNoOpInterface.cpp
@@ -119,6 +119,9 @@
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisable(GrGLenum cap) {
}
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisableClientState(GrGLenum) {
+}
+
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisableVertexAttribArray(GrGLuint index) {
}
@@ -143,6 +146,9 @@
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnable(GrGLenum cap) {
}
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnableClientState(GrGLenum cap) {
+}
+
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnableVertexAttribArray(GrGLuint index) {
}
@@ -164,6 +170,15 @@
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLinkProgram(GrGLuint program) {
}
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLoadIdentity() {
+}
+
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLoadMatrixf(const GrGLfloat*) {
+}
+
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLMatrixMode(GrGLenum) {
+}
+
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLQueryCounter(GrGLuint id, GrGLenum target) {
}
@@ -210,6 +225,15 @@
GrGLenum zpass) {
}
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexGenf(GrGLenum, GrGLenum, float) {
+}
+
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexGenfv(GrGLenum, GrGLenum, const float*) {
+}
+
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexGeni(GrGLenum, GrGLenum, GrGLint) {
+}
+
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexImage2D(GrGLenum target,
GrGLint level,
GrGLint internalformat,
@@ -361,6 +385,9 @@
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,
@@ -458,6 +485,9 @@
case GR_GL_MAX_TEXTURE_IMAGE_UNITS:
*params = 8;
break;
+ case GR_GL_MAX_TEXTURE_COORDS:
+ *params = 8;
+ break;
case GR_GL_MAX_VERTEX_UNIFORM_VECTORS:
*params = kDefaultMaxVertexUniformVectors;
break;
diff --git a/src/gpu/gl/GrGLNoOpInterface.h b/src/gpu/gl/GrGLNoOpInterface.h
index 0451e9c..8fe9b44 100644
--- a/src/gpu/gl/GrGLNoOpInterface.h
+++ b/src/gpu/gl/GrGLNoOpInterface.h
@@ -70,6 +70,8 @@
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);
@@ -86,6 +88,8 @@
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);
@@ -96,10 +100,16 @@
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLFrontFace(GrGLenum mode);
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLoadIdentity();
+
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLoadMatrixf(const GrGLfloat*);
+
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLineWidth(GrGLfloat width);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLinkProgram(GrGLuint program);
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLMatrixMode(GrGLenum);
+
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLQueryCounter(GrGLuint id,
GrGLenum target);
@@ -159,6 +169,12 @@
GrGLsizei width,
GrGLsizei height);
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexGenf(GrGLenum, GrGLenum, GrGLfloat);
+
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexGenfv(GrGLenum, GrGLenum, const GrGLfloat*);
+
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexGeni(GrGLenum, GrGLenum, GrGLint);
+
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDiscardFramebuffer(GrGLenum target,
GrGLsizei numAttachments,
const GrGLenum* attachments);
@@ -261,6 +277,8 @@
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,
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 3b7df49..94a1306 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -333,9 +333,9 @@
fHWAAState.invalidate();
}
- // invalid
+ fHWActiveTextureUnitIdx = -1; // invalid
+
if (resetBits & kTextureBinding_GrGLBackendState) {
- fHWActiveTextureUnitIdx = -1;
for (int s = 0; s < fHWBoundTextures.count(); ++s) {
fHWBoundTextures[s] = NULL;
}
@@ -364,12 +364,31 @@
fHWBoundRenderTarget = NULL;
}
- if (resetBits & kPathStencil_GrGLBackendState) {
- fHWPathStencilMatrixState.invalidate();
- if (this->caps()->pathStencilingSupport()) {
- // we don't use the model view matrix.
- GL_CALL(MatrixMode(GR_GL_MODELVIEW));
- GL_CALL(LoadIdentity());
+ if (resetBits & kFixedFunction_GrGLBackendState &&
+ kDesktop_GrGLBinding == this->glBinding() &&
+ !this->glCaps().isCoreProfile()) {
+
+ fHWProjectionMatrixState.invalidate();
+ // we don't use the model view matrix.
+ GL_CALL(MatrixMode(GR_GL_MODELVIEW));
+ GL_CALL(LoadIdentity());
+
+ // When we use fixed function vertex processing we always use the vertex array
+ // and none of the other arrays.
+ GL_CALL(EnableClientState(GR_GL_VERTEX_ARRAY));
+ GL_CALL(DisableClientState(GR_GL_NORMAL_ARRAY));
+ GL_CALL(DisableClientState(GR_GL_COLOR_ARRAY));
+ GL_CALL(DisableClientState(GR_GL_INDEX_ARRAY));
+ GL_CALL(DisableClientState(GR_GL_EDGE_FLAG_ARRAY));
+ for (int i = 0; i < this->glCaps().maxFixedFunctionTextureCoords(); ++i) {
+ GL_CALL(ClientActiveTexture(GR_GL_TEXTURE0 + i));
+ GL_CALL(DisableClientState(GR_GL_TEXTURE_COORD_ARRAY));
+
+ GL_CALL(ActiveTexture(GR_GL_TEXTURE0 + i));
+ GL_CALL(Disable(GR_GL_TEXTURE_GEN_S));
+ GL_CALL(Disable(GR_GL_TEXTURE_GEN_T));
+ GL_CALL(Disable(GR_GL_TEXTURE_GEN_Q));
+ GL_CALL(Disable(GR_GL_TEXTURE_GEN_R));
}
}
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index 672df42..1d1cdc5 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -417,7 +417,7 @@
} fHWAAState;
- GrGLProgram::MatrixState fHWPathStencilMatrixState;
+ GrGLProgram::MatrixState fHWProjectionMatrixState;
GrStencilSettings fHWStencilSettings;
TriState fHWStencilTestEnabled;
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 3f58c1b..2b1795d 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -209,9 +209,9 @@
size.set(rt->width(), rt->height());
const SkMatrix& vm = this->getDrawState().getViewMatrix();
- if (fHWPathStencilMatrixState.fRenderTargetOrigin != rt->origin() ||
- !fHWPathStencilMatrixState.fViewMatrix.cheapEqualTo(viewMatrix) ||
- fHWPathStencilMatrixState.fRenderTargetSize!= size) {
+ if (fHWProjectionMatrixState.fRenderTargetOrigin != rt->origin() ||
+ !fHWProjectionMatrixState.fViewMatrix.cheapEqualTo(viewMatrix) ||
+ fHWProjectionMatrixState.fRenderTargetSize!= size) {
// rescale the coords from skia's "device" coords to GL's normalized coords,
// and perform a y-flip if required.
SkMatrix m;
@@ -249,9 +249,9 @@
};
GL_CALL(MatrixMode(GR_GL_PROJECTION));
GL_CALL(LoadMatrixf(mv));
- fHWPathStencilMatrixState.fViewMatrix = vm;
- fHWPathStencilMatrixState.fRenderTargetSize = size;
- fHWPathStencilMatrixState.fRenderTargetOrigin = rt->origin();
+ fHWProjectionMatrixState.fViewMatrix = vm;
+ fHWProjectionMatrixState.fRenderTargetSize = size;
+ fHWProjectionMatrixState.fRenderTargetOrigin = rt->origin();
}
}
diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
index d517aa8..2ccd158 100644
--- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
+++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
@@ -32,6 +32,13 @@
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) {
@@ -801,6 +808,7 @@
interface->fClear = noOpGLClear;
interface->fClearColor = noOpGLClearColor;
interface->fClearStencil = noOpGLClearStencil;
+ interface->fClientActiveTexture = debugGLClientActiveTexture;
interface->fColorMask = noOpGLColorMask;
interface->fCompileShader = noOpGLCompileShader;
interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D;
@@ -816,12 +824,14 @@
interface->fDeleteVertexArrays = debugGLDeleteVertexArrays;
interface->fDepthMask = noOpGLDepthMask;
interface->fDisable = noOpGLDisable;
+ interface->fDisableClientState = noOpGLDisableClientState;
interface->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray;
interface->fDrawArrays = noOpGLDrawArrays;
interface->fDrawBuffer = noOpGLDrawBuffer;
interface->fDrawBuffers = noOpGLDrawBuffers;
interface->fDrawElements = noOpGLDrawElements;
interface->fEnable = noOpGLEnable;
+ interface->fEnableClientState = noOpGLEnableClientState;
interface->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray;
interface->fEndQuery = noOpGLEndQuery;
interface->fFinish = noOpGLFinish;
@@ -848,8 +858,11 @@
interface->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv;
interface->fGetUniformLocation = noOpGLGetUniformLocation;
interface->fGenVertexArrays = debugGLGenVertexArrays;
+ interface->fLoadIdentity = noOpGLLoadIdentity;
+ interface->fLoadMatrixf = noOpGLLoadMatrixf;
interface->fLineWidth = noOpGLLineWidth;
interface->fLinkProgram = noOpGLLinkProgram;
+ interface->fMatrixMode = noOpGLMatrixMode;
interface->fPixelStorei = debugGLPixelStorei;
interface->fQueryCounter = noOpGLQueryCounter;
interface->fReadBuffer = noOpGLReadBuffer;
@@ -862,6 +875,9 @@
interface->fStencilMaskSeparate = noOpGLStencilMaskSeparate;
interface->fStencilOp = noOpGLStencilOp;
interface->fStencilOpSeparate = noOpGLStencilOpSeparate;
+ interface->fTexGenf = noOpGLTexGenf;
+ interface->fTexGenfv = noOpGLTexGenfv;
+ interface->fTexGeni = noOpGLTexGeni;
interface->fTexImage2D = noOpGLTexImage2D;
interface->fTexParameteri = noOpGLTexParameteri;
interface->fTexParameteriv = noOpGLTexParameteriv;
@@ -890,6 +906,7 @@
interface->fUseProgram = debugGLUseProgram;
interface->fVertexAttrib4fv = noOpGLVertexAttrib4fv;
interface->fVertexAttribPointer = noOpGLVertexAttribPointer;
+ interface->fVertexPointer = noOpGLVertexPointer;
interface->fViewport = noOpGLViewport;
interface->fBindFramebuffer = debugGLBindFramebuffer;
interface->fBindRenderbuffer = debugGLBindRenderbuffer;
diff --git a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
index eb0e87e..ba0adad 100644
--- a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
+++ b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
@@ -84,6 +84,7 @@
GET_PROC(Clear);
GET_PROC(ClearColor);
GET_PROC(ClearStencil);
+ GET_PROC(ClientActiveTexture);
GET_PROC(ColorMask);
GET_PROC(CompileShader);
GET_PROC(CompressedTexImage2D);
@@ -98,12 +99,14 @@
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);
@@ -141,6 +144,9 @@
GET_PROC(StencilMaskSeparate);
GET_PROC(StencilOp);
GET_PROC(StencilOpSeparate);
+ GET_PROC(TexGenf);
+ GET_PROC(TexGenfv);
+ GET_PROC(TexGeni);
GET_PROC(TexImage2D);
GET_PROC(TexParameteri);
GET_PROC(TexParameteriv);
@@ -174,6 +180,7 @@
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")) {
diff --git a/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp b/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp
index 1ffcbcd..31f88d5 100644
--- a/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp
+++ b/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp
@@ -63,6 +63,7 @@
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);
@@ -77,12 +78,14 @@
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);
@@ -116,6 +119,9 @@
GR_GL_GET_PROC(GetUniformLocation);
GR_GL_GET_PROC(LineWidth);
GR_GL_GET_PROC(LinkProgram);
+ GR_GL_GET_PROC(LoadIdentity);
+ GR_GL_GET_PROC(LoadMatrixf);
+ GR_GL_GET_PROC(MatrixMode);
GR_GL_GET_PROC(MapBuffer);
GR_GL_GET_PROC(PixelStorei);
GR_GL_GET_PROC(ReadBuffer);
@@ -128,6 +134,9 @@
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)
GR_GL_GET_PROC(TexParameteri);
GR_GL_GET_PROC(TexParameteriv);
@@ -159,6 +168,7 @@
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")) {
diff --git a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp
index 5820b8e..1b44900 100644
--- a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp
+++ b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp
@@ -63,6 +63,7 @@
interface->fClear = glClear;
interface->fClearColor = glClearColor;
interface->fClearStencil = glClearStencil;
+ interface->fClientActiveTexture = glClientActiveTexture;
interface->fColorMask = glColorMask;
GR_GL_GET_PROC(CompileShader);
interface->fCompressedTexImage2D = glCompressedTexImage2D;
@@ -77,12 +78,14 @@
interface->fDeleteTextures = glDeleteTextures;
interface->fDepthMask = glDepthMask;
interface->fDisable = glDisable;
+ interface->fDisableClientState = glDisableClientState;
GR_GL_GET_PROC(DisableVertexAttribArray);
interface->fDrawArrays = glDrawArrays;
interface->fDrawBuffer = glDrawBuffer;
GR_GL_GET_PROC(DrawBuffers);
interface->fDrawElements = glDrawElements;
interface->fEnable = glEnable;
+ interface->fEnableClientState = glEnableClientState;
GR_GL_GET_PROC(EnableVertexAttribArray);
GR_GL_GET_PROC(EndQuery);
interface->fFinish = glFinish;
@@ -132,6 +135,9 @@
interface->fStencilOp = glStencilOp;
GR_GL_GET_PROC(StencilOpSeparate);
interface->fTexImage2D = glTexImage2D;
+ interface->fTexGenf = glTexGenf;
+ interface->fTexGenfv = glTexGenfv;
+ interface->fTexGeni = glTexGeni;
interface->fTexParameteri = glTexParameteri;
interface->fTexParameteriv = glTexParameteriv;
if (glVer >= GR_GL_VER(4,2) || extensions.has("GL_ARB_texture_storage")) {
@@ -163,6 +169,7 @@
GR_GL_GET_PROC(UseProgram);
GR_GL_GET_PROC(VertexAttrib4fv);
GR_GL_GET_PROC(VertexAttribPointer);
+ GR_GL_GET_PROC(VertexPointer);
interface->fViewport = glViewport;
GR_GL_GET_PROC(BindFragDataLocationIndexed);
diff --git a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
index 53b1edd..e6f1d1f 100644
--- a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
+++ b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
@@ -97,10 +97,12 @@
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)
@@ -120,6 +122,9 @@
SET_PROC(StencilFunc)
SET_PROC(StencilMask)
SET_PROC(StencilOp)
+ SET_PROC(TexGenf)
+ SET_PROC(TexGenfv)
+ SET_PROC(TexGeni)
SET_PROC(TexImage2D)
SET_PROC(TexParameteri)
SET_PROC(TexParameteriv)
@@ -130,6 +135,7 @@
}
SET_PROC(TexSubImage2D)
SET_PROC(Viewport)
+ SET_PROC(VertexPointer)
WGL_SET_PROC(ActiveTexture);
WGL_SET_PROC(AttachShader);
@@ -139,6 +145,7 @@
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);