summaryrefslogtreecommitdiff
path: root/Runtime/GfxDevice/d3d/GpuProgramsD3D.h
blob: 6b21fa9efd18c6af95ef5cd9ea730dc34aaf5c5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
};