mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
some changes to support reflection map and fixes a crash bug with windo/fullscreen mode switch
This commit is contained in:
parent
e10c64cdb3
commit
d582986396
@ -278,6 +278,8 @@ set_vertex_format(DWORD NewFvfType) {
|
|||||||
if (_CurFVFType != NewFvfType) {
|
if (_CurFVFType != NewFvfType) {
|
||||||
_CurFVFType = NewFvfType;
|
_CurFVFType = NewFvfType;
|
||||||
|
|
||||||
|
// dxgsg8_cat.info() << "current fvf " << _CurFVFType << endl;
|
||||||
|
|
||||||
HRESULT hr = _pD3DDevice->SetVertexShader(NewFvfType);
|
HRESULT hr = _pD3DDevice->SetVertexShader(NewFvfType);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if(FAILED(hr)) {
|
if(FAILED(hr)) {
|
||||||
@ -527,10 +529,26 @@ compute_distance_to(const LPoint3f &point) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE D3DTEXTUREADDRESS DXGraphicsStateGuardian8::
|
INLINE D3DTEXTUREADDRESS DXGraphicsStateGuardian8::
|
||||||
get_texture_wrap_mode(Texture::WrapMode wm) const {
|
get_texture_wrap_mode(Texture::WrapMode wm) const {
|
||||||
|
#if 0
|
||||||
static D3DTEXTUREADDRESS PandaTexWrapMode_to_D3DTexWrapMode[Texture::WM_invalid] = {
|
static D3DTEXTUREADDRESS PandaTexWrapMode_to_D3DTexWrapMode[Texture::WM_invalid] = {
|
||||||
D3DTADDRESS_CLAMP,D3DTADDRESS_WRAP,D3DTADDRESS_MIRROR,D3DTADDRESS_MIRRORONCE,D3DTADDRESS_BORDER};
|
D3DTADDRESS_CLAMP,D3DTADDRESS_WRAP,D3DTADDRESS_MIRROR,D3DTADDRESS_MIRRORONCE,D3DTADDRESS_BORDER};
|
||||||
|
|
||||||
return PandaTexWrapMode_to_D3DTexWrapMode[wm];
|
return PandaTexWrapMode_to_D3DTexWrapMode[wm];
|
||||||
|
#endif
|
||||||
|
switch (wm) {
|
||||||
|
case Texture::WM_clamp:
|
||||||
|
return D3DTADDRESS_CLAMP;
|
||||||
|
case Texture::WM_repeat:
|
||||||
|
return D3DTADDRESS_WRAP;
|
||||||
|
case Texture::WM_mirror:
|
||||||
|
return D3DTADDRESS_MIRROR;
|
||||||
|
case Texture::WM_mirror_once:
|
||||||
|
return D3DTADDRESS_MIRRORONCE;
|
||||||
|
case Texture::WM_border_color:
|
||||||
|
return D3DTADDRESS_BORDER;
|
||||||
|
}
|
||||||
|
dxgsg8_cat.error() << "Invalid Texture::Mode value" << endl;
|
||||||
|
return D3DTADDRESS_WRAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1264,6 +1264,7 @@ draw_prim_setup(const Geom *geom) {
|
|||||||
|
|
||||||
vi = geom->make_vertex_iterator();
|
vi = geom->make_vertex_iterator();
|
||||||
DWORD newFVFflags = D3DFVF_XYZ;
|
DWORD newFVFflags = D3DFVF_XYZ;
|
||||||
|
|
||||||
size_t vertex_size = sizeof(float) * 3;
|
size_t vertex_size = sizeof(float) * 3;
|
||||||
|
|
||||||
GeomBindType ColorBinding=geom->get_binding(G_COLOR);
|
GeomBindType ColorBinding=geom->get_binding(G_COLOR);
|
||||||
@ -1324,7 +1325,9 @@ draw_prim_setup(const Geom *geom) {
|
|||||||
//////
|
//////
|
||||||
|
|
||||||
ti = geom->make_texcoord_iterator();
|
ti = geom->make_texcoord_iterator();
|
||||||
|
|
||||||
newFVFflags |= (D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0));
|
newFVFflags |= (D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0));
|
||||||
|
|
||||||
vertex_size += sizeof(float) * 2;
|
vertex_size += sizeof(float) * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3503,24 +3506,32 @@ issue_tex_gen(const TexGenAttrib *attrib) {
|
|||||||
|
|
||||||
} else if (attrib->get_mode() == TexGenAttrib::M_spherical) {
|
} else if (attrib->get_mode() == TexGenAttrib::M_spherical) {
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// best reflection on a sphere is achieved by camera space normals in directx
|
||||||
|
_pD3DDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX,
|
||||||
|
D3DTSS_TCI_CAMERASPACENORMAL);
|
||||||
// We have set up the texture matrix to scale and translate the
|
// We have set up the texture matrix to scale and translate the
|
||||||
// texture coordinates to get from camera space (-1, +1) to
|
// texture coordinates to get from camera space (-1, +1) to
|
||||||
// texture space (0,1)
|
// texture space (0,1)
|
||||||
LMatrix4f dm(0.5f, 0.0f, 0.0f, 0.0f,
|
LMatrix4f dm(0.5f, 0.0f, 0.0f, 0.0f,
|
||||||
0.0f, 0.5f, 0.0f, 0.0f,
|
0.0f, 0.5f, 0.0f, 0.0f,
|
||||||
0.0f, 0.0f, 0.0f, 0.0f,
|
0.0f, 0.0f, 1.0f, 0.0f,
|
||||||
0.5f, 0.5f, 0.0f, 0.0f);
|
0.5f, 0.5f, 0.0f, 1.0f);
|
||||||
|
#else
|
||||||
|
// since this is a reflection map, we want the camera space
|
||||||
|
// reflection vector. A close approximation of the asin(theta)/pi
|
||||||
|
// + 0.5 is achieved by the following matrix
|
||||||
|
_pD3DDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX,
|
||||||
|
D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR);
|
||||||
|
LMatrix4f dm(0.33f, 0.0f, 0.0f, 0.0f,
|
||||||
|
0.0f, 0.33f, 0.0f, 0.0f,
|
||||||
|
0.0f, 0.0f, 1.0f, 0.0f,
|
||||||
|
0.5f, 0.5f, 0.0f, 1.0f);
|
||||||
|
#endif
|
||||||
_pD3DDevice->SetTransform(D3DTS_TEXTURE0, (D3DMATRIX *)dm.get_data());
|
_pD3DDevice->SetTransform(D3DTS_TEXTURE0, (D3DMATRIX *)dm.get_data());
|
||||||
_pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS,
|
_pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS,
|
||||||
D3DTTFF_COUNT2);
|
D3DTTFF_COUNT2);
|
||||||
#if 0
|
//_pD3DDevice->SetRenderState(D3DRS_LOCALVIEWER, false);
|
||||||
_pD3DDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX,
|
|
||||||
D3DTSS_TCI_CAMERASPACENORMAL);
|
|
||||||
#else
|
|
||||||
_pD3DDevice->SetRenderState(D3DRS_LOCALVIEWER, TRUE);
|
|
||||||
_pD3DDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX,
|
|
||||||
D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ typedef enum {
|
|||||||
A8_FLAG = FLG(8),
|
A8_FLAG = FLG(8),
|
||||||
A8R3G3B2_FLAG = FLG(9),
|
A8R3G3B2_FLAG = FLG(9),
|
||||||
X4R4G4B4_FLAG = FLG(10),
|
X4R4G4B4_FLAG = FLG(10),
|
||||||
A2B10G10R10_FLAG = FLG(11),
|
A2R10G10B10_FLAG = FLG(11),
|
||||||
G16R16_FLAG = FLG(12),
|
G16R16_FLAG = FLG(12),
|
||||||
A8P8_FLAG = FLG(13),
|
A8P8_FLAG = FLG(13),
|
||||||
P8_FLAG = FLG(14),
|
P8_FLAG = FLG(14),
|
||||||
|
@ -527,7 +527,6 @@ search_for_valid_displaymode(DXScreenData &scrn,
|
|||||||
// if (_dxgsg->scrn.bIsLowVidMemCard)
|
// if (_dxgsg->scrn.bIsLowVidMemCard)
|
||||||
// nassertv((RequestedX_Size==640)&&(RequestedY_Size==480));
|
// nassertv((RequestedX_Size==640)&&(RequestedY_Size==480));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*pSuggestedPixFmt = D3DFMT_UNKNOWN;
|
*pSuggestedPixFmt = D3DFMT_UNKNOWN;
|
||||||
*pSupportedScreenDepthsMask = 0x0;
|
*pSupportedScreenDepthsMask = 0x0;
|
||||||
*pCouldntFindAnyValidZBuf = false;
|
*pCouldntFindAnyValidZBuf = false;
|
||||||
@ -570,7 +569,8 @@ search_for_valid_displaymode(DXScreenData &scrn,
|
|||||||
(dispmode.Height!=RequestedY_Size)) {
|
(dispmode.Height!=RequestedY_Size)) {
|
||||||
if (bVerboseMode) {
|
if (bVerboseMode) {
|
||||||
wdxdisplay8_cat.info()
|
wdxdisplay8_cat.info()
|
||||||
<< "Mode dimension found " << dispmode.Width << "x" << dispmode.Height
|
<< "Mode dimension " << dispmode.Width << "x" << dispmode.Height
|
||||||
|
<< " and format " << dispmode.Format
|
||||||
<< ": continuing onto next mode\n";
|
<< ": continuing onto next mode\n";
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -715,6 +715,11 @@ search_for_valid_displaymode(DXScreenData &scrn,
|
|||||||
<< "Validated Mode (" << RequestedX_Size << "x"
|
<< "Validated Mode (" << RequestedX_Size << "x"
|
||||||
<< RequestedY_Size << "," << D3DFormatStr(dispmode.Format) << endl;
|
<< RequestedY_Size << "," << D3DFormatStr(dispmode.Format) << endl;
|
||||||
|
|
||||||
|
/*
|
||||||
|
// dx8 valid display modes for render targets.
|
||||||
|
D3DFMT_X1R5G5B5, D3DFMT_R5G6B5, D3DFMT_X8R8G8B8, and D3DFMT_A8R8G8B8
|
||||||
|
*/
|
||||||
|
|
||||||
switch (dispmode.Format) {
|
switch (dispmode.Format) {
|
||||||
case D3DFMT_X1R5G5B5:
|
case D3DFMT_X1R5G5B5:
|
||||||
*pSupportedScreenDepthsMask |= X1R5G5B5_FLAG;
|
*pSupportedScreenDepthsMask |= X1R5G5B5_FLAG;
|
||||||
@ -722,15 +727,15 @@ search_for_valid_displaymode(DXScreenData &scrn,
|
|||||||
case D3DFMT_X8R8G8B8:
|
case D3DFMT_X8R8G8B8:
|
||||||
*pSupportedScreenDepthsMask |= X8R8G8B8_FLAG;
|
*pSupportedScreenDepthsMask |= X8R8G8B8_FLAG;
|
||||||
break;
|
break;
|
||||||
case D3DFMT_R8G8B8:
|
case D3DFMT_A8R8G8B8:
|
||||||
*pSupportedScreenDepthsMask |= R8G8B8_FLAG;
|
*pSupportedScreenDepthsMask |= A8R8G8B8_FLAG;
|
||||||
break;
|
break;
|
||||||
case D3DFMT_R5G6B5:
|
case D3DFMT_R5G6B5:
|
||||||
*pSupportedScreenDepthsMask |= R5G6B5_FLAG;
|
*pSupportedScreenDepthsMask |= R5G6B5_FLAG;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Render target formats should be only D3DFMT_X1R5G5B5,
|
// Render target formats should be only D3DFMT_X1R5G5B5,
|
||||||
// D3DFMT_R5G6B5, D3DFMT_X8R8G8B8 (or R8G8B8?)
|
// D3DFMT_R5G6B5, D3DFMT_X8R8G8B8 and D3DFMT_A8R8G8B8
|
||||||
wdxdisplay8_cat.error()
|
wdxdisplay8_cat.error()
|
||||||
<< "unrecognized supported fmt "<< D3DFormatStr(dispmode.Format)
|
<< "unrecognized supported fmt "<< D3DFormatStr(dispmode.Format)
|
||||||
<< " returned by EnumAdapterDisplayModes!\n";
|
<< " returned by EnumAdapterDisplayModes!\n";
|
||||||
@ -741,8 +746,8 @@ search_for_valid_displaymode(DXScreenData &scrn,
|
|||||||
// memory & speed reasons on some older cards in particular
|
// memory & speed reasons on some older cards in particular
|
||||||
if (*pSupportedScreenDepthsMask & X8R8G8B8_FLAG) {
|
if (*pSupportedScreenDepthsMask & X8R8G8B8_FLAG) {
|
||||||
*pSuggestedPixFmt = D3DFMT_X8R8G8B8;
|
*pSuggestedPixFmt = D3DFMT_X8R8G8B8;
|
||||||
} else if (*pSupportedScreenDepthsMask & R8G8B8_FLAG) {
|
} else if (*pSupportedScreenDepthsMask & A8R8G8B8_FLAG) {
|
||||||
*pSuggestedPixFmt = D3DFMT_R8G8B8;
|
*pSuggestedPixFmt = D3DFMT_A8R8G8B8;
|
||||||
} else if (*pSupportedScreenDepthsMask & R5G6B5_FLAG) {
|
} else if (*pSupportedScreenDepthsMask & R5G6B5_FLAG) {
|
||||||
*pSuggestedPixFmt = D3DFMT_R5G6B5;
|
*pSuggestedPixFmt = D3DFMT_R5G6B5;
|
||||||
} else if (*pSupportedScreenDepthsMask & X1R5G5B5_FLAG) {
|
} else if (*pSupportedScreenDepthsMask & X1R5G5B5_FLAG) {
|
||||||
|
@ -16,6 +16,78 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if defined(_DEBUG) || defined(COUNT_DRAWPRIMS)
|
||||||
|
typedef enum {DrawPrim,DrawIndexedPrim} DP_Type;
|
||||||
|
static const char *DP_Type_Strs[3] = {"DrawPrimitive","DrawIndexedPrimitive"};
|
||||||
|
|
||||||
|
void INLINE TestDrawPrimFailure(DP_Type dptype,HRESULT hr,IDirect3DDevice9 *pD3DDevice,DWORD nVerts,DWORD nTris) {
|
||||||
|
if(FAILED(hr)) {
|
||||||
|
// loss of exclusive mode is not a real DrawPrim problem, ignore it
|
||||||
|
HRESULT testcooplvl_hr = pD3DDevice->TestCooperativeLevel();
|
||||||
|
if((testcooplvl_hr != D3DERR_DEVICELOST)||(testcooplvl_hr != D3DERR_DEVICENOTRESET)) {
|
||||||
|
dxgsg9_cat.fatal() << DP_Type_Strs[dptype] << "() failed: result = " << D3DERRORSTRING(hr);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CountDPs(nVerts,nTris);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define TestDrawPrimFailure(a,b,c,nVerts,nTris) CountDPs(nVerts,nTris);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
INLINE DWORD
|
||||||
|
Colorf_to_D3DCOLOR(const Colorf &cColorf) {
|
||||||
|
// MS VC defines _M_IX86 for x86. gcc should define _X86_
|
||||||
|
#if defined(_M_IX86) || defined(_X86_)
|
||||||
|
DWORD d3dcolor,tempcolorval=255;
|
||||||
|
|
||||||
|
// note the default FPU rounding mode will give 255*0.5f=0x80, not 0x7F as VC would force it to by resetting rounding mode
|
||||||
|
// dont think this makes much difference
|
||||||
|
|
||||||
|
__asm {
|
||||||
|
push ebx ; want to save this in case this fn is inlined
|
||||||
|
push ecx
|
||||||
|
mov ecx, cColorf
|
||||||
|
fild tempcolorval
|
||||||
|
fld DWORD PTR [ecx]
|
||||||
|
fmul ST(0),ST(1)
|
||||||
|
fistp tempcolorval ; no way to store directly to int register
|
||||||
|
mov eax, tempcolorval
|
||||||
|
shl eax, 16
|
||||||
|
|
||||||
|
fld DWORD PTR [ecx+4] ;grn
|
||||||
|
fmul ST(0),ST(1)
|
||||||
|
fistp tempcolorval
|
||||||
|
mov ebx,tempcolorval
|
||||||
|
shl ebx, 8
|
||||||
|
or eax,ebx
|
||||||
|
|
||||||
|
fld DWORD PTR [ecx+8] ;blue
|
||||||
|
fmul ST(0),ST(1)
|
||||||
|
fistp tempcolorval
|
||||||
|
or eax,tempcolorval
|
||||||
|
|
||||||
|
fld DWORD PTR [ecx+12] ;alpha
|
||||||
|
fmul ST(0),ST(1)
|
||||||
|
fistp tempcolorval
|
||||||
|
; simulate pop 255.0 off FP stack w/o store, mark top as empty and increment stk ptr
|
||||||
|
ffree ST(0)
|
||||||
|
fincstp
|
||||||
|
mov ebx,tempcolorval
|
||||||
|
shl ebx, 24
|
||||||
|
or eax,ebx
|
||||||
|
mov d3dcolor,eax
|
||||||
|
pop ecx
|
||||||
|
pop ebx
|
||||||
|
}
|
||||||
|
|
||||||
|
// dxgsg9_cat.debug() << (void*)d3dcolor << endl;
|
||||||
|
return d3dcolor;
|
||||||
|
#else //!_X86_
|
||||||
|
return MY_D3DRGBA(cColorf[0], cColorf[1], cColorf[2], cColorf[3]);
|
||||||
|
#endif //!_X86_
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian9::enable_line_smooth
|
// Function: DXGraphicsStateGuardian9::enable_line_smooth
|
||||||
@ -369,6 +441,129 @@ enable_zwritemask(bool val) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DXGraphicsStateGuardian9::add_to_FVFBuf
|
||||||
|
// Access: Private
|
||||||
|
// Description: This adds data to the flexible vertex format
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void DXGraphicsStateGuardian9::
|
||||||
|
add_to_FVFBuf(void *data, size_t bytes) {
|
||||||
|
memcpy(_pCurFvfBufPtr, data, bytes);
|
||||||
|
_pCurFvfBufPtr += bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE void DXGraphicsStateGuardian9::
|
||||||
|
transform_color(Colorf &InColor,D3DCOLOR &OutRGBAColor) {
|
||||||
|
Colorf transformed
|
||||||
|
((InColor[0] * _current_color_scale[0]) + _current_color_offset[0],
|
||||||
|
(InColor[1] * _current_color_scale[1]) + _current_color_offset[1],
|
||||||
|
(InColor[2] * _current_color_scale[2]) + _current_color_offset[2],
|
||||||
|
(InColor[3] * _current_color_scale[3]) + _current_color_offset[3]);
|
||||||
|
OutRGBAColor = Colorf_to_D3DCOLOR(transformed);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DXGraphicsStateGuardian9::enable_texturing
|
||||||
|
// Access:
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void DXGraphicsStateGuardian9::
|
||||||
|
enable_texturing(bool val) {
|
||||||
|
_texturing_enabled = val;
|
||||||
|
|
||||||
|
if (!val) {
|
||||||
|
_pD3DDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_DISABLE);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
nassertv(_pCurTexContext!=NULL);
|
||||||
|
SetTextureBlendMode(_CurTexBlendMode,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DXGraphicsStateGuardian9::wants_texcoords
|
||||||
|
// Access: Public, Virtual
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool DXGraphicsStateGuardian9::
|
||||||
|
wants_texcoords() const {
|
||||||
|
return _texturing_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DXGraphicsStateGuardian9::compute_distance_to
|
||||||
|
// Access: Public, Virtual
|
||||||
|
// Description: This function may only be called during a render
|
||||||
|
// traversal; it will compute the distance to the
|
||||||
|
// indicated point, assumed to be in modelview
|
||||||
|
// coordinates, from the camera plane.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE float DXGraphicsStateGuardian9::
|
||||||
|
compute_distance_to(const LPoint3f &point) const {
|
||||||
|
// In the case of a DXGraphicsStateGuardian9, we know that the
|
||||||
|
// modelview matrix already includes the relative transform from the
|
||||||
|
// camera, as well as a to-y-up conversion. Thus, the distance to
|
||||||
|
// the camera plane is simply the +z distance. (negative of gl compute_distance_to,
|
||||||
|
// since d3d uses left-hand coords)
|
||||||
|
|
||||||
|
return point[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DXGraphicsStateGuardian9::get_texture_wrap_mode
|
||||||
|
// Access: Protected
|
||||||
|
// Description: Maps from the Texture's internal wrap mode symbols to
|
||||||
|
// GL's.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE D3DTEXTUREADDRESS DXGraphicsStateGuardian9::
|
||||||
|
get_texture_wrap_mode(Texture::WrapMode wm) const {
|
||||||
|
static D3DTEXTUREADDRESS PandaTexWrapMode_to_D3DTexWrapMode[Texture::WM_invalid] = {
|
||||||
|
D3DTADDRESS_CLAMP,D3DTADDRESS_WRAP,D3DTADDRESS_MIRROR,D3DTADDRESS_MIRRORONCE,D3DTADDRESS_BORDER};
|
||||||
|
|
||||||
|
return PandaTexWrapMode_to_D3DTexWrapMode[wm];
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DXGraphicsStateGuardian9::get_fog_mode_type
|
||||||
|
// Access: Protected
|
||||||
|
// Description: Maps from the fog types to gl version
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE D3DFOGMODE DXGraphicsStateGuardian9::
|
||||||
|
get_fog_mode_type(Fog::Mode m) const {
|
||||||
|
switch (m) {
|
||||||
|
case Fog::M_linear:
|
||||||
|
return D3DFOG_LINEAR;
|
||||||
|
case Fog::M_exponential:
|
||||||
|
return D3DFOG_EXP;
|
||||||
|
case Fog::M_exponential_squared:
|
||||||
|
return D3DFOG_EXP2;
|
||||||
|
}
|
||||||
|
dxgsg9_cat.error() << "Invalid Fog::Mode value" << endl;
|
||||||
|
return D3DFOG_EXP;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DXGraphicsStateGuardian9::enable_clip_plane
|
||||||
|
// Access: Protected, Virtual
|
||||||
|
// Description: Intended to be overridden by a derived class to
|
||||||
|
// enable the indicated clip_plane id. A specific
|
||||||
|
// PlaneNode will already have been bound to this id via
|
||||||
|
// bind_clip_plane().
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void DXGraphicsStateGuardian9::
|
||||||
|
enable_clip_plane(int plane_id, bool enable) {
|
||||||
|
assert(plane_id < D3DMAXUSERCLIPPLANES);
|
||||||
|
|
||||||
|
DWORD bitflag = ((DWORD)1 << plane_id);
|
||||||
|
if (enable) {
|
||||||
|
_clip_plane_bits |= bitflag;
|
||||||
|
} else {
|
||||||
|
_clip_plane_bits &= ~bitflag;
|
||||||
|
}
|
||||||
|
|
||||||
|
_pD3DDevice->SetRenderState(D3DRS_CLIPPLANEENABLE, _clip_plane_bits);
|
||||||
|
}
|
||||||
|
|
||||||
/** unimplemented
|
/** unimplemented
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -129,59 +129,6 @@ static bool bTexStatsRetrievalImpossible=false;
|
|||||||
|
|
||||||
//#define Colorf_to_D3DCOLOR(out_color) (MY_D3DRGBA((out_color)[0], (out_color)[1], (out_color)[2], (out_color)[3]))
|
//#define Colorf_to_D3DCOLOR(out_color) (MY_D3DRGBA((out_color)[0], (out_color)[1], (out_color)[2], (out_color)[3]))
|
||||||
|
|
||||||
INLINE DWORD
|
|
||||||
Colorf_to_D3DCOLOR(const Colorf &cColorf) {
|
|
||||||
// MS VC defines _M_IX86 for x86. gcc should define _X86_
|
|
||||||
#if defined(_M_IX86) || defined(_X86_)
|
|
||||||
DWORD d3dcolor,tempcolorval=255;
|
|
||||||
|
|
||||||
// note the default FPU rounding mode will give 255*0.5f=0x80, not 0x7F as VC would force it to by resetting rounding mode
|
|
||||||
// dont think this makes much difference
|
|
||||||
|
|
||||||
__asm {
|
|
||||||
push ebx ; want to save this in case this fn is inlined
|
|
||||||
push ecx
|
|
||||||
mov ecx, cColorf
|
|
||||||
fild tempcolorval
|
|
||||||
fld DWORD PTR [ecx]
|
|
||||||
fmul ST(0),ST(1)
|
|
||||||
fistp tempcolorval ; no way to store directly to int register
|
|
||||||
mov eax, tempcolorval
|
|
||||||
shl eax, 16
|
|
||||||
|
|
||||||
fld DWORD PTR [ecx+4] ;grn
|
|
||||||
fmul ST(0),ST(1)
|
|
||||||
fistp tempcolorval
|
|
||||||
mov ebx,tempcolorval
|
|
||||||
shl ebx, 8
|
|
||||||
or eax,ebx
|
|
||||||
|
|
||||||
fld DWORD PTR [ecx+8] ;blue
|
|
||||||
fmul ST(0),ST(1)
|
|
||||||
fistp tempcolorval
|
|
||||||
or eax,tempcolorval
|
|
||||||
|
|
||||||
fld DWORD PTR [ecx+12] ;alpha
|
|
||||||
fmul ST(0),ST(1)
|
|
||||||
fistp tempcolorval
|
|
||||||
; simulate pop 255.0 off FP stack w/o store, mark top as empty and increment stk ptr
|
|
||||||
ffree ST(0)
|
|
||||||
fincstp
|
|
||||||
mov ebx,tempcolorval
|
|
||||||
shl ebx, 24
|
|
||||||
or eax,ebx
|
|
||||||
mov d3dcolor,eax
|
|
||||||
pop ecx
|
|
||||||
pop ebx
|
|
||||||
}
|
|
||||||
|
|
||||||
// dxgsg9_cat.debug() << (void*)d3dcolor << endl;
|
|
||||||
return d3dcolor;
|
|
||||||
#else //!_X86_
|
|
||||||
return MY_D3DRGBA(cColorf[0], cColorf[1], cColorf[2], cColorf[3]);
|
|
||||||
#endif //!_X86_
|
|
||||||
}
|
|
||||||
|
|
||||||
void DXGraphicsStateGuardian9::
|
void DXGraphicsStateGuardian9::
|
||||||
set_color_clear_value(const Colorf& value) {
|
set_color_clear_value(const Colorf& value) {
|
||||||
_color_clear_value = value;
|
_color_clear_value = value;
|
||||||
@ -1118,26 +1065,6 @@ void DXGraphicsStateGuardian9::set_clipper(RECT cliprect) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(COUNT_DRAWPRIMS)
|
|
||||||
typedef enum {DrawPrim,DrawIndexedPrim} DP_Type;
|
|
||||||
static const char *DP_Type_Strs[3] = {"DrawPrimitive","DrawIndexedPrimitive"};
|
|
||||||
|
|
||||||
void INLINE TestDrawPrimFailure(DP_Type dptype,HRESULT hr,IDirect3DDevice9 *pD3DDevice,DWORD nVerts,DWORD nTris) {
|
|
||||||
if(FAILED(hr)) {
|
|
||||||
// loss of exclusive mode is not a real DrawPrim problem, ignore it
|
|
||||||
HRESULT testcooplvl_hr = pD3DDevice->TestCooperativeLevel();
|
|
||||||
if((testcooplvl_hr != D3DERR_DEVICELOST)||(testcooplvl_hr != D3DERR_DEVICENOTRESET)) {
|
|
||||||
dxgsg9_cat.fatal() << DP_Type_Strs[dptype] << "() failed: result = " << D3DERRORSTRING(hr);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CountDPs(nVerts,nTris);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define TestDrawPrimFailure(a,b,c,nVerts,nTris) CountDPs(nVerts,nTris);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian9::report_texmgr_stats
|
// Function: DXGraphicsStateGuardian9::report_texmgr_stats
|
||||||
// Access: Protected
|
// Access: Protected
|
||||||
@ -1283,17 +1210,6 @@ report_texmgr_stats() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DXGraphicsStateGuardian9::add_to_FVFBuf
|
|
||||||
// Access: Private
|
|
||||||
// Description: This adds data to the flexible vertex format
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE void DXGraphicsStateGuardian9::
|
|
||||||
add_to_FVFBuf(void *data, size_t bytes) {
|
|
||||||
memcpy(_pCurFvfBufPtr, data, bytes);
|
|
||||||
_pCurFvfBufPtr += bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
// generates slightly fewer instrs
|
// generates slightly fewer instrs
|
||||||
#define add_DWORD_to_FVFBuf(data) { *((DWORD *)_pCurFvfBufPtr) = (DWORD) data; _pCurFvfBufPtr += sizeof(DWORD);}
|
#define add_DWORD_to_FVFBuf(data) { *((DWORD *)_pCurFvfBufPtr) = (DWORD) data; _pCurFvfBufPtr += sizeof(DWORD);}
|
||||||
|
|
||||||
@ -1302,16 +1218,6 @@ typedef enum {
|
|||||||
} GeomVertFormat;
|
} GeomVertFormat;
|
||||||
|
|
||||||
|
|
||||||
INLINE void DXGraphicsStateGuardian9::
|
|
||||||
transform_color(Colorf &InColor,D3DCOLOR &OutRGBAColor) {
|
|
||||||
Colorf transformed
|
|
||||||
((InColor[0] * _current_color_scale[0]) + _current_color_offset[0],
|
|
||||||
(InColor[1] * _current_color_scale[1]) + _current_color_offset[1],
|
|
||||||
(InColor[2] * _current_color_scale[2]) + _current_color_offset[2],
|
|
||||||
(InColor[3] * _current_color_scale[3]) + _current_color_offset[3]);
|
|
||||||
OutRGBAColor = Colorf_to_D3DCOLOR(transformed);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian9::draw_prim_setup
|
// Function: DXGraphicsStateGuardian9::draw_prim_setup
|
||||||
// Access: Private
|
// Access: Private
|
||||||
@ -3526,24 +3432,6 @@ void DXGraphicsStateGuardian9::SetTextureBlendMode(TextureApplyAttrib::Mode TexB
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DXGraphicsStateGuardian9::enable_texturing
|
|
||||||
// Access:
|
|
||||||
// Description:
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE void DXGraphicsStateGuardian9::
|
|
||||||
enable_texturing(bool val) {
|
|
||||||
_texturing_enabled = val;
|
|
||||||
|
|
||||||
if (!val) {
|
|
||||||
_pD3DDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_DISABLE);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
nassertv(_pCurTexContext!=NULL);
|
|
||||||
SetTextureBlendMode(_CurTexBlendMode,true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian9::issue_transform
|
// Function: DXGraphicsStateGuardian9::issue_transform
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
@ -3599,6 +3487,57 @@ issue_tex_matrix(const TexMatrixAttrib *attrib) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DXGraphicsStateGuardian8::issue_tex_gen
|
||||||
|
// Access: Public, Virtual
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DXGraphicsStateGuardian9::
|
||||||
|
issue_tex_gen(const TexGenAttrib *attrib) {
|
||||||
|
/*
|
||||||
|
* Automatically generate texture coordinates for stage 0.
|
||||||
|
* Use the wrap mode from the texture coordinate set at index 1.
|
||||||
|
*/
|
||||||
|
DO_PSTATS_STUFF(_texture_state_pcollector.add_level(1));
|
||||||
|
if (attrib->is_off()) {
|
||||||
|
|
||||||
|
//enable_texturing(false);
|
||||||
|
// reset the texcoordindex lookup to 0
|
||||||
|
//_pD3DDevice->SetTransform(D3DTS_TEXTURE0, (D3DMATRIX *)dm.get_data());
|
||||||
|
_pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, 0);
|
||||||
|
_pD3DDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0);
|
||||||
|
|
||||||
|
} else if (attrib->get_mode() == TexGenAttrib::M_spherical) {
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// best reflection on a sphere is achieved by camera space normals in directx
|
||||||
|
_pD3DDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX,
|
||||||
|
D3DTSS_TCI_CAMERASPACENORMAL);
|
||||||
|
// We have set up the texture matrix to scale and translate the
|
||||||
|
// texture coordinates to get from camera space (-1, +1) to
|
||||||
|
// texture space (0,1)
|
||||||
|
LMatrix4f dm(0.5f, 0.0f, 0.0f, 0.0f,
|
||||||
|
0.0f, 0.5f, 0.0f, 0.0f,
|
||||||
|
0.0f, 0.0f, 1.0f, 0.0f,
|
||||||
|
0.5f, 0.5f, 0.0f, 1.0f);
|
||||||
|
#else
|
||||||
|
// since this is a reflection map, we want the camera space
|
||||||
|
// reflection vector. A close approximation of the asin(theta)/pi
|
||||||
|
// + 0.5 is achieved by the following matrix
|
||||||
|
_pD3DDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX,
|
||||||
|
D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR);
|
||||||
|
LMatrix4f dm(0.33f, 0.0f, 0.0f, 0.0f,
|
||||||
|
0.0f, 0.33f, 0.0f, 0.0f,
|
||||||
|
0.0f, 0.0f, 1.0f, 0.0f,
|
||||||
|
0.5f, 0.5f, 0.0f, 1.0f);
|
||||||
|
#endif
|
||||||
|
_pD3DDevice->SetTransform(D3DTS_TEXTURE0, (D3DMATRIX *)dm.get_data());
|
||||||
|
_pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS,
|
||||||
|
D3DTTFF_COUNT2);
|
||||||
|
//_pD3DDevice->SetRenderState(D3DRS_LOCALVIEWER, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian9::issue_texture
|
// Function: DXGraphicsStateGuardian9::issue_texture
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
@ -4068,17 +4007,6 @@ end_frame() {
|
|||||||
GraphicsStateGuardian::end_frame();
|
GraphicsStateGuardian::end_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DXGraphicsStateGuardian9::wants_texcoords
|
|
||||||
// Access: Public, Virtual
|
|
||||||
// Description:
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE bool DXGraphicsStateGuardian9::
|
|
||||||
wants_texcoords() const {
|
|
||||||
return _texturing_enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian9::depth_offset_decals
|
// Function: DXGraphicsStateGuardian9::depth_offset_decals
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
@ -4111,25 +4039,6 @@ get_internal_coordinate_system() const {
|
|||||||
return CS_yup_left;
|
return CS_yup_left;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DXGraphicsStateGuardian9::compute_distance_to
|
|
||||||
// Access: Public, Virtual
|
|
||||||
// Description: This function may only be called during a render
|
|
||||||
// traversal; it will compute the distance to the
|
|
||||||
// indicated point, assumed to be in modelview
|
|
||||||
// coordinates, from the camera plane.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE float DXGraphicsStateGuardian9::
|
|
||||||
compute_distance_to(const LPoint3f &point) const {
|
|
||||||
// In the case of a DXGraphicsStateGuardian9, we know that the
|
|
||||||
// modelview matrix already includes the relative transform from the
|
|
||||||
// camera, as well as a to-y-up conversion. Thus, the distance to
|
|
||||||
// the camera plane is simply the +z distance. (negative of gl compute_distance_to,
|
|
||||||
// since d3d uses left-hand coords)
|
|
||||||
|
|
||||||
return point[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian9::set_draw_buffer
|
// Function: DXGraphicsStateGuardian9::set_draw_buffer
|
||||||
// Access: Protected
|
// Access: Protected
|
||||||
@ -4201,39 +4110,6 @@ set_read_buffer(const RenderBuffer &rb) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DXGraphicsStateGuardian9::get_texture_wrap_mode
|
|
||||||
// Access: Protected
|
|
||||||
// Description: Maps from the Texture's internal wrap mode symbols to
|
|
||||||
// GL's.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE D3DTEXTUREADDRESS DXGraphicsStateGuardian9::
|
|
||||||
get_texture_wrap_mode(Texture::WrapMode wm) const {
|
|
||||||
static D3DTEXTUREADDRESS PandaTexWrapMode_to_D3DTexWrapMode[Texture::WM_invalid] = {
|
|
||||||
D3DTADDRESS_CLAMP,D3DTADDRESS_WRAP,D3DTADDRESS_MIRROR,D3DTADDRESS_MIRRORONCE,D3DTADDRESS_BORDER};
|
|
||||||
|
|
||||||
return PandaTexWrapMode_to_D3DTexWrapMode[wm];
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DXGraphicsStateGuardian9::get_fog_mode_type
|
|
||||||
// Access: Protected
|
|
||||||
// Description: Maps from the fog types to gl version
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE D3DFOGMODE DXGraphicsStateGuardian9::
|
|
||||||
get_fog_mode_type(Fog::Mode m) const {
|
|
||||||
switch (m) {
|
|
||||||
case Fog::M_linear:
|
|
||||||
return D3DFOG_LINEAR;
|
|
||||||
case Fog::M_exponential:
|
|
||||||
return D3DFOG_EXP;
|
|
||||||
case Fog::M_exponential_squared:
|
|
||||||
return D3DFOG_EXP2;
|
|
||||||
}
|
|
||||||
dxgsg9_cat.error() << "Invalid Fog::Mode value" << endl;
|
|
||||||
return D3DFOG_EXP;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian9::enable_lighting
|
// Function: DXGraphicsStateGuardian9::enable_lighting
|
||||||
// Access: Protected, Virtual
|
// Access: Protected, Virtual
|
||||||
@ -4297,28 +4173,6 @@ slot_new_clip_plane(int plane_id) {
|
|||||||
return (plane_id < D3DMAXUSERCLIPPLANES);
|
return (plane_id < D3DMAXUSERCLIPPLANES);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DXGraphicsStateGuardian9::enable_clip_plane
|
|
||||||
// Access: Protected, Virtual
|
|
||||||
// Description: Intended to be overridden by a derived class to
|
|
||||||
// enable the indicated clip_plane id. A specific
|
|
||||||
// PlaneNode will already have been bound to this id via
|
|
||||||
// bind_clip_plane().
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE void DXGraphicsStateGuardian9::
|
|
||||||
enable_clip_plane(int plane_id, bool enable) {
|
|
||||||
assert(plane_id < D3DMAXUSERCLIPPLANES);
|
|
||||||
|
|
||||||
DWORD bitflag = ((DWORD)1 << plane_id);
|
|
||||||
if (enable) {
|
|
||||||
_clip_plane_bits |= bitflag;
|
|
||||||
} else {
|
|
||||||
_clip_plane_bits &= ~bitflag;
|
|
||||||
}
|
|
||||||
|
|
||||||
_pD3DDevice->SetRenderState(D3DRS_CLIPPLANEENABLE, _clip_plane_bits);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian9::bind_clip_plane
|
// Function: DXGraphicsStateGuardian9::bind_clip_plane
|
||||||
// Access: Protected, Virtual
|
// Access: Protected, Virtual
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "graphicsStateGuardian.h"
|
#include "graphicsStateGuardian.h"
|
||||||
#include "geomprimitives.h"
|
#include "geomprimitives.h"
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
|
#include "texGenAttrib.h"
|
||||||
#include "pixelBuffer.h"
|
#include "pixelBuffer.h"
|
||||||
#include "displayRegion.h"
|
#include "displayRegion.h"
|
||||||
#include "material.h"
|
#include "material.h"
|
||||||
@ -113,6 +114,7 @@ public:
|
|||||||
|
|
||||||
virtual void issue_transform(const TransformState *transform);
|
virtual void issue_transform(const TransformState *transform);
|
||||||
virtual void issue_tex_matrix(const TexMatrixAttrib *attrib);
|
virtual void issue_tex_matrix(const TexMatrixAttrib *attrib);
|
||||||
|
virtual void issue_tex_gen(const TexGenAttrib *attrib);
|
||||||
virtual void issue_texture(const TextureAttrib *attrib);
|
virtual void issue_texture(const TextureAttrib *attrib);
|
||||||
virtual void issue_material(const MaterialAttrib *attrib);
|
virtual void issue_material(const MaterialAttrib *attrib);
|
||||||
virtual void issue_render_mode(const RenderModeAttrib *attrib);
|
virtual void issue_render_mode(const RenderModeAttrib *attrib);
|
||||||
|
@ -156,7 +156,7 @@ typedef enum {
|
|||||||
A8_FLAG = FLG(8),
|
A8_FLAG = FLG(8),
|
||||||
A8R3G3B2_FLAG = FLG(9),
|
A8R3G3B2_FLAG = FLG(9),
|
||||||
X4R4G4B4_FLAG = FLG(10),
|
X4R4G4B4_FLAG = FLG(10),
|
||||||
A2B10G10R10_FLAG = FLG(11),
|
A2R10G10B10_FLAG = FLG(11),
|
||||||
G16R16_FLAG = FLG(12),
|
G16R16_FLAG = FLG(12),
|
||||||
A8P8_FLAG = FLG(13),
|
A8P8_FLAG = FLG(13),
|
||||||
P8_FLAG = FLG(14),
|
P8_FLAG = FLG(14),
|
||||||
|
@ -529,9 +529,19 @@ search_for_valid_displaymode(DXScreenData &scrn,
|
|||||||
bool bVerboseMode) {
|
bool bVerboseMode) {
|
||||||
// Use this list of format modes when trying to find a valid graphics
|
// Use this list of format modes when trying to find a valid graphics
|
||||||
// format for the card. Formats are scanned in the order listed.
|
// format for the card. Formats are scanned in the order listed.
|
||||||
|
/*
|
||||||
|
Format Back buffer Display
|
||||||
|
A2R10G10B10 x x (full-screen mode only)
|
||||||
|
A8R8G8B8 x
|
||||||
|
X8R8G8B8 x x
|
||||||
|
A1R5G5B5 x
|
||||||
|
X1R5G5B5 x x
|
||||||
|
R5G6B5 x x
|
||||||
|
*/
|
||||||
|
|
||||||
static D3DFORMAT valid_formats[] = {
|
static D3DFORMAT valid_formats[] = {
|
||||||
D3DFMT_X8R8G8B8,
|
D3DFMT_X8R8G8B8,
|
||||||
D3DFMT_A2B10G10R10,
|
D3DFMT_A2R10G10B10,
|
||||||
D3DFMT_R5G6B5,
|
D3DFMT_R5G6B5,
|
||||||
D3DFMT_X1R5G5B5,
|
D3DFMT_X1R5G5B5,
|
||||||
};
|
};
|
||||||
@ -745,8 +755,8 @@ search_for_valid_displaymode(DXScreenData &scrn,
|
|||||||
case D3DFMT_X8R8G8B8:
|
case D3DFMT_X8R8G8B8:
|
||||||
*pSupportedScreenDepthsMask |= X8R8G8B8_FLAG;
|
*pSupportedScreenDepthsMask |= X8R8G8B8_FLAG;
|
||||||
break;
|
break;
|
||||||
case D3DFMT_A2B10G10R10:
|
case D3DFMT_A2R10G10B10:
|
||||||
*pSupportedScreenDepthsMask |= A2B10G10R10_FLAG;
|
*pSupportedScreenDepthsMask |= A2R10G10B10_FLAG;
|
||||||
break;
|
break;
|
||||||
case D3DFMT_R5G6B5:
|
case D3DFMT_R5G6B5:
|
||||||
*pSupportedScreenDepthsMask |= R5G6B5_FLAG;
|
*pSupportedScreenDepthsMask |= R5G6B5_FLAG;
|
||||||
@ -883,7 +893,7 @@ void Init_D3DFORMAT_map(void) {
|
|||||||
INSERT_ELEM(A8);
|
INSERT_ELEM(A8);
|
||||||
INSERT_ELEM(A8R3G3B2);
|
INSERT_ELEM(A8R3G3B2);
|
||||||
INSERT_ELEM(X4R4G4B4);
|
INSERT_ELEM(X4R4G4B4);
|
||||||
INSERT_ELEM(A2B10G10R10);
|
INSERT_ELEM(A2R10G10B10);
|
||||||
INSERT_ELEM(G16R16);
|
INSERT_ELEM(G16R16);
|
||||||
INSERT_ELEM(A8P8);
|
INSERT_ELEM(A8P8);
|
||||||
INSERT_ELEM(P8);
|
INSERT_ELEM(P8);
|
||||||
@ -924,7 +934,7 @@ const char *D3DFormatStr(D3DFORMAT fmt) {
|
|||||||
CASESTR(D3DFMT_A8);
|
CASESTR(D3DFMT_A8);
|
||||||
CASESTR(D3DFMT_A8R3G3B2);
|
CASESTR(D3DFMT_A8R3G3B2);
|
||||||
CASESTR(D3DFMT_X4R4G4B4);
|
CASESTR(D3DFMT_X4R4G4B4);
|
||||||
CASESTR(D3DFMT_A2B10G10R10);
|
CASESTR(D3DFMT_A2R10G10B10);
|
||||||
CASESTR(D3DFMT_G16R16);
|
CASESTR(D3DFMT_G16R16);
|
||||||
CASESTR(D3DFMT_A8P8);
|
CASESTR(D3DFMT_A8P8);
|
||||||
CASESTR(D3DFMT_P8);
|
CASESTR(D3DFMT_P8);
|
||||||
|
@ -853,8 +853,6 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
|
|||||||
wdxdisplay9_cat.warning() << "pPresParams->BackBufferCount : " << pPresParams->BackBufferCount << endl;
|
wdxdisplay9_cat.warning() << "pPresParams->BackBufferCount : " << pPresParams->BackBufferCount << endl;
|
||||||
wdxdisplay9_cat.warning() << "D3D CreateDevice failed for device #" << Display.CardIDNum << D3DERRORSTRING(hr);
|
wdxdisplay9_cat.warning() << "D3D CreateDevice failed for device #" << Display.CardIDNum << D3DERRORSTRING(hr);
|
||||||
goto Fallback_to_16bpp_buffers;
|
goto Fallback_to_16bpp_buffers;
|
||||||
//exit(1);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} // end create windowed buffers
|
} // end create windowed buffers
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user