69#define VALUE_NAME_RENDER_DEVICE_NAME "RenderDeviceName"
70#define VALUE_NAME_RENDER_DEVICE_WIDTH "RenderDeviceWidth"
71#define VALUE_NAME_RENDER_DEVICE_HEIGHT "RenderDeviceHeight"
72#define VALUE_NAME_RENDER_DEVICE_DEPTH "RenderDeviceDepth"
73#define VALUE_NAME_RENDER_DEVICE_WINDOWED "RenderDeviceWindowed"
74#define VALUE_NAME_RENDER_DEVICE_TEXTURE_DEPTH "RenderDeviceTextureDepth"
84#define __volatile unsigned
109#define DX8_RECORD_MATRIX_CHANGE() matrix_changes++
110#define DX8_RECORD_MATERIAL_CHANGE() material_changes++
111#define DX8_RECORD_VERTEX_BUFFER_CHANGE() vertex_buffer_changes++
112#define DX8_RECORD_INDEX_BUFFER_CHANGE() index_buffer_changes++
113#define DX8_RECORD_LIGHT_CHANGE() light_changes++
114#define DX8_RECORD_TEXTURE_CHANGE() texture_changes++
115#define DX8_RECORD_RENDER_STATE_CHANGE() render_state_changes++
116#define DX8_RECORD_TEXTURE_STAGE_STATE_CHANGE() texture_stage_state_changes++
117#define DX8_RECORD_DRAW_CALLS() draw_calls++
127 if (res==D3D_OK)
return;
132#define DX8CALL_HRES(x,res) DX8_Assert(); res = DX8Wrapper::_Get_D3D_Device8()->x; DX8_ErrorCode(res); number_of_DX8_calls++;
133#define DX8CALL(x) DX8_Assert(); DX8_ErrorCode(DX8Wrapper::_Get_D3D_Device8()->x); number_of_DX8_calls++;
134#define DX8CALL_D3D(x) DX8_Assert(); DX8_ErrorCode(DX8Wrapper::_Get_D3D8()->x); number_of_DX8_calls++;
135#define DX8_THREAD_ASSERT() if (_DX8SingleThreaded) { WWASSERT_PRINT(DX8Wrapper::_Get_Main_Thread_ID()==ThreadClass::_Get_Current_Thread_ID(),"DX8Wrapper::DX8 calls must be called from the main thread!"); }
137#define DX8CALL_HRES(x,res) res = DX8Wrapper::_Get_D3D_Device8()->x; number_of_DX8_calls++;
138#define DX8CALL(x) DX8Wrapper::_Get_D3D_Device8()->x; number_of_DX8_calls++;
139#define DX8CALL_D3D(x) DX8Wrapper::_Get_D3D8()->x; number_of_DX8_calls++;
140#define DX8_THREAD_ASSERT() ;
144#define no_EXTENDED_STATS
152 bool m_disableTerrain;
154 bool m_disableObjects;
155 bool m_disableOverhead;
156 bool m_disableConsole;
157 int m_debugLinesToShow;
160 DX8_Stats::DX8_Stats(
void) {
161 m_disableConsole = m_showingStats = m_disableTerrain = m_disableWater = m_disableOverhead = m_disableObjects =
false;
163 m_debugLinesToShow = -1;
216 WORLD_CHANGED = 1<<0,
218 LIGHT0_CHANGED = 1<<2,
219 LIGHT1_CHANGED = 1<<3,
220 LIGHT2_CHANGED = 1<<4,
221 LIGHT3_CHANGED = 1<<5,
222 TEXTURE0_CHANGED= 1<<6,
223 TEXTURE1_CHANGED= 1<<7,
224 TEXTURE2_CHANGED= 1<<8,
225 TEXTURE3_CHANGED= 1<<9,
226 MATERIAL_CHANGED= 1<<14,
227 SHADER_CHANGED = 1<<15,
228 VERTEX_BUFFER_CHANGED = 1<<16,
229 INDEX_BUFFER_CHANGED = 1 << 17,
230 WORLD_IDENTITY= 1<<18,
231 VIEW_IDENTITY= 1<<19,
234 TEXTURE0_CHANGED|TEXTURE1_CHANGED|TEXTURE2_CHANGED|TEXTURE3_CHANGED,
236 LIGHT0_CHANGED|LIGHT1_CHANGED|LIGHT2_CHANGED|LIGHT3_CHANGED,
239 static void Draw_Sorting_IB_VB(
240 unsigned primitive_type,
241 unsigned short start_index,
242 unsigned short polygon_count,
243 unsigned short min_vertex_index,
244 unsigned short vertex_count);
247 unsigned primitive_type,
248 unsigned short start_index,
249 unsigned short polygon_count,
250 unsigned short min_vertex_index=0,
251 unsigned short vertex_count=0);
255 static DX8_Stats stats;
258 static bool Init(
void * hwnd,
bool lite =
false);
279 static void End_Scene(
bool flip_frame =
true);
284 static void Clear(
bool clear_color,
bool clear_z_stencil,
const Vector3 &color,
float dest_alpha=0.0f,
float z=1.0f,
unsigned int stencil=0);
286 static void Set_Viewport(CONST D3DVIEWPORT8* pViewport);
300 static void Set_Gamma(
float gamma,
float bright,
float contrast,
bool calibrate=
true,
bool uselimit=
true);
325 static void Set_DX8_Texture(
unsigned int stage, IDirect3DBaseTexture8* texture);
328 static void Set_Fog(
bool enable,
const Vector3 &color,
float start,
float end);
341 static void Set_Light(
unsigned index,
const D3DLIGHT8* light);
347 unsigned buffer_type,
348 unsigned short start_index,
349 unsigned short polygon_count,
350 unsigned short min_vertex_index,
351 unsigned short vertex_count);
353 unsigned short start_index,
354 unsigned short polygon_count,
355 unsigned short min_vertex_index,
356 unsigned short vertex_count);
358 unsigned short start_index,
359 unsigned short index_count,
360 unsigned short min_vertex_index,
361 unsigned short vertex_count);
374 D3DPOOL pool=D3DPOOL_MANAGED
383 D3DPOOL pool=D3DPOOL_MANAGED,
384 bool rendertarget=
false
394 D3DPOOL pool=D3DPOOL_MANAGED
404 D3DPOOL pool=D3DPOOL_MANAGED,
405 bool rendertarget=
false
416 IDirect3DSurface8* pSourceSurface,
417 CONST RECT* pSourceRectsArray,
419 IDirect3DSurface8* pDestinationSurface,
420 CONST POINT* pDestPointsArray
459 static void Set_Alpha (
const float alpha,
unsigned int &color);
489 static void Set_Render_Target (IDirect3DSurface8 *render_target,
bool use_default_depth_buffer =
false);
490 static void Set_Render_Target (IDirect3DSurface8* render_target, IDirect3DSurface8* dpeth_buffer);
587 static bool Set_Render_Device(
const char * dev_name,
int width=-1,
int height=-1,
int bits=-1,
int windowed=-1,
bool resize_window=
false);
588 static bool Set_Render_Device(
int dev=-1,
int resx=-1,
int resy=-1,
int bits=-1,
int windowed=-1,
bool resize_window =
false,
bool reset_device =
false,
bool restore_assets=
true);
596 static bool Set_Device_Resolution(
int width=-1,
int height=-1,
int bits=-1,
int windowed=-1,
bool resize_window=
false);
602 static bool Registry_Save_Render_Device(
const char *sub_key,
int device,
int width,
int height,
int depth,
bool windowed,
int texture_depth);
603 static bool Registry_Load_Render_Device(
const char * sub_key,
char *device,
int device_len,
int &width,
int &height,
int &depth,
int &windowed,
int &texture_depth);
616 static bool Find_Color_And_Z_Mode(
int resx,
int resy,
int bitdepth,D3DFORMAT * set_colorbuffer,D3DFORMAT * set_backbuffer, D3DFORMAT * set_zmode);
618 static bool Find_Z_Mode(D3DFORMAT colorbuffer,D3DFORMAT backbuffer, D3DFORMAT *zmode);
619 static bool Test_Z_Mode(D3DFORMAT colorbuffer,D3DFORMAT backbuffer, D3DFORMAT zmode);
741 int memsize=
sizeof(
Vector4)*count;
747 DX8CALL(SetVertexShaderConstant(reg,data,count));
752 int memsize=
sizeof(
Vector4)*count;
758 DX8CALL(SetPixelShaderConstant(reg,data,count));
771 SNAPSHOT_SAY((
"DX8 - SetTransform %d [%f,%f,%f,%f][%f,%f,%f,%f][%f,%f,%f,%f][%f,%f,%f,%f]\n",transform,m[0][0],m[0][1],m[0][2],m[0][3],m[1][0],m[1][1],m[1][2],m[1][3],m[2][0],m[2][1],m[2][2],m[2][3],m[3][0],m[3][1],m[3][2],m[3][3]));
773 DX8CALL(SetTransform(transform,(D3DMATRIX*)&m));
787 SNAPSHOT_SAY((
"DX8 - SetTransform %d [%f,%f,%f,%f][%f,%f,%f,%f][%f,%f,%f,%f]\n",transform,m[0][0],m[0][1],m[0][2],m[0][3],m[1][0],m[1][1],m[1][2],m[1][3],m[2][0],m[2][1],m[2][2],m[2][3]));
789 DX8CALL(SetTransform(transform,(D3DMATRIX*)&m));
795 DX8CALL(GetTransform(transform,(D3DMATRIX*)&m));
861 DX8CALL(SetLight(index,light));
879#ifdef MESH_RENDER_SNAPSHOT_ENABLED
883 SNAPSHOT_SAY((
"DX8 - SetRenderState(state: %s, value: %s)\n",
896 DX8CALL(SetClipPlane( Index, pPlane ));
908#ifdef MESH_RENDER_SNAPSHOT_ENABLED
912 SNAPSHOT_SAY((
"DX8 - SetTextureStageState(stage: %d, state: %s, value: %s)\n",
927 {
DX8CALL(SetTexture(stage, texture));
931 if (
Textures[stage]==texture)
return;
938 DX8CALL(SetTexture(stage, texture));
943 IDirect3DSurface8* pSourceSurface,
944 CONST RECT* pSourceRectsArray,
946 IDirect3DSurface8* pDestinationSurface,
947 CONST POINT* pDestPointsArray
961 col[3]=((color&0xff000000)>>24)/255.0f;
962 col[0]=((color&0xff0000)>>16)/255.0f;
963 col[1]=((color&0xff00)>>8)/255.0f;
964 col[2]=((color&0xff)>>0)/255.0f;
981 return D3DCOLOR_COLORVALUE(color.
X,color.
Y,color.
Z,alpha);
994 return D3DCOLOR_COLORVALUE(color.
X,color.
Y,color.
Z,color.
W);
1007 const float scale = 255.0;
1022 and eax,~(1024|2048)
1032 mov esi,dword ptr color
1033 fld dword ptr[
scale]
1036 fld dword ptr[esi+4]
1037 fld dword ptr[esi+8]
1038 fld dword ptr[alpha]
1044 fistp dword ptr[esp+0]
1045 fistp dword ptr[esp+4]
1046 fistp dword ptr[esp+8]
1047 fistp dword ptr[esp+12]
1084 for (
int i=0;i<4;++i) {
1085 float f=(color[i]<0.0f) ? 0.0f : color[i];
1086 color[i]=(f>1.0f) ? 1.0f : f;
1093 mov esi,dword ptr color
1097 mov edi,dword ptr[esi]
1104 mov dword ptr[esi],edi
1106 mov edi,dword ptr[esi+4]
1113 mov dword ptr[esi+4],edi
1115 mov edi,dword ptr[esi+8]
1122 mov dword ptr[esi+8],edi
1124 mov edi,dword ptr[esi+12]
1131 mov dword ptr[esi+12],edi
1158 unsigned char *component = (
unsigned char*) &color;
1160 component [3] = 255.0f * alpha;
1204#ifdef MESH_RENDER_SNAPSHOT_ENABLED
1218 float tmp_zbias=
ZBias;
1219 tmp_zbias*=(1.0f/16.0f);
1221 tmp[2][2]-=tmp_zbias*tmp[3][2];
1222 DX8CALL(SetTransform(D3DTS_PROJECTION,(D3DMATRIX*)&tmp));
1231 if (zbias==
ZBias)
return;
1232 if (zbias>15) zbias=15;
1233 if (zbias<0) zbias=0;
1238 float tmp_zbias=
ZBias;
1239 tmp_zbias*=(1.0f/16.0f);
1241 tmp[2][2]-=tmp_zbias*tmp[3][2];
1242 DX8CALL(SetTransform(D3DTS_PROJECTION,(D3DMATRIX*)&tmp));
1251 switch ((
int)transform) {
1262 case D3DTS_PROJECTION:
1273 DX8CALL(SetTransform(transform,(D3DMATRIX*)&m2));
1281 switch ((
int)transform) {
1295 DX8CALL(SetTransform(transform,(D3DMATRIX*)&m2));
1328 switch ((
int)transform) {
1338 DX8CALL(GetTransform(transform,&mat));
1445 unsigned lnt
prevVer = 0x00000000;
1447 for(
unsigned t = 0; t < crib; ++t )
1449 (D3D2_BASE_VEC)
nextVer += name[t];
Color scale(const Color &a, const Color &b)
void add(float *sum, float *addend)
static bool Has_CMOV_Instruction()
virtual void ReleaseResources(void)=0
virtual void ReAcquireResources(void)=0
static int Get_Swap_Interval(void)
static const char * Get_DX8_Fill_Mode_Name(unsigned value)
static unsigned Get_Last_Frame_Texture_Stage_State_Changes()
static void Set_World_Identity()
static LightEnvironmentClass * Get_Light_Environment()
static unsigned Get_DX8_Render_State(D3DRENDERSTATETYPE state)
static bool Is_Device_Lost()
static void Set_Vertex_Buffer(const VertexBufferClass *vb, unsigned stream=0)
static void Begin_Scene(void)
static const char * Get_DX8_Stencil_Op_Name(unsigned value)
static IDirect3DDevice8 * _Get_D3D_Device8()
static bool Test_Z_Mode(D3DFORMAT colorbuffer, D3DFORMAT backbuffer, D3DFORMAT zmode)
static void Begin_Statistics()
static unsigned TextureStageStates[MAX_TEXTURE_STAGES][32]
static unsigned Get_Last_Frame_Material_Changes()
static bool IsRenderToTexture
static LightEnvironmentClass * Light_Environment
static const char * Get_DX8_Vertex_Blend_Flag_Name(unsigned value)
static void Set_Vertex_Shader_Constant(int reg, const void *data, int count)
static int CurRenderDevice
static void Set_Texture(unsigned stage, TextureBaseClass *texture)
static DWORD Vertex_Processing_Behavior
static bool Set_Next_Render_Device(void)
static void Set_DX8_Material(const D3DMATERIAL8 *mat)
static bool Is_Initted(void)
static void _Update_Texture(TextureClass *system, TextureClass *video)
static void Clear(bool clear_color, bool clear_z_stencil, const Vector3 &color, float dest_alpha=0.0f, float z=1.0f, unsigned int stencil=0)
Clear current render device.
static const char * Get_DX8_Texture_Stage_State_Name(D3DTEXTURESTAGESTATETYPE state)
static void Set_Index_Buffer_Index_Offset(unsigned offset)
static IDirect3DTexture8 * _Create_DX8_Texture(unsigned int width, unsigned int height, WW3DFormat format, MipCountType mip_level_count, D3DPOOL pool=D3DPOOL_MANAGED, bool rendertarget=false)
static unsigned long FrameCount
static void Do_Onetime_Device_Dependent_Inits(void)
static RenderStateStruct render_state
static const char * Get_DX8_Fog_Mode_Name(unsigned value)
static void Set_View_Identity()
static void Get_Format_Name(unsigned int format, StringClass *tex_format)
static void Get_Shader(ShaderClass &shader)
static unsigned Get_Last_Frame_Vertex_Buffer_Changes()
static IDirect3DSurface8 * _Get_DX8_Front_Buffer()
static bool Validate_Device(void)
static void _Enable_Triangle_Draw(bool enable)
static bool Find_Color_Mode(D3DFORMAT colorbuffer, int resx, int resy, UINT *mode)
static IDirect3DSurface8 * CurrentDepthBuffer
friend class DX8IndexBufferClass
static const char * Get_DX8_ZBuffer_Type_Name(unsigned value)
static void Set_Projection_Transform_With_Z_Bias(const Matrix4x4 &matrix, float znear, float zfar)
static unsigned light_changes
static void Set_Default_Global_Render_States(void)
static D3DMATRIX old_world
static void Set_Polygon_Mode(int mode)
static IDirect3D8 * _Get_D3D8()
static int Get_Render_Device(void)
static const DX8Caps * Get_Current_Caps()
static ZTextureClass * Shadow_Map[MAX_SHADOW_MAPS]
static void Shutdown(void)
static IDirect3DCubeTexture8 * _Create_DX8_Cube_Texture(unsigned int width, unsigned int height, WW3DFormat format, MipCountType mip_level_count, D3DPOOL pool=D3DPOOL_MANAGED, bool rendertarget=false)
static SurfaceClass * _Get_DX8_Back_Buffer(unsigned int num=0)
static unsigned RenderStates[256]
static D3DADAPTER_IDENTIFIER8 CurrentAdapterIdentifier
static bool world_identity
static DWORD Pixel_Shader
static void Set_DX8_Clip_Plane(DWORD Index, CONST float *pPlane)
static WWINLINE const D3DLIGHT8 & Peek_Light(unsigned index)
static void Set_Light(unsigned index, const D3DLIGHT8 *light)
static const char * Get_DX8_Shade_Mode_Name(unsigned value)
static void Get_Device_Resolution(int &set_w, int &set_h, int &set_bits, bool &set_windowed)
static unsigned _MainThreadID
static void Set_Ambient(const Vector3 &color)
static void Set_Shadow_Map(int idx, ZTextureClass *ztex)
static D3DCOLOR Get_Fog_Color()
static bool Get_Fog_Enable()
static IDirect3DSwapChain8 * Create_Additional_Swap_Chain(HWND render_window)
static Vector4 Pixel_Shader_Constants[MAX_PIXEL_SHADER_CONSTANTS]
static void Set_DX8_Texture(unsigned int stage, IDirect3DBaseTexture8 *texture)
static DX8_CleanupHook * m_pCleanupHook
static const char * Get_DX8_Texture_Filter_Name(unsigned value)
static bool Set_Any_Render_Device(void)
static void Invalidate_Cached_Render_States(void)
static bool Init(void *hwnd, bool lite=false)
static void Set_Light_Environment(LightEnvironmentClass *light_env)
Set the light environment. This is a lighting model which used up to four directional lights to produ...
static int ResolutionWidth
static void Flip_To_Primary(void)
static unsigned texture_changes
static unsigned DrawPolygonLowBoundLimit
static void End_Scene(bool flip_frame=true)
static const char * Get_DX8_Texture_Op_Name(unsigned value)
static void Set_Alpha(const float alpha, unsigned int &color)
static unsigned vertex_buffer_changes
static unsigned int Get_Free_Texture_RAM()
static void SetCleanupHook(DX8_CleanupHook *pCleanupHook)
static bool Toggle_Windowed(void)
static void Set_Pixel_Shader_Constant(int reg, const void *data, int count)
static bool Create_Device(void)
static void Get_DX8_Texture_Stage_State_Value_Name(StringClass &name, D3DTEXTURESTAGESTATETYPE state, unsigned value)
static IDirect3DSurface8 * CurrentRenderTarget
static void Set_Draw_Polygon_Low_Bound_Limit(unsigned n)
static void Clamp_Color(Vector4 &color)
static const char * Get_DX8_Material_Source_Name(unsigned value)
static bool Set_Render_Device(const char *dev_name, int width=-1, int height=-1, int bits=-1, int windowed=-1, bool resize_window=false)
static D3DFORMAT DisplayFormat
static void Enumerate_Devices()
static bool _Is_Triangle_Draw_Enabled()
static unsigned _Get_Main_Thread_ID()
static IDirect3DSurface8 * DefaultRenderTarget
static void Set_DX8_Texture_Stage_State(unsigned stage, D3DTEXTURESTAGESTATETYPE state, unsigned value)
static unsigned texture_stage_state_changes
static void Apply_Default_State()
Resets render device to default state.
static int Get_Device_Resolution_Width(void)
static int TextureBitDepth
static DWORD Get_Vertex_Processing_Behavior()
static const char * Get_DX8_Texture_Arg_Name(unsigned value)
static WW3DFormat getBackBufferFormat(void)
Returns the display format - added by TR for video playback - not part of W3D.
static unsigned long Get_FrameCount(void)
static const char * Get_DX8_Texture_Address_Name(unsigned value)
static void Compute_Caps(WW3DFormat display_format)
static void _Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform, const Matrix4x4 &m)
static DX8Caps * CurrentCaps
static void Set_Index_Buffer(const IndexBufferClass *ib, unsigned short index_base_offset)
static unsigned int Convert_Color_Clamp(const Vector4 &color)
static RenderInfoClass * Render_Info
static void _Get_DX8_Transform(D3DTRANSFORMSTATETYPE transform, Matrix4x4 &m)
static WWINLINE bool Is_Light_Enabled(unsigned index)
static void Set_Gamma(float gamma, float bright, float contrast, bool calibrate=true, bool uselimit=true)
static const char * Get_DX8_Cmp_Func_Name(unsigned value)
static void Set_DX8_ZBias(int zbias)
static IDirect3DSurface8 * _Create_DX8_Surface(unsigned int width, unsigned int height, WW3DFormat format)
static unsigned Get_Last_Frame_Light_Changes()
static bool Is_View_Identity()
static void Set_Texture_Bitdepth(int depth)
static unsigned Get_Last_Frame_Texture_Changes()
static bool Reset_Device(bool reload_assets=true)
static void Set_Vertex_Shader(DWORD vertex_shader)
static void Set_Pixel_Shader(DWORD pixel_shader)
static Vector4 Convert_Color(unsigned color)
static unsigned matrix_changes
static const char * Get_DX8_Patch_Edge_Style_Name(unsigned value)
static void Draw_Strip(unsigned short start_index, unsigned short index_count, unsigned short min_vertex_index, unsigned short vertex_count)
static Vector4 Vertex_Shader_Constants[MAX_VERTEX_SHADER_CONSTANTS]
static const char * Get_DX8_Debug_Monitor_Token_Name(unsigned value)
static const char * Get_DX8_Cull_Mode_Name(unsigned value)
static unsigned render_state_changes
static void End_Statistics()
static IDirect3DBaseTexture8 * Textures[MAX_TEXTURE_STAGES]
static void _Copy_DX8_Rects(IDirect3DSurface8 *pSourceSurface, CONST RECT *pSourceRectsArray, UINT cRects, IDirect3DSurface8 *pDestinationSurface, CONST POINT *pDestPointsArray)
static unsigned Get_Last_Frame_Draw_Calls()
static int Get_Render_Device_Count(void)
static bool Is_World_Identity()
static void Do_Onetime_Device_Dependent_Shutdowns(void)
static bool Set_Device_Resolution(int width=-1, int height=-1, int bits=-1, int windowed=-1, bool resize_window=false)
static const char * Get_DX8_Render_State_Name(D3DRENDERSTATETYPE state)
static bool Is_Windowed(void)
static void Set_Render_Target_With_Z(TextureClass *texture, ZTextureClass *ztexture=NULL)
static const char * Get_DX8_Blend_Name(unsigned value)
static IDirect3DDevice8 * D3DDevice
static void Get_Render_Target_Resolution(int &set_w, int &set_h, int &set_bits, bool &set_windowed)
static void Draw_Triangles(unsigned buffer_type, unsigned short start_index, unsigned short polygon_count, unsigned short min_vertex_index, unsigned short vertex_count)
static int Get_Texture_Bitdepth(void)
static unsigned render_state_changed
static void Set_Viewport(CONST D3DVIEWPORT8 *pViewport)
static const char * Get_Render_Device_Name(int device_index)
static bool Has_Stencil(void)
static void Set_Material(const VertexMaterialClass *material)
static unsigned index_buffer_changes
static void Get_DX8_Render_State_Value_Name(StringClass &name, D3DRENDERSTATETYPE state, unsigned value)
static void Set_DX8_Light(int index, D3DLIGHT8 *light)
static ZTextureClass * Get_Shadow_Map(int idx)
static unsigned Get_Last_Frame_Matrix_Changes()
static void Set_Shader(const ShaderClass &shader)
static TextureClass * Create_Render_Target(int width, int height, WW3DFormat format=WW3D_FORMAT_UNKNOWN)
static IDirect3DTexture8 * _Create_DX8_ZTexture(unsigned int width, unsigned int height, WW3DZFormat zformat, MipCountType mip_level_count, D3DPOOL pool=D3DPOOL_MANAGED)
static void Set_Swap_Interval(int swap)
static const RenderDeviceDescClass & Get_Render_Device_Desc(int deviceidx)
friend class DX8VertexBufferClass
static bool CurrentDX8LightEnables[4]
static const D3DADAPTER_IDENTIFIER8 & Get_Current_Adapter_Identifier()
static bool Registry_Save_Render_Device(const char *sub_key)
static void Get_Transform(D3DTRANSFORMSTATETYPE transform, Matrix4x4 &m)
static void Set_Transform(D3DTRANSFORMSTATETYPE transform, const Matrix4x4 &m)
static void Set_Fog(bool enable, const Vector3 &color, float start, float end)
static const char * Get_DX8_Blend_Op_Name(unsigned value)
static Matrix4x4 ProjectionMatrix
static void Apply_Render_State_Changes()
static void Set_DX8_Render_State(D3DRENDERSTATETYPE state, unsigned value)
static void Release_Render_State()
static IDirect3DSurface8 * DefaultDepthBuffer
static void Reset_Statistics()
static D3DMATRIX old_view
static Vector3 Ambient_Color
static bool Registry_Load_Render_Device(const char *sub_key, bool resize_window)
static DWORD Vertex_Shader
static unsigned Get_Last_Frame_Render_State_Changes()
static void Flush_DX8_Resource_Manager(unsigned int bytes=0)
static bool Find_Z_Mode(D3DFORMAT colorbuffer, D3DFORMAT backbuffer, D3DFORMAT *zmode)
static IDirect3D8 * D3DInterface
static void Get_Render_State(RenderStateStruct &state)
static IDirect3DVolumeTexture8 * _Create_DX8_Volume_Texture(unsigned int width, unsigned int height, unsigned int depth, WW3DFormat format, MipCountType mip_level_count, D3DPOOL pool=D3DPOOL_MANAGED)
static void Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default_depth_buffer=false)
static const char * Get_DX8_Texture_Transform_Flag_Name(unsigned value)
static unsigned material_changes
static unsigned draw_calls
static Matrix4x4 DX8Transforms[D3DTS_WORLD+1]
static bool _EnableTriangleDraw
static bool Find_Color_And_Z_Mode(int resx, int resy, int bitdepth, D3DFORMAT *set_colorbuffer, D3DFORMAT *set_backbuffer, D3DFORMAT *set_zmode)
static int Get_Device_Resolution_Height(void)
static int ResolutionHeight
static unsigned Get_Last_Frame_DX8_Calls()
static void Set_Render_State(const RenderStateStruct &state)
static bool Is_Render_To_Texture(void)
static void Release_Device(void)
static unsigned Get_Last_Frame_Index_Buffer_Changes()
static const Vector3 & Get_Ambient()
WWINLINE void Make_Identity(void)
WWINLINE Matrix4x4 Transpose(void) const
const StringClass & Get_Description(StringClass &str) const
const char * Get_Name(void) const
static bool Is_Snapshot_Activated()
unsigned number_of_DX8_calls
const unsigned MAX_SHADOW_MAPS
@ BUFFER_TYPE_DYNAMIC_DX8
@ BUFFER_TYPE_DYNAMIC_SORTING
const unsigned MAX_PIXEL_SHADER_CONSTANTS
void Log_DX8_ErrorCode(unsigned res)
const unsigned MAX_TEXTURE_STAGES
WWINLINE unsigned flimby(char *name, unsigned crib)
#define DX8_RECORD_LIGHT_CHANGE()
#define DX8_RECORD_TEXTURE_STAGE_STATE_CHANGE()
#define DX8_RECORD_MATERIAL_CHANGE()
#define DX8_RECORD_MATRIX_CHANGE()
#define DX8_RECORD_TEXTURE_CHANGE()
#define DX8_RECORD_RENDER_STATE_CHANGE()
const unsigned MAX_VERTEX_STREAMS
WWINLINE void DX8_ErrorCode(unsigned res)
const unsigned MAX_VERTEX_SHADER_CONSTANTS
#define REF_PTR_RELEASE(x)
#define REF_PTR_SET(dst, src)
unsigned vertex_buffer_types[MAX_VERTEX_STREAMS]
unsigned short index_base_offset
RenderStateStruct & operator=(const RenderStateStruct &src)
unsigned short vba_offset
unsigned short iba_offset
IndexBufferClass * index_buffer
TextureBaseClass * Textures[MAX_TEXTURE_STAGES]
unsigned index_buffer_type
VertexMaterialClass * material
VertexBufferClass * vertex_buffers[MAX_VERTEX_STREAMS]