Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #ifndef __SP_DIRECT3D11_SHADER_H__
00009 #define __SP_DIRECT3D11_SHADER_H__
00010 
00011 
00012 #include "Base/spStandard.hpp"
00013 
00014 #if defined(SP_COMPILE_WITH_DIRECT3D11)
00015 
00016 
00017 #include "RenderSystem/Direct3D11/spDirect3D11ShaderClass.hpp"
00018 
00019 
00020 namespace sp
00021 {
00022 namespace video
00023 {
00024 
00025 
00026 class SP_EXPORT Direct3D11Shader : public Shader
00027 {
00028     
00029     public:
00030         
00031         Direct3D11Shader(ShaderClass* Table, const EShaderTypes Type, const EShaderVersions Version);
00032         ~Direct3D11Shader();
00033         
00034         
00035         
00036         bool compile(
00037             const std::list<io::stringc> &ShaderBuffer, const io::stringc &EntryPoint = "", const c8** CompilerOptions = 0
00038         );
00039         
00040         
00041         
00042         bool setConstantBuffer(const io::stringc &Name, const void* Buffer);
00043         bool setConstantBuffer(u32 Number, const void* Buffer);
00044         
00045         
00046         
00047         u32 getConstantCount() const;
00048         std::vector<io::stringc> getConstantList() const;
00049         
00050     private:
00051         
00052         friend class Direct3D11ShaderClass;
00053         friend class Direct3D11RenderSystem;
00054         
00055         
00056         
00057         bool compileHLSL(const c8* ProgramBuffer, const c8* EntryPoint, const c8* TargetName);
00058         
00059         void createProgramString(const std::list<io::stringc> &ShaderBuffer, c8* &ProgramBuffer);
00060         
00061         bool createConstantBuffers();
00062         
00063         
00064         
00065         inline u32 getVersionIndex(const EShaderVersions Min, const EShaderVersions Max) const
00066         {
00067             return math::MinMax(Version_, Min, Max) - Min;
00068         }
00069         
00070         
00071         
00072         ID3D11Device* D3DDevice_;
00073         ID3D11DeviceContext* D3DDeviceContext_;
00074         
00075         ID3D11VertexShader* VertexShaderObject_;
00076         ID3D11PixelShader* PixelShaderObject_;
00077         ID3D11GeometryShader* GeometryShaderObject_;
00078         ID3D11HullShader* HullShaderObject_;
00079         ID3D11DomainShader* DomainShaderObject_;
00080         ID3D11ComputeShader* ComputeShaderObject_;
00081         
00082         std::vector<ID3D11Buffer*> ConstantBuffers_;
00083         std::map<std::string, ID3D11Buffer*> ConstantBufferNames_;
00084         
00085         ID3D11InputLayout* InputVertexLayout_;
00086         ID3D11ShaderReflection* ShaderReflection_;
00087         
00088 };
00089 
00090 
00091 } 
00092 
00093 } 
00094 
00095 
00096 #endif
00097 
00098 #endif
00099 
00100 
00101 
00102