Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 7 files). Show all
Unified · Split
| @@ -1923,7 +1923,7 @@ inline bool operator==(const SimpleProgramKey& a, const SimpleProgramKey& b) { · 1922 unmodified lines | |||
| 1923 | return a.getRaw() == b.getRaw(); | 1923 | return a.getRaw() == b.getRaw(); |
| 1924 | } | 1924 | } |
| 1925 | 1925 | ||
| 1926 | static void buildWebShader(const std::string& vertShaderText, const std::string& fragShaderText, bool blendEnable, bool isAA, | 1926 | static void buildWebShader(const std::string& vertShaderText, const std::string& fragShaderText, bool blendEnable, |
| 1927 | gpu::ShaderPointer& shaderPointerOut, gpu::PipelinePointer& pipelinePointerOut) { | 1927 | gpu::ShaderPointer& shaderPointerOut, gpu::PipelinePointer& pipelinePointerOut) { |
| 1928 | auto VS = gpu::Shader::createVertex(vertShaderText); | 1928 | auto VS = gpu::Shader::createVertex(vertShaderText); |
| 1929 | auto PS = gpu::Shader::createPixel(fragShaderText); | 1929 | auto PS = gpu::Shader::createPixel(fragShaderText); |
| @@ -1939,43 +1939,23 @@ static void buildWebShader(const std::string& vertShaderText, const std::string& · 9 unmodified lines | |||
| 1939 | 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, |
| 1940 | 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); |
| 1941 | 1941 | ||
| 1942 | if (isAA) { | 1942 | PrepareStencil::testMaskDrawShapeNoAA(*state); |
| 1943 | blendEnable ? PrepareStencil::testMask(*state) : PrepareStencil::testMaskDrawShape(*state); | ||
| 1944 | } else { | ||
| 1945 | PrepareStencil::testMaskDrawShapeNoAA(*state); | ||
| 1946 | } | ||
| 1947 | 1943 | ||
| 1948 | pipelinePointerOut = gpu::Pipeline::create(shaderPointerOut, state); | 1944 | pipelinePointerOut = gpu::Pipeline::create(shaderPointerOut, state); |
| 1949 | } | 1945 | } |
| 1950 | 1946 | ||
| 1951 | void GeometryCache::bindOpaqueWebBrowserProgram(gpu::Batch& batch, bool isAA) { | 1947 | void GeometryCache::bindWebBrowserProgram(gpu::Batch& batch, bool transparent) { |
| 1952 | batch.setPipeline(getOpaqueWebBrowserProgram(isAA)); | 1948 | batch.setPipeline(getWebBrowserProgram(transparent)); |
| 1953 | } | ||
| 1954 | |||
| 1955 | gpu::PipelinePointer GeometryCache::getOpaqueWebBrowserProgram(bool isAA) { | ||
| 1956 | static std::once_flag once; | ||
| 1957 | std::call_once(once, [&]() { | ||
| 1958 | const bool BLEND_ENABLE = false; | ||
| 1959 | buildWebShader(simple_vert, simple_opaque_web_browser_frag, BLEND_ENABLE, true, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipeline); | ||
| 1960 | buildWebShader(simple_vert, simple_opaque_web_browser_frag, BLEND_ENABLE, false, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipelineNoAA); | ||
| 1961 | }); | ||
| 1962 | |||
| 1963 | return isAA ? _simpleOpaqueWebBrowserPipeline : _simpleOpaqueWebBrowserPipelineNoAA; | ||
| 1964 | } | ||
| 1965 | |||
| 1966 | void GeometryCache::bindTransparentWebBrowserProgram(gpu::Batch& batch, bool isAA) { | ||
| 1967 | batch.setPipeline(getTransparentWebBrowserProgram(isAA)); | ||
| 1968 | } | 1949 | } |
| 1969 | 1950 | ||
| 1970 | gpu::PipelinePointer GeometryCache::getTransparentWebBrowserProgram(bool isAA) { | 1951 | gpu::PipelinePointer GeometryCache::getWebBrowserProgram(bool transparent) { |
| 1971 | static std::once_flag once; | 1952 | static std::once_flag once; |
| 1972 | std::call_once(once, [&]() { | 1953 | std::call_once(once, [&]() { |
| 1973 | const bool BLEND_ENABLE = true; | 1954 | buildWebShader(simple_vert, simple_opaque_web_browser_frag, false, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipelineNoAA); |
| 1974 | buildWebShader(simple_vert, simple_transparent_web_browser_frag, BLEND_ENABLE, true, _simpleTransparentWebBrowserShader, _simpleTransparentWebBrowserPipeline); | 1955 | buildWebShader(simple_vert, simple_transparent_web_browser_frag, true, _simpleTransparentWebBrowserShader, _simpleTransparentWebBrowserPipelineNoAA); |
| 1975 | buildWebShader(simple_vert, simple_transparent_web_browser_frag, BLEND_ENABLE, false, _simpleTransparentWebBrowserShader, _simpleTransparentWebBrowserPipelineNoAA); | ||
| 1976 | }); | 1956 | }); |
| 1977 | 1957 | ||
| 1978 | return isAA ? _simpleTransparentWebBrowserPipeline : _simpleTransparentWebBrowserPipelineNoAA; | 1958 | return transparent ? _simpleTransparentWebBrowserPipelineNoAA : _simpleOpaqueWebBrowserPipelineNoAA; |
| 1979 | } | 1959 | } |
| 1980 | 1960 | ||
| 1981 | void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool culled, bool unlit, bool depthBiased) { | 1961 | void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool culled, bool unlit, bool depthBiased) { |