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 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1927 fStencilSettings, | 1927 fStencilSettings, |
1928 GR_GL_FRONT_AND_BACK, | 1928 GR_GL_FRONT_AND_BACK, |
1929 GrStencilSettings::kFront_Face); | 1929 GrStencilSettings::kFront_Face); |
1930 } | 1930 } |
1931 } | 1931 } |
1932 fHWStencilSettings = fStencilSettings; | 1932 fHWStencilSettings = fStencilSettings; |
1933 } | 1933 } |
1934 } | 1934 } |
1935 | 1935 |
1936 void GrGpuGL::flushAAState(DrawType type) { | 1936 void GrGpuGL::flushAAState(DrawType type) { |
1937 // At least some ATI linux drivers will render GL_LINES incorrectly when MSAA st ate is enabled but | |
1938 // the target is not multisampled. Single pixel wide lines are rendered thicker than 1 pixel wide. | |
robertphillips
2013/03/19 18:56:05
I think if we leave the #if 0 code we should have
bsalomon
2013/03/19 18:56:46
Will add a comment
| |
1939 #if 0 | |
1940 #define RT_HAS_MSAA rt->isMultisampled() | |
1941 #else | |
1942 #define RT_HAS_MSAA (rt->isMultisampled() || kDrawLines_DrawType == type) | |
1943 #endif | |
1944 | |
1937 const GrRenderTarget* rt = this->getDrawState().getRenderTarget(); | 1945 const GrRenderTarget* rt = this->getDrawState().getRenderTarget(); |
1938 if (kDesktop_GrGLBinding == this->glBinding()) { | 1946 if (kDesktop_GrGLBinding == this->glBinding()) { |
1939 // ES doesn't support toggling GL_MULTISAMPLE and doesn't have | 1947 // ES doesn't support toggling GL_MULTISAMPLE and doesn't have |
1940 // smooth lines. | 1948 // smooth lines. |
1941 // we prefer smooth lines over multisampled lines | 1949 // we prefer smooth lines over multisampled lines |
1942 bool smoothLines = false; | 1950 bool smoothLines = false; |
1943 | 1951 |
1944 if (kDrawLines_DrawType == type) { | 1952 if (kDrawLines_DrawType == type) { |
1945 smoothLines = this->willUseHWAALines(); | 1953 smoothLines = this->willUseHWAALines(); |
1946 if (smoothLines) { | 1954 if (smoothLines) { |
1947 if (kYes_TriState != fHWAAState.fSmoothLineEnabled) { | 1955 if (kYes_TriState != fHWAAState.fSmoothLineEnabled) { |
1948 GL_CALL(Enable(GR_GL_LINE_SMOOTH)); | 1956 GL_CALL(Enable(GR_GL_LINE_SMOOTH)); |
1949 fHWAAState.fSmoothLineEnabled = kYes_TriState; | 1957 fHWAAState.fSmoothLineEnabled = kYes_TriState; |
1950 // must disable msaa to use line smoothing | 1958 // must disable msaa to use line smoothing |
1951 if (rt->isMultisampled() && | 1959 if (RT_HAS_MSAA && |
1952 kNo_TriState != fHWAAState.fMSAAEnabled) { | 1960 kNo_TriState != fHWAAState.fMSAAEnabled) { |
1953 GL_CALL(Disable(GR_GL_MULTISAMPLE)); | 1961 GL_CALL(Disable(GR_GL_MULTISAMPLE)); |
1954 fHWAAState.fMSAAEnabled = kNo_TriState; | 1962 fHWAAState.fMSAAEnabled = kNo_TriState; |
1955 } | 1963 } |
1956 } | 1964 } |
1957 } else { | 1965 } else { |
1958 if (kNo_TriState != fHWAAState.fSmoothLineEnabled) { | 1966 if (kNo_TriState != fHWAAState.fSmoothLineEnabled) { |
1959 GL_CALL(Disable(GR_GL_LINE_SMOOTH)); | 1967 GL_CALL(Disable(GR_GL_LINE_SMOOTH)); |
1960 fHWAAState.fSmoothLineEnabled = kNo_TriState; | 1968 fHWAAState.fSmoothLineEnabled = kNo_TriState; |
1961 } | 1969 } |
1962 } | 1970 } |
1963 } | 1971 } |
1964 if (!smoothLines && rt->isMultisampled()) { | 1972 if (!smoothLines && RT_HAS_MSAA) { |
1965 // FIXME: GL_NV_pr doesn't seem to like MSAA disabled. The paths | 1973 // FIXME: GL_NV_pr doesn't seem to like MSAA disabled. The paths |
1966 // convex hulls of each segment appear to get filled. | 1974 // convex hulls of each segment appear to get filled. |
1967 bool enableMSAA = kStencilPath_DrawType == type || | 1975 bool enableMSAA = kStencilPath_DrawType == type || |
1968 this->getDrawState().isHWAntialiasState(); | 1976 this->getDrawState().isHWAntialiasState(); |
1969 if (enableMSAA) { | 1977 if (enableMSAA) { |
1970 if (kYes_TriState != fHWAAState.fMSAAEnabled) { | 1978 if (kYes_TriState != fHWAAState.fMSAAEnabled) { |
1971 GL_CALL(Enable(GR_GL_MULTISAMPLE)); | 1979 GL_CALL(Enable(GR_GL_MULTISAMPLE)); |
1972 fHWAAState.fMSAAEnabled = kYes_TriState; | 1980 fHWAAState.fMSAAEnabled = kYes_TriState; |
1973 } | 1981 } |
1974 } else { | 1982 } else { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2333 this->setVertexArrayID(gpu, 0); | 2341 this->setVertexArrayID(gpu, 0); |
2334 } | 2342 } |
2335 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2343 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2336 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2344 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2337 fDefaultVertexArrayAttribState.resize(attrCount); | 2345 fDefaultVertexArrayAttribState.resize(attrCount); |
2338 } | 2346 } |
2339 attribState = &fDefaultVertexArrayAttribState; | 2347 attribState = &fDefaultVertexArrayAttribState; |
2340 } | 2348 } |
2341 return attribState; | 2349 return attribState; |
2342 } | 2350 } |
OLD | NEW |