Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
shader.h
1 #pragma once
2 
3 #include "content/text_file.h"
4 #include "renderer/d3d12_includes.h"
5 
6 namespace blowbox
7 {
15  {
16  ShaderType_VERTEX,
17  ShaderType_PIXEL,
18  ShaderType_GEOMETRY,
19  ShaderType_COMPUTE,
20  ShaderType_HULL,
21  ShaderType_DOMAIN,
22  ShaderType_UNKNOWN
23  };
24 
33  class Shader
34  {
35  public:
37  Shader();
38 
40  ~Shader();
41 
47  void Create(TextFile* shader_file, const ShaderType& shader_type);
48 
50  const ShaderType& GetShaderType() const;
51 
53  const D3D12_SHADER_BYTECODE& GetShaderByteCode() const;
54 
56  const void* GetShaderBinary() const;
57 
59  UINT GetShaderBinaryLength() const;
60 
62  const ID3DBlob* GetShaderBlob() const;
63 
64  private:
67  ID3DBlob* shader_blob_;
68  D3D12_SHADER_BYTECODE shader_byte_code_;
69  };
70 }
Wraps the loading and accessing of text files from disk.
Definition: text_file.h:15
Shader()
Constructs a Shader.
Definition: shader.cc:9
TextFile * shader_file_
The TextFile that was used to compile this Shader.
Definition: shader.h:65
void Create(TextFile *shader_file, const ShaderType &shader_type)
Creates the actual Shader.
Definition: shader.cc:24
UINT GetShaderBinaryLength() const
Definition: shader.cc:114
D3D12_SHADER_BYTECODE shader_byte_code_
A D3D12 compatible shader byte code object for this Shader.
Definition: shader.h:68
const ShaderType & GetShaderType() const
Definition: shader.cc:96
ShaderType shader_type_
The type of Shader this is.
Definition: shader.h:66
ShaderType
Enumeration for all different shader types.
Definition: shader.h:14
const void * GetShaderBinary() const
Definition: shader.cc:108
const D3D12_SHADER_BYTECODE & GetShaderByteCode() const
Definition: shader.cc:102
The main Blowbox namespace.
Definition: image.cc:8
ID3DBlob * shader_blob_
The underlying ID3DBlob where the Shader binary is stored in.
Definition: shader.h:67
const ID3DBlob * GetShaderBlob() const
Definition: shader.cc:120
~Shader()
Destructs a Shader.
Definition: shader.cc:18
Wraps Shader objects.
Definition: shader.h:33