Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 18 files). Show all
Unified · Split
| @@ -561,7 +561,7 @@ void GeometryCache::initializeShapePipelines() { · 560 unmodified lines | ||
| 561 | 561 | render::ShapePipelinePointer GeometryCache::getShapePipeline(bool textured, bool transparent, bool culled, |
| 562 | 562 | bool unlit, bool depthBias) { |
| 563 | 563 | |
| 564 | − return std::make_shared<render::ShapePipeline>(getSimplePipeline(textured, transparent, culled, unlit, depthBias, false), nullptr, | |
| 564 | + return std::make_shared<render::ShapePipeline>(getSimplePipeline(textured, transparent, culled, unlit, depthBias, false, true), nullptr, | |
| 565 | 565 | [](const render::ShapePipeline& , gpu::Batch& batch, render::Args*) { |
| 566 | 566 | batch.setResourceTexture(render::ShapePipeline::Slot::MAP::ALBEDO, DependencyManager::get<TextureCache>()->getWhiteTexture()); |
| 567 | 567 | } |
| @@ -1877,6 +1877,7 @@ public: · 1309 unmodified lines | ||
| 1877 | 1877 | IS_UNLIT_FLAG, |
| 1878 | 1878 | HAS_DEPTH_BIAS_FLAG, |
| 1879 | 1879 | IS_FADING_FLAG, |
| 1880 | + IS_AA_FLAG, | |
| 1880 | 1881 | |
| 1881 | 1882 | NUM_FLAGS, |
| 1882 | 1883 | }; |
| @@ -1888,6 +1889,7 @@ public: · 5 unmodified lines | ||
| 1888 | 1889 | IS_UNLIT = (1 << IS_UNLIT_FLAG), |
| 1889 | 1890 | HAS_DEPTH_BIAS = (1 << HAS_DEPTH_BIAS_FLAG), |
| 1890 | 1891 | IS_FADING = (1 << IS_FADING_FLAG), |
| 1892 | + IS_AA = (1 << IS_AA_FLAG), | |
| 1891 | 1893 | }; |
| 1892 | 1894 | typedef unsigned short Flags; |
| 1893 | 1895 | |
| @@ -1899,6 +1901,7 @@ public: · 5 unmodified lines | ||
| 1899 | 1901 | bool isUnlit() const { return isFlag(IS_UNLIT); } |
| 1900 | 1902 | bool hasDepthBias() const { return isFlag(HAS_DEPTH_BIAS); } |
| 1901 | 1903 | bool isFading() const { return isFlag(IS_FADING); } |
| 1904 | + bool isAA() const { return isFlag(IS_AA); } | |
| 1902 | 1905 | |
| 1903 | 1906 | Flags _flags = 0; |
| 1904 | 1907 | short _spare = 0; |
| @@ -1907,9 +1910,9 @@ public: · 2 unmodified lines | ||
| 1907 | 1910 | |
| 1908 | 1911 | |
| 1909 | 1912 | SimpleProgramKey(bool textured = false, bool transparent = false, bool culled = true, |
| 1910 | − bool unlit = false, bool depthBias = false, bool fading = false) { | |
| 1913 | + bool unlit = false, bool depthBias = false, bool fading = false, bool isAA = true) { | |
| 1911 | 1914 | _flags = (textured ? IS_TEXTURED : 0) | (transparent ? IS_TRANSPARENT : 0) | (culled ? IS_CULLED : 0) | |
| 1912 | − (unlit ? IS_UNLIT : 0) | (depthBias ? HAS_DEPTH_BIAS : 0) | (fading ? IS_FADING : 0); | |
| 1915 | + (unlit ? IS_UNLIT : 0) | (depthBias ? HAS_DEPTH_BIAS : 0) | (fading ? IS_FADING : 0) | (isAA ? IS_AA : 0); | |
| 1913 | 1916 | } |
| 1914 | 1917 | |
| 1915 | 1918 | SimpleProgramKey(int bitmask) : _flags(bitmask) {} |
| @@ -1958,8 +1961,8 @@ gpu::PipelinePointer GeometryCache::getWebBrowserProgram(bool transparent) { · 42 unmodified lines | ||
| 1958 | 1961 | return transparent ? _simpleTransparentWebBrowserPipelineNoAA : _simpleOpaqueWebBrowserPipelineNoAA; |
| 1959 | 1962 | } |
| 1960 | 1963 | |
| 1961 | −void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool culled, bool unlit, bool depthBiased) { | |
| 1962 | − batch.setPipeline(getSimplePipeline(textured, transparent, culled, unlit, depthBiased)); | |
| 1964 | +void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool culled, bool unlit, bool depthBiased, bool isAA) { | |
| 1965 | + batch.setPipeline(getSimplePipeline(textured, transparent, culled, unlit, depthBiased, false, isAA)); | |
| 1963 | 1966 | |
| 1964 | 1967 | // If not textured, set a default albedo map |
| 1965 | 1968 | if (!textured) { |
| @@ -1968,8 +1971,8 @@ void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool tra · 2 unmodified lines | ||
| 1968 | 1971 | } |
| 1969 | 1972 | } |
| 1970 | 1973 | |
| 1971 | −gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transparent, bool culled, bool unlit, bool depthBiased, bool fading) { | |
| 1972 | − SimpleProgramKey config { textured, transparent, culled, unlit, depthBiased, fading }; | |
| 1974 | +gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transparent, bool culled, bool unlit, bool depthBiased, bool fading, bool isAA) { | |
| 1975 | + SimpleProgramKey config { textured, transparent, culled, unlit, depthBiased, fading, isAA }; | |
| 1973 | 1976 | |
| 1974 | 1977 | // If the pipeline already exists, return it |
| 1975 | 1978 | auto it = _simplePrograms.find(config); |
| @@ -2027,11 +2030,10 @@ gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transp · 51 unmodified lines | ||
| 2027 | 2030 | gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, |
| 2028 | 2031 | gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); |
| 2029 | 2032 | |
| 2030 | − if (config.isTransparent()) { | |
| 2031 | − PrepareStencil::testMask(*state); | |
| 2032 | − } | |
| 2033 | − else { | |
| 2034 | − PrepareStencil::testMaskDrawShape(*state); | |
| 2033 | + if (config.isAA()) { | |
| 2034 | + config.isTransparent() ? PrepareStencil::testMask(*state) : PrepareStencil::testMaskDrawShape(*state); | |
| 2035 | + } else { | |
| 2036 | + PrepareStencil::testMaskDrawShapeNoAA(*state); | |
| 2035 | 2037 | } |
| 2036 | 2038 | |
| 2037 | 2039 | gpu::ShaderPointer program = (config.isUnlit()) ? (config.isFading() ? _unlitFadeShader : _unlitShader) : (config.isFading() ? _simpleFadeShader : _simpleShader); |