30 vertModule.
_variant =
"FullScreenQuad";
38 shaderDescriptor.
_modules.push_back(vertModule);
39 shaderDescriptor.
_modules.push_back(fragModule);
40 shaderDescriptor.
_globalDefines.emplace_back(
"luminanceBias PushData0[0].x" );
43 bloomCalc.waitForReady(
false);
56 shaderDescriptor = {};
57 shaderDescriptor.
_modules.push_back(vertModule);
58 shaderDescriptor.
_modules.push_back(fragModule);
61 bloomApply.waitForReady(
false);
75 resolutionDownscaleFactor = 4.0f;
89 desc.
_name =
"Bloom_Blur_0";
91 desc.
_name =
"Bloom_Blur_1";
128 const U16 w =
to_U16(width / resolutionDownscaleFactor);
129 const U16 h =
to_U16(height / resolutionDownscaleFactor);
148 const auto& screenTex =
Get(screenAtt->texture())->getView();
153 beginRenderPassCmd._name =
"DO_BLOOM_PASS";
158 GFX::EnqueueCommand<GFX::BindPipelineCommand>( bufferInOut )->_pipeline =
_bloomCalcPipeline;
159 PushConstantsStruct& params = GFX::EnqueueCommand<GFX::SendPushConstantsCommand>( bufferInOut )->_fastData;
162 auto cmd = GFX::EnqueueCommand<GFX::BindShaderResourcesCommand>( bufferInOut );
166 Set( binding.
_data, screenTex, screenAtt->_descriptor._sampler );
174 GFX::EnqueueCommand<GFX::DrawCommand>(bufferInOut)->_drawCommands.emplace_back();
175 GFX::EnqueueCommand<GFX::EndRenderPassCommand>(bufferInOut);
190 const auto& bloomTex =
Get(bloomAtt->texture())->getView();
197 auto cmd = GFX::EnqueueCommand<GFX::BindShaderResourcesCommand>( bufferInOut );
201 Set( binding.
_data, screenTex, screenAtt->_descriptor._sampler );
205 Set( binding.
_data, bloomTex, bloomAtt->_descriptor._sampler );
208 GFX::EnqueueCommand<GFX::BindPipelineCommand>( bufferInOut )->_pipeline =
_bloomApplyPipeline;
210 GFX::EnqueueCommand<GFX::DrawCommand>(bufferInOut)->_drawCommands.emplace_back();
211 GFX::EnqueueCommand<GFX::EndRenderPassCommand>(bufferInOut);
Pipeline * _bloomApplyPipeline
~BloomPreRenderOperator() override
F32 luminanceBias() const noexcept
bool ready() const noexcept override
Handle< ShaderProgram > _bloomApply
Pipeline * _bloomCalcPipeline
RenderTargetHandle _bloomOutput
BloomPreRenderOperator(GFXDevice &context, PreRenderBatch &parent)
void reshape(U16 width, U16 height) override
bool execute(PlayerIndex idx, const CameraSnapshot &cameraSnapshot, const RenderTargetHandle &input, const RenderTargetHandle &output, GFX::CommandBuffer &bufferInOut) override
Return true if we rendered into "output".
RenderTargetHandle _bloomBlurBuffer[2]
Handle< ShaderProgram > _bloomCalc
Rough around the edges Adapter pattern abstracting the actual rendering API and access to the GPU.
void blurTarget(RenderTargetHandle &blurSource, RenderTargetHandle &blurBuffer, const RenderTargetHandle &blurTarget, RTAttachmentType att, RTColourAttachmentSlot slot, I32 kernelSize, bool gaussian, U8 layerCount, GFX::CommandBuffer &bufferInOut)
GFXRTPool & renderTargetPool() noexcept
Pipeline * newPipeline(const PipelineDescriptor &descriptor)
Create and return a new graphics pipeline. This is only used for caching and doesn't use the object a...
const RenderStateBlock & get2DStateBlock() const noexcept
RenderTargetHandle allocateRT(const RenderTargetDescriptor &descriptor)
bool deallocateRT(RenderTargetHandle &handle)
PlatformContext & context() noexcept
Configuration & config() noexcept
Handle< Texture > luminanceTex() const noexcept
virtual void reshape(U16 width, U16 height)
virtual bool ready() const noexcept
RTDrawDescriptor _screenOnlyDraw
RTAttachment * getAttachment(RTAttachmentType type, RTColourAttachmentSlot slot=RTColourAttachmentSlot::SLOT_0) const
bool resize(U16 width, U16 height)
Resize all attachments.
FORCE_INLINE T * EnqueueCommand(CommandBuffer &buffer)
F32 resolutionDownscaleFactor
Handle console commands that start with a forward slash.
FORCE_INLINE void DestroyResource(Handle< T > &handle, const bool immediate=false)
constexpr U16 to_U16(const T value)
void Set(DescriptorSetBindingData &dataInOut, ShaderBuffer *buffer, const BufferRange range) noexcept
DescriptorSetBinding & AddBinding(DescriptorSet &setInOut, U8 slot, U16 stageVisibilityMask)
FORCE_INLINE Handle< T > CreateResource(const ResourceDescriptor< T > &descriptor, bool &wasInCache, std::atomic_uint &taskCounter)
RTClearEntry DEFAULT_CLEAR_ENTRY
FORCE_INLINE T * Get(const Handle< T > handle)
constexpr auto to_base(const Type value) -> Type
struct Divide::Configuration::Rendering::PostFX::Bloom bloom
struct Divide::Configuration::Rendering::PostFX postFX
struct Divide::Configuration::Rendering rendering
DescriptorSetBindingData _data
static constexpr RTColourAttachmentSlot ALBEDO
PrimitiveTopology _primitiveTopology
Handle< ShaderProgram > _shaderProgramHandle
RenderStateBlock _stateBlock
vector< ShaderModuleDescriptor > _modules
ModuleDefines _globalDefines
MipMappingState _mipMappingState
InternalRTAttachmentDescriptors _attachments