Render non-AA overlays correctly
Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 10 files). Show all
Unified · Split
| @@ -42,9 +42,7 @@ · 41 unmodified lines | |||
| 42 | #include "simple_textured_fade_frag.h" | 42 | #include "simple_textured_fade_frag.h" |
| 43 | #include "simple_textured_unlit_fade_frag.h" | 43 | #include "simple_textured_unlit_fade_frag.h" |
| 44 | #include "simple_opaque_web_browser_frag.h" | 44 | #include "simple_opaque_web_browser_frag.h" |
| 45 | #include "simple_opaque_web_browser_overlay_frag.h" | ||
| 46 | #include "simple_transparent_web_browser_frag.h" | 45 | #include "simple_transparent_web_browser_frag.h" |
| 47 | #include "simple_transparent_web_browser_overlay_frag.h" | ||
| 48 | #include "glowLine_vert.h" | 46 | #include "glowLine_vert.h" |
| 49 | #include "glowLine_frag.h" | 47 | #include "glowLine_frag.h" |
| 50 | 48 | ||
| @@ -1828,7 +1826,7 @@ void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch, bool noBlend) { · 1777 unmodified lines | |||
| 1828 | 1826 | ||
| 1829 | 1827 | ||
| 1830 | auto stateNoBlend = std::make_shared<gpu::State>(); | 1828 | auto stateNoBlend = std::make_shared<gpu::State>(); |
| 1831 | PrepareStencil::testMaskDrawShape(*state); | 1829 | PrepareStencil::testMaskDrawShape(*stateNoBlend); |
| 1832 | 1830 | ||
| 1833 | auto noBlendPS = gpu::StandardShaderLib::getDrawTextureOpaquePS(); | 1831 | auto noBlendPS = gpu::StandardShaderLib::getDrawTextureOpaquePS(); |
| 1834 | auto programNoBlend = gpu::Shader::createProgram(vs, noBlendPS); | 1832 | auto programNoBlend = gpu::Shader::createProgram(vs, noBlendPS); |
| @@ -1925,7 +1923,7 @@ inline bool operator==(const SimpleProgramKey& a, const SimpleProgramKey& b) { · 90 unmodified lines | |||
| 1925 | return a.getRaw() == b.getRaw(); | 1923 | return a.getRaw() == b.getRaw(); |
| 1926 | } | 1924 | } |
| 1927 | 1925 | ||
| 1928 | static void buildWebShader(const std::string& vertShaderText, const std::string& fragShaderText, bool blendEnable, | 1926 | static void buildWebShader(const std::string& vertShaderText, const std::string& fragShaderText, bool blendEnable, bool isAA, |
| 1929 | gpu::ShaderPointer& shaderPointerOut, gpu::PipelinePointer& pipelinePointerOut) { | 1927 | gpu::ShaderPointer& shaderPointerOut, gpu::PipelinePointer& pipelinePointerOut) { |
| 1930 | auto VS = gpu::Shader::createVertex(vertShaderText); | 1928 | auto VS = gpu::Shader::createVertex(vertShaderText); |
| 1931 | auto PS = gpu::Shader::createPixel(fragShaderText); | 1929 | auto PS = gpu::Shader::createPixel(fragShaderText); |
| @@ -1940,10 +1938,11 @@ static void buildWebShader(const std::string& vertShaderText, const std::string& · 8 unmodified lines | |||
| 1940 | state->setBlendFunction(blendEnable, | 1938 | state->setBlendFunction(blendEnable, |
| 1941 | gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, | 1939 | gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, |
| 1942 | gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); | 1940 | gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); |
| 1943 | if (blendEnable) { | 1941 | |
| 1944 | PrepareStencil::testMask(*state); | 1942 | if (isAA) { |
| 1943 | blendEnable ? PrepareStencil::testMask(*state) : PrepareStencil::testMaskDrawShape(*state); | ||
| 1945 | } else { | 1944 | } else { |
| 1946 | PrepareStencil::testMaskDrawShape(*state); | 1945 | PrepareStencil::testMaskDrawShapeNoAA(*state); |
| 1947 | } | 1946 | } |
| 1948 | 1947 | ||
| 1949 | pipelinePointerOut = gpu::Pipeline::create(shaderPointerOut, state); | 1948 | pipelinePointerOut = gpu::Pipeline::create(shaderPointerOut, state); |
| @@ -1957,11 +1956,11 @@ gpu::PipelinePointer GeometryCache::getOpaqueWebBrowserProgram(bool isAA) { · 7 unmodified lines | |||
| 1957 | static std::once_flag once; | 1956 | static std::once_flag once; |
| 1958 | std::call_once(once, [&]() { | 1957 | std::call_once(once, [&]() { |
| 1959 | const bool BLEND_ENABLE = false; | 1958 | const bool BLEND_ENABLE = false; |
| 1960 | buildWebShader(simple_vert, simple_opaque_web_browser_frag, BLEND_ENABLE, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipeline); | 1959 | buildWebShader(simple_vert, simple_opaque_web_browser_frag, BLEND_ENABLE, true, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipeline); |
| 1961 | buildWebShader(simple_vert, simple_opaque_web_browser_overlay_frag, BLEND_ENABLE, _simpleOpaqueWebBrowserOverlayShader, _simpleOpaqueWebBrowserOverlayPipeline); | 1960 | buildWebShader(simple_vert, simple_opaque_web_browser_frag, BLEND_ENABLE, false, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipelineNoAA); |
| 1962 | }); | 1961 | }); |
| 1963 | 1962 | ||
| 1964 | return isAA ? _simpleOpaqueWebBrowserPipeline : _simpleOpaqueWebBrowserOverlayPipeline; | 1963 | return isAA ? _simpleOpaqueWebBrowserPipeline : _simpleOpaqueWebBrowserPipelineNoAA; |
| 1965 | } | 1964 | } |
| 1966 | 1965 | ||
| 1967 | void GeometryCache::bindTransparentWebBrowserProgram(gpu::Batch& batch, bool isAA) { | 1966 | void GeometryCache::bindTransparentWebBrowserProgram(gpu::Batch& batch, bool isAA) { |
| @@ -1971,13 +1970,12 @@ void GeometryCache::bindTransparentWebBrowserProgram(gpu::Batch& batch, bool isA · 3 unmodified lines | |||
| 1971 | gpu::PipelinePointer GeometryCache::getTransparentWebBrowserProgram(bool isAA) { | 1970 | gpu::PipelinePointer GeometryCache::getTransparentWebBrowserProgram(bool isAA) { |
| 1972 | static std::once_flag once; | 1971 | static std::once_flag once; |
| 1973 | std::call_once(once, [&]() { | 1972 | std::call_once(once, [&]() { |
| 1974 | |||
| 1975 | const bool BLEND_ENABLE = true; | 1973 | const bool BLEND_ENABLE = true; |
| 1976 | buildWebShader(simple_vert, simple_transparent_web_browser_frag, BLEND_ENABLE, _simpleTransparentWebBrowserShader, _simpleTransparentWebBrowserPipeline); | 1974 | buildWebShader(simple_vert, simple_transparent_web_browser_frag, BLEND_ENABLE, true, _simpleTransparentWebBrowserShader, _simpleTransparentWebBrowserPipeline); |
| 1977 | buildWebShader(simple_vert, simple_transparent_web_browser_overlay_frag, BLEND_ENABLE, _simpleTransparentWebBrowserOverlayShader, _simpleTransparentWebBrowserOverlayPipeline); | 1975 | buildWebShader(simple_vert, simple_transparent_web_browser_frag, BLEND_ENABLE, false, _simpleTransparentWebBrowserShader, _simpleTransparentWebBrowserPipelineNoAA); |
| 1978 | }); | 1976 | }); |
| 1979 | 1977 | ||
| 1980 | return isAA ? _simpleTransparentWebBrowserPipeline : _simpleTransparentWebBrowserOverlayPipeline; | 1978 | return isAA ? _simpleTransparentWebBrowserPipeline : _simpleTransparentWebBrowserPipelineNoAA; |
| 1981 | } | 1979 | } |
| 1982 | 1980 | ||
| 1983 | void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool culled, bool unlit, bool depthBiased) { | 1981 | void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool culled, bool unlit, bool depthBiased) { |