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

Unified Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 163913007: Implement support for CHROMIUM_NV_path_rendering pseudo extension (Closed) Base URL: https://skia.googlesource.com/skia.git@nv-pr-00-use-attribs
Patch Set: rebase Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.h ('k') | src/gpu/gl/GrGpuGL_program.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLShaderBuilder.cpp
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index b72e23f9ba20b10879c70b6c48c52324ec288cf7..437f6147e4d148ba7b4268e14375b6549ad632de 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -186,6 +186,15 @@ bool GrGLShaderBuilder::enableFeature(GLSLFeature feature) {
"GL_OES_standard_derivatives");
}
return true;
+ case kTexCoordSupport_GLSLFeature:
+ if (!fGpu->glCaps().pathRenderingSupport()) {
+ return false;
+ }
+ if (kGLES_GrGLStandard == fGpu->glStandard()) {
+ this->addFSFeature(1 << kTexCoordSupport_GLSLFeature,
+ "GL_CHROMIUM_path_rendering");
+ }
+ return true;
default:
GrCrash("Unexpected GLSLFeature requested.");
return false;
@@ -976,6 +985,7 @@ GrGLFragmentOnlyShaderBuilder::GrGLFragmentOnlyShaderBuilder(GrGpuGL* gpu,
}
int GrGLFragmentOnlyShaderBuilder::addTexCoordSets(int count) {
+ SkAssertResult(this->enableFeature(kTexCoordSupport_GLSLFeature));
int firstFreeCoordSet = fNumTexCoordSets;
fNumTexCoordSets += count;
SkASSERT(gpu()->glCaps().maxFixedFunctionTextureCoords() >= fNumTexCoordSets);
@@ -997,3 +1007,21 @@ GrGLProgramEffects* GrGLFragmentOnlyShaderBuilder::createAndEmitEffects(
inOutFSColor);
return pathTexGenEffectsBuilder.finish();
}
+
+bool GrGLFragmentOnlyShaderBuilder::compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shaderIds) const {
+ // Command buffer does not support vertexshader-less programs.
+ // Use a dummy shader.
+ const GrGLContext& glCtx = this->gpu()->glContext();
+ SkString vertShaderSrc(GrGetGLSLVersionDecl(this->ctxInfo()));
+ vertShaderSrc.append("void main() {\n");
+ vertShaderSrc.append("gl_Position = vec4(1);");
+ vertShaderSrc.append("}\n");
+ GrGLuint vertShaderId = attach_shader(glCtx, programId, GR_GL_VERTEX_SHADER, vertShaderSrc);
+ if (!vertShaderId) {
+ return false;
+ }
+ *shaderIds->append() = vertShaderId;
+
+ return this->INHERITED::compileAndAttachShaders(programId, shaderIds);
+}
+
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.h ('k') | src/gpu/gl/GrGpuGL_program.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698