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