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

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

Issue 791713002: Don't call GetShaderPrecisionFormat for geometry shaders. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: doh Created 6 years 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 | « no previous file | no next file » | 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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 return GR_GL_FRAGMENT_SHADER; 799 return GR_GL_FRAGMENT_SHADER;
800 } 800 }
801 SkFAIL("Unknown shader type."); 801 SkFAIL("Unknown shader type.");
802 return -1; 802 return -1;
803 } 803 }
804 804
805 void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, const Gr GLInterface* intf) { 805 void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, const Gr GLInterface* intf) {
806 if (kGLES_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_V ER(4,1) || 806 if (kGLES_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_V ER(4,1) ||
807 ctxInfo.hasExtension("GL_ARB_ES2_compatibility")) { 807 ctxInfo.hasExtension("GL_ARB_ES2_compatibility")) {
808 for (int s = 0; s < kGrShaderTypeCount; ++s) { 808 for (int s = 0; s < kGrShaderTypeCount; ++s) {
809 if (kGeometry_GrShaderType != s || fGeometryShaderSupport) { 809 if (kGeometry_GrShaderType != s) {
810 GrShaderType shaderType = static_cast<GrShaderType>(s); 810 GrShaderType shaderType = static_cast<GrShaderType>(s);
811 GrGLenum glShader = shader_type_to_gl_shader(shaderType); 811 GrGLenum glShader = shader_type_to_gl_shader(shaderType);
812 PrecisionInfo* first = NULL; 812 PrecisionInfo* first = NULL;
813 fShaderPrecisionVaries = false; 813 fShaderPrecisionVaries = false;
814 for (int p = 0; p < kGrSLPrecisionCount; ++p) { 814 for (int p = 0; p < kGrSLPrecisionCount; ++p) {
815 GrSLPrecision precision = static_cast<GrSLPrecision>(p); 815 GrSLPrecision precision = static_cast<GrSLPrecision>(p);
816 GrGLenum glPrecision = precision_to_gl_float_type(precision) ; 816 GrGLenum glPrecision = precision_to_gl_float_type(precision) ;
817 GrGLint range[2]; 817 GrGLint range[2];
818 GrGLint bits; 818 GrGLint bits;
819 GR_GL_GetShaderPrecisionFormat(intf, glShader, glPrecision, range, &bits); 819 GR_GL_GetShaderPrecisionFormat(intf, glShader, glPrecision, range, &bits);
820 if (bits) { 820 if (bits) {
821 fFloatPrecisions[s][p].fLogRangeLow = range[0]; 821 fFloatPrecisions[s][p].fLogRangeLow = range[0];
822 fFloatPrecisions[s][p].fLogRangeHigh = range[1]; 822 fFloatPrecisions[s][p].fLogRangeHigh = range[1];
823 fFloatPrecisions[s][p].fBits = bits; 823 fFloatPrecisions[s][p].fBits = bits;
824 if (!first) { 824 if (!first) {
825 first = &fFloatPrecisions[s][p]; 825 first = &fFloatPrecisions[s][p];
826 } else if (!fShaderPrecisionVaries) { 826 } else if (!fShaderPrecisionVaries) {
827 fShaderPrecisionVaries = (*first != fFloatPrecisions [s][p]); 827 fShaderPrecisionVaries = (*first != fFloatPrecisions [s][p]);
828 } 828 }
829 } 829 }
830 } 830 }
831 } 831 }
832 } 832 }
833 } else { 833 } else {
834 // We're on a desktop GL that doesn't have precision info. Assume they'r e all 32bit float. 834 // We're on a desktop GL that doesn't have precision info. Assume they'r e all 32bit float.
835 fShaderPrecisionVaries = false; 835 fShaderPrecisionVaries = false;
836 for (int s = 0; s < kGrShaderTypeCount; ++s) { 836 for (int s = 0; s < kGrShaderTypeCount; ++s) {
837 if (kGeometry_GrShaderType != s || fGeometryShaderSupport) { 837 if (kGeometry_GrShaderType != s) {
838 for (int p = 0; p < kGrSLPrecisionCount; ++p) { 838 for (int p = 0; p < kGrSLPrecisionCount; ++p) {
839 fFloatPrecisions[s][p].fLogRangeLow = 127; 839 fFloatPrecisions[s][p].fLogRangeLow = 127;
840 fFloatPrecisions[s][p].fLogRangeHigh = 127; 840 fFloatPrecisions[s][p].fLogRangeHigh = 127;
841 fFloatPrecisions[s][p].fBits = 23; 841 fFloatPrecisions[s][p].fBits = 23;
842 } 842 }
843 } 843 }
844 } 844 }
845 } 845 }
846 // GetShaderPrecisionFormat doesn't accept GL_GEOMETRY_SHADER as a shader ty pe. Assume they're
847 // the same as the vertex shader. Only fragment shaders were ever allowed to omit support for
848 // highp. GS was added after GetShaderPrecisionFormat was added to the list of features that
849 // are recommended against.
850 if (fGeometryShaderSupport) {
851 for (int p = 0; p < kGrSLPrecisionCount; ++p) {
852 fFloatPrecisions[kGeometry_GrShaderType][p] = fFloatPrecisions[kVert ex_GrShaderType][p];
853 }
854 }
846 } 855 }
847 856
848 857
849 void GrGLCaps::markColorConfigAndStencilFormatAsVerified( 858 void GrGLCaps::markColorConfigAndStencilFormatAsVerified(
850 GrPixelConfig config, 859 GrPixelConfig config,
851 const GrGLStencilBuffer::Format& format) { 860 const GrGLStencilBuffer::Format& format) {
852 #if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT 861 #if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT
853 return; 862 return;
854 #endif 863 #endif
855 SkASSERT((unsigned)config < (unsigned)kGrPixelConfigCnt); 864 SkASSERT((unsigned)config < (unsigned)kGrPixelConfigCnt);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); 978 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
970 r.appendf("Fragment coord conventions support: %s\n", 979 r.appendf("Fragment coord conventions support: %s\n",
971 (fFragCoordsConventionSupport ? "YES": "NO")); 980 (fFragCoordsConventionSupport ? "YES": "NO"));
972 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); 981 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
973 r.appendf("Use non-VBO for dynamic data: %s\n", 982 r.appendf("Use non-VBO for dynamic data: %s\n",
974 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); 983 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
975 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); 984 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO "));
976 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); 985 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO"));
977 return r; 986 return r;
978 } 987 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698