44 desc.
_name =
"SMAAWeights";
50 aaShaderDescriptor.
_globalDefines.emplace_back(
"dvd_qualityMultiplier int(PushData0[0].x)" );
57 fxaa.waitForReady(
false);
80 weightsDescriptor.
_modules = { vertModule, fragModule };
81 weightsDescriptor.
_globalDefines.emplace_back(
"dvd_qualityMultiplier int(PushData0[0].x)" );
84 smaaWeights.waitForReady(
false);
98 blendDescriptor.
_modules = { vertModule, fragModule };
101 smaaBlend.waitForReady(
false);
118 searchDescriptor.assetName(
"smaa_search.png");
119 searchDescriptor.assetLocation(Paths::g_imagesLocation);
120 searchDescriptor.waitForReady(
false);
124 areaDescriptor.assetName(
"smaa_area.png");
125 areaDescriptor.assetLocation(Paths::g_imagesLocation);
126 areaDescriptor.waitForReady(
false);
161 if (useSMAA() != currentUseSMAA()) {
162 currentUseSMAA(useSMAA());
168 if (postAAQualityLevel() != currentPostAAQualityLevel()) {
169 currentPostAAQualityLevel(postAAQualityLevel());
174 if (currentPostAAQualityLevel() == 0) {
187 beginRenderPassCmd._name =
"DO_SMAA_WEIGHT_PASS";
196 auto cmd = GFX::EnqueueCommand<GFX::BindShaderResourcesCommand>(bufferInOut);
201 Set( binding.
_data, att->texture(), att->_descriptor._sampler );
215 GFX::EnqueueCommand<GFX::BindPipelineCommand>(bufferInOut)->_pipeline =
_smaaWeightPipeline;
217 PushConstantsStruct& pushData = GFX::EnqueueCommand<GFX::SendPushConstantsCommand>( bufferInOut )->_fastData;
220 GFX::EnqueueCommand<GFX::DrawCommand>(bufferInOut)->_drawCommands.emplace_back();
221 GFX::EnqueueCommand<GFX::EndRenderPassCommand>(bufferInOut);
228 beginRenderPassCmd._name =
"DO_SMAA_BLEND_PASS";
233 auto cmd = GFX::EnqueueCommand<GFX::BindShaderResourcesCommand>(bufferInOut);
238 Set( binding.
_data, screenAtt->texture(), screenAtt->_descriptor._sampler );
242 Set( binding.
_data, weightAtt->texture(), screenAtt->_descriptor._sampler );
245 GFX::EnqueueCommand<GFX::BindPipelineCommand>(bufferInOut)->_pipeline =
_smaaBlendPipeline;
247 GFX::EnqueueCommand<GFX::DrawCommand>(bufferInOut)->_drawCommands.emplace_back();
248 GFX::EnqueueCommand<GFX::EndRenderPassCommand>(bufferInOut);
256 beginRenderPassCmd.
_name =
"DO_POSTAA_PASS";
259 GFX::EnqueueCommand<GFX::BindPipelineCommand>(bufferInOut )->_pipeline =
_fxaaPipeline;
261 PushConstantsStruct& pushData = GFX::EnqueueCommand<GFX::SendPushConstantsCommand>( bufferInOut )->_fastData;
264 auto cmd = GFX::EnqueueCommand<GFX::BindShaderResourcesCommand>(bufferInOut);
269 Set( binding.
_data, screenAtt->texture(), screenAtt->_descriptor._sampler );
272 GFX::EnqueueCommand<GFX::DrawCommand>(bufferInOut)->_drawCommands.emplace_back();
273 GFX::EnqueueCommand<GFX::EndRenderPassCommand>(bufferInOut);
#define WAIT_FOR_CONDITION(...)
Rough around the edges Adapter pattern abstracting the actual rendering API and access to the GPU.
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)
PlatformContext & context() noexcept
Configuration & config() noexcept
PostAAPreRenderOperator(GFXDevice &context, PreRenderBatch &parent)
bool ready() const noexcept override
Handle< ShaderProgram > _fxaa
Pipeline * _smaaBlendPipeline
void reshape(U16 width, U16 height) override
Handle< Texture > _areaTexture
Pipeline * _smaaWeightPipeline
RenderTargetHandle _smaaWeights
Handle< Texture > _searchTexture
Handle< ShaderProgram > _smaaBlend
Handle< ShaderProgram > _smaaWeightComputation
~PostAAPreRenderOperator()
bool execute(PlayerIndex idx, const CameraSnapshot &cameraSnapshot, const RenderTargetHandle &input, const RenderTargetHandle &output, GFX::CommandBuffer &bufferInOut) override
This is tricky as we use our screen as both input and output.
void popFilter(const FilterType filter, const bool overrideScene=false)
void pushFilter(const FilterType filter, const bool overrideScene=false)
RenderTargetHandle edgesRT() const noexcept
PostFX & parent() 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.
FColour4 WHITE
Random stuff added for convenience.
FORCE_INLINE T * EnqueueCommand(CommandBuffer &buffer)
Handle console commands that start with a forward slash.
FORCE_INLINE void DestroyResource(Handle< T > &handle, const bool immediate=false)
@ RES_LOADED
The resource is available for usage.
constexpr F32 to_F32(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)
FORCE_INLINE T * Get(const Handle< T > handle)
constexpr auto to_base(const Type value) -> Type
struct Divide::Configuration::Rendering::PostFX::PostAA postAA
struct Divide::Configuration::Rendering::PostFX postFX
struct Divide::Configuration::Rendering rendering
DescriptorSetBindingData _data
RTDrawDescriptor _descriptor
RTClearDescriptor _clearDescriptor
static constexpr RTColourAttachmentSlot ALBEDO
PrimitiveTopology _primitiveTopology
Handle< ShaderProgram > _shaderProgramHandle
RenderStateBlock _stateBlock
vector< ShaderModuleDescriptor > _modules
ModuleDefines _globalDefines
ImageTools::ImportOptions _textureOptions
InternalRTAttachmentDescriptors _attachments
TextureFilter _minFilter
Texture filtering mode.
TextureWrap _wrapU
Texture wrap mode (Or S-R-T)
U8 _anisotropyLevel
The value must be in the range [0...255] and is automatically clamped by the max HW supported level.
TextureMipSampling _mipSampling