#ifndef Shader_h__ #define Shader_h__ #include #include #include #include "ForwardDeclarations.h" #include #include #include using namespace Microsoft::WRL; class ShaderData { public: ComPtr blob; D3D12_SHADER_BYTECODE get_bytecode() { D3D12_SHADER_BYTECODE bytecode = {}; bytecode.BytecodeLength = blob->GetBufferSize(); bytecode.pShaderBytecode = blob->GetBufferPointer(); return bytecode; } }; typedef std::shared_ptr ShaderDataPtr; enum class ShaderType { Vs, Ps, Gs, Hull, Domain, Count }; class Shader { public: std::wstring class_name() const { return L"Shader"; } static ShaderPtr Create(); static ShaderPtr Create(const std::wstring& filePath); void FromFile(const std::wstring& shaderFilePath); ShaderDataPtr GetShader(ShaderType type); ComPtr GetDevice(); private: Shader(ComPtr dev); ShaderDataPtr shaders[(uint32_t)ShaderType::Count]; ComPtr device; ComPtr CompileSHader(const std::wstring& filename, const std::string& entry, const std::string& profile); }; #endif // Shader_h__