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

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

Issue 2288033003: Turned on SkSL->GLSL compiler (Closed)
Patch Set: changed <iostream> to <ostream> Created 4 years, 2 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/GrGLContext.cpp ('k') | src/gpu/gl/builders/GrGLShaderStringBuilder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 575570246325c4ddad2100d710693c5436451758..8c0373ac283d61413721faa9d26d4e538701eb23 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -3790,20 +3790,11 @@ bool GrGLGpu::createCopyProgram(int progIdx) {
fshaderTxt.append(";");
uTexture.appendDecl(glslCaps, &fshaderTxt);
fshaderTxt.append(";");
- const char* fsOutName;
- if (glslCaps->mustDeclareFragmentShaderOutput()) {
- oFragColor.appendDecl(glslCaps, &fshaderTxt);
- fshaderTxt.append(";");
- fsOutName = oFragColor.c_str();
- } else {
- fsOutName = "gl_FragColor";
- }
fshaderTxt.appendf(
"// Copy Program FS\n"
"void main() {"
- " %s = %s(u_texture, v_texCoord);"
+ " sk_FragColor = %s(u_texture, v_texCoord);"
"}",
- fsOutName,
GrGLSLTexture2DFunctionName(kVec2f_GrSLType, kSamplerTypes[progIdx], this->glslGeneration())
);
@@ -3936,14 +3927,6 @@ bool GrGLGpu::createMipmapProgram(int progIdx) {
}
uTexture.appendDecl(glslCaps, &fshaderTxt);
fshaderTxt.append(";");
- const char* fsOutName;
- if (glslCaps->mustDeclareFragmentShaderOutput()) {
- oFragColor.appendDecl(glslCaps, &fshaderTxt);
- fshaderTxt.append(";");
- fsOutName = oFragColor.c_str();
- } else {
- fsOutName = "gl_FragColor";
- }
const char* sampleFunction = GrGLSLTexture2DFunctionName(kVec2f_GrSLType,
kTexture2DSampler_GrSLType,
this->glslGeneration());
@@ -3954,19 +3937,19 @@ bool GrGLGpu::createMipmapProgram(int progIdx) {
if (oddWidth && oddHeight) {
fshaderTxt.appendf(
- " %s = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texCoord1) + "
- " %s(u_texture, v_texCoord2) + %s(u_texture, v_texCoord3)) * 0.25;",
- fsOutName, sampleFunction, sampleFunction, sampleFunction, sampleFunction
+ " sk_FragColor = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texCoord1) + "
+ " %s(u_texture, v_texCoord2) + %s(u_texture, v_texCoord3)) * 0.25;",
+ sampleFunction, sampleFunction, sampleFunction, sampleFunction
);
} else if (oddWidth || oddHeight) {
fshaderTxt.appendf(
- " %s = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texCoord1)) * 0.5;",
- fsOutName, sampleFunction, sampleFunction
+ " sk_FragColor = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texCoord1)) * 0.5;",
+ sampleFunction, sampleFunction
);
} else {
fshaderTxt.appendf(
- " %s = %s(u_texture, v_texCoord0);",
- fsOutName, sampleFunction
+ " sk_FragColor = %s(u_texture, v_texCoord0);",
+ sampleFunction
);
}
@@ -4053,20 +4036,11 @@ bool GrGLGpu::createWireRectProgram() {
&fshaderTxt);
uColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
fshaderTxt.append(";");
- const char* fsOutName;
- if (this->glCaps().glslCaps()->mustDeclareFragmentShaderOutput()) {
- oFragColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
- fshaderTxt.append(";");
- fsOutName = oFragColor.c_str();
- } else {
- fsOutName = "gl_FragColor";
- }
fshaderTxt.appendf(
"// Write Rect Program FS\n"
"void main() {"
- " %s = %s;"
+ " sk_FragColor = %s;"
"}",
- fsOutName,
uColor.c_str()
);
« no previous file with comments | « src/gpu/gl/GrGLContext.cpp ('k') | src/gpu/gl/builders/GrGLShaderStringBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698