Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
prism/engine/renderer/include/materialcompiler.hpp
Joshua Goins 3229c4fa2c Another big WebGPU compatibility patch
All specialization constants are removed (they cause trouble in
WebGPU, since they don't support array sizing, and it was a pain
in Metal anyway) - they are now macro defined. WebGPU now runs, although
push constant emulation is not implemented yet.
2022-03-07 00:33:44 -05:00

27 lines
943 B
C++
Executable file

#pragma once
#include <tuple>
#include "gfx.hpp"
class Material;
constexpr int position_buffer_index = 2;
constexpr int normal_buffer_index = 3;
constexpr int texcoord_buffer_index = 4;
constexpr int tangent_buffer_index = 5;
constexpr int bitangent_buffer_index = 6;
constexpr int bone_buffer_index = 7;
class MaterialCompiler {
public:
GFXPipeline* create_static_pipeline(GFXGraphicsPipelineCreateInfo createInfo, bool positions_only = false, bool cubemap = false);
GFXPipeline* create_skinned_pipeline(GFXGraphicsPipelineCreateInfo createInfo, bool positions_only = false);
// generates static and skinned versions of the pipeline provided
std::tuple<GFXPipeline*, GFXPipeline*> create_pipeline_permutations(GFXGraphicsPipelineCreateInfo& createInfo, bool positions_only = false);
ShaderSource compile_material_fragment(Material& material, bool use_ibl = true);
};
static MaterialCompiler material_compiler;