diff options
-rw-r--r-- | include/gpu/gl/GrGLFunctions.h | 30 | ||||
-rw-r--r-- | include/gpu/gl/GrGLInterface.h | 35 | ||||
-rw-r--r-- | src/gpu/gl/GrGLAssembleGLESInterface.h | 29 | ||||
-rw-r--r-- | src/gpu/gl/GrGLAssembleInterface.cpp | 38 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 23 | ||||
-rw-r--r-- | src/gpu/gl/GrGLDefines.h | 81 | ||||
-rw-r--r-- | src/gpu/gl/GrGLInterface.cpp | 138 |
7 files changed, 110 insertions, 264 deletions
diff --git a/include/gpu/gl/GrGLFunctions.h b/include/gpu/gl/GrGLFunctions.h index 5ac77a2556..f31ae8a2a3 100644 --- a/include/gpu/gl/GrGLFunctions.h +++ b/include/gpu/gl/GrGLFunctions.h @@ -214,11 +214,14 @@ extern "C" { // Experimental: Functions for GL_NV_path_rendering. These will be // alphabetized with the above functions once this is fully supported // (and functions we are unlikely to use will possibly be omitted). + // EXT_direct_state_access typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLMatrixLoadfProc)(GrGLenum matrixMode, const GrGLfloat* m); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLMatrixLoadIdentityProc)(GrGLenum); + // ARB_program_interface_query + typedef GrGLint (GR_GL_FUNCTION_TYPE* GrGLGetProgramResourceLocationProc)(GrGLuint program, GrGLenum programInterface, const GrGLchar *name); + // NV_path_rendering typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathCommandsProc)(GrGLuint path, GrGLsizei numCommands, const GrGLubyte *commands, GrGLsizei numCoords, GrGLenum coordType, const GrGLvoid *coords); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathCoordsProc)(GrGLuint path, GrGLsizei numCoords, GrGLenum coordType, const GrGLvoid *coords); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathSubCommandsProc)(GrGLuint path, GrGLsizei commandStart, GrGLsizei commandsToDelete, GrGLsizei numCommands, const GrGLubyte *commands, GrGLsizei numCoords, GrGLenum coordType, const GrGLvoid *coords); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathSubCoordsProc)(GrGLuint path, GrGLsizei coordStart, GrGLsizei numCoords, GrGLenum coordType, const GrGLvoid *coords); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathStringProc)(GrGLuint path, GrGLenum format, GrGLsizei length, const GrGLvoid *pathString); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathGlyphsProc)(GrGLuint firstPathName, GrGLenum fontTarget, const GrGLvoid *fontName, GrGLbitfield fontStyle, GrGLsizei numGlyphs, GrGLenum type, const GrGLvoid *charcodes, GrGLenum handleMissingGlyphs, GrGLuint pathParameterTemplate, GrGLfloat emScale); @@ -227,45 +230,22 @@ extern "C" { typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCopyPathProc)(GrGLuint resultPath, GrGLuint srcPath); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInterpolatePathsProc)(GrGLuint resultPath, GrGLuint pathA, GrGLuint pathB, GrGLfloat weight); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTransformPathProc)(GrGLuint resultPath, GrGLuint srcPath, GrGLenum transformType, const GrGLfloat *transformValues); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathParameterivProc)(GrGLuint path, GrGLenum pname, const GrGLint *value); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathParameteriProc)(GrGLuint path, GrGLenum pname, GrGLint value); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathParameterfvProc)(GrGLuint path, GrGLenum pname, const GrGLfloat *value); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathParameterfProc)(GrGLuint path, GrGLenum pname, GrGLfloat value); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathDashArrayProc)(GrGLuint path, GrGLsizei dashCount, const GrGLfloat *dashArray); typedef GrGLuint (GR_GL_FUNCTION_TYPE* GrGLGenPathsProc)(GrGLsizei range); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDeletePathsProc)(GrGLuint path, GrGLsizei range); - typedef GrGLboolean (GR_GL_FUNCTION_TYPE* GrGLIsPathProc)(GrGLuint path); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathStencilFuncProc)(GrGLenum func, GrGLint ref, GrGLuint mask); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathStencilDepthOffsetProc)(GrGLfloat factor, GrGLfloat units); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilFillPathProc)(GrGLuint path, GrGLenum fillMode, GrGLuint mask); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilStrokePathProc)(GrGLuint path, GrGLint reference, GrGLuint mask); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilFillPathInstancedProc)(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, GrGLenum transformType, const GrGLfloat *transformValues); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilStrokePathInstancedProc)(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLint reference, GrGLuint mask, GrGLenum transformType, const GrGLfloat *transformValues); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathCoverDepthFuncProc)(GrGLenum zfunc); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathColorGenProc)(GrGLenum color, GrGLenum genMode, GrGLenum colorFormat, const GrGLfloat *coeffs); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathTexGenProc)(GrGLenum texCoordSet, GrGLenum genMode, GrGLint components, const GrGLfloat *coeffs); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathFogGenProc)(GrGLenum genMode); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCoverFillPathProc)(GrGLuint path, GrGLenum coverMode); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCoverStrokePathProc)(GrGLuint name, GrGLenum coverMode); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCoverFillPathInstancedProc)(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLenum coverMode, GrGLenum transformType, const GrGLfloat *transformValues); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCoverStrokePathInstancedProc)(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLenum coverMode, GrGLenum transformType, const GrGLfloat* transformValues); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetPathParameterivProc)(GrGLuint name, GrGLenum param, GrGLint *value); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetPathParameterfvProc)(GrGLuint name, GrGLenum param, GrGLfloat *value); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetPathCommandsProc)(GrGLuint name, GrGLubyte *commands); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetPathCoordsProc)(GrGLuint name, GrGLfloat *coords); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetPathDashArrayProc)(GrGLuint name, GrGLfloat *dashArray); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetPathMetricsProc)(GrGLbitfield metricQueryMask, GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLsizei stride, GrGLfloat *metrics); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetPathMetricRangeProc)(GrGLbitfield metricQueryMask, GrGLuint fistPathName, GrGLsizei numPaths, GrGLsizei stride, GrGLfloat *metrics); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetPathSpacingProc)(GrGLenum pathListMode, GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLfloat advanceScale, GrGLfloat kerningScale, GrGLenum transformType, GrGLfloat *returnedSpacing); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetPathColorGenivProc)(GrGLenum color, GrGLenum pname, GrGLint *value); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetPathColorGenfvProc)(GrGLenum color, GrGLenum pname, GrGLfloat *value); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetPathTexGenivProc)(GrGLenum texCoordSet, GrGLenum pname, GrGLint *value); - typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetPathTexGenfvProc)(GrGLenum texCoordSet, GrGLenum pname, GrGLfloat *value); - typedef GrGLboolean (GR_GL_FUNCTION_TYPE* GrGLIsPointInFillPathProc)(GrGLuint path, GrGLuint mask, GrGLfloat x, GrGLfloat y); - typedef GrGLboolean (GR_GL_FUNCTION_TYPE* GrGLIsPointInStrokePathProc)(GrGLuint path, GrGLfloat x, GrGLfloat y); - typedef GrGLfloat (GR_GL_FUNCTION_TYPE* GrGLGetPathLengthProc)(GrGLuint path, GrGLsizei startSegment, GrGLsizei numSegments); - typedef GrGLboolean (GR_GL_FUNCTION_TYPE* GrGLPointAlongPathProc)(GrGLuint path, GrGLsizei startSegment, GrGLsizei numSegments, GrGLfloat distance, GrGLfloat *x, GrGLfloat *y, GrGLfloat *tangentX, GrGLfloat *tangentY); + typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLProgramPathFragmentInputGenProc)(GrGLuint program, GrGLint location, GrGLenum genMode, GrGLint components,const GrGLfloat *coeffs); } // extern "C" #endif diff --git a/include/gpu/gl/GrGLInterface.h b/include/gpu/gl/GrGLInterface.h index 6c5ab24fdc..add7ee2567 100644 --- a/include/gpu/gl/GrGLInterface.h +++ b/include/gpu/gl/GrGLInterface.h @@ -317,55 +317,24 @@ public: // Experimental: Functions for GL_NV_path_rendering. These will be // alphabetized with the above functions once this is fully supported // (and functions we are unlikely to use will possibly be omitted). + GLPtr<GrGLGetProgramResourceLocationProc> fGetProgramResourceLocation; GLPtr<GrGLPathCommandsProc> fPathCommands; GLPtr<GrGLPathCoordsProc> fPathCoords; - GLPtr<GrGLPathSubCommandsProc> fPathSubCommands; - GLPtr<GrGLPathSubCoordsProc> fPathSubCoords; - GLPtr<GrGLPathStringProc> fPathString; - GLPtr<GrGLPathGlyphsProc> fPathGlyphs; - GLPtr<GrGLPathGlyphRangeProc> fPathGlyphRange; - GLPtr<GrGLWeightPathsProc> fWeightPaths; - GLPtr<GrGLCopyPathProc> fCopyPath; - GLPtr<GrGLInterpolatePathsProc> fInterpolatePaths; - GLPtr<GrGLTransformPathProc> fTransformPath; - GLPtr<GrGLPathParameterivProc> fPathParameteriv; GLPtr<GrGLPathParameteriProc> fPathParameteri; - GLPtr<GrGLPathParameterfvProc> fPathParameterfv; GLPtr<GrGLPathParameterfProc> fPathParameterf; - GLPtr<GrGLPathDashArrayProc> fPathDashArray; GLPtr<GrGLGenPathsProc> fGenPaths; GLPtr<GrGLDeletePathsProc> fDeletePaths; - GLPtr<GrGLIsPathProc> fIsPath; GLPtr<GrGLPathStencilFuncProc> fPathStencilFunc; - GLPtr<GrGLPathStencilDepthOffsetProc> fPathStencilDepthOffset; GLPtr<GrGLStencilFillPathProc> fStencilFillPath; GLPtr<GrGLStencilStrokePathProc> fStencilStrokePath; GLPtr<GrGLStencilFillPathInstancedProc> fStencilFillPathInstanced; GLPtr<GrGLStencilStrokePathInstancedProc> fStencilStrokePathInstanced; - GLPtr<GrGLPathCoverDepthFuncProc> fPathCoverDepthFunc; - GLPtr<GrGLPathColorGenProc> fPathColorGen; GLPtr<GrGLPathTexGenProc> fPathTexGen; - GLPtr<GrGLPathFogGenProc> fPathFogGen; GLPtr<GrGLCoverFillPathProc> fCoverFillPath; GLPtr<GrGLCoverStrokePathProc> fCoverStrokePath; GLPtr<GrGLCoverFillPathInstancedProc> fCoverFillPathInstanced; GLPtr<GrGLCoverStrokePathInstancedProc> fCoverStrokePathInstanced; - GLPtr<GrGLGetPathParameterivProc> fGetPathParameteriv; - GLPtr<GrGLGetPathParameterfvProc> fGetPathParameterfv; - GLPtr<GrGLGetPathCommandsProc> fGetPathCommands; - GLPtr<GrGLGetPathCoordsProc> fGetPathCoords; - GLPtr<GrGLGetPathDashArrayProc> fGetPathDashArray; - GLPtr<GrGLGetPathMetricsProc> fGetPathMetrics; - GLPtr<GrGLGetPathMetricRangeProc> fGetPathMetricRange; - GLPtr<GrGLGetPathSpacingProc> fGetPathSpacing; - GLPtr<GrGLGetPathColorGenivProc> fGetPathColorGeniv; - GLPtr<GrGLGetPathColorGenfvProc> fGetPathColorGenfv; - GLPtr<GrGLGetPathTexGenivProc> fGetPathTexGeniv; - GLPtr<GrGLGetPathTexGenfvProc> fGetPathTexGenfv; - GLPtr<GrGLIsPointInFillPathProc> fIsPointInFillPath; - GLPtr<GrGLIsPointInStrokePathProc> fIsPointInStrokePath; - GLPtr<GrGLGetPathLengthProc> fGetPathLength; - GLPtr<GrGLPointAlongPathProc> fPointAlongPath; + GLPtr<GrGLProgramPathFragmentInputGenProc> fProgramPathFragmentInputGen; } fFunctions; // Per-GL func callback diff --git a/src/gpu/gl/GrGLAssembleGLESInterface.h b/src/gpu/gl/GrGLAssembleGLESInterface.h index 30602c12d5..43f48c2594 100644 --- a/src/gpu/gl/GrGLAssembleGLESInterface.h +++ b/src/gpu/gl/GrGLAssembleGLESInterface.h @@ -249,6 +249,35 @@ static const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get GET_PROC(InvalidateTexImage); GET_PROC(InvalidateTexSubImage); +#if GL_ES_VERSION_3_1 + GET_LINKED(GetProgramResourceLocation); +#else + if (version >= GR_GL_VER(3,1)) { + GET_PROC(GetProgramResourceLocation); + } +#endif + + if (extensions.has("GL_NV_path_rendering")) { + GET_PROC_SUFFIX(MatrixLoadf, EXT); + GET_PROC_SUFFIX(MatrixLoadIdentity, EXT); + GET_PROC_SUFFIX(PathCommands, NV); + GET_PROC_SUFFIX(PathCoords, NV); + GET_PROC_SUFFIX(PathParameteri, NV); + GET_PROC_SUFFIX(PathParameterf, NV); + GET_PROC_SUFFIX(GenPaths, NV); + GET_PROC_SUFFIX(DeletePaths, NV); + GET_PROC_SUFFIX(PathStencilFunc, NV); + GET_PROC_SUFFIX(StencilFillPath, NV); + GET_PROC_SUFFIX(StencilStrokePath, NV); + GET_PROC_SUFFIX(StencilFillPathInstanced, NV); + GET_PROC_SUFFIX(StencilStrokePathInstanced, NV); + GET_PROC_SUFFIX(CoverFillPath, NV); + GET_PROC_SUFFIX(CoverStrokePath, NV); + GET_PROC_SUFFIX(CoverFillPathInstanced, NV); + GET_PROC_SUFFIX(CoverStrokePathInstanced, NV); + GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV); + } + interface->fStandard = kGLES_GrGLStandard; interface->fExtensions.swap(&extensions); diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp index 98dabffe13..4c02a6eb58 100644 --- a/src/gpu/gl/GrGLAssembleInterface.cpp +++ b/src/gpu/gl/GrGLAssembleInterface.cpp @@ -224,53 +224,21 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { if (extensions.has("GL_NV_path_rendering")) { GET_PROC_SUFFIX(PathCommands, NV); GET_PROC_SUFFIX(PathCoords, NV); - GET_PROC_SUFFIX(PathSubCommands, NV); - GET_PROC_SUFFIX(PathSubCoords, NV); - GET_PROC_SUFFIX(PathString, NV); - GET_PROC_SUFFIX(PathGlyphs, NV); - GET_PROC_SUFFIX(PathGlyphRange, NV); - GET_PROC_SUFFIX(WeightPaths, NV); - GET_PROC_SUFFIX(CopyPath, NV); - GET_PROC_SUFFIX(InterpolatePaths, NV); - GET_PROC_SUFFIX(TransformPath, NV); - GET_PROC_SUFFIX(PathParameteriv, NV); GET_PROC_SUFFIX(PathParameteri, NV); - GET_PROC_SUFFIX(PathParameterfv, NV); GET_PROC_SUFFIX(PathParameterf, NV); - GET_PROC_SUFFIX(PathDashArray, NV); GET_PROC_SUFFIX(GenPaths, NV); GET_PROC_SUFFIX(DeletePaths, NV); - GET_PROC_SUFFIX(IsPath, NV); GET_PROC_SUFFIX(PathStencilFunc, NV); - GET_PROC_SUFFIX(PathStencilDepthOffset, NV); GET_PROC_SUFFIX(StencilFillPath, NV); GET_PROC_SUFFIX(StencilStrokePath, NV); GET_PROC_SUFFIX(StencilFillPathInstanced, NV); GET_PROC_SUFFIX(StencilStrokePathInstanced, NV); - GET_PROC_SUFFIX(PathCoverDepthFunc, NV); - GET_PROC_SUFFIX(PathColorGen, NV); GET_PROC_SUFFIX(PathTexGen, NV); - GET_PROC_SUFFIX(PathFogGen, NV); GET_PROC_SUFFIX(CoverFillPath, NV); GET_PROC_SUFFIX(CoverStrokePath, NV); GET_PROC_SUFFIX(CoverFillPathInstanced, NV); GET_PROC_SUFFIX(CoverStrokePathInstanced, NV); - GET_PROC_SUFFIX(GetPathParameteriv, NV); - GET_PROC_SUFFIX(GetPathParameterfv, NV); - GET_PROC_SUFFIX(GetPathCommands, NV); - GET_PROC_SUFFIX(GetPathCoords, NV); - GET_PROC_SUFFIX(GetPathDashArray, NV); - GET_PROC_SUFFIX(GetPathMetrics, NV); - GET_PROC_SUFFIX(GetPathMetricRange, NV); - GET_PROC_SUFFIX(GetPathSpacing, NV); - GET_PROC_SUFFIX(GetPathColorGeniv, NV); - GET_PROC_SUFFIX(GetPathColorGenfv, NV); - GET_PROC_SUFFIX(GetPathTexGeniv, NV); - GET_PROC_SUFFIX(GetPathTexGenfv, NV); - GET_PROC_SUFFIX(IsPointInFillPath, NV); - GET_PROC_SUFFIX(IsPointInStrokePath, NV); - GET_PROC_SUFFIX(GetPathLength, NV); - GET_PROC_SUFFIX(PointAlongPath, NV); + GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV); } if (extensions.has("GL_EXT_debug_marker")) { @@ -288,6 +256,10 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { GET_PROC(InvalidateTexSubImage); } + if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_program_interface_query")) { + GET_PROC(GetProgramResourceLocation); + } + interface->fStandard = kGL_GrGLStandard; interface->fExtensions.swap(&extensions); diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 4a62c5acaa..8f2d4c1297 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -311,8 +311,27 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { // attachment, hence this min: fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize); - fPathRenderingSupport = ctxInfo.hasExtension("GL_NV_path_rendering") && - ctxInfo.hasExtension("GL_EXT_direct_state_access"); + fPathRenderingSupport = ctxInfo.hasExtension("GL_NV_path_rendering"); + + if (fPathRenderingSupport) { + if (kGL_GrGLStandard == standard) { + // We need one of the two possible texturing methods: using fixed function pipeline + // (PathTexGen, texcoords, ...) or using the newer NVPR API additions that support + // setting individual fragment inputs with ProgramPathFragmentInputGen. The API + // additions are detected by checking the existence of the function. Eventually we may + // choose to remove the fixed function codepath. + // Set fMaxFixedFunctionTextureCoords = 0 here if you want to force + // ProgramPathFragmentInputGen usage on desktop. + fPathRenderingSupport = ctxInfo.hasExtension("GL_EXT_direct_state_access") && + (fMaxFixedFunctionTextureCoords > 0 || + ((ctxInfo.version() >= GR_GL_VER(4,3) || + ctxInfo.hasExtension("GL_ARB_program_interface_query")) && + NULL != gli->fFunctions.fProgramPathFragmentInputGen)); + } else { + // Note: path rendering is not yet implemented for GLES. + fPathRenderingSupport = ctxInfo.version() >= GR_GL_VER(3,1) && false; + } + } fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker"); diff --git a/src/gpu/gl/GrGLDefines.h b/src/gpu/gl/GrGLDefines.h index e2ddde88c4..1e8d7cc278 100644 --- a/src/gpu/gl/GrGLDefines.h +++ b/src/gpu/gl/GrGLDefines.h @@ -827,19 +827,6 @@ #define GR_GL_ARC_TO 0xFE #define GR_GL_RELATIVE_ARC_TO 0xFF -// path string formats -#define GR_GL_PATH_FORMAT_SVG 0x9070 -#define GR_GL_PATH_FORMAT_PS 0x9071 - -// font targets -#define GR_GL_STANDARD_FONT_NAME 0x9072 -#define GR_GL_SYSTEM_FONT_NAME 0x9073 -#define GR_GL_FILE_NAME 0x9074 - -// handle missing glyphs -#define GR_GL_SKIP_MISSING_GLYPH 0x90A9 -#define GR_GL_USE_MISSING_GLYPH 0x90AA - // path parameters #define GR_GL_PATH_STROKE_WIDTH 0x9075 #define GR_GL_PATH_INITIAL_END_CAP 0x9077 @@ -870,10 +857,6 @@ #define GR_GL_COUNT_DOWN 0x9089 /* GL_PATH_FILL_MODE_NV */ -// path color gen -/* GL_PRIMARY_COLOR */ -#define GR_GL_SECONDARY_COLOR 0x852D - // gen mode /* GL_NONE */ /* GL_EYE_LINEAR */ @@ -897,11 +880,6 @@ #define GR_GL_TRANSPOSE_AFFINE_2D 0x9096 #define GR_GL_TRANSPOSE_AFFINE_3D 0x9098 -// path string types -#define GR_GL_UTF8 0x909A -#define GR_GL_UTF16 0x909B - -#define GR_GL_PATH_COMPUTED_LENGTH 0x90A0 // cap/dash values /* GL_FLAT */ @@ -916,60 +894,9 @@ #define GR_GL_MITER_REVERT 0x90A7 #define GR_GL_MITER_TRUNCATE 0x90A8 -// path dash reset values -#define GR_GL_MOVE_TO_RESETS 0x90B5 -#define GR_GL_MOVE_TO_CONTINUES 0x90B6 - -// font styles -/* GL_NONE */ -#define GR_GL_BOLD_BIT 0x01 -#define GR_GL_ITALIC_BIT 0x02 - -// pnames for glGet -#define GR_GL_PATH_ERROR_POSITION 0x90AB -#define GR_GL_PATH_FOG_GEN_MODE 0x90AC -#define GR_GL_PATH_STENCIL_FUNC 0x90B7 -#define GR_GL_PATH_STENCIL_REF 0x90B8 -#define GR_GL_PATH_STENCIL_VALUE_MASK 0x90B9 -#define GR_GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR 0x90BD -#define GR_GL_PATH_STENCIL_DEPTH_OFFSET_UNITS 0x90BE -#define GR_GL_PATH_COVER_DEPTH_FUNC 0x90BF - -// per-glyph metrics bits in metric mask query -#define GR_GL_GLYPH_WIDTH_BIT 0x01 -#define GR_GL_GLYPH_HEIGHT_BIT 0x02 -#define GR_GL_GLYPH_HORIZONTAL_BEARING_X_BIT 0x04 -#define GR_GL_GLYPH_HORIZONTAL_BEARING_Y_BIT 0x08 -#define GR_GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT 0x10 -#define GR_GL_GLYPH_VERTICAL_BEARING_X_BIT 0x20 -#define GR_GL_GLYPH_VERTICAL_BEARING_Y_BIT 0x40 -#define GR_GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT 0x80 -#define GR_GL_GLYPH_HAS_KERNING 0x100 - -// per-font face metrics in metric mask query -#define GR_GL_FONT_X_MIN_BOUNDS 0x00010000 -#define GR_GL_FONT_Y_MIN_BOUNDS 0x00020000 -#define GR_GL_FONT_X_MAX_BOUNDS 0x00040000 -#define GR_GL_FONT_Y_MAX_BOUNDS 0x00080000 -#define GR_GL_FONT_UNITS_PER_EM 0x00100000 -#define GR_GL_FONT_ASCENDER 0x00200000 -#define GR_GL_FONT_DESCENDER 0x00400000 -#define GR_GL_FONT_HEIGHT 0x00800000 -#define GR_GL_FONT_MAX_ADVANCE_WIDTH 0x01000000 -#define GR_GL_FONT_MAX_ADVANCE_HEIGHT 0x02000000 -#define GR_GL_FONT_UNDERLINE_POSITION 0x04000000 -#define GR_GL_FONT_UNDERLINE_THICKNESS 0x08000000 -#define GR_GL_FONT_HAS_KERNING 0x10000000 - -// path list modes (glGetPathSpacing) -#define GR_GL_ACCUM_ADJACENT_PAIRS 0x90AD -#define GR_GL_ADJACENT_PAIRS 0x90AE -#define GR_GL_FIRST_TO_REST 0x90AF - -//path gen modes -#define GR_GL_PATH_GEN_MODE 0x90B0 -#define GR_GL_PATH_GEN_COEFF 0x90B1 -#define GR_GL_PATH_GEN_COLOR_FORMAT 0x90B2 -#define GR_GL_PATH_GEN_COMPONENTS 0x90B3 +// NV_path_rendering extension to ARB_program_interface_query: +// .. corresponds to the set of active input variables used by the fragment +// shader stage of <program> (if a fragment stage exists). +#define GR_GL_FRAGMENT_INPUT 0x936D #endif diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp index b81d9ceeb8..89e23f79f1 100644 --- a/src/gpu/gl/GrGLInterface.cpp +++ b/src/gpu/gl/GrGLInterface.cpp @@ -39,57 +39,23 @@ const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) { GrGLInterface* newInterface = GrGLInterface::NewClone(interface); newInterface->fExtensions.remove("GL_NV_path_rendering"); - newInterface->fFunctions.fPathCommands = NULL; newInterface->fFunctions.fPathCoords = NULL; - newInterface->fFunctions.fPathSubCommands = NULL; - newInterface->fFunctions.fPathSubCoords = NULL; - newInterface->fFunctions.fPathString = NULL; - newInterface->fFunctions.fPathGlyphs = NULL; - newInterface->fFunctions.fPathGlyphRange = NULL; - newInterface->fFunctions.fWeightPaths = NULL; - newInterface->fFunctions.fCopyPath = NULL; - newInterface->fFunctions.fInterpolatePaths = NULL; - newInterface->fFunctions.fTransformPath = NULL; - newInterface->fFunctions.fPathParameteriv = NULL; newInterface->fFunctions.fPathParameteri = NULL; - newInterface->fFunctions.fPathParameterfv = NULL; newInterface->fFunctions.fPathParameterf = NULL; - newInterface->fFunctions.fPathDashArray = NULL; newInterface->fFunctions.fGenPaths = NULL; newInterface->fFunctions.fDeletePaths = NULL; - newInterface->fFunctions.fIsPath = NULL; newInterface->fFunctions.fPathStencilFunc = NULL; - newInterface->fFunctions.fPathStencilDepthOffset = NULL; newInterface->fFunctions.fStencilFillPath = NULL; newInterface->fFunctions.fStencilStrokePath = NULL; newInterface->fFunctions.fStencilFillPathInstanced = NULL; newInterface->fFunctions.fStencilStrokePathInstanced = NULL; - newInterface->fFunctions.fPathCoverDepthFunc = NULL; - newInterface->fFunctions.fPathColorGen = NULL; newInterface->fFunctions.fPathTexGen = NULL; - newInterface->fFunctions.fPathFogGen = NULL; newInterface->fFunctions.fCoverFillPath = NULL; newInterface->fFunctions.fCoverStrokePath = NULL; newInterface->fFunctions.fCoverFillPathInstanced = NULL; newInterface->fFunctions.fCoverStrokePathInstanced = NULL; - newInterface->fFunctions.fGetPathParameteriv = NULL; - newInterface->fFunctions.fGetPathParameterfv = NULL; - newInterface->fFunctions.fGetPathCommands = NULL; - newInterface->fFunctions.fGetPathCoords = NULL; - newInterface->fFunctions.fGetPathDashArray = NULL; - newInterface->fFunctions.fGetPathMetrics = NULL; - newInterface->fFunctions.fGetPathMetricRange = NULL; - newInterface->fFunctions.fGetPathSpacing = NULL; - newInterface->fFunctions.fGetPathColorGeniv = NULL; - newInterface->fFunctions.fGetPathColorGenfv = NULL; - newInterface->fFunctions.fGetPathTexGeniv = NULL; - newInterface->fFunctions.fGetPathTexGenfv = NULL; - newInterface->fFunctions.fIsPointInFillPath = NULL; - newInterface->fFunctions.fIsPointInStrokePath = NULL; - newInterface->fFunctions.fGetPathLength = NULL; - newInterface->fFunctions.fPointAlongPath = NULL; - + newInterface->fFunctions.fProgramPathFragmentInputGen = NULL; return newInterface; } @@ -292,65 +258,6 @@ bool GrGLInterface::validate() const { RETURN_FALSE_INTERFACE } } - if (fExtensions.has("GL_EXT_direct_state_access")) { - if (NULL == fFunctions.fMatrixLoadf || - NULL == fFunctions.fMatrixLoadIdentity) { - RETURN_FALSE_INTERFACE - } - } - if (fExtensions.has("GL_NV_path_rendering")) { - if (NULL == fFunctions.fPathCommands || - NULL == fFunctions.fPathCoords || - NULL == fFunctions.fPathSubCommands || - NULL == fFunctions.fPathSubCoords || - NULL == fFunctions.fPathString || - NULL == fFunctions.fPathGlyphs || - NULL == fFunctions.fPathGlyphRange || - NULL == fFunctions.fWeightPaths || - NULL == fFunctions.fCopyPath || - NULL == fFunctions.fInterpolatePaths || - NULL == fFunctions.fTransformPath || - NULL == fFunctions.fPathParameteriv || - NULL == fFunctions.fPathParameteri || - NULL == fFunctions.fPathParameterfv || - NULL == fFunctions.fPathParameterf || - NULL == fFunctions.fPathDashArray || - NULL == fFunctions.fGenPaths || - NULL == fFunctions.fDeletePaths || - NULL == fFunctions.fIsPath || - NULL == fFunctions.fPathStencilFunc || - NULL == fFunctions.fPathStencilDepthOffset || - NULL == fFunctions.fStencilFillPath || - NULL == fFunctions.fStencilStrokePath || - NULL == fFunctions.fStencilFillPathInstanced || - NULL == fFunctions.fStencilStrokePathInstanced || - NULL == fFunctions.fPathCoverDepthFunc || - NULL == fFunctions.fPathColorGen || - NULL == fFunctions.fPathTexGen || - NULL == fFunctions.fPathFogGen || - NULL == fFunctions.fCoverFillPath || - NULL == fFunctions.fCoverStrokePath || - NULL == fFunctions.fCoverFillPathInstanced || - NULL == fFunctions.fCoverStrokePathInstanced || - NULL == fFunctions.fGetPathParameteriv || - NULL == fFunctions.fGetPathParameterfv || - NULL == fFunctions.fGetPathCommands || - NULL == fFunctions.fGetPathCoords || - NULL == fFunctions.fGetPathDashArray || - NULL == fFunctions.fGetPathMetrics || - NULL == fFunctions.fGetPathMetricRange || - NULL == fFunctions.fGetPathSpacing || - NULL == fFunctions.fGetPathColorGeniv || - NULL == fFunctions.fGetPathColorGenfv || - NULL == fFunctions.fGetPathTexGeniv || - NULL == fFunctions.fGetPathTexGenfv || - NULL == fFunctions.fIsPointInFillPath || - NULL == fFunctions.fIsPointInStrokePath || - NULL == fFunctions.fGetPathLength || - NULL == fFunctions.fPointAlongPath) { - RETURN_FALSE_INTERFACE - } - } } // optional function on desktop before 1.3 @@ -526,5 +433,48 @@ bool GrGLInterface::validate() const { RETURN_FALSE_INTERFACE; } } + + if ((kGL_GrGLStandard == fStandard && fExtensions.has("GL_EXT_direct_state_access")) || + (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_NV_path_rendering"))) { + if (NULL == fFunctions.fMatrixLoadf || + NULL == fFunctions.fMatrixLoadIdentity) { + RETURN_FALSE_INTERFACE + } + } + + if ((kGL_GrGLStandard == fStandard && + (glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_program_interface_query"))) || + (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { + if (NULL == fFunctions.fGetProgramResourceLocation) { + RETURN_FALSE_INTERFACE + } + } + + if (fExtensions.has("GL_NV_path_rendering")) { + if (NULL == fFunctions.fPathCommands || + NULL == fFunctions.fPathCoords || + NULL == fFunctions.fPathParameteri || + NULL == fFunctions.fPathParameterf || + NULL == fFunctions.fGenPaths || + NULL == fFunctions.fDeletePaths || + NULL == fFunctions.fPathStencilFunc || + NULL == fFunctions.fStencilFillPath || + NULL == fFunctions.fStencilStrokePath || + NULL == fFunctions.fStencilFillPathInstanced || + NULL == fFunctions.fStencilStrokePathInstanced || + NULL == fFunctions.fCoverFillPath || + NULL == fFunctions.fCoverStrokePath || + NULL == fFunctions.fCoverFillPathInstanced || + NULL == fFunctions.fCoverStrokePathInstanced) { + RETURN_FALSE_INTERFACE + } + // Currently ProgramPathFragmentInputGen is not used on + // OpenGL, rather PathTexGen is. + if ((kGL_GrGLStandard == fStandard && NULL == fFunctions.fPathTexGen) || + (kGLES_GrGLStandard == fStandard && NULL == fFunctions.fProgramPathFragmentInputGen)) { + RETURN_FALSE_INTERFACE + } + } + return true; } |