CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
RendererComputePipeline.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "Forward.hpp"
11
12#include "RendererShader.hpp"
13
15
18
20
21namespace CeresEngine {
22
26 };
27
31
32
36
37 public: // Reflection
40 template<typename Processor> static constexpr void reflect(Processor&& RTTI) {
41 CE_REFL_DATA(shaderSpecialization); //
42 }
43 };
44
107
111 private:
116
117 private:
119
122
126
127 public:
131
132 public:
142 RendererComputePipelinePtr get(StringView name, const RendererShaderPtr& shader, const GPUPipelineLayoutPtr& pipelineLayout = nullptr);
143
152 RendererComputePipelinePtr get(const RendererShaderPtr& shader, const GPUPipelineLayoutPtr& pipelineLayout = nullptr) {
153 return get(StringView(), shader, pipelineLayout);
154 }
155
156 private:
157 friend class RendererComputePipeline;
158
162
165 };
166
167} // namespace CeresEngine
168
#define CE_FLAGS_OPERATORS(Enum)
Defines global operators for a Flags<Enum, Storage> implementation.
Definition Flags.hpp:216
#define CE_REFLECT_HASH(T)
Definition Hash.hpp:89
#define CE_REFL_DATA(N)
Definition Macros.hpp:541
A retain-release type of smart pointer.
Definition SmartPtr.hpp:132
A simple reference counter base class.
Definition SmartPtr.hpp:438
A renderer compute pipeline.
Definition RendererComputePipeline.hpp:48
GPUComputePipelinePtr getPipeline(const RendererComputePipelineSpecialization &specialization) const
Gets the compiled compute pipeline program for the given parameters.
RendererComputePipeline(RendererComputePipelineManager &manager, StringView name, const RendererShaderPtr &shader, const GPUPipelineLayoutPtr &pipelineLayout=nullptr)
Creates a new renderer compute pipeline instance.
const GPUPipelineLayoutPtr & getPipelineLayout() const noexcept
Pointer to an optional pipeline layout for the compute pipeline.
Definition RendererComputePipeline.hpp:102
RendererComputePipelineManager & mManager
The renderer compute pipeline manager that owns this compute pipeline object.
Definition RendererComputePipeline.hpp:54
const String & getName() const noexcept
A human-readable name to use on the pipeline.
Definition RendererComputePipeline.hpp:99
const RendererShaderPtr & getShader() const noexcept
The shader to be used when creating new GPU Compute Pipeline instances.
Definition RendererComputePipeline.hpp:105
GPUComputePipelinePtr getPipeline(RendererShaderSpecialization shaderSpecialization=RendererShaderSpecialization()) const
Gets the compiled compute pipeline program for the given parameters.
Definition RendererComputePipeline.hpp:91
String mName
A human-readable name to use on the pipeline.
Definition RendererComputePipeline.hpp:57
GPUPipelineLayoutPtr mPipelineLayout
Pointer to an optional pipeline layout for the compute pipeline.
Definition RendererComputePipeline.hpp:65
HashMap< UInt64, GPUComputePipelinePtr > mPipelines
The compute pipeline programs, indexed by their parameters hash.
Definition RendererComputePipeline.hpp:68
RendererShaderPtr mShader
The shader to be used when creating new GPU Compute Pipeline instances.
Definition RendererComputePipeline.hpp:61
The renderer compute pipeline manager that is responsible for managing and re-using GPU compute pipel...
Definition RendererComputePipeline.hpp:110
RendererComputePipelineManager(Renderer &renderer)
Creates a new ComputePipeline Manager instance.
RendererComputePipelinePtr getOrCreate(StringView name, const RendererShaderPtr &shader, const GPUPipelineLayoutPtr &pipelineLayout)
Gets an existing or creates a new renderer compute pipeline instance for the given base descriptor.
RendererComputePipelinePtr get(StringView name, const RendererShaderPtr &shader, const GPUPipelineLayoutPtr &pipelineLayout=nullptr)
Gets (or creates) a new RendererComputePipeline from a compute pipeline state descriptor.
HashMap< UInt64, ComputePipelineInfo > mComputePipelines
A map that holds compute pipeline information for each base compute pipeline descriptor.
Definition RendererComputePipeline.hpp:125
RendererComputePipelinePtr get(const RendererShaderPtr &shader, const GPUPipelineLayoutPtr &pipelineLayout=nullptr)
Gets (or creates) a new RendererComputePipeline from a compute pipeline compute pipeline program desc...
Definition RendererComputePipeline.hpp:152
Renderer & mRenderer
The renderer that owns this manager instance.
Definition RendererComputePipeline.hpp:121
void notifyDestroy(const RendererComputePipeline *computePipeline) noexcept
Notifies the manager that the renderer compute pipeline is being destroyed.
The CeresEngine renderer.
Definition Renderer.hpp:35
Definition Application.hpp:19
BasicStringView< char > StringView
Narrow string view used for handling narrow encoded text in UTF-8.
Definition String.hpp:190
Flags< RendererComputePipelineFlag > RendererComputePipelineFlags
Flags that can be either set by the renderer or by the user to customize the behavior of the compute ...
Definition Forward.hpp:46
RendererComputePipelineFlag
Flags that can be either set by the renderer or by the user to customize the behavior of the compute ...
Definition RendererComputePipeline.hpp:25
std::unordered_map< Key, T, Hash, KeyEqual, ScopedAllocatorAdaptor< StdAllocator< Pair< const Key, T >, RawAllocator > > > HashMap
HashMap is an associative container that contains key-value pairs with unique keys.
Definition Map.hpp:33
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
RendererComputePipeline * rendererComputePipeline
An instance of the renderer compute pipeline.
Definition RendererComputePipeline.hpp:114
A structure that describes a RendererComputePipeline specialization.
Definition RendererComputePipeline.hpp:33
static constexpr void reflect(Processor &&RTTI)
Executes the given processor for every field of the struct.
Definition RendererComputePipeline.hpp:40
RendererShaderSpecialization shaderSpecialization
A description of the shader specialization to use.
Definition RendererComputePipeline.hpp:35
A structure that describes a RendererGraphicsPipeline specialization.
Definition RendererShader.hpp:31