Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 47 files). Show all
Unified · Split
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | #include "TextureCache.h" |
| 26 | 26 | #include "RenderUtilsLogging.h" |
| 27 | +#include "StencilMaskPass.h" | |
| 27 | 28 | |
| 28 | 29 | #include "gpu/StandardShaderLib.h" |
| 29 | 30 | |
| @@ -1654,6 +1655,9 @@ void GeometryCache::renderGlowLine(gpu::Batch& batch, const glm::vec3& p1, const · 1624 unmodified lines | ||
| 1654 | 1655 | state->setBlendFunction(true, |
| 1655 | 1656 | gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, |
| 1656 | 1657 | gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); |
| 1658 | + | |
| 1659 | + PrepareStencil::testMask(*state); | |
| 1660 | + | |
| 1657 | 1661 | gpu::Shader::BindingSet slotBindings; |
| 1658 | 1662 | slotBindings.insert(gpu::Shader::Binding(std::string("lineData"), LINE_DATA_SLOT)); |
| 1659 | 1663 | gpu::Shader::makeProgram(*program, slotBindings); |
| @@ -1707,11 +1711,14 @@ void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch, bool noBlend) { · 47 unmodified lines | ||
| 1707 | 1711 | |
| 1708 | 1712 | // enable decal blend |
| 1709 | 1713 | state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA); |
| 1714 | + PrepareStencil::testMask(*state); | |
| 1710 | 1715 | |
| 1711 | 1716 | _standardDrawPipeline = gpu::Pipeline::create(program, state); |
| 1712 | 1717 | |
| 1713 | 1718 | |
| 1714 | 1719 | auto stateNoBlend = std::make_shared<gpu::State>(); |
| 1720 | + PrepareStencil::testMaskDrawShape(*state); | |
| 1721 | + | |
| 1715 | 1722 | auto noBlendPS = gpu::StandardShaderLib::getDrawTextureOpaquePS(); |
| 1716 | 1723 | auto programNoBlend = gpu::Shader::createProgram(vs, noBlendPS); |
| 1717 | 1724 | gpu::Shader::makeProgram((*programNoBlend)); |
| @@ -1734,12 +1741,14 @@ void GeometryCache::useGridPipeline(gpu::Batch& batch, GridBuffer gridBuffer, bo · 16 unmodified lines | ||
| 1734 | 1741 | |
| 1735 | 1742 | auto stateLayered = std::make_shared<gpu::State>(); |
| 1736 | 1743 | stateLayered->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA); |
| 1744 | + PrepareStencil::testMask(*stateLayered); | |
| 1737 | 1745 | _gridPipelineLayered = gpu::Pipeline::create(program, stateLayered); |
| 1738 | 1746 | |
| 1739 | 1747 | auto state = std::make_shared<gpu::State>(stateLayered->getValues()); |
| 1740 | 1748 | const float DEPTH_BIAS = 0.001f; |
| 1741 | 1749 | state->setDepthBias(DEPTH_BIAS); |
| 1742 | 1750 | state->setDepthTest(true, false, gpu::LESS_EQUAL); |
| 1751 | + PrepareStencil::testMaskDrawShape(*state); | |
| 1743 | 1752 | _gridPipeline = gpu::Pipeline::create(program, state); |
| 1744 | 1753 | } |
| 1745 | 1754 | |
| @@ -1817,6 +1826,11 @@ static void buildWebShader(const std::string& vertShaderText, const std::string& · 71 unmodified lines | ||
| 1817 | 1826 | state->setBlendFunction(blendEnable, |
| 1818 | 1827 | gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, |
| 1819 | 1828 | gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); |
| 1829 | + if (blendEnable) { | |
| 1830 | + PrepareStencil::testMask(*state); | |
| 1831 | + } else { | |
| 1832 | + PrepareStencil::testMaskDrawShape(*state); | |
| 1833 | + } | |
| 1820 | 1834 | |
| 1821 | 1835 | pipelinePointerOut = gpu::Pipeline::create(shaderPointerOut, state); |
| 1822 | 1836 | } |
| @@ -1902,6 +1916,12 @@ gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transp · 79 unmodified lines | ||
| 1902 | 1916 | gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, |
| 1903 | 1917 | gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); |
| 1904 | 1918 | |
| 1919 | + if (config.isTransparent()) { | |
| 1920 | + PrepareStencil::testMask(*state); | |
| 1921 | + } else { | |
| 1922 | + PrepareStencil::testMaskDrawShape(*state); | |
| 1923 | + } | |
| 1924 | + | |
| 1905 | 1925 | gpu::ShaderPointer program = (config.isUnlit()) ? _unlitShader : _simpleShader; |
| 1906 | 1926 | gpu::PipelinePointer pipeline = gpu::Pipeline::create(program, state); |
| 1907 | 1927 | _simplePrograms.insert(config, pipeline); |