mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 03:23:33 +02:00
Move linear pass down sample shader to deferred compile
This commit is contained in:
parent
529d5517e5
commit
999e5beba1
3 changed files with 13 additions and 12 deletions
|
@ -135,7 +135,6 @@ void DrawHighlightMask::run(const render::RenderContextPointer& renderContext, c
|
|||
gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps);
|
||||
|
||||
gpu::Shader::BindingSet slotBindings;
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
|
||||
_stencilMaskPipeline = gpu::Pipeline::create(program, state);
|
||||
_stencilMaskFillPipeline = gpu::Pipeline::create(program, fillState);
|
||||
|
@ -327,7 +326,6 @@ const gpu::PipelinePointer& DrawHighlight::getPipeline(const render::HighlightSt
|
|||
|
||||
ps = Highlight_filled_frag::getShader();
|
||||
program = gpu::Shader::createProgram(vs, ps);
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
_pipelineFilled = gpu::Pipeline::create(program, state);
|
||||
}
|
||||
return style.isFilled() ? _pipelineFilled : _pipeline;
|
||||
|
|
|
@ -168,7 +168,7 @@ void LinearDepthPass::run(const render::RenderContextPointer& renderContext, con
|
|||
outputs.edit4() = halfNormalTexture;
|
||||
|
||||
auto linearDepthPipeline = getLinearDepthPipeline(renderContext);
|
||||
auto downsamplePipeline = getDownsamplePipeline();
|
||||
auto downsamplePipeline = getDownsamplePipeline(renderContext);
|
||||
|
||||
auto depthViewport = args->_viewport;
|
||||
auto halfViewport = depthViewport >> 1;
|
||||
|
@ -241,19 +241,12 @@ const gpu::PipelinePointer& LinearDepthPass::getLinearDepthPipeline(const render
|
|||
}
|
||||
|
||||
|
||||
const gpu::PipelinePointer& LinearDepthPass::getDownsamplePipeline() {
|
||||
const gpu::PipelinePointer& LinearDepthPass::getDownsamplePipeline(const render::RenderContextPointer& renderContext) {
|
||||
if (!_downsamplePipeline) {
|
||||
auto vs = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS();
|
||||
auto ps = surfaceGeometry_downsampleDepthNormal_frag::getShader();
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps);
|
||||
|
||||
gpu::Shader::BindingSet slotBindings;
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("deferredFrameTransformBuffer"), DepthLinearPass_FrameTransformSlot));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("linearDepthMap"), DepthLinearPass_DepthMapSlot));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("normalMap"), DepthLinearPass_NormalMapSlot));
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
|
||||
|
||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||
PrepareStencil::testShape(*state);
|
||||
|
||||
|
@ -261,6 +254,16 @@ const gpu::PipelinePointer& LinearDepthPass::getDownsamplePipeline() {
|
|||
|
||||
// Good to go add the brand new pipeline
|
||||
_downsamplePipeline = gpu::Pipeline::create(program, state);
|
||||
|
||||
gpu::doInBatch("LinearDepthPass::run", renderContext->args->_context, [program](gpu::Batch& batch) {
|
||||
batch.runLambda([program]() {
|
||||
gpu::Shader::BindingSet slotBindings;
|
||||
slotBindings.insert(gpu::Shader::Binding("deferredFrameTransformBuffer", DepthLinearPass_FrameTransformSlot));
|
||||
slotBindings.insert(gpu::Shader::Binding("linearDepthMap", DepthLinearPass_DepthMapSlot));
|
||||
slotBindings.insert(gpu::Shader::Binding("normalMap", DepthLinearPass_NormalMapSlot));
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return _downsamplePipeline;
|
||||
|
|
|
@ -84,7 +84,7 @@ private:
|
|||
const gpu::PipelinePointer& getLinearDepthPipeline(const render::RenderContextPointer& renderContext);
|
||||
gpu::PipelinePointer _linearDepthPipeline;
|
||||
|
||||
const gpu::PipelinePointer& getDownsamplePipeline();
|
||||
const gpu::PipelinePointer& getDownsamplePipeline(const render::RenderContextPointer& renderContext);
|
||||
gpu::PipelinePointer _downsamplePipeline;
|
||||
|
||||
gpu::RangeTimerPointer _gpuTimer;
|
||||
|
|
Loading…
Reference in a new issue