OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrGLProgram.h" | 8 #include "GrGLProgram.h" |
9 | 9 |
10 #include "GrAllocator.h" | 10 #include "GrAllocator.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 SkAutoMalloc log(sizeof(char)*(infoLen+1)); // outside if for debugger | 357 SkAutoMalloc log(sizeof(char)*(infoLen+1)); // outside if for debugger |
358 if (infoLen > 0) { | 358 if (infoLen > 0) { |
359 // retrieve length even though we don't need it to workaround bug in
chrome cmd buffer | 359 // retrieve length even though we don't need it to workaround bug in
chrome cmd buffer |
360 // param validation. | 360 // param validation. |
361 GrGLsizei length = GR_GL_INIT_ZERO; | 361 GrGLsizei length = GR_GL_INIT_ZERO; |
362 GR_GL_CALL(gli, GetShaderInfoLog(shader, infoLen+1, | 362 GR_GL_CALL(gli, GetShaderInfoLog(shader, infoLen+1, |
363 &length, (char*)log.get())); | 363 &length, (char*)log.get())); |
364 print_shader(stringCnt, strings, stringLengths); | 364 print_shader(stringCnt, strings, stringLengths); |
365 GrPrintf("\n%s", log.get()); | 365 GrPrintf("\n%s", log.get()); |
366 } | 366 } |
367 SkASSERT(!"Shader compilation failed!"); | 367 SkDEBUGFAIL("Shader compilation failed!"); |
368 GR_GL_CALL(gli, DeleteShader(shader)); | 368 GR_GL_CALL(gli, DeleteShader(shader)); |
369 return 0; | 369 return 0; |
370 } | 370 } |
371 return shader; | 371 return shader; |
372 } | 372 } |
373 | 373 |
374 // helper version of above for when shader is already flattened into a single Sk
String | 374 // helper version of above for when shader is already flattened into a single Sk
String |
375 GrGLuint compile_shader(const GrGLContext& gl, GrGLenum type, const SkString& sh
ader) { | 375 GrGLuint compile_shader(const GrGLContext& gl, GrGLenum type, const SkString& sh
ader) { |
376 const GrGLchar* str = shader.c_str(); | 376 const GrGLchar* str = shader.c_str(); |
377 int length = shader.size(); | 377 int length = shader.size(); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 if (infoLen > 0) { | 735 if (infoLen > 0) { |
736 // retrieve length even though we don't need it to workaround | 736 // retrieve length even though we don't need it to workaround |
737 // bug in chrome cmd buffer param validation. | 737 // bug in chrome cmd buffer param validation. |
738 GrGLsizei length = GR_GL_INIT_ZERO; | 738 GrGLsizei length = GR_GL_INIT_ZERO; |
739 GL_CALL(GetProgramInfoLog(fProgramID, | 739 GL_CALL(GetProgramInfoLog(fProgramID, |
740 infoLen+1, | 740 infoLen+1, |
741 &length, | 741 &length, |
742 (char*)log.get())); | 742 (char*)log.get())); |
743 GrPrintf((char*)log.get()); | 743 GrPrintf((char*)log.get()); |
744 } | 744 } |
745 SkASSERT(!"Error linking program"); | 745 SkDEBUGFAIL("Error linking program"); |
746 GL_CALL(DeleteProgram(fProgramID)); | 746 GL_CALL(DeleteProgram(fProgramID)); |
747 fProgramID = 0; | 747 fProgramID = 0; |
748 return false; | 748 return false; |
749 } | 749 } |
750 return true; | 750 return true; |
751 } | 751 } |
752 | 752 |
753 void GrGLProgram::initSamplerUniforms() { | 753 void GrGLProgram::initSamplerUniforms() { |
754 GL_CALL(UseProgram(fProgramID)); | 754 GL_CALL(UseProgram(fProgramID)); |
755 GrGLint texUnitIdx = 0; | 755 GrGLint texUnitIdx = 0; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 SkScalarToFloat(m[SkMatrix::kMTransX]), | 992 SkScalarToFloat(m[SkMatrix::kMTransX]), |
993 SkScalarToFloat(m[SkMatrix::kMTransY]), | 993 SkScalarToFloat(m[SkMatrix::kMTransY]), |
994 SkScalarToFloat(m[SkMatrix::kMPersp2]) | 994 SkScalarToFloat(m[SkMatrix::kMPersp2]) |
995 }; | 995 }; |
996 fUniformManager.setMatrix3f(fUniformHandles.fViewMatrixUni, mt); | 996 fUniformManager.setMatrix3f(fUniformHandles.fViewMatrixUni, mt); |
997 fMatrixState.fViewMatrix = drawState.getViewMatrix(); | 997 fMatrixState.fViewMatrix = drawState.getViewMatrix(); |
998 fMatrixState.fRenderTargetSize = size; | 998 fMatrixState.fRenderTargetSize = size; |
999 fMatrixState.fRenderTargetOrigin = rt->origin(); | 999 fMatrixState.fRenderTargetOrigin = rt->origin(); |
1000 } | 1000 } |
1001 } | 1001 } |
OLD | NEW |