21 #if (defined(_M_IX86) || defined(_X86_)) && !defined(STDFLOAT_DOUBLE) 22 DWORD d3dcolor, tempcolorval=255;
29 push ebx ; want to save
this in
case this fn is inlined
35 fistp tempcolorval ; no way to store directly to
int register 39 fld DWORD PTR [ecx+4] ;grn
46 fld DWORD PTR [ecx+8] ;blue
51 fld DWORD PTR [ecx+12] ;alpha
54 ; simulate pop 255.0 off FP stack w/o store, mark top as empty and increment stk ptr
68 return D3DCOLOR_COLORVALUE(cLColor[0], cLColor[1], cLColor[2], cLColor[3]);
75 INLINE D3DTEXTUREADDRESS DXGraphicsStateGuardian9::
76 get_texture_wrap_mode(SamplerState::WrapMode wm) {
78 case SamplerState::WM_clamp:
79 return D3DTADDRESS_CLAMP;
80 case SamplerState::WM_repeat:
81 return D3DTADDRESS_WRAP;
82 case SamplerState::WM_mirror:
83 return D3DTADDRESS_MIRROR;
84 case SamplerState::WM_mirror_once:
85 return D3DTADDRESS_MIRRORONCE;
86 case SamplerState::WM_border_color:
87 return D3DTADDRESS_BORDER;
89 dxgsg9_cat.error() <<
"Invalid Texture::Mode value" << std::endl;
90 return D3DTADDRESS_WRAP;
96 INLINE D3DFOGMODE DXGraphicsStateGuardian9::
97 get_fog_mode_type(Fog::Mode m) {
100 return D3DFOG_LINEAR;
101 case Fog::M_exponential:
103 case Fog::M_exponential_squared:
106 dxgsg9_cat.error() <<
"Invalid Fog::Mode value" << std::endl;
113 INLINE D3DTRANSFORMSTATETYPE DXGraphicsStateGuardian9::
114 get_tex_mat_sym(
int stage_index) {
115 return (D3DTRANSFORMSTATETYPE)(D3DTS_TEXTURE0 + stage_index);
122 INLINE
unsigned char *DXGraphicsStateGuardian9::
123 get_safe_buffer_start() {
124 if (_temp_buffer ==
nullptr) {
129 _temp_buffer =
new unsigned char[0x1ffff];
130 _safe_buffer_start = (
unsigned char *)(((uintptr_t)_temp_buffer + 0xffff) & ~0xffff);
133 return _safe_buffer_start;
136 #define ALWAYS_SET_RENDER_STATE true 148 if (ALWAYS_SET_RENDER_STATE || _render_state_array [state] != value)
150 hr = _d3d_device->SetRenderState(state, value);
151 _render_state_array [state] = value;
167 if (ALWAYS_SET_RENDER_STATE || _texture_stage_states_array [stage].state_array [type] != value)
169 hr = _d3d_device->SetTextureStageState(stage, type, value);
170 _texture_stage_states_array [stage].state_array [type] = value;
186 if (ALWAYS_SET_RENDER_STATE || _texture_render_states_array [sampler].state_array [type] != value)
188 hr = _d3d_device->SetSamplerState(sampler, type, value);
189 _texture_render_states_array [sampler].state_array [type] = value;
203 return _supports_render_texture;
HRESULT set_sampler_state(DWORD sampler, D3DSAMPLERSTATETYPE type, DWORD value)
This function creates a common layer between DX and Panda.
HRESULT set_texture_stage_state(DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value)
This function creates a common layer between DX and Panda.
bool get_supports_render_texture() const
Returns true if this particular GSG can render from a wdxGraphicsBuffer9 directly into a texture,...
static DWORD LColor_to_D3DCOLOR(const LColor &cLColor)
Converts Panda's floating-point LColor structure to DirectX's D3DCOLOR packed structure.
HRESULT set_render_state(D3DRENDERSTATETYPE state, DWORD value)
This function creates a common layer between DX and Panda for SetRenderState.