mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:21:24 +02:00
REmoving unecessary job introduced dureing development
This commit is contained in:
parent
7bf2c5fc8e
commit
a278e6c52c
6 changed files with 74 additions and 107 deletions
|
@ -273,44 +273,6 @@ graphics::MeshPointer DeferredLightingEffect::getSpotLightMesh() {
|
||||||
return _spotLightMesh;
|
return _spotLightMesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu::FramebufferPointer PreparePrimaryFramebuffer::createFramebuffer(const char* name, const glm::uvec2& frameSize) {
|
|
||||||
gpu::FramebufferPointer framebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create(name));
|
|
||||||
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
|
|
||||||
|
|
||||||
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR);
|
|
||||||
auto primaryColorTexture = gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
|
|
||||||
|
|
||||||
framebuffer->setRenderBuffer(0, primaryColorTexture);
|
|
||||||
|
|
||||||
auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
|
|
||||||
auto primaryDepthTexture = gpu::Texture::createRenderBuffer(depthFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
|
|
||||||
|
|
||||||
framebuffer->setDepthStencilBuffer(primaryDepthTexture, depthFormat);
|
|
||||||
|
|
||||||
return framebuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreparePrimaryFramebuffer::configure(const Config& config) {
|
|
||||||
_resolutionScale = config.getResolutionScale();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreparePrimaryFramebuffer::run(const RenderContextPointer& renderContext, Output& primaryFramebuffer) {
|
|
||||||
glm::uvec2 frameSize(renderContext->args->_viewport.z, renderContext->args->_viewport.w);
|
|
||||||
glm::uvec2 scaledFrameSize(glm::vec2(frameSize) * _resolutionScale);
|
|
||||||
|
|
||||||
// Resizing framebuffers instead of re-building them seems to cause issues with threaded
|
|
||||||
// rendering
|
|
||||||
if (!_primaryFramebuffer || _primaryFramebuffer->getSize() != scaledFrameSize) {
|
|
||||||
_primaryFramebuffer = createFramebuffer("deferredPrimary", scaledFrameSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
primaryFramebuffer = _primaryFramebuffer;
|
|
||||||
|
|
||||||
// Set viewport for the rest of the scaled passes
|
|
||||||
renderContext->args->_viewport.z = scaledFrameSize.x;
|
|
||||||
renderContext->args->_viewport.w = scaledFrameSize.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrepareDeferred::run(const RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) {
|
void PrepareDeferred::run(const RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) {
|
||||||
auto args = renderContext->args;
|
auto args = renderContext->args;
|
||||||
|
|
||||||
|
|
|
@ -74,41 +74,6 @@ private:
|
||||||
friend class RenderDeferredCleanup;
|
friend class RenderDeferredCleanup;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PreparePrimaryFramebufferConfig : public render::Job::Config {
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PROPERTY(float resolutionScale WRITE setResolutionScale READ getResolutionScale)
|
|
||||||
public:
|
|
||||||
float getResolutionScale() const { return resolutionScale; }
|
|
||||||
void setResolutionScale(float scale) {
|
|
||||||
resolutionScale = std::max(0.1f, std::min(2.0f, scale));
|
|
||||||
}
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void dirty();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
float resolutionScale{ 1.0f };
|
|
||||||
};
|
|
||||||
|
|
||||||
class PreparePrimaryFramebuffer {
|
|
||||||
public:
|
|
||||||
|
|
||||||
using Output = gpu::FramebufferPointer;
|
|
||||||
using Config = PreparePrimaryFramebufferConfig;
|
|
||||||
using JobModel = render::Job::ModelO<PreparePrimaryFramebuffer, Output, Config>;
|
|
||||||
|
|
||||||
PreparePrimaryFramebuffer(float resolutionScale = 1.0f) : _resolutionScale{resolutionScale} {}
|
|
||||||
void configure(const Config& config);
|
|
||||||
void run(const render::RenderContextPointer& renderContext, Output& primaryFramebuffer);
|
|
||||||
|
|
||||||
gpu::FramebufferPointer _primaryFramebuffer;
|
|
||||||
float _resolutionScale{ 1.0f };
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
static gpu::FramebufferPointer createFramebuffer(const char* name, const glm::uvec2& size);
|
|
||||||
};
|
|
||||||
|
|
||||||
class PrepareDeferred {
|
class PrepareDeferred {
|
||||||
public:
|
public:
|
||||||
// Inputs: primaryFramebuffer and lightingModel
|
// Inputs: primaryFramebuffer and lightingModel
|
||||||
|
|
|
@ -177,28 +177,6 @@ void Blit::run(const RenderContextPointer& renderContext, const gpu::Framebuffer
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewFramebuffer::run(const render::RenderContextPointer& renderContext, const Input& input, Output& output) {
|
|
||||||
RenderArgs* args = renderContext->args;
|
|
||||||
// auto frameSize = input;
|
|
||||||
output.reset();
|
|
||||||
|
|
||||||
glm::uvec2 frameSize(args->_viewport.z, args->_viewport.w);
|
|
||||||
|
|
||||||
if (_outputFramebuffer && _outputFramebuffer->getSize() != frameSize) {
|
|
||||||
_outputFramebuffer.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_outputFramebuffer) {
|
|
||||||
_outputFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("newFramebuffer.out"));
|
|
||||||
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
|
|
||||||
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR);
|
|
||||||
auto colorTexture = gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
|
|
||||||
_outputFramebuffer->setRenderBuffer(0, colorTexture);
|
|
||||||
}
|
|
||||||
|
|
||||||
output = _outputFramebuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewOrDefaultFramebuffer::run(const render::RenderContextPointer& renderContext, const Input& input, Output& output) {
|
void NewOrDefaultFramebuffer::run(const render::RenderContextPointer& renderContext, const Input& input, Output& output) {
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
// auto frameSize = input;
|
// auto frameSize = input;
|
||||||
|
|
|
@ -84,18 +84,6 @@ public:
|
||||||
void run(const render::RenderContextPointer& renderContext, const gpu::FramebufferPointer& srcFramebuffer);
|
void run(const render::RenderContextPointer& renderContext, const gpu::FramebufferPointer& srcFramebuffer);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class NewFramebuffer {
|
|
||||||
public:
|
|
||||||
using Input = glm::uvec2;
|
|
||||||
using Output = gpu::FramebufferPointer;
|
|
||||||
using JobModel = render::Job::ModelIO<NewFramebuffer, Input, Output>;
|
|
||||||
|
|
||||||
void run(const render::RenderContextPointer& renderContext, const Input& input, Output& output);
|
|
||||||
private:
|
|
||||||
gpu::FramebufferPointer _outputFramebuffer;
|
|
||||||
};
|
|
||||||
|
|
||||||
class NewOrDefaultFramebuffer {
|
class NewOrDefaultFramebuffer {
|
||||||
public:
|
public:
|
||||||
using Input = glm::uvec2;
|
using Input = glm::uvec2;
|
||||||
|
|
|
@ -428,6 +428,44 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gpu::FramebufferPointer PreparePrimaryFramebuffer::createFramebuffer(const char* name, const glm::uvec2& frameSize) {
|
||||||
|
gpu::FramebufferPointer framebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create(name));
|
||||||
|
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
|
||||||
|
|
||||||
|
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR);
|
||||||
|
auto primaryColorTexture = gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
|
||||||
|
|
||||||
|
framebuffer->setRenderBuffer(0, primaryColorTexture);
|
||||||
|
|
||||||
|
auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
|
||||||
|
auto primaryDepthTexture = gpu::Texture::createRenderBuffer(depthFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
|
||||||
|
|
||||||
|
framebuffer->setDepthStencilBuffer(primaryDepthTexture, depthFormat);
|
||||||
|
|
||||||
|
return framebuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreparePrimaryFramebuffer::configure(const Config& config) {
|
||||||
|
_resolutionScale = config.getResolutionScale();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreparePrimaryFramebuffer::run(const RenderContextPointer& renderContext, Output& primaryFramebuffer) {
|
||||||
|
glm::uvec2 frameSize(renderContext->args->_viewport.z, renderContext->args->_viewport.w);
|
||||||
|
glm::uvec2 scaledFrameSize(glm::vec2(frameSize) * _resolutionScale);
|
||||||
|
|
||||||
|
// Resizing framebuffers instead of re-building them seems to cause issues with threaded
|
||||||
|
// rendering
|
||||||
|
if (!_primaryFramebuffer || _primaryFramebuffer->getSize() != scaledFrameSize) {
|
||||||
|
_primaryFramebuffer = createFramebuffer("deferredPrimary", scaledFrameSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
primaryFramebuffer = _primaryFramebuffer;
|
||||||
|
|
||||||
|
// Set viewport for the rest of the scaled passes
|
||||||
|
renderContext->args->_viewport.z = scaledFrameSize.x;
|
||||||
|
renderContext->args->_viewport.w = scaledFrameSize.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void RenderTransparentDeferred::run(const RenderContextPointer& renderContext, const Inputs& inputs) {
|
void RenderTransparentDeferred::run(const RenderContextPointer& renderContext, const Inputs& inputs) {
|
||||||
assert(renderContext->args);
|
assert(renderContext->args);
|
||||||
|
|
|
@ -149,4 +149,40 @@ public:
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class PreparePrimaryFramebufferConfig : public render::Job::Config {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(float resolutionScale WRITE setResolutionScale READ getResolutionScale)
|
||||||
|
public:
|
||||||
|
float getResolutionScale() const { return resolutionScale; }
|
||||||
|
void setResolutionScale(float scale) {
|
||||||
|
resolutionScale = std::max(0.1f, std::min(2.0f, scale));
|
||||||
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void dirty();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
float resolutionScale{ 1.0f };
|
||||||
|
};
|
||||||
|
|
||||||
|
class PreparePrimaryFramebuffer {
|
||||||
|
public:
|
||||||
|
|
||||||
|
using Output = gpu::FramebufferPointer;
|
||||||
|
using Config = PreparePrimaryFramebufferConfig;
|
||||||
|
using JobModel = render::Job::ModelO<PreparePrimaryFramebuffer, Output, Config>;
|
||||||
|
|
||||||
|
PreparePrimaryFramebuffer(float resolutionScale = 1.0f) : _resolutionScale{ resolutionScale } {}
|
||||||
|
void configure(const Config& config);
|
||||||
|
void run(const render::RenderContextPointer& renderContext, Output& primaryFramebuffer);
|
||||||
|
|
||||||
|
gpu::FramebufferPointer _primaryFramebuffer;
|
||||||
|
float _resolutionScale{ 1.0f };
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
static gpu::FramebufferPointer createFramebuffer(const char* name, const glm::uvec2& size);
|
||||||
|
};
|
||||||
|
|
||||||
#endif // hifi_RenderDeferredTask_h
|
#endif // hifi_RenderDeferredTask_h
|
||||||
|
|
Loading…
Reference in a new issue