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 | 8 |
9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1897 GR_GL_CALL(gl, StencilMask(writeMask)); | 1897 GR_GL_CALL(gl, StencilMask(writeMask)); |
1898 GR_GL_CALL(gl, StencilOp(glFailOp, glPassOp, glPassOp)); | 1898 GR_GL_CALL(gl, StencilOp(glFailOp, glPassOp, glPassOp)); |
1899 } else { | 1899 } else { |
1900 GR_GL_CALL(gl, StencilFuncSeparate(glFace, glFunc, ref, mask)); | 1900 GR_GL_CALL(gl, StencilFuncSeparate(glFace, glFunc, ref, mask)); |
1901 GR_GL_CALL(gl, StencilMaskSeparate(glFace, writeMask)); | 1901 GR_GL_CALL(gl, StencilMaskSeparate(glFace, writeMask)); |
1902 GR_GL_CALL(gl, StencilOpSeparate(glFace, glFailOp, glPassOp, glPassOp)); | 1902 GR_GL_CALL(gl, StencilOpSeparate(glFace, glFailOp, glPassOp, glPassOp)); |
1903 } | 1903 } |
1904 } | 1904 } |
1905 } | 1905 } |
1906 | 1906 |
1907 void GrGpuGL::flushStencil(DrawType type) { | 1907 void GrGpuGL::flushStencil(const GrStencilSettings& stencilSettings, DrawType ty
pe) { |
1908 if (kStencilPath_DrawType != type && fHWStencilSettings != fStencilSettings)
{ | 1908 if (kStencilPath_DrawType != type && fHWStencilSettings != stencilSettings)
{ |
1909 if (fStencilSettings.isDisabled()) { | 1909 if (stencilSettings.isDisabled()) { |
1910 if (kNo_TriState != fHWStencilTestEnabled) { | 1910 if (kNo_TriState != fHWStencilTestEnabled) { |
1911 GL_CALL(Disable(GR_GL_STENCIL_TEST)); | 1911 GL_CALL(Disable(GR_GL_STENCIL_TEST)); |
1912 fHWStencilTestEnabled = kNo_TriState; | 1912 fHWStencilTestEnabled = kNo_TriState; |
1913 } | 1913 } |
1914 } else { | 1914 } else { |
1915 if (kYes_TriState != fHWStencilTestEnabled) { | 1915 if (kYes_TriState != fHWStencilTestEnabled) { |
1916 GL_CALL(Enable(GR_GL_STENCIL_TEST)); | 1916 GL_CALL(Enable(GR_GL_STENCIL_TEST)); |
1917 fHWStencilTestEnabled = kYes_TriState; | 1917 fHWStencilTestEnabled = kYes_TriState; |
1918 } | 1918 } |
1919 } | 1919 } |
1920 if (!fStencilSettings.isDisabled()) { | 1920 if (!stencilSettings.isDisabled()) { |
1921 if (this->caps()->twoSidedStencilSupport()) { | 1921 if (this->caps()->twoSidedStencilSupport()) { |
1922 set_gl_stencil(this->glInterface(), | 1922 set_gl_stencil(this->glInterface(), |
1923 fStencilSettings, | 1923 stencilSettings, |
1924 GR_GL_FRONT, | 1924 GR_GL_FRONT, |
1925 GrStencilSettings::kFront_Face); | 1925 GrStencilSettings::kFront_Face); |
1926 set_gl_stencil(this->glInterface(), | 1926 set_gl_stencil(this->glInterface(), |
1927 fStencilSettings, | 1927 stencilSettings, |
1928 GR_GL_BACK, | 1928 GR_GL_BACK, |
1929 GrStencilSettings::kBack_Face); | 1929 GrStencilSettings::kBack_Face); |
1930 } else { | 1930 } else { |
1931 set_gl_stencil(this->glInterface(), | 1931 set_gl_stencil(this->glInterface(), |
1932 fStencilSettings, | 1932 stencilSettings, |
1933 GR_GL_FRONT_AND_BACK, | 1933 GR_GL_FRONT_AND_BACK, |
1934 GrStencilSettings::kFront_Face); | 1934 GrStencilSettings::kFront_Face); |
1935 } | 1935 } |
1936 } | 1936 } |
1937 fHWStencilSettings = fStencilSettings; | 1937 fHWStencilSettings = stencilSettings; |
1938 } | 1938 } |
1939 } | 1939 } |
1940 | 1940 |
1941 void GrGpuGL::flushAAState(const GrOptDrawState& optState, DrawType type) { | 1941 void GrGpuGL::flushAAState(const GrOptDrawState& optState, DrawType type) { |
1942 // At least some ATI linux drivers will render GL_LINES incorrectly when MSAA st
ate is enabled but | 1942 // At least some ATI linux drivers will render GL_LINES incorrectly when MSAA st
ate is enabled but |
1943 // the target is not multisampled. Single pixel wide lines are rendered thicker
than 1 pixel wide. | 1943 // the target is not multisampled. Single pixel wide lines are rendered thicker
than 1 pixel wide. |
1944 #if 0 | 1944 #if 0 |
1945 // Replace RT_HAS_MSAA with this definition once this driver bug is no longe
r a relevant concern | 1945 // Replace RT_HAS_MSAA with this definition once this driver bug is no longe
r a relevant concern |
1946 #define RT_HAS_MSAA rt->isMultisampled() | 1946 #define RT_HAS_MSAA rt->isMultisampled() |
1947 #else | 1947 #else |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2610 this->setVertexArrayID(gpu, 0); | 2610 this->setVertexArrayID(gpu, 0); |
2611 } | 2611 } |
2612 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2612 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2613 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2613 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2614 fDefaultVertexArrayAttribState.resize(attrCount); | 2614 fDefaultVertexArrayAttribState.resize(attrCount); |
2615 } | 2615 } |
2616 attribState = &fDefaultVertexArrayAttribState; | 2616 attribState = &fDefaultVertexArrayAttribState; |
2617 } | 2617 } |
2618 return attribState; | 2618 return attribState; |
2619 } | 2619 } |
OLD | NEW |