3#include <litefx/rendering_builders.hpp>
7#if defined(BUILD_DEFINE_BUILDERS)
16 class LITEFX_DIRECTX12_API DirectX12ShaderProgramBuilder :
public ShaderProgramBuilder<DirectX12ShaderProgramBuilder, DirectX12ShaderProgram> {
17 LITEFX_IMPLEMENTATION(DirectX12ShaderProgramBuilderImpl);
24 explicit DirectX12ShaderProgramBuilder(
const DirectX12Device& device);
25 DirectX12ShaderProgramBuilder(
const DirectX12ShaderProgramBuilder&) =
delete;
26 DirectX12ShaderProgramBuilder(DirectX12ShaderProgramBuilder&&) =
delete;
27 virtual ~DirectX12ShaderProgramBuilder() noexcept;
32 virtual
void build() override;
37 virtual DirectX12ShaderProgramBuilder& withShaderModule(const ShaderStage& type, const
String& fileName, const
String& entryPoint = "main") override;
40 virtual DirectX12ShaderProgramBuilder& withShaderModule(const ShaderStage& type, std::istream& stream, const
String& name, const
String& entryPoint = "main") override;
43 virtual DirectX12ShaderProgramBuilder& withVertexShaderModule(const
String& fileName, const
String& entryPoint = "main") override;
46 virtual DirectX12ShaderProgramBuilder& withVertexShaderModule(std::istream& stream, const
String& name, const
String& entryPoint = "main") override;
49 virtual DirectX12ShaderProgramBuilder& withTessellationControlShaderModule(const
String& fileName, const
String& entryPoint = "main") override;
52 virtual DirectX12ShaderProgramBuilder& withTessellationControlShaderModule(std::istream& stream, const
String& name, const
String& entryPoint = "main") override;
55 virtual DirectX12ShaderProgramBuilder& withTessellationEvaluationShaderModule(const
String& fileName, const
String& entryPoint = "main") override;
58 virtual DirectX12ShaderProgramBuilder& withTessellationEvaluationShaderModule(std::istream& stream, const
String& name, const
String& entryPoint = "main") override;
61 virtual DirectX12ShaderProgramBuilder& withGeometryShaderModule(const
String& fileName, const
String& entryPoint = "main") override;
64 virtual DirectX12ShaderProgramBuilder& withGeometryShaderModule(std::istream& stream, const
String& name, const
String& entryPoint = "main") override;
67 virtual DirectX12ShaderProgramBuilder& withFragmentShaderModule(const
String& fileName, const
String& entryPoint = "main") override;
70 virtual DirectX12ShaderProgramBuilder& withFragmentShaderModule(std::istream& stream, const
String& name, const
String& entryPoint = "main") override;
73 virtual DirectX12ShaderProgramBuilder& withComputeShaderModule(const
String& fileName, const
String& entryPoint = "main") override;
76 virtual DirectX12ShaderProgramBuilder& withComputeShaderModule(std::istream& stream, const
String& name, const
String& entryPoint = "main") override;
83 class LITEFX_DIRECTX12_API DirectX12RasterizerBuilder : public RasterizerBuilder<DirectX12RasterizerBuilder, DirectX12Rasterizer> {
84 LITEFX_IMPLEMENTATION(DirectX12RasterizerBuilderImpl);
90 explicit DirectX12RasterizerBuilder() noexcept;
91 DirectX12RasterizerBuilder(const DirectX12RasterizerBuilder&) noexcept = delete;
92 DirectX12RasterizerBuilder(DirectX12RasterizerBuilder&&) noexcept = delete;
93 virtual ~DirectX12RasterizerBuilder() noexcept;
98 virtual
void build() override;
103 virtual DirectX12RasterizerBuilder& polygonMode(const PolygonMode& mode = PolygonMode::Solid) noexcept override;
106 virtual DirectX12RasterizerBuilder& cullMode(const CullMode& cullMode = CullMode::BackFaces) noexcept override;
109 virtual DirectX12RasterizerBuilder& cullOrder(const CullOrder& cullOrder = CullOrder::CounterClockWise) noexcept override;
112 virtual DirectX12RasterizerBuilder& lineWidth(const
Float& lineWidth = 1.f) noexcept override;
115 virtual DirectX12RasterizerBuilder& depthBias(const
DepthStencilState::DepthBias& depthBias) noexcept override;
118 virtual DirectX12RasterizerBuilder& depthState(const
DepthStencilState::DepthState& depthState) noexcept override;
121 virtual DirectX12RasterizerBuilder& stencilState(const
DepthStencilState::StencilState& stencilState) noexcept override;
129 class LITEFX_DIRECTX12_API DirectX12VertexBufferLayoutBuilder : public VertexBufferLayoutBuilder<DirectX12VertexBufferLayoutBuilder, DirectX12VertexBufferLayout, DirectX12InputAssemblerBuilder> {
131 using VertexBufferLayoutBuilder<DirectX12VertexBufferLayoutBuilder, DirectX12VertexBufferLayout, DirectX12InputAssemblerBuilder>::VertexBufferLayoutBuilder;
148 virtual DirectX12VertexBufferLayoutBuilder& withAttribute(
const BufferFormat& format,
const UInt32& offset,
const AttributeSemantic& semantic = AttributeSemantic::Unknown,
const UInt32& semanticIndex = 0);
158 virtual DirectX12VertexBufferLayoutBuilder& withAttribute(
const UInt32& location,
const BufferFormat& format,
const UInt32& offset,
const AttributeSemantic& semantic = AttributeSemantic::Unknown,
const UInt32& semanticIndex = 0);
165 class LITEFX_DIRECTX12_API DirectX12InputAssemblerBuilder :
public InputAssemblerBuilder<DirectX12InputAssemblerBuilder, DirectX12InputAssembler> {
166 LITEFX_IMPLEMENTATION(DirectX12InputAssemblerBuilderImpl);
172 explicit DirectX12InputAssemblerBuilder() noexcept;
173 DirectX12InputAssemblerBuilder(const DirectX12InputAssemblerBuilder&) noexcept = delete;
174 DirectX12InputAssemblerBuilder(DirectX12InputAssemblerBuilder&&) noexcept = delete;
175 virtual ~DirectX12InputAssemblerBuilder() noexcept;
180 virtual
void build() override;
185 virtual DirectX12InputAssemblerBuilder& topology(const PrimitiveTopology& topology) override;
188 virtual
void use(
UniquePtr<DirectX12VertexBufferLayout>&& layout) override;
191 virtual
void use(
UniquePtr<DirectX12IndexBufferLayout>&& layout) override;
199 virtual DirectX12VertexBufferLayoutBuilder vertexBuffer(const
size_t& elementSize, const
UInt32& binding = 0);
205 virtual DirectX12InputAssemblerBuilder& indexType(const IndexType& type);
214 class LITEFX_DIRECTX12_API DirectX12DescriptorSetLayoutBuilder : public DescriptorSetLayoutBuilder<DirectX12DescriptorSetLayoutBuilder, DirectX12DescriptorSetLayout, DirectX12PipelineLayoutBuilder> {
215 LITEFX_IMPLEMENTATION(DirectX12DescriptorSetLayoutBuilderImpl);
226 explicit DirectX12DescriptorSetLayoutBuilder(DirectX12PipelineLayoutBuilder& parent,
const UInt32& space = 0,
const ShaderStage& stages = ShaderStage::Fragment | ShaderStage::Geometry | ShaderStage::TessellationControl | ShaderStage::TessellationEvaluation | ShaderStage::Vertex,
const UInt32& poolSize = 0,
const UInt32& maxUnboundedArraySize = 0);
227 DirectX12DescriptorSetLayoutBuilder(
const DirectX12DescriptorSetLayoutBuilder&) =
delete;
228 DirectX12DescriptorSetLayoutBuilder(DirectX12DescriptorSetLayoutBuilder&&) =
delete;
229 virtual ~DirectX12DescriptorSetLayoutBuilder() noexcept;
234 virtual
void build() override;
239 virtual DirectX12DescriptorSetLayoutBuilder& withDescriptor(
UniquePtr<DirectX12DescriptorLayout>&& layout) override;
242 virtual DirectX12DescriptorSetLayoutBuilder& withDescriptor(const DescriptorType& type, const
UInt32& binding, const
UInt32& descriptorSize, const
UInt32& descriptors = 1) override;
245 virtual DirectX12DescriptorSetLayoutBuilder& withStaticSampler(const
UInt32& binding, const FilterMode& magFilter = FilterMode::Nearest, const FilterMode& minFilter = FilterMode::Nearest, const BorderMode& borderU = BorderMode::Repeat, const BorderMode& borderV = BorderMode::Repeat, const BorderMode& borderW = BorderMode::Repeat, const MipMapMode& mipMapMode = MipMapMode::Nearest, const
Float& mipMapBias = 0.f, const
Float& minLod = 0.f, const
Float& maxLod = std::numeric_limits<
Float>::max(), const
Float& anisotropy = 0.f) override;
253 virtual DirectX12DescriptorSetLayoutBuilder& space(const
UInt32& space) noexcept;
259 virtual DirectX12DescriptorSetLayoutBuilder& shaderStages(const ShaderStage& stages) noexcept;
265 virtual DirectX12DescriptorSetLayoutBuilder& poolSize(const
UInt32& poolSize) noexcept;
272 class LITEFX_DIRECTX12_API DirectX12PushConstantsLayoutBuilder : public PushConstantsLayoutBuilder<DirectX12PushConstantsLayoutBuilder, DirectX12PushConstantsLayout, DirectX12PipelineLayoutBuilder> {
273 LITEFX_IMPLEMENTATION(DirectX12PushConstantsLayoutBuilderImpl);
281 explicit DirectX12PushConstantsLayoutBuilder(DirectX12PipelineLayoutBuilder& parent,
const UInt32& size);
282 DirectX12PushConstantsLayoutBuilder(
const DirectX12PushConstantsLayoutBuilder&) =
delete;
283 DirectX12PushConstantsLayoutBuilder(DirectX12PushConstantsLayoutBuilder&&) =
delete;
284 virtual ~DirectX12PushConstantsLayoutBuilder() noexcept;
289 virtual
void build() override;
293 virtual DirectX12PushConstantsLayoutBuilder& withRange(const ShaderStage& shaderStages, const
UInt32& offset, const
UInt32& size, const
UInt32& space, const
UInt32& binding) override;
302 class LITEFX_DIRECTX12_API DirectX12PipelineLayoutBuilder : public PipelineLayoutBuilder<DirectX12PipelineLayoutBuilder, DirectX12PipelineLayout> {
303 LITEFX_IMPLEMENTATION(DirectX12PipelineLayoutBuilderImpl);
304 friend class DirectX12DescriptorSetLayoutBuilder;
310 DirectX12PipelineLayoutBuilder(
const DirectX12Device& device);
311 DirectX12PipelineLayoutBuilder(DirectX12PipelineLayoutBuilder&&) =
delete;
312 DirectX12PipelineLayoutBuilder(
const DirectX12PipelineLayoutBuilder&) =
delete;
313 virtual ~DirectX12PipelineLayoutBuilder() noexcept;
318 virtual
void build() override;
323 virtual
void use(
UniquePtr<DirectX12DescriptorSetLayout>&& layout) override;
326 virtual
void use(
UniquePtr<DirectX12PushConstantsLayout>&& layout) override;
336 virtual DirectX12DescriptorSetLayoutBuilder descriptorSet(const
UInt32& space = 0, const ShaderStage& stages = ShaderStage::Compute | ShaderStage::Fragment | ShaderStage::Geometry | ShaderStage::TessellationControl | ShaderStage::TessellationEvaluation | ShaderStage::
Vertex, const
UInt32& poolSize = 0);
342 virtual DirectX12PushConstantsLayoutBuilder pushConstants(const
UInt32& size);
349 virtual const DirectX12Device& device() const noexcept;
356 class LITEFX_DIRECTX12_API DirectX12RenderPipelineBuilder : public RenderPipelineBuilder<DirectX12RenderPipelineBuilder, DirectX12RenderPipeline> {
357 LITEFX_IMPLEMENTATION(DirectX12RenderPipelineBuilderImpl);
365 explicit DirectX12RenderPipelineBuilder(
const DirectX12RenderPass& renderPass,
const String& name =
"");
366 DirectX12RenderPipelineBuilder(DirectX12RenderPipelineBuilder&&) =
delete;
367 DirectX12RenderPipelineBuilder(
const DirectX12RenderPipelineBuilder&) =
delete;
368 virtual ~DirectX12RenderPipelineBuilder() noexcept;
373 virtual
void build() override;
378 virtual DirectX12RenderPipelineBuilder& shaderProgram(
SharedPtr<DirectX12ShaderProgram> shaderProgram) override;
381 virtual DirectX12RenderPipelineBuilder& layout(
SharedPtr<DirectX12PipelineLayout> layout) override;
384 virtual DirectX12RenderPipelineBuilder& rasterizer(
SharedPtr<DirectX12Rasterizer> rasterizer) override;
387 virtual DirectX12RenderPipelineBuilder& inputAssembler(
SharedPtr<DirectX12InputAssembler> inputAssembler) override;
390 virtual DirectX12RenderPipelineBuilder& viewport(
SharedPtr<
IViewport> viewport) override;
393 virtual DirectX12RenderPipelineBuilder& scissor(
SharedPtr<
IScissor> scissor) override;
396 virtual DirectX12RenderPipelineBuilder& enableAlphaToCoverage(const
bool& enable = true) override;
403 class LITEFX_DIRECTX12_API DirectX12ComputePipelineBuilder : public ComputePipelineBuilder<DirectX12ComputePipelineBuilder, DirectX12ComputePipeline> {
404 LITEFX_IMPLEMENTATION(DirectX12ComputePipelineBuilderImpl);
412 explicit DirectX12ComputePipelineBuilder(
const DirectX12Device& device,
const String& name =
"");
413 DirectX12ComputePipelineBuilder(DirectX12ComputePipelineBuilder&&) =
delete;
414 DirectX12ComputePipelineBuilder(
const DirectX12ComputePipelineBuilder&) =
delete;
415 virtual ~DirectX12ComputePipelineBuilder() noexcept;
420 virtual
void build() override;
425 virtual DirectX12ComputePipelineBuilder& shaderProgram(
SharedPtr<DirectX12ShaderProgram> program) override;
428 virtual DirectX12ComputePipelineBuilder& layout(
SharedPtr<DirectX12PipelineLayout> layout) override;
435 class LITEFX_DIRECTX12_API DirectX12RenderPassBuilder : public RenderPassBuilder<DirectX12RenderPassBuilder, DirectX12RenderPass> {
436 LITEFX_IMPLEMENTATION(DirectX12RenderPassBuilderImpl)
444 explicit DirectX12RenderPassBuilder(
const DirectX12Device& device,
const String& name =
"") noexcept;
452 explicit DirectX12RenderPassBuilder(const DirectX12Device& device, const MultiSamplingLevel& samples = MultiSamplingLevel::x1, const
String& name = "") noexcept;
460 explicit DirectX12RenderPassBuilder(const DirectX12Device& device, const
UInt32& commandBuffers, const
String& name = "") noexcept;
469 explicit DirectX12RenderPassBuilder(const DirectX12Device& device, const
UInt32& commandBuffers, const MultiSamplingLevel& multiSamplingLevel, const
String& name = "") noexcept;
470 DirectX12RenderPassBuilder(const DirectX12RenderPassBuilder&) noexcept = delete;
471 DirectX12RenderPassBuilder(DirectX12RenderPassBuilder&&) noexcept = delete;
472 virtual ~DirectX12RenderPassBuilder() noexcept;
477 virtual
void build() override;
482 virtual DirectX12RenderPassBuilder& commandBuffers(const
UInt32& count) override;
485 virtual DirectX12RenderPassBuilder& multiSamplingLevel(const MultiSamplingLevel& samples) override;
488 virtual DirectX12RenderPassBuilder& renderTarget(const RenderTargetType& type, const Format& format, const
Vector4f& clearValues = { 0.0f, 0.0f, 0.0f, 0.0f },
bool clearColor =
true,
bool clearStencil =
true,
bool isVolatile =
false)
override;
491 virtual DirectX12RenderPassBuilder& renderTarget(
const String& name,
const RenderTargetType& type,
const Format& format,
const Vector4f& clearValues = { 0.0f, 0.0f, 0.0f, 0.0f },
bool clearColor =
true,
bool clearStencil =
true,
bool isVolatile =
false)
override;
494 virtual DirectX12RenderPassBuilder& renderTarget(
const UInt32& location,
const RenderTargetType& type,
const Format& format,
const Vector4f& clearValues = { 0.0f, 0.0f, 0.0f, 0.0f },
bool clearColor =
true,
bool clearStencil =
true,
bool isVolatile =
false)
override;
497 virtual DirectX12RenderPassBuilder& renderTarget(
const String& name,
const UInt32& location,
const RenderTargetType& type,
const Format& format,
const Vector4f& clearValues = { 0.0f, 0.0f, 0.0f, 0.0f },
bool clearColor =
true,
bool clearStencil =
true,
bool isVolatile =
false)
override;
500 virtual DirectX12RenderPassBuilder& renderTarget(DirectX12InputAttachmentMapping& output,
const RenderTargetType& type,
const Format& format,
const Vector4f& clearValues = { 0.0f, 0.0f, 0.0f, 0.0f },
bool clearColor =
true,
bool clearStencil =
true,
bool isVolatile =
false)
override;
503 virtual DirectX12RenderPassBuilder& renderTarget(
const String& name, DirectX12InputAttachmentMapping& output,
const RenderTargetType& type,
const Format& format,
const Vector4f& clearValues = { 0.0f, 0.0f, 0.0f, 0.0f },
bool clearColor =
true,
bool clearStencil =
true,
bool isVolatile =
false)
override;
506 virtual DirectX12RenderPassBuilder& renderTarget(DirectX12InputAttachmentMapping& output,
const UInt32& location,
const RenderTargetType& type,
const Format& format,
const Vector4f& clearValues = { 0.0f, 0.0f, 0.0f, 0.0f },
bool clearColor =
true,
bool clearStencil =
true,
bool isVolatile =
false)
override;
509 virtual DirectX12RenderPassBuilder& renderTarget(
const String& name, DirectX12InputAttachmentMapping& output,
const UInt32& location,
const RenderTargetType& type,
const Format& format,
const Vector4f& clearValues = { 0.0f, 0.0f, 0.0f, 0.0f },
bool clearColor =
true,
bool clearStencil =
true,
bool isVolatile =
false)
override;
512 virtual DirectX12RenderPassBuilder& inputAttachment(
const DirectX12InputAttachmentMapping& inputAttachment)
override;
515 virtual DirectX12RenderPassBuilder& inputAttachment(
const UInt32& inputLocation,
const DirectX12RenderPass& renderPass,
const UInt32& outputLocation)
override;
518 virtual DirectX12RenderPassBuilder& inputAttachment(
const UInt32& inputLocation,
const DirectX12RenderPass& renderPass,
const RenderTarget& renderTarget)
override;
Stores the depth/stencil state of a see IRasterizer.
Definition: rendering_api.hpp:2066
The interface of a scissor.
Definition: rendering_api.hpp:2415
Interface for a viewport.
Definition: rendering_api.hpp:2331
Implements a render target.
Definition: rendering_api.hpp:1994
uint32_t UInt32
Definition: math.hpp:37
float_t Float
Definition: math.hpp:40
std::string String
Definition: string.hpp:19
std::shared_ptr< T > SharedPtr
Represents a shared pointer, that expresses non-exclusive ownership.
Definition: containers.hpp:94
std::unique_ptr< T, TDeleter > UniquePtr
Represents a unique pointer, that expresses exclusive ownership.
Definition: containers.hpp:87
Definition: graphics.hpp:11