28 vertModule.
_variant =
"FullScreenQuad";
34 fragModule.
_defines.emplace_back(
"USE_DEPTH_BLUR");
36 fragModule.
_defines.emplace_back(
"USER_NOISE");
43 fragModule.
_defines.emplace_back(
"size PushData0[0].xy");
45 fragModule.
_defines.emplace_back(
"focus PushData0[0].zw");
46 fragModule.
_defines.emplace_back(
"_zPlanes PushData0[1].xy");
48 fragModule.
_defines.emplace_back(
"focalDepth PushData0[1].z");
50 fragModule.
_defines.emplace_back(
"focalLength PushData0[1].w");
51 fragModule.
_defines.emplace_back(
"fstop PushData0[2].x");
53 fragModule.
_defines.emplace_back(
"ndofstart PushData0[2].y");
55 fragModule.
_defines.emplace_back(
"ndofdist PushData0[2].z");
57 fragModule.
_defines.emplace_back(
"fdofstart PushData0[2].w");
59 fragModule.
_defines.emplace_back(
"fdofdist PushData0[3].x");
61 fragModule.
_defines.emplace_back(
"vignout PushData0[3].y");
63 fragModule.
_defines.emplace_back(
"vignin PushData0[3].z");
65 fragModule.
_defines.emplace_back(
"showFocus uint(PushData0[3].w)");
67 fragModule.
_defines.emplace_back(
"manualdof uint(PushData1[0].x)");
69 fragModule.
_defines.emplace_back(
"vignetting uint(PushData1[0].y)");
71 fragModule.
_defines.emplace_back(
"autofocus uint(PushData1[0].z)");
74 shaderDescriptor.
_modules.push_back(vertModule);
75 shaderDescriptor.
_modules.push_back(fragModule);
78 dof.waitForReady(
false);
136 const auto& screenTex =
Get(screenAtt->texture())->getView();
137 const auto& extraTex =
Get(extraAtt->texture())->getView();
139 auto cmd = GFX::EnqueueCommand<GFX::BindShaderResourcesCommand>(bufferInOut);
143 Set( binding.
_data, screenTex, screenAtt->_descriptor._sampler );
147 Set( binding.
_data, extraTex, extraAtt->_descriptor._sampler );
153 beginRenderPassCmd._name =
"DO_DOF_PASS";
157 GFX::EnqueueCommand<GFX::BindPipelineCommand>(bufferInOut)->_pipeline =
_pipeline;
158 GFX::EnqueueCommand<GFX::SendPushConstantsCommand>(bufferInOut)->_fastData =
_constants;
161 GFX::EnqueueCommand<GFX::DrawCommand>(bufferInOut)->_drawCommands.emplace_back();
162 GFX::EnqueueCommand<GFX::EndRenderPassCommand>(bufferInOut);
bool ready() const noexcept 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".
PushConstantsStruct _constants
DoFPreRenderOperator(GFXDevice &context, PreRenderBatch &parent)
void reshape(U16 width, U16 height) override
void parametersChanged() noexcept
Handle< ShaderProgram > _dofShader
Rough around the edges Adapter pattern abstracting the actual rendering API and access to the GPU.
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
PlatformContext & context() noexcept
Configuration & config() noexcept
RenderTargetHandle screenRT() const noexcept
RenderTargetHandle getLinearDepthRT() 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
vec2< U16 > getResolution() const noexcept
void set(const T *v) noexcept
set the 2 components of the vector manually using a source pointer to a (large enough) array
FORCE_INLINE T * EnqueueCommand(CommandBuffer &buffer)
FStops StringToFStops(const string &name)
Str StringFormat(const char *fmt, Args &&...args)
constexpr U8 g_samplesOnFirstRing
Handle console commands that start with a forward slash.
static constexpr F32 g_FStopValues[to_base(FStops::COUNT)]
FORCE_INLINE void DestroyResource(Handle< T > &handle, const bool immediate=false)
@ RES_LOADED
The resource is available for usage.
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::DOF dof
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