Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/gpu/gl/GrGLCaps.cpp

Issue 1185573003: Import new functionality for GL4 backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix KHR_debug suffixes Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLCreateNullInterface.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "GrGLCaps.h" 9 #include "GrGLCaps.h"
10 10
(...skipping 21 matching lines...) Expand all
32 fUnpackFlipYSupport = false; 32 fUnpackFlipYSupport = false;
33 fPackRowLengthSupport = false; 33 fPackRowLengthSupport = false;
34 fPackFlipYSupport = false; 34 fPackFlipYSupport = false;
35 fTextureUsageSupport = false; 35 fTextureUsageSupport = false;
36 fTexStorageSupport = false; 36 fTexStorageSupport = false;
37 fTextureRedSupport = false; 37 fTextureRedSupport = false;
38 fImagingSupport = false; 38 fImagingSupport = false;
39 fTwoFormatLimit = false; 39 fTwoFormatLimit = false;
40 fFragCoordsConventionSupport = false; 40 fFragCoordsConventionSupport = false;
41 fVertexArrayObjectSupport = false; 41 fVertexArrayObjectSupport = false;
42 fInstancedDrawingSupport = false;
43 fDirectStateAccessSupport = false;
44 fDebugSupport = false;
42 fES2CompatibilitySupport = false; 45 fES2CompatibilitySupport = false;
43 fMultisampleDisableSupport = false; 46 fMultisampleDisableSupport = false;
44 fUseNonVBOVertexAndIndexDynamicData = false; 47 fUseNonVBOVertexAndIndexDynamicData = false;
45 fIsCoreProfile = false; 48 fIsCoreProfile = false;
46 fFullClearIsFree = false; 49 fFullClearIsFree = false;
47 50
48 fReadPixelsSupportedCache.reset(); 51 fReadPixelsSupportedCache.reset();
49 52
50 fShaderCaps.reset(SkNEW_ARGS(GrGLSLCaps, (contextOptions, 53 fShaderCaps.reset(SkNEW_ARGS(GrGLSLCaps, (contextOptions,
51 ctxInfo, glInterface, *this))); 54 ctxInfo, glInterface, *this)));
(...skipping 30 matching lines...) Expand all
82 } 85 }
83 else if (ctxInfo.hasExtension("GL_ARM_shader_framebuffer_fetch")) { 86 else if (ctxInfo.hasExtension("GL_ARM_shader_framebuffer_fetch")) {
84 // The arm extension also requires an additional flag which we will set onResetContext 87 // The arm extension also requires an additional flag which we will set onResetContext
85 glslCaps->fFBFetchNeedsCustomOutput = false; 88 glslCaps->fFBFetchNeedsCustomOutput = false;
86 glslCaps->fFBFetchSupport = true; 89 glslCaps->fFBFetchSupport = true;
87 glslCaps->fFBFetchColorName = "gl_LastFragColorARM"; 90 glslCaps->fFBFetchColorName = "gl_LastFragColorARM";
88 glslCaps->fFBFetchExtensionString = "GL_ARM_shader_framebuffer_fetch "; 91 glslCaps->fFBFetchExtensionString = "GL_ARM_shader_framebuffer_fetch ";
89 } 92 }
90 } 93 }
91 94
95 glslCaps->fBindlessTextureSupport = ctxInfo.hasExtension("GL_NV_bindless_tex ture");
96
92 // Adreno GPUs have a tendency to drop tiles when there is a divide-by-zero in a shader 97 // Adreno GPUs have a tendency to drop tiles when there is a divide-by-zero in a shader
93 glslCaps->fDropsTileOnZeroDivide = kQualcomm_GrGLVendor == ctxInfo.vendor(); 98 glslCaps->fDropsTileOnZeroDivide = kQualcomm_GrGLVendor == ctxInfo.vendor();
94 99
95 /************************************************************************** 100 /**************************************************************************
96 * Caps specific to GrGLCaps 101 * Caps specific to GrGLCaps
97 **************************************************************************/ 102 **************************************************************************/
98 103
99 if (kGLES_GrGLStandard == standard) { 104 if (kGLES_GrGLStandard == standard) {
100 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS, 105 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS,
101 &fMaxFragmentUniformVectors); 106 &fMaxFragmentUniformVectors);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 228
224 if (kGL_GrGLStandard == standard) { 229 if (kGL_GrGLStandard == standard) {
225 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || 230 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) ||
226 ctxInfo.hasExtension("GL_ARB_vertex_array_ob ject") || 231 ctxInfo.hasExtension("GL_ARB_vertex_array_ob ject") ||
227 ctxInfo.hasExtension("GL_APPLE_vertex_array_ object"); 232 ctxInfo.hasExtension("GL_APPLE_vertex_array_ object");
228 } else { 233 } else {
229 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || 234 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) ||
230 ctxInfo.hasExtension("GL_OES_vertex_array_ob ject"); 235 ctxInfo.hasExtension("GL_OES_vertex_array_ob ject");
231 } 236 }
232 237
238 if ((kGL_GrGLStandard == standard && version >= GR_GL_VER(3,2)) ||
239 (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0))) {
240 fInstancedDrawingSupport = true;
241 } else {
242 fInstancedDrawingSupport = (ctxInfo.hasExtension("GL_ARB_draw_instanced" ) ||
243 ctxInfo.hasExtension("GL_EXT_draw_instanced" )) &&
244 (ctxInfo.hasExtension("GL_ARB_instanced_array s") ||
245 ctxInfo.hasExtension("GL_EXT_instanced_array s"));
246 }
247
248 if (kGL_GrGLStandard == standard) {
249 fDirectStateAccessSupport = ctxInfo.hasExtension("GL_EXT_direct_state_ac cess");
250 } else {
251 fDirectStateAccessSupport = false;
252 }
253
254 if (kGL_GrGLStandard == standard && version >= GR_GL_VER(4,3)) {
255 fDebugSupport = true;
256 } else {
257 fDebugSupport = ctxInfo.hasExtension("GL_KHR_debug");
258 }
259
233 if (kGL_GrGLStandard == standard) { 260 if (kGL_GrGLStandard == standard) {
234 fES2CompatibilitySupport = ctxInfo.hasExtension("GL_ARB_ES2_compatibilit y"); 261 fES2CompatibilitySupport = ctxInfo.hasExtension("GL_ARB_ES2_compatibilit y");
235 } 262 }
236 else { 263 else {
237 fES2CompatibilitySupport = true; 264 fES2CompatibilitySupport = true;
238 } 265 }
239 266
240 if (kGL_GrGLStandard == standard) { 267 if (kGL_GrGLStandard == standard) {
241 fMultisampleDisableSupport = true; 268 fMultisampleDisableSupport = true;
242 } else { 269 } else {
243 fMultisampleDisableSupport = false; 270 fMultisampleDisableSupport = false;
244 } 271 }
245 272
246 /************************************************************************** 273 /**************************************************************************
247 * GrShaderCaps fields 274 * GrShaderCaps fields
248 **************************************************************************/ 275 **************************************************************************/
249 276
250 glslCaps->fPathRenderingSupport = ctxInfo.hasExtension("GL_NV_path_rendering "); 277 glslCaps->fPathRenderingSupport = ctxInfo.hasExtension("GL_NV_path_rendering ");
251 278
252 if (glslCaps->fPathRenderingSupport) { 279 if (glslCaps->fPathRenderingSupport) {
253 if (kGL_GrGLStandard == standard) { 280 if (kGL_GrGLStandard == standard) {
254 // We only support v1.3+ of GL_NV_path_rendering which allows us to 281 // We only support v1.3+ of GL_NV_path_rendering which allows us to
255 // set individual fragment inputs with ProgramPathFragmentInputGen. The API 282 // set individual fragment inputs with ProgramPathFragmentInputGen. The API
256 // additions are detected by checking the existence of the function. 283 // additions are detected by checking the existence of the function.
257 glslCaps->fPathRenderingSupport = 284 glslCaps->fPathRenderingSupport = ((ctxInfo.version() >= GR_GL_VER(4 , 3) ||
258 ctxInfo.hasExtension("GL_EXT_direct_state_access") &&
259 ((ctxInfo.version() >= GR_GL_VER(4, 3) ||
260 ctxInfo.hasExtension("GL_ARB_program_interface_query")) && 285 ctxInfo.hasExtension("GL_ARB_program_interface_query")) &&
261 gli->fFunctions.fProgramPathFragmentInputGen); 286 gli->fFunctions.fProgramPathFragmentInputGen);
262 } 287 }
263 else { 288 else {
264 glslCaps->fPathRenderingSupport = ctxInfo.version() >= GR_GL_VER(3, 1); 289 glslCaps->fPathRenderingSupport = ctxInfo.version() >= GR_GL_VER(3, 1);
265 } 290 }
266 } 291 }
267 292
268 // For now these two are equivalent but we could have dst read in shader via some other method 293 // For now these two are equivalent but we could have dst read in shader via some other method
269 glslCaps->fDstReadInShaderSupport = glslCaps->fFBFetchSupport; 294 glslCaps->fDstReadInShaderSupport = glslCaps->fFBFetchSupport;
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); 1041 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO"));
1017 1042
1018 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO" )); 1043 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO" ));
1019 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO" )); 1044 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO" ));
1020 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); 1045 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO"));
1021 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); 1046 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO"));
1022 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); 1047 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
1023 r.appendf("Fragment coord conventions support: %s\n", 1048 r.appendf("Fragment coord conventions support: %s\n",
1024 (fFragCoordsConventionSupport ? "YES": "NO")); 1049 (fFragCoordsConventionSupport ? "YES": "NO"));
1025 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); 1050 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
1051 r.appendf("Instanced drawing support: %s\n", (fInstancedDrawingSupport ? "YE S": "NO"));
1052 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ? "YES": "NO"));
1053 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO"));
1026 r.appendf("Multisample disable support: %s\n", (fMultisampleDisableSupport ? "YES" : "NO")); 1054 r.appendf("Multisample disable support: %s\n", (fMultisampleDisableSupport ? "YES" : "NO"));
1027 r.appendf("Use non-VBO for dynamic data: %s\n", 1055 r.appendf("Use non-VBO for dynamic data: %s\n",
1028 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); 1056 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
1029 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); 1057 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO "));
1030 return r; 1058 return r;
1031 } 1059 }
1032 1060
1033 //////////////////////////////////////////////////////////////////////////////// //////////// 1061 //////////////////////////////////////////////////////////////////////////////// ////////////
1034 1062
1035 GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options, 1063 GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options,
1036 const GrGLContextInfo& ctxInfo, 1064 const GrGLContextInfo& ctxInfo,
1037 const GrGLInterface* gli, 1065 const GrGLInterface* gli,
1038 const GrGLCaps& glCaps) { 1066 const GrGLCaps& glCaps) {
1039 fDropsTileOnZeroDivide = false; 1067 fDropsTileOnZeroDivide = false;
1040 fFBFetchSupport = false; 1068 fFBFetchSupport = false;
1041 fFBFetchNeedsCustomOutput = false; 1069 fFBFetchNeedsCustomOutput = false;
1070 fBindlessTextureSupport = false;
1042 fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction; 1071 fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction;
1043 fFBFetchColorName = NULL; 1072 fFBFetchColorName = NULL;
1044 fFBFetchExtensionString = NULL; 1073 fFBFetchExtensionString = NULL;
1045 } 1074 }
1046 1075
1047 SkString GrGLSLCaps::dump() const { 1076 SkString GrGLSLCaps::dump() const {
1048 SkString r = INHERITED::dump(); 1077 SkString r = INHERITED::dump();
1049 1078
1050 static const char* kAdvBlendEqInteractionStr[] = { 1079 static const char* kAdvBlendEqInteractionStr[] = {
1051 "Not Supported", 1080 "Not Supported",
1052 "Automatic", 1081 "Automatic",
1053 "General Enable", 1082 "General Enable",
1054 "Specific Enables", 1083 "Specific Enables",
1055 }; 1084 };
1056 GR_STATIC_ASSERT(0 == kNotSupported_AdvBlendEqInteraction); 1085 GR_STATIC_ASSERT(0 == kNotSupported_AdvBlendEqInteraction);
1057 GR_STATIC_ASSERT(1 == kAutomatic_AdvBlendEqInteraction); 1086 GR_STATIC_ASSERT(1 == kAutomatic_AdvBlendEqInteraction);
1058 GR_STATIC_ASSERT(2 == kGeneralEnable_AdvBlendEqInteraction); 1087 GR_STATIC_ASSERT(2 == kGeneralEnable_AdvBlendEqInteraction);
1059 GR_STATIC_ASSERT(3 == kSpecificEnables_AdvBlendEqInteraction); 1088 GR_STATIC_ASSERT(3 == kSpecificEnables_AdvBlendEqInteraction);
1060 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kAdvBlendEqInteractionStr) == kLast_AdvBlend EqInteraction + 1); 1089 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kAdvBlendEqInteractionStr) == kLast_AdvBlend EqInteraction + 1);
1061 1090
1062 r.appendf("--- GLSL-Specific ---\n"); 1091 r.appendf("--- GLSL-Specific ---\n");
1063 1092
1064 r.appendf("FB Fetch Support: %s\n", (fFBFetchSupport ? "YES" : "NO")); 1093 r.appendf("FB Fetch Support: %s\n", (fFBFetchSupport ? "YES" : "NO"));
1065 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); 1094 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO"));
1095 r.appendf("Bindless texture support: %s\n", (fBindlessTextureSupport ? "YES" : "NO"));
1066 r.appendf("Advanced blend equation interaction: %s\n", 1096 r.appendf("Advanced blend equation interaction: %s\n",
1067 kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]); 1097 kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]);
1068 return r; 1098 return r;
1069 } 1099 }
1070 1100
1071 static GrGLenum precision_to_gl_float_type(GrSLPrecision p) { 1101 static GrGLenum precision_to_gl_float_type(GrSLPrecision p) {
1072 switch (p) { 1102 switch (p) {
1073 case kLow_GrSLPrecision: 1103 case kLow_GrSLPrecision:
1074 return GR_GL_LOW_FLOAT; 1104 return GR_GL_LOW_FLOAT;
1075 case kMedium_GrSLPrecision: 1105 case kMedium_GrSLPrecision:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 if (fGeometryShaderSupport) { 1175 if (fGeometryShaderSupport) {
1146 for (int p = 0; p < kGrSLPrecisionCount; ++p) { 1176 for (int p = 0; p < kGrSLPrecisionCount; ++p) {
1147 fFloatPrecisions[kGeometry_GrShaderType][p] = fFloatPrecisions[kVert ex_GrShaderType][p]; 1177 fFloatPrecisions[kGeometry_GrShaderType][p] = fFloatPrecisions[kVert ex_GrShaderType][p];
1148 } 1178 }
1149 } 1179 }
1150 } 1180 }
1151 1181
1152 1182
1153 1183
1154 1184
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLCreateNullInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698