From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai <chaifix@163.com> Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/GfxDevice/d3d/GpuProgramsD3D.h | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Runtime/GfxDevice/d3d/GpuProgramsD3D.h (limited to 'Runtime/GfxDevice/d3d/GpuProgramsD3D.h') diff --git a/Runtime/GfxDevice/d3d/GpuProgramsD3D.h b/Runtime/GfxDevice/d3d/GpuProgramsD3D.h new file mode 100644 index 0000000..6b21fa9 --- /dev/null +++ b/Runtime/GfxDevice/d3d/GpuProgramsD3D.h @@ -0,0 +1,40 @@ +#pragma once + +#include "D3D9Includes.h" +#include "Runtime/GfxDevice/GpuProgram.h" + + +class D3D9VertexShader : public GpuProgram { +public: + D3D9VertexShader( const std::string& source ); + virtual ~D3D9VertexShader(); + + virtual void ApplyGpuProgram (const GpuProgramParameters& params, const UInt8* buffer); + IDirect3DVertexShader9* GetShader(FogMode fog, bool& outResetToNoFog); + IDirect3DVertexShader9* GetShaderAtFogIndex(FogMode fog) { return m_Shaders[fog]; } + +private: + bool Create( const std::string& source ); + + std::string m_SourceForFog; // original source, used for fog patching if needed + IDirect3DVertexShader9* m_Shaders[kFogModeCount]; + unsigned m_FogFailed; // bit per fog mode +}; + +class D3D9PixelShader : public GpuProgram { +public: + D3D9PixelShader( const std::string& source ); + virtual ~D3D9PixelShader(); + + virtual void ApplyGpuProgram (const GpuProgramParameters& params, const UInt8* buffer); + IDirect3DPixelShader9* GetShader(FogMode fog, const GpuProgramParameters& params); + IDirect3DPixelShader9* GetShaderAtFogIndex(FogMode fog) { return m_Shaders[fog]; } + +private: + bool Create( const std::string& source ); + + std::string m_SourceForFog; // original source, used for fog patching if needed + IDirect3DPixelShader9* m_Shaders[kFogModeCount]; + int m_FogRegisters[kFogModeCount]; + unsigned m_FogFailed; // bit per fog mode +}; -- cgit v1.1-26-g67d0