OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "GrGLShaderStringBuilder.h" | 8 #include "GrGLShaderStringBuilder.h" |
9 #include "gl/GrGLGpu.h" | 9 #include "gl/GrGLGpu.h" |
10 #include "gl/GrGLSLPrettyPrint.h" | 10 #include "gl/GrGLSLPrettyPrint.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 if (traceShader) { | 47 if (traceShader) { |
48 SkString shader = GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths, c
ount, false); | 48 SkString shader = GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths, c
ount, false); |
49 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "skia_gpu::G
LShader", | 49 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "skia_gpu::G
LShader", |
50 TRACE_EVENT_SCOPE_THREAD, "shader", TRACE_STR_COPY(
shader.c_str())); | 50 TRACE_EVENT_SCOPE_THREAD, "shader", TRACE_STR_COPY(
shader.c_str())); |
51 } | 51 } |
52 | 52 |
53 stats->incShaderCompilations(); | 53 stats->incShaderCompilations(); |
54 GR_GL_CALL(gli, CompileShader(shaderId)); | 54 GR_GL_CALL(gli, CompileShader(shaderId)); |
55 | 55 |
56 // Calling GetShaderiv in Chromium is quite expensive. Assume success in rel
ease builds. | 56 // Calling GetShaderiv in Chromium is quite expensive. Assume success in rel
ease builds. |
57 bool checkCompiled = !glCtx.isChromium(); | 57 bool checkCompiled = kChromium_GrGLDriver != glCtx.driver(); |
58 #ifdef SK_DEBUG | 58 #ifdef SK_DEBUG |
59 checkCompiled = true; | 59 checkCompiled = true; |
60 #endif | 60 #endif |
61 if (checkCompiled) { | 61 if (checkCompiled) { |
62 GrGLint compiled = GR_GL_INIT_ZERO; | 62 GrGLint compiled = GR_GL_INIT_ZERO; |
63 GR_GL_CALL(gli, GetShaderiv(shaderId, GR_GL_COMPILE_STATUS, &compiled)); | 63 GR_GL_CALL(gli, GetShaderiv(shaderId, GR_GL_COMPILE_STATUS, &compiled)); |
64 | 64 |
65 if (!compiled) { | 65 if (!compiled) { |
66 GrGLint infoLen = GR_GL_INIT_ZERO; | 66 GrGLint infoLen = GR_GL_INIT_ZERO; |
67 GR_GL_CALL(gli, GetShaderiv(shaderId, GR_GL_INFO_LOG_LENGTH, &infoLe
n)); | 67 GR_GL_CALL(gli, GetShaderiv(shaderId, GR_GL_INFO_LOG_LENGTH, &infoLe
n)); |
(...skipping 18 matching lines...) Expand all Loading... |
86 } | 86 } |
87 | 87 |
88 // Attach the shader, but defer deletion until after we have linked the prog
ram. | 88 // Attach the shader, but defer deletion until after we have linked the prog
ram. |
89 // This works around a bug in the Android emulator's GLES2 wrapper which | 89 // This works around a bug in the Android emulator's GLES2 wrapper which |
90 // will immediately delete the shader object and free its memory even though
it's | 90 // will immediately delete the shader object and free its memory even though
it's |
91 // attached to a program, which then causes glLinkProgram to fail. | 91 // attached to a program, which then causes glLinkProgram to fail. |
92 GR_GL_CALL(gli, AttachShader(programId, shaderId)); | 92 GR_GL_CALL(gli, AttachShader(programId, shaderId)); |
93 | 93 |
94 return shaderId; | 94 return shaderId; |
95 } | 95 } |
OLD | NEW |