Correct GetDeviceCaps so that it uses wined3dcaps as required by the

earlier device caps patch.
This commit is contained in:
Oliver Stieber 2005-06-22 18:30:29 +00:00 committed by Alexandre Julliard
parent 9feda99e3c
commit 784518d772
1 changed files with 211 additions and 173 deletions

View File

@ -1161,13 +1161,12 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceFormatConversion(IWineD3D *iface, UINT
/* Note: d3d8 passes in a pointer to a D3DCAPS8 structure, which is a true /* Note: d3d8 passes in a pointer to a D3DCAPS8 structure, which is a true
subset of a D3DCAPS9 structure. However, it has to come via a void * subset of a D3DCAPS9 structure. However, it has to come via a void *
as the d3d8 interface cannot import the d3d9 header */ as the d3d8 interface cannot import the d3d9 header */
HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, WINED3DCAPS* pCapsIn) { HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, WINED3DCAPS* pCaps) {
IWineD3DImpl *This = (IWineD3DImpl *)iface; IWineD3DImpl *This = (IWineD3DImpl *)iface;
BOOL gotContext = FALSE; BOOL gotContext = FALSE;
GLint gl_tex_size = 0; GLint gl_tex_size = 0;
WineD3D_Context *fake_ctx = NULL; WineD3D_Context *fake_ctx = NULL;
D3DCAPS9 *pCaps = (D3DCAPS9 *)pCapsIn;
TRACE_(d3d_caps)("(%p)->(Adptr:%d, DevType: %x, pCaps: %p)\n", This, Adapter, DeviceType, pCaps); TRACE_(d3d_caps)("(%p)->(Adptr:%d, DevType: %x, pCaps: %p)\n", This, Adapter, DeviceType, pCaps);
@ -1189,14 +1188,15 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
FIXME_(d3d_caps)("GetDeviceCaps called but no GL Context - Returning dummy values\n"); FIXME_(d3d_caps)("GetDeviceCaps called but no GL Context - Returning dummy values\n");
gl_tex_size=65535; gl_tex_size=65535;
pCaps->MaxTextureBlendStages = 2; *(pCaps->MaxTextureBlendStages) = 2;
pCaps->MaxSimultaneousTextures = 2; *pCaps->MaxSimultaneousTextures = 2;
pCaps->MaxUserClipPlanes = 8; *pCaps->MaxUserClipPlanes = 8;
pCaps->MaxActiveLights = 8; *pCaps->MaxActiveLights = 8;
pCaps->MaxVertexBlendMatrices = 0; *pCaps->MaxVertexBlendMatrices = 0;
pCaps->MaxVertexBlendMatrixIndex = 1; *pCaps->MaxVertexBlendMatrixIndex = 1;
pCaps->MaxAnisotropy = 0; *pCaps->MaxAnisotropy = 0;
pCaps->MaxPointSize = 255.0; *pCaps->MaxPointSize = 255.0;
} else { } else {
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_tex_size); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_tex_size);
} }
@ -1212,167 +1212,181 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
/* ------------------------------------------------ /* ------------------------------------------------
The following fields apply to both d3d8 and d3d9 The following fields apply to both d3d8 and d3d9
------------------------------------------------ */ ------------------------------------------------ */
pCaps->DeviceType = (DeviceType == D3DDEVTYPE_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF; /* Not quite true, but use h/w supported by opengl I suppose */ *pCaps->DeviceType = (DeviceType == D3DDEVTYPE_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF; /* Not quite true, but use h/w supported by opengl I suppose */
pCaps->AdapterOrdinal = Adapter; *pCaps->AdapterOrdinal = Adapter;
pCaps->Caps = 0; *pCaps->Caps = 0;
pCaps->Caps2 = D3DCAPS2_CANRENDERWINDOWED; *pCaps->Caps2 = D3DCAPS2_CANRENDERWINDOWED;
pCaps->Caps3 = D3DDEVCAPS_HWTRANSFORMANDLIGHT; *pCaps->Caps3 = D3DDEVCAPS_HWTRANSFORMANDLIGHT;
pCaps->PresentationIntervals = D3DPRESENT_INTERVAL_IMMEDIATE; *pCaps->PresentationIntervals = D3DPRESENT_INTERVAL_IMMEDIATE;
pCaps->CursorCaps = 0; *pCaps->CursorCaps = 0;
pCaps->DevCaps = D3DDEVCAPS_DRAWPRIMTLVERTEX |
D3DDEVCAPS_HWTRANSFORMANDLIGHT |
D3DDEVCAPS_PUREDEVICE | D3DDEVCAPS_HWRASTERIZATION;
pCaps->PrimitiveMiscCaps = D3DPMISCCAPS_CULLCCW | *pCaps->DevCaps = D3DDEVCAPS_DRAWPRIMTLVERTEX |
D3DPMISCCAPS_CULLCW | D3DDEVCAPS_HWTRANSFORMANDLIGHT |
D3DPMISCCAPS_COLORWRITEENABLE | D3DDEVCAPS_PUREDEVICE |
D3DPMISCCAPS_CLIPTLVERTS | D3DDEVCAPS_HWRASTERIZATION;
D3DPMISCCAPS_CLIPPLANESCALEDPOINTS |
D3DPMISCCAPS_MASKZ;
*pCaps->PrimitiveMiscCaps = D3DPMISCCAPS_CULLCCW |
D3DPMISCCAPS_CULLCW |
D3DPMISCCAPS_COLORWRITEENABLE |
D3DPMISCCAPS_CLIPTLVERTS |
D3DPMISCCAPS_CLIPPLANESCALEDPOINTS |
D3DPMISCCAPS_MASKZ;
/*NOT: D3DPMISCCAPS_TSSARGTEMP*/ /*NOT: D3DPMISCCAPS_TSSARGTEMP*/
pCaps->RasterCaps = D3DPRASTERCAPS_DITHER | *pCaps->RasterCaps = D3DPRASTERCAPS_DITHER |
D3DPRASTERCAPS_PAT | D3DPRASTERCAPS_PAT |
D3DPRASTERCAPS_WFOG | D3DPRASTERCAPS_WFOG |
D3DPRASTERCAPS_ZFOG | D3DPRASTERCAPS_ZFOG |
D3DPRASTERCAPS_FOGVERTEX | D3DPRASTERCAPS_FOGVERTEX |
D3DPRASTERCAPS_FOGTABLE | D3DPRASTERCAPS_FOGTABLE |
D3DPRASTERCAPS_FOGRANGE; D3DPRASTERCAPS_FOGRANGE;
if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC)) { if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC)) {
pCaps->RasterCaps |= D3DPRASTERCAPS_ANISOTROPY; *pCaps->RasterCaps |= D3DPRASTERCAPS_ANISOTROPY |
D3DPRASTERCAPS_ZBIAS |
D3DPRASTERCAPS_MIPMAPLODBIAS;
} }
/* FIXME Add: /* FIXME Add:
D3DPRASTERCAPS_MIPMAPLODBIAS
D3DPRASTERCAPS_ZBIAS
D3DPRASTERCAPS_COLORPERSPECTIVE D3DPRASTERCAPS_COLORPERSPECTIVE
D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE
D3DPRASTERCAPS_ANTIALIASEDGES D3DPRASTERCAPS_ANTIALIASEDGES
D3DPRASTERCAPS_ZBUFFERLESSHSR D3DPRASTERCAPS_ZBUFFERLESSHSR
D3DPRASTERCAPS_WBUFFER */ D3DPRASTERCAPS_WBUFFER */
pCaps->ZCmpCaps = D3DPCMPCAPS_ALWAYS | *pCaps->ZCmpCaps = D3DPCMPCAPS_ALWAYS |
D3DPCMPCAPS_EQUAL | D3DPCMPCAPS_EQUAL |
D3DPCMPCAPS_GREATER | D3DPCMPCAPS_GREATER |
D3DPCMPCAPS_GREATEREQUAL | D3DPCMPCAPS_GREATEREQUAL |
D3DPCMPCAPS_LESS | D3DPCMPCAPS_LESS |
D3DPCMPCAPS_LESSEQUAL | D3DPCMPCAPS_LESSEQUAL |
D3DPCMPCAPS_NEVER | D3DPCMPCAPS_NEVER |
D3DPCMPCAPS_NOTEQUAL; D3DPCMPCAPS_NOTEQUAL;
pCaps->SrcBlendCaps = 0xFFFFFFFF; /*FIXME: Tidy up later */ *pCaps->SrcBlendCaps = 0xFFFFFFFF; /*FIXME: Tidy up later */
pCaps->DestBlendCaps = 0xFFFFFFFF; /*FIXME: Tidy up later */ *pCaps->DestBlendCaps = 0xFFFFFFFF; /*FIXME: Tidy up later */
pCaps->AlphaCmpCaps = 0xFFFFFFFF; /*FIXME: Tidy up later */ *pCaps->AlphaCmpCaps = 0xFFFFFFFF; /*FIXME: Tidy up later */
pCaps->ShadeCaps = D3DPSHADECAPS_SPECULARGOURAUDRGB | *pCaps->ShadeCaps = D3DPSHADECAPS_SPECULARGOURAUDRGB |
D3DPSHADECAPS_COLORGOURAUDRGB; D3DPSHADECAPS_COLORGOURAUDRGB;
pCaps->TextureCaps = D3DPTEXTURECAPS_ALPHA | *pCaps->TextureCaps = D3DPTEXTURECAPS_ALPHA |
D3DPTEXTURECAPS_ALPHAPALETTE | D3DPTEXTURECAPS_ALPHAPALETTE |
D3DPTEXTURECAPS_POW2 | D3DPTEXTURECAPS_VOLUMEMAP |
D3DPTEXTURECAPS_VOLUMEMAP | D3DPTEXTURECAPS_MIPMAP |
D3DPTEXTURECAPS_MIPMAP | D3DPTEXTURECAPS_PROJECTED |
D3DPTEXTURECAPS_PROJECTED; D3DPTEXTURECAPS_PERSPECTIVE |
D3DPTEXTURECAPS_VOLUMEMAP_POW2 ;
/* TODO: add support for NON-POW2 if avaialble
*/
if (This->dxVersion > 8) {
*pCaps->TextureCaps |= D3DPTEXTURECAPS_NONPOW2CONDITIONAL;
} else { /* NONPOW2 isn't accessable by d3d8 yet */
*pCaps->TextureCaps |= D3DPTEXTURECAPS_POW2;
}
if (GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) { if (GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) {
pCaps->TextureCaps |= D3DPTEXTURECAPS_CUBEMAP | *pCaps->TextureCaps |= D3DPTEXTURECAPS_CUBEMAP |
D3DPTEXTURECAPS_MIPCUBEMAP | D3DPTEXTURECAPS_MIPCUBEMAP |
D3DPTEXTURECAPS_CUBEMAP_POW2; D3DPTEXTURECAPS_CUBEMAP_POW2;
} }
pCaps->TextureFilterCaps = D3DPTFILTERCAPS_MAGFLINEAR | *pCaps->TextureFilterCaps = D3DPTFILTERCAPS_MAGFLINEAR |
D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFPOINT |
D3DPTFILTERCAPS_MINFLINEAR | D3DPTFILTERCAPS_MINFLINEAR |
D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFPOINT |
D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MIPFLINEAR |
D3DPTFILTERCAPS_MIPFPOINT; D3DPTFILTERCAPS_MIPFPOINT;
pCaps->CubeTextureFilterCaps = 0; *pCaps->CubeTextureFilterCaps = 0;
pCaps->VolumeTextureFilterCaps = 0; *pCaps->VolumeTextureFilterCaps = 0;
pCaps->TextureAddressCaps = D3DPTADDRESSCAPS_BORDER | *pCaps->TextureAddressCaps = D3DPTADDRESSCAPS_BORDER |
D3DPTADDRESSCAPS_CLAMP | D3DPTADDRESSCAPS_CLAMP |
D3DPTADDRESSCAPS_WRAP; D3DPTADDRESSCAPS_WRAP;
if (GL_SUPPORT(ARB_TEXTURE_BORDER_CLAMP)) { if (GL_SUPPORT(ARB_TEXTURE_BORDER_CLAMP)) {
pCaps->TextureAddressCaps |= D3DPTADDRESSCAPS_BORDER; *pCaps->TextureAddressCaps |= D3DPTADDRESSCAPS_BORDER;
} }
if (GL_SUPPORT(ARB_TEXTURE_MIRRORED_REPEAT)) { if (GL_SUPPORT(ARB_TEXTURE_MIRRORED_REPEAT)) {
pCaps->TextureAddressCaps |= D3DPTADDRESSCAPS_MIRROR; *pCaps->TextureAddressCaps |= D3DPTADDRESSCAPS_MIRROR;
} }
if (GL_SUPPORT(ATI_TEXTURE_MIRROR_ONCE)) { if (GL_SUPPORT(ATI_TEXTURE_MIRROR_ONCE)) {
pCaps->TextureAddressCaps |= D3DPTADDRESSCAPS_MIRRORONCE; *pCaps->TextureAddressCaps |= D3DPTADDRESSCAPS_MIRRORONCE;
} }
pCaps->VolumeTextureAddressCaps = 0; *pCaps->VolumeTextureAddressCaps = 0;
pCaps->LineCaps = D3DLINECAPS_TEXTURE | *pCaps->LineCaps = D3DLINECAPS_TEXTURE |
D3DLINECAPS_ZTEST; D3DLINECAPS_ZTEST;
/* FIXME: Add /* FIXME: Add
D3DLINECAPS_BLEND D3DLINECAPS_BLEND
D3DLINECAPS_ALPHACMP D3DLINECAPS_ALPHACMP
D3DLINECAPS_FOG */ D3DLINECAPS_FOG */
pCaps->MaxTextureWidth = gl_tex_size; *pCaps->MaxTextureWidth = gl_tex_size;
pCaps->MaxTextureHeight = gl_tex_size; *pCaps->MaxTextureHeight = gl_tex_size;
pCaps->MaxVolumeExtent = 0; *pCaps->MaxVolumeExtent = 0;
pCaps->MaxTextureRepeat = 32768; *pCaps->MaxTextureRepeat = 32768;
pCaps->MaxTextureAspectRatio = 32768; *pCaps->MaxTextureAspectRatio = 32768;
pCaps->MaxVertexW = 1.0; *pCaps->MaxVertexW = 1.0;
pCaps->GuardBandLeft = 0; *pCaps->GuardBandLeft = 0;
pCaps->GuardBandTop = 0; *pCaps->GuardBandTop = 0;
pCaps->GuardBandRight = 0; *pCaps->GuardBandRight = 0;
pCaps->GuardBandBottom = 0; *pCaps->GuardBandBottom = 0;
pCaps->ExtentsAdjust = 0; *pCaps->ExtentsAdjust = 0;
pCaps->StencilCaps = D3DSTENCILCAPS_DECRSAT | *pCaps->StencilCaps = D3DSTENCILCAPS_DECRSAT |
D3DSTENCILCAPS_INCRSAT | D3DSTENCILCAPS_INCRSAT |
D3DSTENCILCAPS_INVERT | D3DSTENCILCAPS_INVERT |
D3DSTENCILCAPS_KEEP | D3DSTENCILCAPS_KEEP |
D3DSTENCILCAPS_REPLACE | D3DSTENCILCAPS_REPLACE |
D3DSTENCILCAPS_ZERO; D3DSTENCILCAPS_ZERO;
if (GL_SUPPORT(EXT_STENCIL_WRAP)) { if (GL_SUPPORT(EXT_STENCIL_WRAP)) {
pCaps->StencilCaps |= D3DSTENCILCAPS_DECR | *pCaps->StencilCaps |= D3DSTENCILCAPS_DECR |
D3DSTENCILCAPS_INCR; D3DSTENCILCAPS_INCR;
} }
pCaps->FVFCaps = D3DFVFCAPS_PSIZE | 0x0008; /* 8 texture coords */ *pCaps->FVFCaps = D3DFVFCAPS_PSIZE | 0x0008; /* 8 texture coords */
pCaps->TextureOpCaps = D3DTEXOPCAPS_ADD | *pCaps->TextureOpCaps = D3DTEXOPCAPS_ADD |
D3DTEXOPCAPS_ADDSIGNED | D3DTEXOPCAPS_ADDSIGNED |
D3DTEXOPCAPS_ADDSIGNED2X | D3DTEXOPCAPS_ADDSIGNED2X |
D3DTEXOPCAPS_MODULATE | D3DTEXOPCAPS_MODULATE |
D3DTEXOPCAPS_MODULATE2X | D3DTEXOPCAPS_MODULATE2X |
D3DTEXOPCAPS_MODULATE4X | D3DTEXOPCAPS_MODULATE4X |
D3DTEXOPCAPS_SELECTARG1 | D3DTEXOPCAPS_SELECTARG1 |
D3DTEXOPCAPS_SELECTARG2 | D3DTEXOPCAPS_SELECTARG2 |
D3DTEXOPCAPS_DISABLE; D3DTEXOPCAPS_DISABLE;
#if defined(GL_VERSION_1_3) #if defined(GL_VERSION_1_3)
pCaps->TextureOpCaps |= D3DTEXOPCAPS_DOTPRODUCT3 | *pCaps->TextureOpCaps |= D3DTEXOPCAPS_DOTPRODUCT3 |
D3DTEXOPCAPS_SUBTRACT; D3DTEXOPCAPS_SUBTRACT;
#endif #endif
if (GL_SUPPORT(ARB_TEXTURE_ENV_COMBINE) || if (GL_SUPPORT(ARB_TEXTURE_ENV_COMBINE) ||
GL_SUPPORT(EXT_TEXTURE_ENV_COMBINE) || GL_SUPPORT(EXT_TEXTURE_ENV_COMBINE) ||
GL_SUPPORT(NV_TEXTURE_ENV_COMBINE4)) { GL_SUPPORT(NV_TEXTURE_ENV_COMBINE4)) {
pCaps->TextureOpCaps |= D3DTEXOPCAPS_BLENDDIFFUSEALPHA | *pCaps->TextureOpCaps |= D3DTEXOPCAPS_BLENDDIFFUSEALPHA |
D3DTEXOPCAPS_BLENDTEXTUREALPHA | D3DTEXOPCAPS_BLENDTEXTUREALPHA |
D3DTEXOPCAPS_BLENDFACTORALPHA | D3DTEXOPCAPS_BLENDFACTORALPHA |
D3DTEXOPCAPS_BLENDCURRENTALPHA | D3DTEXOPCAPS_BLENDCURRENTALPHA |
D3DTEXOPCAPS_LERP; D3DTEXOPCAPS_LERP;
} }
if (GL_SUPPORT(NV_TEXTURE_ENV_COMBINE4)) { if (GL_SUPPORT(NV_TEXTURE_ENV_COMBINE4)) {
pCaps->TextureOpCaps |= D3DTEXOPCAPS_ADDSMOOTH | *pCaps->TextureOpCaps |= D3DTEXOPCAPS_ADDSMOOTH |
D3DTEXOPCAPS_MULTIPLYADD | D3DTEXOPCAPS_MULTIPLYADD |
D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR | D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR |
D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA | D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA |
D3DTEXOPCAPS_BLENDTEXTUREALPHAPM; D3DTEXOPCAPS_BLENDTEXTUREALPHAPM;
} }
#if 0 #if 0
@ -1384,99 +1398,122 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
if (gotContext) { if (gotContext) {
GLint gl_max; GLint gl_max;
GLfloat gl_float; GLfloat gl_float;
#if defined(GL_VERSION_1_3) #if defined(GL_VERSION_1_3)
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &gl_max); glGetIntegerv(GL_MAX_TEXTURE_UNITS, &gl_max);
#else #else
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max); glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max);
#endif #endif
TRACE_(d3d_caps)("GLCaps: GL_MAX_TEXTURE_UNITS_ARB=%d\n", gl_max); TRACE_(d3d_caps)("GLCaps: GL_MAX_TEXTURE_UNITS_ARB=%d\n", gl_max);
pCaps->MaxTextureBlendStages = min(8, gl_max); *pCaps->MaxTextureBlendStages = min(8, gl_max);
pCaps->MaxSimultaneousTextures = min(8, gl_max); *pCaps->MaxSimultaneousTextures = min(8, gl_max);
glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max); glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
pCaps->MaxUserClipPlanes = min(D3DMAXUSERCLIPPLANES, gl_max); *pCaps->MaxUserClipPlanes = min(D3DMAXUSERCLIPPLANES, gl_max);
TRACE_(d3d_caps)("GLCaps: GL_MAX_CLIP_PLANES=%ld\n", pCaps->MaxUserClipPlanes); TRACE_(d3d_caps)("GLCaps: GL_MAX_CLIP_PLANES=%ld\n", *pCaps->MaxUserClipPlanes);
glGetIntegerv(GL_MAX_LIGHTS, &gl_max); glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
pCaps->MaxActiveLights = gl_max; *pCaps->MaxActiveLights = gl_max;
TRACE_(d3d_caps)("GLCaps: GL_MAX_LIGHTS=%ld\n", pCaps->MaxActiveLights); TRACE_(d3d_caps)("GLCaps: GL_MAX_LIGHTS=%ld\n", *pCaps->MaxActiveLights);
if (GL_SUPPORT(ARB_VERTEX_BLEND)) { if (GL_SUPPORT(ARB_VERTEX_BLEND)) {
glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max); glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max);
pCaps->MaxVertexBlendMatrices = gl_max; #if 0 /* TODO : add support for blends to drawprim */
pCaps->MaxVertexBlendMatrixIndex = 1; *pCaps->MaxVertexBlendMatrices = gl_max;
#else
*pCaps->MaxVertexBlendMatrices = 0;
#endif
*pCaps->MaxVertexBlendMatrixIndex = 1;
} else { } else {
pCaps->MaxVertexBlendMatrices = 0; *pCaps->MaxVertexBlendMatrices = 0;
pCaps->MaxVertexBlendMatrixIndex = 1; *pCaps->MaxVertexBlendMatrixIndex = 1;
} }
if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC)) { if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC)) {
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max); glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max);
pCaps->MaxAnisotropy = gl_max; *pCaps->MaxAnisotropy = gl_max;
} else { } else {
pCaps->MaxAnisotropy = 0; *pCaps->MaxAnisotropy = 0;
} }
glGetFloatv(GL_POINT_SIZE_RANGE, &gl_float); glGetFloatv(GL_POINT_SIZE_RANGE, &gl_float);
pCaps->MaxPointSize = gl_float; *pCaps->MaxPointSize = gl_float;
} }
pCaps->VertexProcessingCaps = D3DVTXPCAPS_DIRECTIONALLIGHTS | *pCaps->VertexProcessingCaps = D3DVTXPCAPS_DIRECTIONALLIGHTS |
D3DVTXPCAPS_MATERIALSOURCE7 | D3DVTXPCAPS_MATERIALSOURCE7 |
D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS |
D3DVTXPCAPS_LOCALVIEWER | D3DVTXPCAPS_LOCALVIEWER |
D3DVTXPCAPS_TEXGEN; D3DVTXPCAPS_TEXGEN;
/* FIXME: Add /* FIXME: Add
D3DVTXPCAPS_TWEENING */ D3DVTXPCAPS_TWEENING */
pCaps->MaxPrimitiveCount = 0xFFFFFFFF; *pCaps->MaxPrimitiveCount = 0xFFFFFFFF;
pCaps->MaxVertexIndex = 0xFFFFFFFF; *pCaps->MaxVertexIndex = 0xFFFFFFFF;
pCaps->MaxStreams = MAX_STREAMS; *pCaps->MaxStreams = MAX_STREAMS;
pCaps->MaxStreamStride = 1024; *pCaps->MaxStreamStride = 1024;
if (((vs_mode == VS_HW) && GL_SUPPORT(ARB_VERTEX_PROGRAM)) || (vs_mode == VS_SW) || (DeviceType == D3DDEVTYPE_REF)) { if (((vs_mode == VS_HW) && GL_SUPPORT(ARB_VERTEX_PROGRAM)) || (vs_mode == VS_SW) || (DeviceType == D3DDEVTYPE_REF)) {
pCaps->VertexShaderVersion = D3DVS_VERSION(1,1); *pCaps->VertexShaderVersion = D3DVS_VERSION(1,1);
if (This->gl_info.gl_vendor == VENDOR_MESA || if (This->gl_info.gl_vendor == VENDOR_MESA ||
This->gl_info.gl_vendor == VENDOR_WINE) { This->gl_info.gl_vendor == VENDOR_WINE) {
pCaps->MaxVertexShaderConst = 95; *pCaps->MaxVertexShaderConst = 95;
} else { } else {
pCaps->MaxVertexShaderConst = WINED3D_VSHADER_MAX_CONSTANTS; *pCaps->MaxVertexShaderConst = WINED3D_VSHADER_MAX_CONSTANTS;
} }
} else { } else {
pCaps->VertexShaderVersion = 0; *pCaps->VertexShaderVersion = 0;
pCaps->MaxVertexShaderConst = 0; *pCaps->MaxVertexShaderConst = 0;
} }
if ((ps_mode == PS_HW) && GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && (DeviceType != D3DDEVTYPE_REF)) { if ((ps_mode == PS_HW) && GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && (DeviceType != D3DDEVTYPE_REF)) {
pCaps->PixelShaderVersion = D3DPS_VERSION(1,4); *pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
pCaps->PixelShader1xMaxValue = 1.0; *pCaps->PixelShader1xMaxValue = 1.0;
} else { } else {
pCaps->PixelShaderVersion = 0; *pCaps->PixelShaderVersion = 0;
pCaps->PixelShader1xMaxValue = 0.0; *pCaps->PixelShader1xMaxValue = 0.0;
} }
/* TODO: ARB_FRAGMENT_PROGRAM_100 */
/* ------------------------------------------------ /* ------------------------------------------------
The following fields apply to d3d9 only The following fields apply to d3d9 only
------------------------------------------------ */ ------------------------------------------------ */
if (This->dxVersion > 8) { if (This->dxVersion > 8) {
GLint max_buffers=1;
FIXME("Caps support for directx9 is nonexistent at the moment!\n"); FIXME("Caps support for directx9 is nonexistent at the moment!\n");
pCaps->DevCaps2 = 0; *pCaps->DevCaps2 = 0;
pCaps->MaxNpatchTessellationLevel = 0; /* TODO: D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES */
pCaps->MasterAdapterOrdinal = 0; *pCaps->MaxNpatchTessellationLevel = 0;
pCaps->AdapterOrdinalInGroup = 0; *pCaps->MasterAdapterOrdinal = 0;
pCaps->NumberOfAdaptersInGroup = 1; *pCaps->AdapterOrdinalInGroup = 0;
pCaps->DeclTypes = 0; *pCaps->NumberOfAdaptersInGroup = 1;
pCaps->NumSimultaneousRTs = 0; *pCaps->DeclTypes = 0;
pCaps->StretchRectFilterCaps = 0; #if 0 /*FIXME: Simultaneous render targets*/
pCaps->VS20Caps.Caps = 0; GL_MAX_DRAW_BUFFERS_ATI 0x00008824
pCaps->PS20Caps.Caps = 0; if (GL_SUPPORT(GL_MAX_DRAW_BUFFERS_ATI)) {
pCaps->VertexTextureFilterCaps = 0; ENTER_GL();
pCaps->MaxVShaderInstructionsExecuted = 0; glEnable(GL_MAX_DRAW_BUFFERS_ATI);
pCaps->MaxPShaderInstructionsExecuted = 0; glGetIntegerv(GL_MAX_DRAW_BUFFERS_ATI, &max_buffers);
pCaps->MaxVertexShader30InstructionSlots = 0; glDisable(GL_MAX_DRAW_BUFFERS_ATI);
pCaps->MaxPixelShader30InstructionSlots = 0; LEAVE_GL();
}
#endif
*pCaps->NumSimultaneousRTs = max_buffers;
*pCaps->StretchRectFilterCaps = 0;
/* TODO: add
D3DPTFILTERCAPS_MINFPOINT
D3DPTFILTERCAPS_MAGFPOINT
D3DPTFILTERCAPS_MINFLINEAR
D3DPTFILTERCAPS_MAGFLINEAR
*/
*pCaps->VS20Caps.Caps = 0;
*pCaps->PS20Caps.Caps = 0;
*pCaps->VertexTextureFilterCaps = 0;
*pCaps->MaxVShaderInstructionsExecuted = 0;
*pCaps->MaxPShaderInstructionsExecuted = 0;
*pCaps->MaxVertexShader30InstructionSlots = 0;
*pCaps->MaxPixelShader30InstructionSlots = 0;
} }
/* If we created a dummy context, throw it away */ /* If we created a dummy context, throw it away */
@ -1484,6 +1521,7 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
return D3D_OK; return D3D_OK;
} }
/* Note due to structure differences between dx8 and dx9 D3DPRESENT_PARAMETERS, /* Note due to structure differences between dx8 and dx9 D3DPRESENT_PARAMETERS,
and fields being inserted in the middle, a new structure is used in place */ and fields being inserted in the middle, a new structure is used in place */
HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,