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 "GrGLGpu.h" | 8 #include "GrGLGpu.h" |
9 #include "GrGLBuffer.h" | 9 #include "GrGLBuffer.h" |
10 #include "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
(...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 GL_CALL(Enable(GR_GL_SAMPLE_SHADING)); | 2047 GL_CALL(Enable(GR_GL_SAMPLE_SHADING)); |
2048 GL_CALL(MinSampleShading(minSampleShading)); | 2048 GL_CALL(MinSampleShading(minSampleShading)); |
2049 } | 2049 } |
2050 else { | 2050 else { |
2051 GL_CALL(Disable(GR_GL_SAMPLE_SHADING)); | 2051 GL_CALL(Disable(GR_GL_SAMPLE_SHADING)); |
2052 } | 2052 } |
2053 fHWMinSampleShading = minSampleShading; | 2053 fHWMinSampleShading = minSampleShading; |
2054 } | 2054 } |
2055 } | 2055 } |
2056 | 2056 |
2057 bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcesso
r& primProc) { | 2057 bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcesso
r& primProc, |
2058 SkAutoTUnref<GrGLProgram> program(fProgramCache->refProgram(this, pipeline,
primProc)); | 2058 bool willDrawPoints) { |
| 2059 SkAutoTUnref<GrGLProgram> program(fProgramCache->refProgram(this, pipeline,
primProc, |
| 2060 willDrawPoints))
; |
2059 if (!program) { | 2061 if (!program) { |
2060 GrCapsDebugf(this->caps(), "Failed to create program!\n"); | 2062 GrCapsDebugf(this->caps(), "Failed to create program!\n"); |
2061 return false; | 2063 return false; |
2062 } | 2064 } |
2063 | 2065 |
2064 program->generateMipmaps(primProc, pipeline); | 2066 program->generateMipmaps(primProc, pipeline); |
2065 | 2067 |
2066 GrXferProcessor::BlendInfo blendInfo; | 2068 GrXferProcessor::BlendInfo blendInfo; |
2067 pipeline.getXferProcessor().getBlendInfo(&blendInfo); | 2069 pipeline.getXferProcessor().getBlendInfo(&blendInfo); |
2068 | 2070 |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2736 SwapBuffers(GetDC(hwnd)); | 2738 SwapBuffers(GetDC(hwnd)); |
2737 } | 2739 } |
2738 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT); | 2740 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT); |
2739 } | 2741 } |
2740 } | 2742 } |
2741 #endif | 2743 #endif |
2742 #endif | 2744 #endif |
2743 | 2745 |
2744 void GrGLGpu::draw(const GrPipeline& pipeline, | 2746 void GrGLGpu::draw(const GrPipeline& pipeline, |
2745 const GrPrimitiveProcessor& primProc, | 2747 const GrPrimitiveProcessor& primProc, |
2746 const GrMesh* meshes, | 2748 const GrMesh meshes[], |
2747 int meshCount) { | 2749 int meshCount) { |
2748 this->handleDirtyContext(); | 2750 this->handleDirtyContext(); |
2749 | 2751 |
2750 if (!this->flushGLState(pipeline, primProc)) { | 2752 bool hasPoints = false; |
| 2753 for (int i = 0; i < meshCount; ++i) { |
| 2754 if (meshes[i].primitiveType() == kPoints_GrPrimitiveType) { |
| 2755 hasPoints = true; |
| 2756 break; |
| 2757 } |
| 2758 } |
| 2759 if (!this->flushGLState(pipeline, primProc, hasPoints)) { |
2751 return; | 2760 return; |
2752 } | 2761 } |
2753 GrPixelLocalStorageState plsState = primProc.getPixelLocalStorageState(); | 2762 GrPixelLocalStorageState plsState = primProc.getPixelLocalStorageState(); |
2754 if (!fHWPLSEnabled && plsState != | 2763 if (!fHWPLSEnabled && plsState != |
2755 GrPixelLocalStorageState::kDisabled_GrPixelLocalStorageState) { | 2764 GrPixelLocalStorageState::kDisabled_GrPixelLocalStorageState) { |
2756 GL_CALL(Enable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); | 2765 GL_CALL(Enable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); |
2757 this->setupPixelLocalStorage(pipeline, primProc); | 2766 this->setupPixelLocalStorage(pipeline, primProc); |
2758 fHWPLSEnabled = true; | 2767 fHWPLSEnabled = true; |
2759 } | 2768 } |
2760 if (plsState == GrPixelLocalStorageState::kFinish_GrPixelLocalStorageState)
{ | 2769 if (plsState == GrPixelLocalStorageState::kFinish_GrPixelLocalStorageState)
{ |
(...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4678 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4687 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
4679 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4688 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
4680 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4689 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
4681 copyParams->fWidth = texture->width(); | 4690 copyParams->fWidth = texture->width(); |
4682 copyParams->fHeight = texture->height(); | 4691 copyParams->fHeight = texture->height(); |
4683 return true; | 4692 return true; |
4684 } | 4693 } |
4685 } | 4694 } |
4686 return false; | 4695 return false; |
4687 } | 4696 } |
OLD | NEW |