5 using namespace RenderCore;
23 renderer, fmt::format(
"Mip Gen {} {}",
i, name), queue,
26 r->
BindShader(self, RHIShaderStageBits::Compute,
"csMain",
"data/shaders/CSMipGeneration.spv");
29 self,
src,
"srcTexture", RHIPipelineStageBits::ComputeShader,
32 .range = RHITextureSubresourceRange::Create(srcAspect, 0, 1, layer, 1)
36 self,
dst,
"srcTexture", RHIPipelineStageBits::ComputeShader,
42 self,
dst,
"dstTexture", RHIPipelineStageBits::ComputeShader,
47 r->BindPushConstant(self, RHIShaderStageBits::Compute, 0,
sizeof(PushConstant));
54 CHECK_MSG((extent =
srcTex->mDesc.extent) ==
dstTex->mDesc.extent,
"Extent of source images mismatch");
55 r->CmdSetPipeline(self,
cmd);
58 r->CmdSetPushConstant(self,
cmd, RHIShaderStageBits::Compute, 0, PushConstant{
59 .srcExtent = {
w,
h },
62 r->CmdDispatch(self,
cmd, {
w,
h,1});
#define CHECK_MSG(expr, format_str,...)
Definition Logging.hpp:31
Definition Command.hpp:34
Definition Resource.hpp:146
const RHITextureDesc mDesc
Definition Resource.hpp:150
Renderer implementing a Frame Graph system with automatic resource tracking and synchronization.
Definition Renderer.hpp:78
void BindShader(PassHandle pass, RHIShaderStage stage, StringView entry_point, Native::Path const &shader_path) const
Binds shader file path to a certain pass at a certain stage.
Definition Renderer.cpp:98
std::basic_string_view< char > StringView
Alias for std::basic_string_view<char>
Definition Container.hpp:53
std::unique_ptr< T, StlDeleter< T > > UniquePtr
std::unique_ptr with custom deleter that uses a Foundation::Core::Allocator to deallocate memory.
Definition Allocator.hpp:161
glm::vec< 3, uint32_t > RHIExtent3D
Definition Common.hpp:11
RHIDeviceQueueType
Definition Common.hpp:69
RHIResourceFormat
Definition Common.hpp:20
LambdaPass< FSetup, FRecord, FSkip > * createPass(Renderer *r, StringView name, RHIDeviceQueueType queue, FSetup &&setup, FRecord &&record, FSkip &&skip={})
Convenient functional wrapper to create a pass from Setup/Record lambdas.
Definition Renderer.hpp:1000
size_t ResourceHandle
Definition RenderPass.hpp:12
size_t PassHandle
Definition RenderPass.hpp:11
Reference implementations of real-time rendering routines.
Definition Application.hpp:18
void createCSMipGenerationPasses(Renderer *renderer, StringView name, RHIDeviceQueueType queue, ResourceHandle src, ResourceHandle dst, RHITextureAspectFlagBits srcAspect, RHIResourceFormat srcFormat, RHITextureAspectFlagBits dstAspect, RHIResourceFormat dstFormat, uint32_t maxMips=16, uint32_t layer=0)
Definition CSMipGeneration.hpp:6
uint32_t mipLevels
Definition Resource.hpp:86
static RHITextureSubresourceRange Create(RHITextureAspectFlag aspect=RHITextureAspectFlagBits::Color, uint32_t base_mip_level=0, uint32_t mip_count=1, uint32_t base_array_layer=0, uint32_t layer_count=1)
Helper function to create a Subresource Range with default parameters.
Definition Resource.hpp:122