Graphics/UberShader: Add config callback
This commit is contained in:
@@ -24,6 +24,8 @@ namespace Nz
|
||||
public:
|
||||
struct Config;
|
||||
struct Option;
|
||||
using ConfigCallback = std::function<void(Config& config, const std::vector<RenderPipelineInfo::VertexBufferData>& vertexBuffers)>;
|
||||
|
||||
UberShader(ShaderStageTypeFlags shaderStages, const ShaderAst::StatementPtr& shaderAst);
|
||||
~UberShader() = default;
|
||||
|
||||
@@ -33,6 +35,9 @@ namespace Nz
|
||||
|
||||
inline bool HasOption(const std::string& optionName, Pointer<const Option>* option = nullptr) const;
|
||||
|
||||
inline void UpdateConfig(Config& config, const std::vector<RenderPipelineInfo::VertexBufferData>& vertexBuffers);
|
||||
inline void UpdateConfigCallback(ConfigCallback callback);
|
||||
|
||||
static constexpr std::size_t MaximumOptionValue = 32;
|
||||
|
||||
struct Config
|
||||
@@ -60,6 +65,7 @@ namespace Nz
|
||||
std::unordered_map<Config, std::shared_ptr<ShaderModule>, ConfigHasher, ConfigEqual> m_combinations;
|
||||
std::unordered_map<std::string, Option> m_optionIndexByName;
|
||||
ShaderAst::StatementPtr m_shaderAst;
|
||||
ConfigCallback m_configCallback;
|
||||
ShaderStageTypeFlags m_shaderStages;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user