Ocular Engine
D3D11UncompiledShaderResourceLoader.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_D3D11_UNCOMPILED_SHADER_RESOURCE_LOADER__H__
19 #define __H__OCULAR_D3D11_UNCOMPILED_SHADER_RESOURCE_LOADER__H__
20 
21 #include "Resources/ResourceLoader.hpp"
22 #include <d3d11.h>
23 
24 //------------------------------------------------------------------------------------------
25 
30 namespace Ocular
31 {
36  namespace Graphics
37  {
38  class ShaderProgram;
39 
77  {
78  public:
79 
82 
83  virtual bool loadResource(Core::Resource* &resource, Core::File const& file, std::string const& mappingName) override;
84 
85  protected:
86 
87  bool getD3DDevice();
88 
89  // Notice that compileVertexShader returns bool while all others return void.
90  // If there is a real compilation error with the file (not just an entrypoint error)
91  // then the same compilation error will be reported for all shader compilation attempts.
92 
93  // So when compileVertexShader fails, we know there is a real issue with the file and
94  // that no shaders can be compiled from it. It would be pointless to continue the other
95  // shader compilations if vertex fails from an error.
96 
97  // But if compileVertexShader experiences success or an entrypoint error, then we can
98  // continue with attempting the other shader types.
99 
100  bool compileVertexShader(Core::File const& file, LPCWSTR source, ShaderProgram* program);
101  void compileGeometryShader(Core::File const& file, LPCWSTR source, ShaderProgram* program);
102  void compileFragmentShader(Core::File const& file, LPCWSTR source, ShaderProgram* program);
103  void compilePreTessellationShader(Core::File const& file, LPCWSTR source, ShaderProgram* program);
104  void compilePostTessellationShader(Core::File const& file, LPCWSTR source, ShaderProgram* program);
105 
106  bool isEntryPointError(ID3DBlob* errorLog) const;
107 
108  private:
109 
110  ID3D11Device* m_D3DDevice;
111  ID3D11DeviceContext* m_D3DDeviceContext;
112  };
113  }
117 }
122 //------------------------------------------------------------------------------------------
123 
124 #endif
Definition: ResourceLoader.hpp:55
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
Definition: D3D11UncompiledShaderResourceLoader.hpp:76
virtual bool loadResource(Core::Resource *&resource, Core::File const &file, std::string const &mappingName) override
Definition: D3D11UncompiledShaderResourceLoader.cpp:70
Definition: ShaderProgram.hpp:54
Definition: File.hpp:41
Definition: Resource.hpp:46