History

Merge branch 'master' of https://github.com/highfidelity/hifi into feat/add-primitive-shapes

Liv committed 9 years ago

Commit e4963e02 parents 9248715 77a6ecf47 files · +568 −750Browse files

Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 47 files). Show all

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+20−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
24 24
25#include "TextureCache.h"25#include "TextureCache.h"
26#include "RenderUtilsLogging.h"26#include "RenderUtilsLogging.h"
27#include "StencilMaskPass.h"
27 28
28#include "gpu/StandardShaderLib.h"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 state->setBlendFunction(true, 1655 state->setBlendFunction(true,
1655 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,1656 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
1656 gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);1657 gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
1658
1659 PrepareStencil::testMask(*state);
1660
1657 gpu::Shader::BindingSet slotBindings;1661 gpu::Shader::BindingSet slotBindings;
1658 slotBindings.insert(gpu::Shader::Binding(std::string("lineData"), LINE_DATA_SLOT));1662 slotBindings.insert(gpu::Shader::Binding(std::string("lineData"), LINE_DATA_SLOT));
1659 gpu::Shader::makeProgram(*program, slotBindings);1663 gpu::Shader::makeProgram(*program, slotBindings);
@@ -1707,11 +1711,14 @@ void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch, bool noBlend) { · 47 unmodified lines
1707 1711
1708 // enable decal blend1712 // enable decal blend
1709 state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA);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 _standardDrawPipeline = gpu::Pipeline::create(program, state);1716 _standardDrawPipeline = gpu::Pipeline::create(program, state);
1712 1717
1713 1718
1714 auto stateNoBlend = std::make_shared<gpu::State>();1719 auto stateNoBlend = std::make_shared<gpu::State>();
1720 PrepareStencil::testMaskDrawShape(*state);
1721
1715 auto noBlendPS = gpu::StandardShaderLib::getDrawTextureOpaquePS();1722 auto noBlendPS = gpu::StandardShaderLib::getDrawTextureOpaquePS();
1716 auto programNoBlend = gpu::Shader::createProgram(vs, noBlendPS);1723 auto programNoBlend = gpu::Shader::createProgram(vs, noBlendPS);
1717 gpu::Shader::makeProgram((*programNoBlend));1724 gpu::Shader::makeProgram((*programNoBlend));
@@ -1734,12 +1741,14 @@ void GeometryCache::useGridPipeline(gpu::Batch& batch, GridBuffer gridBuffer, bo · 16 unmodified lines
1734 1741
1735 auto stateLayered = std::make_shared<gpu::State>();1742 auto stateLayered = std::make_shared<gpu::State>();
1736 stateLayered->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA);1743 stateLayered->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA);
1744 PrepareStencil::testMask(*stateLayered);
1737 _gridPipelineLayered = gpu::Pipeline::create(program, stateLayered);1745 _gridPipelineLayered = gpu::Pipeline::create(program, stateLayered);
1738 1746
1739 auto state = std::make_shared<gpu::State>(stateLayered->getValues());1747 auto state = std::make_shared<gpu::State>(stateLayered->getValues());
1740 const float DEPTH_BIAS = 0.001f;1748 const float DEPTH_BIAS = 0.001f;
1741 state->setDepthBias(DEPTH_BIAS);1749 state->setDepthBias(DEPTH_BIAS);
1742 state->setDepthTest(true, false, gpu::LESS_EQUAL);1750 state->setDepthTest(true, false, gpu::LESS_EQUAL);
1751 PrepareStencil::testMaskDrawShape(*state);
1743 _gridPipeline = gpu::Pipeline::create(program, state);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 state->setBlendFunction(blendEnable,1826 state->setBlendFunction(blendEnable,
1818 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,1827 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
1819 gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);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 pipelinePointerOut = gpu::Pipeline::create(shaderPointerOut, state);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 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,1916 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
1903 gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);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 gpu::ShaderPointer program = (config.isUnlit()) ? _unlitShader : _simpleShader;1925 gpu::ShaderPointer program = (config.isUnlit()) ? _unlitShader : _simpleShader;
1906 gpu::PipelinePointer pipeline = gpu::Pipeline::create(program, state);1926 gpu::PipelinePointer pipeline = gpu::Pipeline::create(program, state);
1907 _simplePrograms.insert(config, pipeline);1927 _simplePrograms.insert(config, pipeline);