Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 19 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 | |
| @@ -1610,6 +1611,9 @@ void GeometryCache::renderGlowLine(gpu::Batch& batch, const glm::vec3& p1, const · 1580 unmodified lines | ||
| 1610 | 1611 | state->setBlendFunction(true, |
| 1611 | 1612 | gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, |
| 1612 | 1613 | gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); |
| 1614 | + | |
| 1615 | + PrepareStencil::testMask(*state); | |
| 1616 | + | |
| 1613 | 1617 | gpu::Shader::BindingSet slotBindings; |
| 1614 | 1618 | slotBindings.insert(gpu::Shader::Binding(std::string("lineData"), LINE_DATA_SLOT)); |
| 1615 | 1619 | gpu::Shader::makeProgram(*program, slotBindings); |
| @@ -1663,11 +1667,14 @@ void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch, bool noBlend) { · 47 unmodified lines | ||
| 1663 | 1667 | |
| 1664 | 1668 | // enable decal blend |
| 1665 | 1669 | state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA); |
| 1670 | + PrepareStencil::testMask(*state); | |
| 1666 | 1671 | |
| 1667 | 1672 | _standardDrawPipeline = gpu::Pipeline::create(program, state); |
| 1668 | 1673 | |
| 1669 | 1674 | |
| 1670 | 1675 | auto stateNoBlend = std::make_shared<gpu::State>(); |
| 1676 | + PrepareStencil::testMaskDrawShape(*state); | |
| 1677 | + | |
| 1671 | 1678 | auto noBlendPS = gpu::StandardShaderLib::getDrawTextureOpaquePS(); |
| 1672 | 1679 | auto programNoBlend = gpu::Shader::createProgram(vs, noBlendPS); |
| 1673 | 1680 | gpu::Shader::makeProgram((*programNoBlend)); |
| @@ -1690,12 +1697,14 @@ void GeometryCache::useGridPipeline(gpu::Batch& batch, GridBuffer gridBuffer, bo · 16 unmodified lines | ||
| 1690 | 1697 | |
| 1691 | 1698 | auto stateLayered = std::make_shared<gpu::State>(); |
| 1692 | 1699 | stateLayered->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA); |
| 1700 | + PrepareStencil::testMask(*stateLayered); | |
| 1693 | 1701 | _gridPipelineLayered = gpu::Pipeline::create(program, stateLayered); |
| 1694 | 1702 | |
| 1695 | 1703 | auto state = std::make_shared<gpu::State>(stateLayered->getValues()); |
| 1696 | 1704 | const float DEPTH_BIAS = 0.001f; |
| 1697 | 1705 | state->setDepthBias(DEPTH_BIAS); |
| 1698 | 1706 | state->setDepthTest(true, false, gpu::LESS_EQUAL); |
| 1707 | + PrepareStencil::testMaskDrawShape(*state); | |
| 1699 | 1708 | _gridPipeline = gpu::Pipeline::create(program, state); |
| 1700 | 1709 | } |
| 1701 | 1710 | |
| @@ -1773,6 +1782,11 @@ static void buildWebShader(const std::string& vertShaderText, const std::string& · 71 unmodified lines | ||
| 1773 | 1782 | state->setBlendFunction(blendEnable, |
| 1774 | 1783 | gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, |
| 1775 | 1784 | gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); |
| 1785 | + if (blendEnable) { | |
| 1786 | + PrepareStencil::testMaskBlendShape(*state); | |
| 1787 | + } else { | |
| 1788 | + PrepareStencil::testMaskDrawShape(*state); | |
| 1789 | + } | |
| 1776 | 1790 | |
| 1777 | 1791 | pipelinePointerOut = gpu::Pipeline::create(shaderPointerOut, state); |
| 1778 | 1792 | } |
| @@ -1858,6 +1872,12 @@ gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transp · 79 unmodified lines | ||
| 1858 | 1872 | gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, |
| 1859 | 1873 | gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); |
| 1860 | 1874 | |
| 1875 | + if (config.isTransparent()) { | |
| 1876 | + PrepareStencil::testMask(*state); | |
| 1877 | + } else { | |
| 1878 | + PrepareStencil::testMaskDrawShape(*state); | |
| 1879 | + } | |
| 1880 | + | |
| 1861 | 1881 | gpu::ShaderPointer program = (config.isUnlit()) ? _unlitShader : _simpleShader; |
| 1862 | 1882 | gpu::PipelinePointer pipeline = gpu::Pipeline::create(program, state); |
| 1863 | 1883 | _simplePrograms.insert(config, pipeline); |