wined3d: The adapters array should be owned by IWineD3DImpl.
This commit is contained in:
parent
3644a7f6d7
commit
2cc43393f0
|
@ -36,6 +36,8 @@
|
|||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(d3d_caps);
|
||||
|
||||
#define GLINFO_LOCATION (*gl_info)
|
||||
|
||||
/* The d3d device ID */
|
||||
static const GUID IID_D3DDEVICE_D3DUID = { 0xaeb2cdd4, 0x6e41, 0x43ea, { 0x94,0x1c,0x83,0x61,0xcc,0x76,0x07,0x81 } };
|
||||
|
||||
|
@ -148,14 +150,11 @@ static const struct {
|
|||
* Utility functions follow
|
||||
**********************************************************/
|
||||
|
||||
/* Adapters */
|
||||
static int numAdapters = 0;
|
||||
static struct WineD3DAdapter Adapters[1];
|
||||
|
||||
static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat, WINED3DSURFTYPE SurfaceType);
|
||||
static const struct fragment_pipeline *select_fragment_implementation(UINT Adapter, WINED3DDEVTYPE DeviceType);
|
||||
static const shader_backend_t *select_shader_backend(UINT Adapter, WINED3DDEVTYPE DeviceType);
|
||||
static const struct blit_shader *select_blit_implementation(UINT Adapter, WINED3DDEVTYPE DeviceType);
|
||||
static const struct fragment_pipeline *select_fragment_implementation(struct WineD3DAdapter *adapter,
|
||||
WINED3DDEVTYPE DeviceType);
|
||||
static const shader_backend_t *select_shader_backend(struct WineD3DAdapter *adapter, WINED3DDEVTYPE DeviceType);
|
||||
static const struct blit_shader *select_blit_implementation(struct WineD3DAdapter *adapter, WINED3DDEVTYPE DeviceType);
|
||||
|
||||
/* lookup tables */
|
||||
const int minLookup[MAX_LOOKUPS] =
|
||||
|
@ -188,6 +187,7 @@ const GLenum magLookup_noFilter[WINED3DTEXF_ANISOTROPIC + 1] =
|
|||
/* drawStridedSlow attributes */
|
||||
glAttribFunc position_funcs[WINED3DDECLTYPE_UNUSED];
|
||||
glAttribFunc diffuse_funcs[WINED3DDECLTYPE_UNUSED];
|
||||
glAttribFunc specular_func_3ubv;
|
||||
glAttribFunc specular_funcs[WINED3DDECLTYPE_UNUSED];
|
||||
glAttribFunc normal_funcs[WINED3DDECLTYPE_UNUSED];
|
||||
glMultiTexCoordFunc multi_texcoord_funcs[WINED3DDECLTYPE_UNUSED];
|
||||
|
@ -329,11 +329,11 @@ static BOOL WineD3D_CreateFakeGLContext(void) {
|
|||
|
||||
/* Adjust the amount of used texture memory */
|
||||
long WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *D3DDevice, long glram){
|
||||
UINT Adapter = D3DDevice->adapterNo;
|
||||
struct WineD3DAdapter *adapter = D3DDevice->adapter;
|
||||
|
||||
Adapters[Adapter].UsedTextureRam += glram;
|
||||
TRACE("Adjusted gl ram by %ld to %d\n", glram, Adapters[Adapter].UsedTextureRam);
|
||||
return Adapters[Adapter].UsedTextureRam;
|
||||
adapter->UsedTextureRam += glram;
|
||||
TRACE("Adjusted gl ram by %ld to %d\n", glram, adapter->UsedTextureRam);
|
||||
return adapter->UsedTextureRam;
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
|
@ -457,7 +457,6 @@ static void select_shader_max_constants(
|
|||
* IWineD3D parts follows
|
||||
**********************************************************/
|
||||
|
||||
#define GLINFO_LOCATION (*gl_info)
|
||||
static inline BOOL test_arb_vs_offset_limit(const WineD3D_GL_Info *gl_info)
|
||||
{
|
||||
GLuint prog;
|
||||
|
@ -1440,7 +1439,6 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
|
|||
|
||||
return return_value;
|
||||
}
|
||||
#undef GLINFO_LOCATION
|
||||
|
||||
/**********************************************************
|
||||
* IWineD3D implementation follows
|
||||
|
@ -1449,8 +1447,9 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
|
|||
static UINT WINAPI IWineD3DImpl_GetAdapterCount (IWineD3D *iface) {
|
||||
IWineD3DImpl *This = (IWineD3DImpl *)iface;
|
||||
|
||||
TRACE_(d3d_caps)("(%p): Reporting %d adapters\n", This, numAdapters);
|
||||
return numAdapters;
|
||||
TRACE_(d3d_caps)("(%p): Reporting %u adapters\n", This, This->adapter_count);
|
||||
|
||||
return This->adapter_count;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DImpl_RegisterSoftwareDevice(IWineD3D *iface, void* pInitializeFunction) {
|
||||
|
@ -1468,7 +1467,7 @@ static HMONITOR WINAPI IWineD3DImpl_GetAdapterMonitor(IWineD3D *iface, UINT Adap
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return MonitorFromPoint(Adapters[Adapter].monitorPoint, MONITOR_DEFAULTTOPRIMARY);
|
||||
return MonitorFromPoint(This->adapters[Adapter].monitorPoint, MONITOR_DEFAULTTOPRIMARY);
|
||||
}
|
||||
|
||||
/* FIXME: GetAdapterModeCount and EnumAdapterModes currently only returns modes
|
||||
|
@ -1670,15 +1669,15 @@ static HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Ad
|
|||
|
||||
/* Return the information requested */
|
||||
TRACE_(d3d_caps)("device/Vendor Name and Version detection using FillGLCaps\n");
|
||||
strcpy(pIdentifier->Driver, Adapters[Adapter].driver);
|
||||
strcpy(pIdentifier->Description, Adapters[Adapter].description);
|
||||
strcpy(pIdentifier->Driver, This->adapters[Adapter].driver);
|
||||
strcpy(pIdentifier->Description, This->adapters[Adapter].description);
|
||||
|
||||
/* Note dx8 doesn't supply a DeviceName */
|
||||
if (NULL != pIdentifier->DeviceName) strcpy(pIdentifier->DeviceName, "\\\\.\\DISPLAY"); /* FIXME: May depend on desktop? */
|
||||
pIdentifier->DriverVersion->u.HighPart = Adapters[Adapter].gl_info.driver_version_hipart;
|
||||
pIdentifier->DriverVersion->u.LowPart = Adapters[Adapter].gl_info.driver_version;
|
||||
*(pIdentifier->VendorId) = Adapters[Adapter].gl_info.gl_vendor;
|
||||
*(pIdentifier->DeviceId) = Adapters[Adapter].gl_info.gl_card;
|
||||
pIdentifier->DriverVersion->u.HighPart = This->adapters[Adapter].gl_info.driver_version_hipart;
|
||||
pIdentifier->DriverVersion->u.LowPart = This->adapters[Adapter].gl_info.driver_version;
|
||||
*(pIdentifier->VendorId) = This->adapters[Adapter].gl_info.gl_vendor;
|
||||
*(pIdentifier->DeviceId) = This->adapters[Adapter].gl_info.gl_card;
|
||||
*(pIdentifier->SubSysId) = 0;
|
||||
*(pIdentifier->Revision) = 0;
|
||||
*pIdentifier->DeviceIdentifier = IID_D3DDEVICE_D3DUID;
|
||||
|
@ -1800,8 +1799,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDepthStencilMatch(IWineD3D *iface, UINT
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
cfgs = Adapters[Adapter].cfgs;
|
||||
nCfgs = Adapters[Adapter].nCfgs;
|
||||
cfgs = This->adapters[Adapter].cfgs;
|
||||
nCfgs = This->adapters[Adapter].nCfgs;
|
||||
for (it = 0; it < nCfgs; ++it) {
|
||||
if (IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&cfgs[it], RenderTargetFormat)) {
|
||||
if (IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&cfgs[it], DepthStencilFormat)) {
|
||||
|
@ -1846,7 +1845,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, U
|
|||
if(!wined3d_settings.allow_multisampling)
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
||||
desc = getFormatDescEntry(SurfaceFormat, &Adapters[Adapter].gl_info, &glDesc);
|
||||
desc = getFormatDescEntry(SurfaceFormat, &This->adapters[Adapter].gl_info, &glDesc);
|
||||
if(!desc || !glDesc) {
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
@ -1855,8 +1854,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, U
|
|||
int i, nCfgs;
|
||||
const WineD3D_PixelFormat *cfgs;
|
||||
|
||||
cfgs = Adapters[Adapter].cfgs;
|
||||
nCfgs = Adapters[Adapter].nCfgs;
|
||||
cfgs = This->adapters[Adapter].cfgs;
|
||||
nCfgs = This->adapters[Adapter].nCfgs;
|
||||
for(i=0; i<nCfgs; i++) {
|
||||
if(cfgs[i].numSamples != MultiSampleType)
|
||||
continue;
|
||||
|
@ -1881,8 +1880,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, U
|
|||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
||||
cfgs = Adapters[Adapter].cfgs;
|
||||
nCfgs = Adapters[Adapter].nCfgs;
|
||||
cfgs = This->adapters[Adapter].cfgs;
|
||||
nCfgs = This->adapters[Adapter].nCfgs;
|
||||
for(i=0; i<nCfgs; i++) {
|
||||
if(cfgs[i].numSamples != MultiSampleType)
|
||||
continue;
|
||||
|
@ -1990,9 +1989,9 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter
|
|||
}
|
||||
|
||||
|
||||
#define GLINFO_LOCATION Adapters[Adapter].gl_info
|
||||
/* Check if we support bumpmapping for a format */
|
||||
static BOOL CheckBumpMapCapability(UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT CheckFormat)
|
||||
static BOOL CheckBumpMapCapability(struct WineD3DAdapter *adapter,
|
||||
WINED3DDEVTYPE DeviceType, WINED3DFORMAT CheckFormat)
|
||||
{
|
||||
const struct fragment_pipeline *fp;
|
||||
const struct GlPixelFormatDesc *glDesc;
|
||||
|
@ -2006,8 +2005,8 @@ static BOOL CheckBumpMapCapability(UINT Adapter, WINED3DDEVTYPE DeviceType, WINE
|
|||
/* Ask the fixed function pipeline implementation if it can deal
|
||||
* with the conversion. If we've got a GL extension giving native
|
||||
* support this will be an identity conversion. */
|
||||
getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);
|
||||
fp = select_fragment_implementation(Adapter, DeviceType);
|
||||
getFormatDescEntry(CheckFormat, &adapter->gl_info, &glDesc);
|
||||
fp = select_fragment_implementation(adapter, DeviceType);
|
||||
if (fp->color_fixup_supported(glDesc->color_fixup))
|
||||
{
|
||||
TRACE_(d3d_caps)("[OK]\n");
|
||||
|
@ -2023,11 +2022,12 @@ static BOOL CheckBumpMapCapability(UINT Adapter, WINED3DDEVTYPE DeviceType, WINE
|
|||
}
|
||||
|
||||
/* Check if the given DisplayFormat + DepthStencilFormat combination is valid for the Adapter */
|
||||
static BOOL CheckDepthStencilCapability(UINT Adapter, WINED3DFORMAT DisplayFormat, WINED3DFORMAT DepthStencilFormat)
|
||||
static BOOL CheckDepthStencilCapability(struct WineD3DAdapter *adapter,
|
||||
WINED3DFORMAT DisplayFormat, WINED3DFORMAT DepthStencilFormat)
|
||||
{
|
||||
int it=0;
|
||||
const struct GlPixelFormatDesc *glDesc;
|
||||
const StaticPixelFormatDesc *desc = getFormatDescEntry(DepthStencilFormat, &GLINFO_LOCATION, &glDesc);
|
||||
const StaticPixelFormatDesc *desc = getFormatDescEntry(DepthStencilFormat, &adapter->gl_info, &glDesc);
|
||||
|
||||
/* Fail if we weren't able to get a description of the format */
|
||||
if(!desc || !glDesc)
|
||||
|
@ -2038,8 +2038,9 @@ static BOOL CheckDepthStencilCapability(UINT Adapter, WINED3DFORMAT DisplayForma
|
|||
return FALSE;
|
||||
|
||||
/* Walk through all WGL pixel formats to find a match */
|
||||
for (it = 0; it < Adapters[Adapter].nCfgs; ++it) {
|
||||
WineD3D_PixelFormat *cfg = &Adapters[Adapter].cfgs[it];
|
||||
for (it = 0; it < adapter->nCfgs; ++it)
|
||||
{
|
||||
WineD3D_PixelFormat *cfg = &adapter->cfgs[it];
|
||||
if (IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(cfg, DisplayFormat)) {
|
||||
if (IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(cfg, DepthStencilFormat)) {
|
||||
return TRUE;
|
||||
|
@ -2050,10 +2051,10 @@ static BOOL CheckDepthStencilCapability(UINT Adapter, WINED3DFORMAT DisplayForma
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CheckFilterCapability(UINT Adapter, WINED3DFORMAT CheckFormat)
|
||||
static BOOL CheckFilterCapability(struct WineD3DAdapter *adapter, WINED3DFORMAT CheckFormat)
|
||||
{
|
||||
const struct GlPixelFormatDesc *glDesc;
|
||||
const StaticPixelFormatDesc *desc = getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);
|
||||
const StaticPixelFormatDesc *desc = getFormatDescEntry(CheckFormat, &adapter->gl_info, &glDesc);
|
||||
|
||||
/* Fail if we weren't able to get a description of the format */
|
||||
if(!desc || !glDesc)
|
||||
|
@ -2067,11 +2068,11 @@ static BOOL CheckFilterCapability(UINT Adapter, WINED3DFORMAT CheckFormat)
|
|||
}
|
||||
|
||||
/* Check the render target capabilities of a format */
|
||||
static BOOL CheckRenderTargetCapability(WINED3DFORMAT AdapterFormat, WINED3DFORMAT CheckFormat)
|
||||
static BOOL CheckRenderTargetCapability(struct WineD3DAdapter *adapter,
|
||||
WINED3DFORMAT AdapterFormat, WINED3DFORMAT CheckFormat)
|
||||
{
|
||||
UINT Adapter = 0;
|
||||
const struct GlPixelFormatDesc *glDesc;
|
||||
const StaticPixelFormatDesc *desc = getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);
|
||||
const StaticPixelFormatDesc *desc = getFormatDescEntry(CheckFormat, &adapter->gl_info, &glDesc);
|
||||
|
||||
/* Fail if we weren't able to get a description of the format */
|
||||
if(!desc || !glDesc)
|
||||
|
@ -2082,7 +2083,7 @@ static BOOL CheckRenderTargetCapability(WINED3DFORMAT AdapterFormat, WINED3DFORM
|
|||
return FALSE;
|
||||
|
||||
if(wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) {
|
||||
WineD3D_PixelFormat *cfgs = Adapters[Adapter].cfgs;
|
||||
WineD3D_PixelFormat *cfgs = adapter->cfgs;
|
||||
int it;
|
||||
short AdapterRed, AdapterGreen, AdapterBlue, AdapterAlpha, AdapterTotalSize;
|
||||
short CheckRed, CheckGreen, CheckBlue, CheckAlpha, CheckTotalSize;
|
||||
|
@ -2099,7 +2100,8 @@ static BOOL CheckRenderTargetCapability(WINED3DFORMAT AdapterFormat, WINED3DFORM
|
|||
|
||||
/* Check if there is a WGL pixel format matching the requirements, the format should also be window
|
||||
* drawable (not offscreen; e.g. Nvidia offers R5G6B5 for pbuffers even when X is running at 24bit) */
|
||||
for (it = 0; it < Adapters[Adapter].nCfgs; ++it) {
|
||||
for (it = 0; it < adapter->nCfgs; ++it)
|
||||
{
|
||||
if (cfgs[it].windowDrawable && IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&cfgs[it], CheckFormat)) {
|
||||
TRACE_(d3d_caps)("iPixelFormat=%d is compatible with CheckFormat=%s\n", cfgs[it].iPixelFormat, debug_d3dformat(CheckFormat));
|
||||
return TRUE;
|
||||
|
@ -2107,11 +2109,12 @@ static BOOL CheckRenderTargetCapability(WINED3DFORMAT AdapterFormat, WINED3DFORM
|
|||
}
|
||||
} else if(wined3d_settings.offscreen_rendering_mode == ORM_PBUFFER) {
|
||||
/* We can probably use this function in FBO mode too on some drivers to get some basic indication of the capabilities. */
|
||||
WineD3D_PixelFormat *cfgs = Adapters[Adapter].cfgs;
|
||||
WineD3D_PixelFormat *cfgs = adapter->cfgs;
|
||||
int it;
|
||||
|
||||
/* Check if there is a WGL pixel format matching the requirements, the pixel format should also be usable with pbuffers */
|
||||
for (it = 0; it < Adapters[Adapter].nCfgs; ++it) {
|
||||
for (it = 0; it < adapter->nCfgs; ++it)
|
||||
{
|
||||
if (cfgs[it].pbufferDrawable && IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&cfgs[it], CheckFormat)) {
|
||||
TRACE_(d3d_caps)("iPixelFormat=%d is compatible with CheckFormat=%s\n", cfgs[it].iPixelFormat, debug_d3dformat(CheckFormat));
|
||||
return TRUE;
|
||||
|
@ -2125,8 +2128,10 @@ static BOOL CheckRenderTargetCapability(WINED3DFORMAT AdapterFormat, WINED3DFORM
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CheckSrgbReadCapability(UINT Adapter, WINED3DFORMAT CheckFormat)
|
||||
static BOOL CheckSrgbReadCapability(struct WineD3DAdapter *adapter, WINED3DFORMAT CheckFormat)
|
||||
{
|
||||
const WineD3D_GL_Info *gl_info = &adapter->gl_info;
|
||||
|
||||
/* Check for supported sRGB formats (Texture loading and framebuffer) */
|
||||
if(!GL_SUPPORT(EXT_TEXTURE_SRGB)) {
|
||||
TRACE_(d3d_caps)("[FAILED] GL_EXT_texture_sRGB not supported\n");
|
||||
|
@ -2154,7 +2159,8 @@ static BOOL CheckSrgbReadCapability(UINT Adapter, WINED3DFORMAT CheckFormat)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CheckSrgbWriteCapability(UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT CheckFormat)
|
||||
static BOOL CheckSrgbWriteCapability(struct WineD3DAdapter *adapter,
|
||||
WINED3DDEVTYPE DeviceType, WINED3DFORMAT CheckFormat)
|
||||
{
|
||||
/* Only offer SRGB writing on X8R8G8B8/A8R8G8B8 when we use ARB or GLSL shaders as we are
|
||||
* doing the color fixup in shaders.
|
||||
|
@ -2162,7 +2168,7 @@ static BOOL CheckSrgbWriteCapability(UINT Adapter, WINED3DDEVTYPE DeviceType, WI
|
|||
if((CheckFormat == WINED3DFMT_X8R8G8B8) || (CheckFormat == WINED3DFMT_A8R8G8B8)) {
|
||||
int vs_selected_mode;
|
||||
int ps_selected_mode;
|
||||
select_shader_mode(&GLINFO_LOCATION, DeviceType, &ps_selected_mode, &vs_selected_mode);
|
||||
select_shader_mode(&adapter->gl_info, DeviceType, &ps_selected_mode, &vs_selected_mode);
|
||||
|
||||
if((ps_selected_mode == SHADER_ARB) || (ps_selected_mode == SHADER_GLSL)) {
|
||||
TRACE_(d3d_caps)("[OK]\n");
|
||||
|
@ -2175,10 +2181,10 @@ static BOOL CheckSrgbWriteCapability(UINT Adapter, WINED3DDEVTYPE DeviceType, WI
|
|||
}
|
||||
|
||||
/* Check if a format support blending in combination with pixel shaders */
|
||||
static BOOL CheckPostPixelShaderBlendingCapability(UINT Adapter, WINED3DFORMAT CheckFormat)
|
||||
static BOOL CheckPostPixelShaderBlendingCapability(struct WineD3DAdapter *adapter, WINED3DFORMAT CheckFormat)
|
||||
{
|
||||
const struct GlPixelFormatDesc *glDesc;
|
||||
const StaticPixelFormatDesc *desc = getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);
|
||||
const StaticPixelFormatDesc *desc = getFormatDescEntry(CheckFormat, &adapter->gl_info, &glDesc);
|
||||
|
||||
/* Fail if we weren't able to get a description of the format */
|
||||
if(!desc || !glDesc)
|
||||
|
@ -2205,8 +2211,10 @@ static BOOL CheckWrapAndMipCapability(UINT Adapter, WINED3DFORMAT CheckFormat) {
|
|||
}
|
||||
|
||||
/* Check if a texture format is supported on the given adapter */
|
||||
static BOOL CheckTextureCapability(UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT CheckFormat)
|
||||
static BOOL CheckTextureCapability(struct WineD3DAdapter *adapter,
|
||||
WINED3DDEVTYPE DeviceType, WINED3DFORMAT CheckFormat)
|
||||
{
|
||||
const WineD3D_GL_Info *gl_info = &adapter->gl_info;
|
||||
const shader_backend_t *shader_backend;
|
||||
const struct fragment_pipeline *fp;
|
||||
const struct GlPixelFormatDesc *glDesc;
|
||||
|
@ -2287,8 +2295,8 @@ static BOOL CheckTextureCapability(UINT Adapter, WINED3DDEVTYPE DeviceType, WINE
|
|||
/* Ask the shader backend if it can deal with the conversion. If
|
||||
* we've got a GL extension giving native support this will be an
|
||||
* identity conversion. */
|
||||
getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);
|
||||
shader_backend = select_shader_backend(Adapter, DeviceType);
|
||||
getFormatDescEntry(CheckFormat, &adapter->gl_info, &glDesc);
|
||||
shader_backend = select_shader_backend(adapter, DeviceType);
|
||||
if (shader_backend->shader_color_fixup_supported(glDesc->color_fixup))
|
||||
{
|
||||
TRACE_(d3d_caps)("[OK]\n");
|
||||
|
@ -2405,9 +2413,9 @@ static BOOL CheckTextureCapability(UINT Adapter, WINED3DDEVTYPE DeviceType, WINE
|
|||
/* Vendor specific formats */
|
||||
case WINED3DFMT_ATI2N:
|
||||
if(GL_SUPPORT(ATI_TEXTURE_COMPRESSION_3DC) || GL_SUPPORT(EXT_TEXTURE_COMPRESSION_RGTC)) {
|
||||
getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);
|
||||
shader_backend = select_shader_backend(Adapter, DeviceType);
|
||||
fp = select_fragment_implementation(Adapter, DeviceType);
|
||||
getFormatDescEntry(CheckFormat, &adapter->gl_info, &glDesc);
|
||||
shader_backend = select_shader_backend(adapter, DeviceType);
|
||||
fp = select_fragment_implementation(adapter, DeviceType);
|
||||
if (shader_backend->shader_color_fixup_supported(glDesc->color_fixup)
|
||||
&& fp->color_fixup_supported(glDesc->color_fixup))
|
||||
{
|
||||
|
@ -2442,7 +2450,9 @@ static BOOL CheckTextureCapability(UINT Adapter, WINED3DDEVTYPE DeviceType, WINE
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CheckSurfaceCapability(UINT Adapter, WINED3DFORMAT AdapterFormat, WINED3DDEVTYPE DeviceType, WINED3DFORMAT CheckFormat, WINED3DSURFTYPE SurfaceType) {
|
||||
static BOOL CheckSurfaceCapability(struct WineD3DAdapter *adapter, WINED3DFORMAT AdapterFormat,
|
||||
WINED3DDEVTYPE DeviceType, WINED3DFORMAT CheckFormat, WINED3DSURFTYPE SurfaceType)
|
||||
{
|
||||
const struct GlPixelFormatDesc *format_desc;
|
||||
const struct blit_shader *blitter;
|
||||
|
||||
|
@ -2475,13 +2485,13 @@ static BOOL CheckSurfaceCapability(UINT Adapter, WINED3DFORMAT AdapterFormat, WI
|
|||
}
|
||||
|
||||
/* All format that are supported for textures are supported for surfaces as well */
|
||||
if(CheckTextureCapability(Adapter, DeviceType, CheckFormat)) return TRUE;
|
||||
if(CheckTextureCapability(adapter, DeviceType, CheckFormat)) return TRUE;
|
||||
/* All depth stencil formats are supported on surfaces */
|
||||
if(CheckDepthStencilCapability(Adapter, AdapterFormat, CheckFormat)) return TRUE;
|
||||
if(CheckDepthStencilCapability(adapter, AdapterFormat, CheckFormat)) return TRUE;
|
||||
|
||||
/* If opengl can't process the format natively, the blitter may be able to convert it */
|
||||
getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &format_desc);
|
||||
blitter = select_blit_implementation(Adapter, DeviceType);
|
||||
getFormatDescEntry(CheckFormat, &adapter->gl_info, &format_desc);
|
||||
blitter = select_blit_implementation(adapter, DeviceType);
|
||||
if (blitter->color_fixup_supported(format_desc->color_fixup))
|
||||
{
|
||||
TRACE_(d3d_caps)("[OK]\n");
|
||||
|
@ -2493,8 +2503,10 @@ static BOOL CheckSurfaceCapability(UINT Adapter, WINED3DFORMAT AdapterFormat, WI
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CheckVertexTextureCapability(UINT Adapter, WINED3DFORMAT CheckFormat)
|
||||
static BOOL CheckVertexTextureCapability(struct WineD3DAdapter *adapter, WINED3DFORMAT CheckFormat)
|
||||
{
|
||||
const WineD3D_GL_Info *gl_info = &adapter->gl_info;
|
||||
|
||||
if (!GL_LIMITS(vertex_samplers)) {
|
||||
TRACE_(d3d_caps)("[FAILED]\n");
|
||||
return FALSE;
|
||||
|
@ -2520,6 +2532,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
WINED3DFORMAT AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat,
|
||||
WINED3DSURFTYPE SurfaceType) {
|
||||
IWineD3DImpl *This = (IWineD3DImpl *)iface;
|
||||
struct WineD3DAdapter *adapter = &This->adapters[Adapter];
|
||||
const WineD3D_GL_Info *gl_info = &adapter->gl_info;
|
||||
DWORD UsageCaps = 0;
|
||||
|
||||
TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%u,%s), AdptFmt:(%u,%s), Use:(%u,%s,%s), ResTyp:(%x,%s), CheckFmt:(%u,%s))\n",
|
||||
|
@ -2553,7 +2567,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
*/
|
||||
if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) {
|
||||
/* Check if the texture format is around */
|
||||
if(CheckTextureCapability(Adapter, DeviceType, CheckFormat)) {
|
||||
if (CheckTextureCapability(adapter, DeviceType, CheckFormat))
|
||||
{
|
||||
if(Usage & WINED3DUSAGE_AUTOGENMIPMAP) {
|
||||
/* Check for automatic mipmap generation support */
|
||||
if(GL_SUPPORT(SGIS_GENERATE_MIPMAP)) {
|
||||
|
@ -2569,7 +2584,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
UsageCaps |= WINED3DUSAGE_DYNAMIC;
|
||||
|
||||
if(Usage & WINED3DUSAGE_RENDERTARGET) {
|
||||
if(CheckRenderTargetCapability(AdapterFormat, CheckFormat)) {
|
||||
if(CheckRenderTargetCapability(adapter, AdapterFormat, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_RENDERTARGET;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No rendertarget support\n");
|
||||
|
@ -2583,7 +2599,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_FILTER support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_FILTER) {
|
||||
if(CheckFilterCapability(Adapter, CheckFormat)) {
|
||||
if (CheckFilterCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_FILTER;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query filter support\n");
|
||||
|
@ -2593,7 +2610,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_POSTPIXELSHADER_BLENDING support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) {
|
||||
if(CheckPostPixelShaderBlendingCapability(Adapter, CheckFormat)) {
|
||||
if (CheckPostPixelShaderBlendingCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query post pixelshader blending support\n");
|
||||
|
@ -2603,7 +2621,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_SRGBREAD support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_SRGBREAD) {
|
||||
if(CheckSrgbReadCapability(Adapter, CheckFormat)) {
|
||||
if (CheckSrgbReadCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_SRGBREAD;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query srgbread support\n");
|
||||
|
@ -2613,7 +2632,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_SRGBWRITE support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_SRGBWRITE) {
|
||||
if(CheckSrgbWriteCapability(Adapter, DeviceType, CheckFormat)) {
|
||||
if (CheckSrgbWriteCapability(adapter, DeviceType, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_SRGBWRITE;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query srgbwrite support\n");
|
||||
|
@ -2623,7 +2643,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_VERTEXTEXTURE support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) {
|
||||
if(CheckVertexTextureCapability(Adapter, CheckFormat)) {
|
||||
if (CheckVertexTextureCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n");
|
||||
|
@ -2655,9 +2676,11 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
* - D3DUSAGE_RENDERTARGET
|
||||
*/
|
||||
|
||||
if(CheckSurfaceCapability(Adapter, AdapterFormat, DeviceType, CheckFormat, SurfaceType)) {
|
||||
if (CheckSurfaceCapability(adapter, AdapterFormat, DeviceType, CheckFormat, SurfaceType))
|
||||
{
|
||||
if(Usage & WINED3DUSAGE_DEPTHSTENCIL) {
|
||||
if(CheckDepthStencilCapability(Adapter, AdapterFormat, CheckFormat)) {
|
||||
if (CheckDepthStencilCapability(adapter, AdapterFormat, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_DEPTHSTENCIL;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No depthstencil support\n");
|
||||
|
@ -2666,7 +2689,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
}
|
||||
|
||||
if(Usage & WINED3DUSAGE_RENDERTARGET) {
|
||||
if(CheckRenderTargetCapability(AdapterFormat, CheckFormat)) {
|
||||
if (CheckRenderTargetCapability(adapter, AdapterFormat, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_RENDERTARGET;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No rendertarget support\n");
|
||||
|
@ -2676,7 +2700,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_POSTPIXELSHADER_BLENDING support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) {
|
||||
if(CheckPostPixelShaderBlendingCapability(Adapter, CheckFormat)) {
|
||||
if (CheckPostPixelShaderBlendingCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query post pixelshader blending support\n");
|
||||
|
@ -2707,7 +2732,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
}
|
||||
|
||||
/* Check if the texture format is around */
|
||||
if(CheckTextureCapability(Adapter, DeviceType, CheckFormat)) {
|
||||
if (CheckTextureCapability(adapter, DeviceType, CheckFormat))
|
||||
{
|
||||
if(Usage & WINED3DUSAGE_AUTOGENMIPMAP) {
|
||||
/* Check for automatic mipmap generation support */
|
||||
if(GL_SUPPORT(SGIS_GENERATE_MIPMAP)) {
|
||||
|
@ -2723,7 +2749,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
UsageCaps |= WINED3DUSAGE_DYNAMIC;
|
||||
|
||||
if(Usage & WINED3DUSAGE_RENDERTARGET) {
|
||||
if(CheckRenderTargetCapability(AdapterFormat, CheckFormat)) {
|
||||
if (CheckRenderTargetCapability(adapter, AdapterFormat, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_RENDERTARGET;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No rendertarget support\n");
|
||||
|
@ -2737,7 +2764,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_FILTER support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_FILTER) {
|
||||
if(CheckFilterCapability(Adapter, CheckFormat)) {
|
||||
if (CheckFilterCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_FILTER;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query filter support\n");
|
||||
|
@ -2747,7 +2775,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_LEGACYBUMPMAP support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_LEGACYBUMPMAP) {
|
||||
if(CheckBumpMapCapability(Adapter, DeviceType, CheckFormat)) {
|
||||
if (CheckBumpMapCapability(adapter, DeviceType, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_LEGACYBUMPMAP;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No legacy bumpmap support\n");
|
||||
|
@ -2757,7 +2786,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_POSTPIXELSHADER_BLENDING support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) {
|
||||
if(CheckPostPixelShaderBlendingCapability(Adapter, CheckFormat)) {
|
||||
if (CheckPostPixelShaderBlendingCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query post pixelshader blending support\n");
|
||||
|
@ -2767,7 +2797,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_SRGBREAD support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_SRGBREAD) {
|
||||
if(CheckSrgbReadCapability(Adapter, CheckFormat)) {
|
||||
if (CheckSrgbReadCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_SRGBREAD;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query srgbread support\n");
|
||||
|
@ -2777,7 +2808,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_SRGBWRITE support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_SRGBWRITE) {
|
||||
if(CheckSrgbWriteCapability(Adapter, DeviceType, CheckFormat)) {
|
||||
if (CheckSrgbWriteCapability(adapter, DeviceType, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_SRGBWRITE;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query srgbwrite support\n");
|
||||
|
@ -2787,7 +2819,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_VERTEXTEXTURE support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) {
|
||||
if(CheckVertexTextureCapability(Adapter, CheckFormat)) {
|
||||
if (CheckVertexTextureCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n");
|
||||
|
@ -2806,7 +2839,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
}
|
||||
|
||||
if(Usage & WINED3DUSAGE_DEPTHSTENCIL) {
|
||||
if(CheckDepthStencilCapability(Adapter, AdapterFormat, CheckFormat)) {
|
||||
if (CheckDepthStencilCapability(adapter, AdapterFormat, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_DEPTHSTENCIL;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No depth stencil support\n");
|
||||
|
@ -2835,7 +2869,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check volume texture and volume usage caps */
|
||||
if(GL_SUPPORT(EXT_TEXTURE3D)) {
|
||||
if(CheckTextureCapability(Adapter, DeviceType, CheckFormat) == FALSE) {
|
||||
if (!CheckTextureCapability(adapter, DeviceType, CheckFormat))
|
||||
{
|
||||
TRACE_(d3d_caps)("[FAILED] - Format not supported\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
@ -2850,7 +2885,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_FILTER support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_FILTER) {
|
||||
if(CheckFilterCapability(Adapter, CheckFormat)) {
|
||||
if (CheckFilterCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_FILTER;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query filter support\n");
|
||||
|
@ -2860,7 +2896,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_POSTPIXELSHADER_BLENDING support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) {
|
||||
if(CheckPostPixelShaderBlendingCapability(Adapter, CheckFormat)) {
|
||||
if (CheckPostPixelShaderBlendingCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query post pixelshader blending support\n");
|
||||
|
@ -2870,7 +2907,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_SRGBREAD support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_SRGBREAD) {
|
||||
if(CheckSrgbReadCapability(Adapter, CheckFormat)) {
|
||||
if (CheckSrgbReadCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_SRGBREAD;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query srgbread support\n");
|
||||
|
@ -2880,7 +2918,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_SRGBWRITE support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_SRGBWRITE) {
|
||||
if(CheckSrgbWriteCapability(Adapter, DeviceType, CheckFormat)) {
|
||||
if (CheckSrgbWriteCapability(adapter, DeviceType, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_SRGBWRITE;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query srgbwrite support\n");
|
||||
|
@ -2890,7 +2929,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
|
|||
|
||||
/* Check QUERY_VERTEXTEXTURE support */
|
||||
if(Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) {
|
||||
if(CheckVertexTextureCapability(Adapter, CheckFormat)) {
|
||||
if (CheckVertexTextureCapability(adapter, CheckFormat))
|
||||
{
|
||||
UsageCaps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE;
|
||||
} else {
|
||||
TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n");
|
||||
|
@ -3005,12 +3045,13 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormatConversion(IWineD3D *iface,
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static const shader_backend_t *select_shader_backend(UINT Adapter, WINED3DDEVTYPE DeviceType) {
|
||||
static const shader_backend_t *select_shader_backend(struct WineD3DAdapter *adapter, WINED3DDEVTYPE DeviceType)
|
||||
{
|
||||
const shader_backend_t *ret;
|
||||
int vs_selected_mode;
|
||||
int ps_selected_mode;
|
||||
|
||||
select_shader_mode(&GLINFO_LOCATION, DeviceType, &ps_selected_mode, &vs_selected_mode);
|
||||
select_shader_mode(&adapter->gl_info, DeviceType, &ps_selected_mode, &vs_selected_mode);
|
||||
if (vs_selected_mode == SHADER_GLSL || ps_selected_mode == SHADER_GLSL) {
|
||||
ret = &glsl_shader_backend;
|
||||
} else if (vs_selected_mode == SHADER_ARB || ps_selected_mode == SHADER_ARB) {
|
||||
|
@ -3021,11 +3062,14 @@ static const shader_backend_t *select_shader_backend(UINT Adapter, WINED3DDEVTYP
|
|||
return ret;
|
||||
}
|
||||
|
||||
static const struct fragment_pipeline *select_fragment_implementation(UINT Adapter, WINED3DDEVTYPE DeviceType) {
|
||||
static const struct fragment_pipeline *select_fragment_implementation(struct WineD3DAdapter *adapter,
|
||||
WINED3DDEVTYPE DeviceType)
|
||||
{
|
||||
const WineD3D_GL_Info *gl_info = &adapter->gl_info;
|
||||
int vs_selected_mode;
|
||||
int ps_selected_mode;
|
||||
|
||||
select_shader_mode(&GLINFO_LOCATION, DeviceType, &ps_selected_mode, &vs_selected_mode);
|
||||
select_shader_mode(&adapter->gl_info, DeviceType, &ps_selected_mode, &vs_selected_mode);
|
||||
if((ps_selected_mode == SHADER_ARB || ps_selected_mode == SHADER_GLSL) && GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) {
|
||||
return &arbfp_fragment_pipeline;
|
||||
} else if(ps_selected_mode == SHADER_ATI) {
|
||||
|
@ -3039,11 +3083,13 @@ static const struct fragment_pipeline *select_fragment_implementation(UINT Adapt
|
|||
}
|
||||
}
|
||||
|
||||
static const struct blit_shader *select_blit_implementation(UINT Adapter, WINED3DDEVTYPE DeviceType) {
|
||||
static const struct blit_shader *select_blit_implementation(struct WineD3DAdapter *adapter, WINED3DDEVTYPE DeviceType)
|
||||
{
|
||||
const WineD3D_GL_Info *gl_info = &adapter->gl_info;
|
||||
int vs_selected_mode;
|
||||
int ps_selected_mode;
|
||||
|
||||
select_shader_mode(&GLINFO_LOCATION, DeviceType, &ps_selected_mode, &vs_selected_mode);
|
||||
select_shader_mode(&adapter->gl_info, DeviceType, &ps_selected_mode, &vs_selected_mode);
|
||||
if((ps_selected_mode == SHADER_ARB || ps_selected_mode == SHADER_GLSL) && GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) {
|
||||
return &arbfp_blit;
|
||||
} else {
|
||||
|
@ -3057,6 +3103,8 @@ static const struct blit_shader *select_blit_implementation(UINT Adapter, WINED3
|
|||
static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DCAPS* pCaps) {
|
||||
|
||||
IWineD3DImpl *This = (IWineD3DImpl *)iface;
|
||||
struct WineD3DAdapter *adapter = &This->adapters[Adapter];
|
||||
const WineD3D_GL_Info *gl_info = &adapter->gl_info;
|
||||
int vs_selected_mode;
|
||||
int ps_selected_mode;
|
||||
struct shader_caps shader_caps;
|
||||
|
@ -3071,11 +3119,11 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
select_shader_mode(&Adapters[Adapter].gl_info, DeviceType, &ps_selected_mode, &vs_selected_mode);
|
||||
select_shader_mode(&adapter->gl_info, DeviceType, &ps_selected_mode, &vs_selected_mode);
|
||||
|
||||
/* This function should *not* be modifying GL caps
|
||||
* TODO: move the functionality where it belongs */
|
||||
select_shader_max_constants(ps_selected_mode, vs_selected_mode, &Adapters[Adapter].gl_info);
|
||||
select_shader_max_constants(ps_selected_mode, vs_selected_mode, &adapter->gl_info);
|
||||
|
||||
/* ------------------------------------------------
|
||||
The following fields apply to both d3d8 and d3d9
|
||||
|
@ -3426,12 +3474,12 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
|||
pCaps->VertexTextureFilterCaps = 0;
|
||||
|
||||
memset(&shader_caps, 0, sizeof(shader_caps));
|
||||
shader_backend = select_shader_backend(Adapter, DeviceType);
|
||||
shader_backend->shader_get_caps(DeviceType, &GLINFO_LOCATION, &shader_caps);
|
||||
shader_backend = select_shader_backend(adapter, DeviceType);
|
||||
shader_backend->shader_get_caps(DeviceType, &adapter->gl_info, &shader_caps);
|
||||
|
||||
memset(&fragment_caps, 0, sizeof(fragment_caps));
|
||||
frag_pipeline = select_fragment_implementation(Adapter, DeviceType);
|
||||
frag_pipeline->get_caps(DeviceType, &GLINFO_LOCATION, &fragment_caps);
|
||||
frag_pipeline = select_fragment_implementation(adapter, DeviceType);
|
||||
frag_pipeline->get_caps(DeviceType, &adapter->gl_info, &fragment_caps);
|
||||
|
||||
/* Add shader misc caps. Only some of them belong to the shader parts of the pipeline */
|
||||
pCaps->PrimitiveMiscCaps |= fragment_caps.PrimitiveMiscCaps;
|
||||
|
@ -3477,15 +3525,15 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
|||
use the VS 3.0 from MSDN or else if there's OpenGL spec use a hardcoded value minimum VS3.0 value. */
|
||||
pCaps->VS20Caps.Caps = WINED3DVS20CAPS_PREDICATION;
|
||||
pCaps->VS20Caps.DynamicFlowControlDepth = WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH; /* VS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
|
||||
pCaps->VS20Caps.NumTemps = max(32, GLINFO_LOCATION.vs_arb_max_temps);
|
||||
pCaps->VS20Caps.NumTemps = max(32, adapter->gl_info.vs_arb_max_temps);
|
||||
pCaps->VS20Caps.StaticFlowControlDepth = WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH ; /* level of nesting in loops / if-statements; VS 3.0 requires MAX (4) */
|
||||
|
||||
pCaps->MaxVShaderInstructionsExecuted = 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */
|
||||
pCaps->MaxVertexShader30InstructionSlots = max(512, GLINFO_LOCATION.vs_arb_max_instructions);
|
||||
pCaps->MaxVertexShader30InstructionSlots = max(512, adapter->gl_info.vs_arb_max_instructions);
|
||||
} else if(pCaps->VertexShaderVersion == WINED3DVS_VERSION(2,0)) {
|
||||
pCaps->VS20Caps.Caps = 0;
|
||||
pCaps->VS20Caps.DynamicFlowControlDepth = WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH;
|
||||
pCaps->VS20Caps.NumTemps = max(12, GLINFO_LOCATION.vs_arb_max_temps);
|
||||
pCaps->VS20Caps.NumTemps = max(12, adapter->gl_info.vs_arb_max_temps);
|
||||
pCaps->VS20Caps.StaticFlowControlDepth = 1;
|
||||
|
||||
pCaps->MaxVShaderInstructionsExecuted = 65535;
|
||||
|
@ -3511,17 +3559,17 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
|||
WINED3DPS20CAPS_NODEPENDENTREADLIMIT |
|
||||
WINED3DPS20CAPS_NOTEXINSTRUCTIONLIMIT;
|
||||
pCaps->PS20Caps.DynamicFlowControlDepth = WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH; /* PS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
|
||||
pCaps->PS20Caps.NumTemps = max(32, GLINFO_LOCATION.ps_arb_max_temps);
|
||||
pCaps->PS20Caps.NumTemps = max(32, adapter->gl_info.ps_arb_max_temps);
|
||||
pCaps->PS20Caps.StaticFlowControlDepth = WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH; /* PS 3.0 requires MAX_STATICFLOWCONTROLDEPTH (4) */
|
||||
pCaps->PS20Caps.NumInstructionSlots = WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS; /* PS 3.0 requires MAX_NUMINSTRUCTIONSLOTS (512) */
|
||||
|
||||
pCaps->MaxPShaderInstructionsExecuted = 65535;
|
||||
pCaps->MaxPixelShader30InstructionSlots = max(WINED3DMIN30SHADERINSTRUCTIONS, GLINFO_LOCATION.ps_arb_max_instructions);
|
||||
pCaps->MaxPixelShader30InstructionSlots = max(WINED3DMIN30SHADERINSTRUCTIONS, adapter->gl_info.ps_arb_max_instructions);
|
||||
} else if(pCaps->PixelShaderVersion == WINED3DPS_VERSION(2,0)) {
|
||||
/* Below we assume PS2.0 specs, not extended 2.0a(GeforceFX)/2.0b(Radeon R3xx) ones */
|
||||
pCaps->PS20Caps.Caps = 0;
|
||||
pCaps->PS20Caps.DynamicFlowControlDepth = 0; /* WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0 */
|
||||
pCaps->PS20Caps.NumTemps = max(12, GLINFO_LOCATION.ps_arb_max_temps);
|
||||
pCaps->PS20Caps.NumTemps = max(12, adapter->gl_info.ps_arb_max_temps);
|
||||
pCaps->PS20Caps.StaticFlowControlDepth = WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH; /* Minimum: 1 */
|
||||
pCaps->PS20Caps.NumInstructionSlots = WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS; /* Minimum number (64 ALU + 32 Texture), a GeforceFX uses 512 */
|
||||
|
||||
|
@ -3615,7 +3663,8 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
|||
pCaps->DirectDrawCaps.StrideAlign = DDRAW_PITCH_ALIGNMENT;
|
||||
|
||||
/* Set D3D caps if OpenGL is available. */
|
||||
if(Adapters[Adapter].opengl) {
|
||||
if (adapter->opengl)
|
||||
{
|
||||
pCaps->DirectDrawCaps.ddsCaps |=WINEDDSCAPS_3DDEVICE |
|
||||
WINEDDSCAPS_MIPMAP |
|
||||
WINEDDSCAPS_TEXTURE |
|
||||
|
@ -3634,6 +3683,7 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
|
|||
{
|
||||
IWineD3DDeviceImpl *object = NULL;
|
||||
IWineD3DImpl *This = (IWineD3DImpl *)iface;
|
||||
struct WineD3DAdapter *adapter = &This->adapters[Adapter];
|
||||
WINED3DDISPLAYMODE mode;
|
||||
const struct fragment_pipeline *frag_pipeline = NULL;
|
||||
int i;
|
||||
|
@ -3659,7 +3709,7 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
|
|||
object->lpVtbl = &IWineD3DDevice_Vtbl;
|
||||
object->ref = 1;
|
||||
object->wineD3D = iface;
|
||||
object->adapter = numAdapters ? &Adapters[Adapter] : NULL;
|
||||
object->adapter = This->adapter_count ? adapter : NULL;
|
||||
IWineD3D_AddRef(object->wineD3D);
|
||||
object->parent = parent;
|
||||
object->device_parent = device_parent;
|
||||
|
@ -3689,16 +3739,17 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
|
|||
object->adapterNo = Adapter;
|
||||
object->devType = DeviceType;
|
||||
|
||||
select_shader_mode(&GLINFO_LOCATION, DeviceType, &object->ps_selected_mode, &object->vs_selected_mode);
|
||||
object->shader_backend = select_shader_backend(Adapter, DeviceType);
|
||||
select_shader_mode(&adapter->gl_info, DeviceType,
|
||||
&object->ps_selected_mode, &object->vs_selected_mode);
|
||||
object->shader_backend = select_shader_backend(adapter, DeviceType);
|
||||
|
||||
memset(&ffp_caps, 0, sizeof(ffp_caps));
|
||||
frag_pipeline = select_fragment_implementation(Adapter, DeviceType);
|
||||
frag_pipeline = select_fragment_implementation(adapter, DeviceType);
|
||||
object->frag_pipe = frag_pipeline;
|
||||
frag_pipeline->get_caps(DeviceType, &GLINFO_LOCATION, &ffp_caps);
|
||||
frag_pipeline->get_caps(DeviceType, &adapter->gl_info, &ffp_caps);
|
||||
object->max_ffp_textures = ffp_caps.MaxSimultaneousTextures;
|
||||
object->max_ffp_texture_stages = ffp_caps.MaxTextureBlendStages;
|
||||
hr = compile_state_table(object->StateTable, object->multistate_funcs, &GLINFO_LOCATION,
|
||||
hr = compile_state_table(object->StateTable, object->multistate_funcs, &adapter->gl_info,
|
||||
ffp_vertexstate_template, frag_pipeline, misc_state_template);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
|
@ -3708,7 +3759,7 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
|
|||
return hr;
|
||||
}
|
||||
|
||||
object->blitter = select_blit_implementation(Adapter, DeviceType);
|
||||
object->blitter = select_blit_implementation(adapter, DeviceType);
|
||||
|
||||
/* set the state of the device to valid */
|
||||
object->state = WINED3D_OK;
|
||||
|
@ -3728,7 +3779,6 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
|
|||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
#undef GLINFO_LOCATION
|
||||
|
||||
static HRESULT WINAPI IWineD3DImpl_GetParent(IWineD3D *iface, IUnknown **pParent) {
|
||||
IWineD3DImpl *This = (IWineD3DImpl *)iface;
|
||||
|
@ -3785,7 +3835,6 @@ static BOOL implementation_is_apple(const WineD3D_GL_Info *gl_info)
|
|||
}
|
||||
}
|
||||
|
||||
#define GLINFO_LOCATION (*gl_info)
|
||||
static void test_pbo_functionality(WineD3D_GL_Info *gl_info) {
|
||||
/* Some OpenGL implementations, namely Apple's Geforce 8 driver, advertises PBOs,
|
||||
* but glTexSubImage from a PBO fails miserably, with the first line repeated over
|
||||
|
@ -3845,7 +3894,6 @@ static void test_pbo_functionality(WineD3D_GL_Info *gl_info) {
|
|||
TRACE_(d3d_caps)("PBO test successful\n");
|
||||
}
|
||||
}
|
||||
#undef GLINFO_LOCATION
|
||||
|
||||
/* Certain applications(Steam) complain if we report an outdated driver version. In general,
|
||||
* reporting a driver version is moot because we are not the Windows driver, and we have different
|
||||
|
@ -4009,8 +4057,6 @@ static void WINE_GLAPI invalid_texcoord_func(GLenum unit, const void *data)
|
|||
DebugBreak();
|
||||
}
|
||||
|
||||
#define GLINFO_LOCATION (Adapters[0].gl_info)
|
||||
|
||||
/* Helper functions for providing vertex data to opengl. The arrays are initialized based on
|
||||
* the extension detection and are used in drawStridedSlow
|
||||
*/
|
||||
|
@ -4051,10 +4097,11 @@ static void WINE_GLAPI diffuse_d3dcolor(const void *data)
|
|||
static void WINE_GLAPI specular_d3dcolor(const void *data)
|
||||
{
|
||||
DWORD specularColor = *((const DWORD *)data);
|
||||
GLbyte d[] = {D3DCOLOR_B_R(specularColor),
|
||||
D3DCOLOR_B_G(specularColor),
|
||||
D3DCOLOR_B_B(specularColor)};
|
||||
|
||||
GL_EXTCALL(glSecondaryColor3ubEXT)(D3DCOLOR_B_R(specularColor),
|
||||
D3DCOLOR_B_G(specularColor),
|
||||
D3DCOLOR_B_B(specularColor));
|
||||
specular_func_3ubv(d);
|
||||
}
|
||||
|
||||
static void WINE_GLAPI warn_no_specular_func(const void *data)
|
||||
|
@ -4110,6 +4157,7 @@ static void fillGLAttribFuncs(const WineD3D_GL_Info *gl_info)
|
|||
}
|
||||
specular_funcs[WINED3DDECLTYPE_FLOAT4] = invalid_func;
|
||||
if(GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
||||
specular_func_3ubv = (glAttribFunc)GL_EXTCALL(glSecondaryColor3ubvEXT);
|
||||
specular_funcs[WINED3DDECLTYPE_D3DCOLOR] = specular_d3dcolor;
|
||||
} else {
|
||||
specular_funcs[WINED3DDECLTYPE_D3DCOLOR] = warn_no_specular_func;
|
||||
|
@ -4174,7 +4222,8 @@ static void fillGLAttribFuncs(const WineD3D_GL_Info *gl_info)
|
|||
}
|
||||
|
||||
#define PUSH1(att) attribs[nAttribs++] = (att);
|
||||
BOOL InitAdapters(void) {
|
||||
BOOL InitAdapters(IWineD3DImpl *This)
|
||||
{
|
||||
static HMODULE mod_gl;
|
||||
BOOL ret;
|
||||
int ps_selected_mode, vs_selected_mode;
|
||||
|
@ -4182,7 +4231,7 @@ BOOL InitAdapters(void) {
|
|||
/* No need to hold any lock. The calling library makes sure only one thread calls
|
||||
* wined3d simultaneously
|
||||
*/
|
||||
if(numAdapters > 0) return Adapters[0].opengl;
|
||||
if (This->adapter_count) return This->adapters[0].opengl;
|
||||
|
||||
TRACE("Initializing adapters\n");
|
||||
|
||||
|
@ -4231,6 +4280,8 @@ BOOL InitAdapters(void) {
|
|||
|
||||
/* For now only one default adapter */
|
||||
{
|
||||
struct WineD3DAdapter *adapter = &This->adapters[0];
|
||||
const WineD3D_GL_Info *gl_info = &adapter->gl_info;
|
||||
int iPixelFormat;
|
||||
int attribs[10];
|
||||
int values[10];
|
||||
|
@ -4243,9 +4294,9 @@ BOOL InitAdapters(void) {
|
|||
HDC hdc;
|
||||
|
||||
TRACE("Initializing default adapter\n");
|
||||
Adapters[0].num = 0;
|
||||
Adapters[0].monitorPoint.x = -1;
|
||||
Adapters[0].monitorPoint.y = -1;
|
||||
adapter->num = 0;
|
||||
adapter->monitorPoint.x = -1;
|
||||
adapter->monitorPoint.y = -1;
|
||||
|
||||
if (!WineD3D_CreateFakeGLContext()) {
|
||||
ERR("Failed to get a gl context for default adapter\n");
|
||||
|
@ -4253,13 +4304,13 @@ BOOL InitAdapters(void) {
|
|||
goto nogl_adapter;
|
||||
}
|
||||
|
||||
ret = IWineD3DImpl_FillGLCaps(&Adapters[0].gl_info);
|
||||
ret = IWineD3DImpl_FillGLCaps(&adapter->gl_info);
|
||||
if(!ret) {
|
||||
ERR("Failed to initialize gl caps for default adapter\n");
|
||||
WineD3D_ReleaseFakeGLContext();
|
||||
goto nogl_adapter;
|
||||
}
|
||||
ret = initPixelFormats(&Adapters[0].gl_info);
|
||||
ret = initPixelFormats(&adapter->gl_info);
|
||||
if(!ret) {
|
||||
ERR("Failed to init gl formats\n");
|
||||
WineD3D_ReleaseFakeGLContext();
|
||||
|
@ -4273,28 +4324,28 @@ BOOL InitAdapters(void) {
|
|||
goto nogl_adapter;
|
||||
}
|
||||
|
||||
Adapters[0].driver = "Display";
|
||||
Adapters[0].description = "Direct3D HAL";
|
||||
adapter->driver = "Display";
|
||||
adapter->description = "Direct3D HAL";
|
||||
|
||||
/* Use the VideoRamSize registry setting when set */
|
||||
if(wined3d_settings.emulated_textureram)
|
||||
Adapters[0].TextureRam = wined3d_settings.emulated_textureram;
|
||||
adapter->TextureRam = wined3d_settings.emulated_textureram;
|
||||
else
|
||||
Adapters[0].TextureRam = Adapters[0].gl_info.vidmem;
|
||||
Adapters[0].UsedTextureRam = 0;
|
||||
TRACE("Emulating %dMB of texture ram\n", Adapters[0].TextureRam/(1024*1024));
|
||||
adapter->TextureRam = adapter->gl_info.vidmem;
|
||||
adapter->UsedTextureRam = 0;
|
||||
TRACE("Emulating %dMB of texture ram\n", adapter->TextureRam/(1024*1024));
|
||||
|
||||
/* Initialize the Adapter's DeviceName which is required for ChangeDisplaySettings and friends */
|
||||
DisplayDevice.cb = sizeof(DisplayDevice);
|
||||
EnumDisplayDevicesW(NULL, 0 /* Adapter 0 = iDevNum 0 */, &DisplayDevice, 0);
|
||||
TRACE("DeviceName: %s\n", debugstr_w(DisplayDevice.DeviceName));
|
||||
strcpyW(Adapters[0].DeviceName, DisplayDevice.DeviceName);
|
||||
strcpyW(adapter->DeviceName, DisplayDevice.DeviceName);
|
||||
|
||||
attribute = WGL_NUMBER_PIXEL_FORMATS_ARB;
|
||||
GL_EXTCALL(wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, &attribute, &Adapters[0].nCfgs));
|
||||
GL_EXTCALL(wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, &attribute, &adapter->nCfgs));
|
||||
|
||||
Adapters[0].cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Adapters[0].nCfgs *sizeof(WineD3D_PixelFormat));
|
||||
cfgs = Adapters[0].cfgs;
|
||||
adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, adapter->nCfgs *sizeof(WineD3D_PixelFormat));
|
||||
cfgs = adapter->cfgs;
|
||||
PUSH1(WGL_RED_BITS_ARB)
|
||||
PUSH1(WGL_GREEN_BITS_ARB)
|
||||
PUSH1(WGL_BLUE_BITS_ARB)
|
||||
|
@ -4306,7 +4357,8 @@ BOOL InitAdapters(void) {
|
|||
PUSH1(WGL_DOUBLE_BUFFER_ARB)
|
||||
PUSH1(WGL_AUX_BUFFERS_ARB)
|
||||
|
||||
for(iPixelFormat=1; iPixelFormat<=Adapters[0].nCfgs; iPixelFormat++) {
|
||||
for (iPixelFormat=1; iPixelFormat <= adapter->nCfgs; ++iPixelFormat)
|
||||
{
|
||||
res = GL_EXTCALL(wglGetPixelFormatAttribivARB(hdc, iPixelFormat, 0, nAttribs, attribs, values));
|
||||
|
||||
if(!res)
|
||||
|
@ -4360,52 +4412,52 @@ BOOL InitAdapters(void) {
|
|||
*
|
||||
* Mark an adapter with this broken stencil behavior.
|
||||
*/
|
||||
Adapters[0].brokenStencil = TRUE;
|
||||
for(i=0, cfgs=Adapters[0].cfgs; i<Adapters[0].nCfgs; i++) {
|
||||
adapter->brokenStencil = TRUE;
|
||||
for (i = 0, cfgs = adapter->cfgs; i < adapter->nCfgs; ++i)
|
||||
{
|
||||
/* Nearly all drivers offer depth formats without stencil, only on i915 this if-statement won't be entered. */
|
||||
if(cfgs[i].depthSize && !cfgs[i].stencilSize) {
|
||||
Adapters[0].brokenStencil = FALSE;
|
||||
adapter->brokenStencil = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fixup_extensions(&Adapters[0].gl_info);
|
||||
add_gl_compat_wrappers(&Adapters[0].gl_info);
|
||||
fixup_extensions(&adapter->gl_info);
|
||||
add_gl_compat_wrappers(&adapter->gl_info);
|
||||
|
||||
WineD3D_ReleaseFakeGLContext();
|
||||
|
||||
select_shader_mode(&Adapters[0].gl_info, WINED3DDEVTYPE_HAL, &ps_selected_mode, &vs_selected_mode);
|
||||
select_shader_max_constants(ps_selected_mode, vs_selected_mode, &Adapters[0].gl_info);
|
||||
fillGLAttribFuncs(&Adapters[0].gl_info);
|
||||
init_type_lookup(&Adapters[0].gl_info);
|
||||
Adapters[0].opengl = TRUE;
|
||||
select_shader_mode(&adapter->gl_info, WINED3DDEVTYPE_HAL, &ps_selected_mode, &vs_selected_mode);
|
||||
select_shader_max_constants(ps_selected_mode, vs_selected_mode, &adapter->gl_info);
|
||||
fillGLAttribFuncs(&adapter->gl_info);
|
||||
init_type_lookup(&adapter->gl_info);
|
||||
adapter->opengl = TRUE;
|
||||
}
|
||||
numAdapters = 1;
|
||||
TRACE("%d adapters successfully initialized\n", numAdapters);
|
||||
This->adapter_count = 1;
|
||||
TRACE("%u adapters successfully initialized\n", This->adapter_count);
|
||||
|
||||
return TRUE;
|
||||
|
||||
nogl_adapter:
|
||||
/* Initialize an adapter for ddraw-only memory counting */
|
||||
memset(Adapters, 0, sizeof(Adapters));
|
||||
Adapters[0].num = 0;
|
||||
Adapters[0].opengl = FALSE;
|
||||
Adapters[0].monitorPoint.x = -1;
|
||||
Adapters[0].monitorPoint.y = -1;
|
||||
memset(This->adapters, 0, sizeof(This->adapters));
|
||||
This->adapters[0].num = 0;
|
||||
This->adapters[0].opengl = FALSE;
|
||||
This->adapters[0].monitorPoint.x = -1;
|
||||
This->adapters[0].monitorPoint.y = -1;
|
||||
|
||||
Adapters[0].driver = "Display";
|
||||
Adapters[0].description = "WineD3D DirectDraw Emulation";
|
||||
This->adapters[0].driver = "Display";
|
||||
This->adapters[0].description = "WineD3D DirectDraw Emulation";
|
||||
if(wined3d_settings.emulated_textureram) {
|
||||
Adapters[0].TextureRam = wined3d_settings.emulated_textureram;
|
||||
This->adapters[0].TextureRam = wined3d_settings.emulated_textureram;
|
||||
} else {
|
||||
Adapters[0].TextureRam = 8 * 1024 * 1024; /* This is plenty for a DDraw-only card */
|
||||
This->adapters[0].TextureRam = 8 * 1024 * 1024; /* This is plenty for a DDraw-only card */
|
||||
}
|
||||
|
||||
numAdapters = 1;
|
||||
This->adapter_count = 1;
|
||||
return FALSE;
|
||||
}
|
||||
#undef PUSH1
|
||||
#undef GLINFO_LOCATION
|
||||
|
||||
/**********************************************************
|
||||
* IWineD3D VTbl follows
|
||||
|
|
|
@ -1911,6 +1911,7 @@ typedef void (WINE_GLAPI * PGLFNRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)(GLenum ta
|
|||
typedef void (WINE_GLAPI * PGLFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);
|
||||
typedef void (WINE_GLAPI * PGLFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);
|
||||
typedef void (WINE_GLAPI * PGLFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);
|
||||
typedef void (WINE_GLAPI * PGLFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);
|
||||
typedef void (WINE_GLAPI * PGLFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
/* GL_EXT_paletted_texture */
|
||||
#ifndef GL_EXT_paletted_texture
|
||||
|
@ -3578,6 +3579,7 @@ typedef enum _GL_SupportedExt {
|
|||
USE_GL_FUNC(PGLFNGLPOINTPARAMETERFVEXTPROC, glPointParameterfvEXT, EXT_POINT_PARAMETERS, NULL )\
|
||||
/* GL_EXT_secondary_color */ \
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLOR3UBEXTPROC, glSecondaryColor3ubEXT, EXT_SECONDARY_COLOR, NULL )\
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLOR3UBVEXTPROC, glSecondaryColor3ubvEXT, EXT_SECONDARY_COLOR, NULL )\
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLOR3FEXTPROC, glSecondaryColor3fEXT, EXT_SECONDARY_COLOR, NULL )\
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLOR3FVEXTPROC, glSecondaryColor3fvEXT, EXT_SECONDARY_COLOR, NULL )\
|
||||
USE_GL_FUNC(PGLFNGLSECONDARYCOLORPOINTEREXTPROC, glSecondaryColorPointerEXT, EXT_SECONDARY_COLOR, NULL )\
|
||||
|
|
|
@ -53,20 +53,23 @@ wined3d_settings_t wined3d_settings =
|
|||
IWineD3D* WINAPI WineDirect3DCreate(UINT dxVersion, IUnknown *parent) {
|
||||
IWineD3DImpl* object;
|
||||
|
||||
if (!InitAdapters()) {
|
||||
WARN("Failed to initialize direct3d adapters, Direct3D will not be available\n");
|
||||
if(dxVersion > 7) {
|
||||
ERR("Direct3D%d is not available without opengl\n", dxVersion);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DImpl));
|
||||
object->lpVtbl = &IWineD3D_Vtbl;
|
||||
object->dxVersion = dxVersion;
|
||||
object->ref = 1;
|
||||
object->parent = parent;
|
||||
|
||||
if (!InitAdapters(object))
|
||||
{
|
||||
WARN("Failed to initialize direct3d adapters, Direct3D will not be available\n");
|
||||
if (dxVersion > 7)
|
||||
{
|
||||
ERR("Direct3D%d is not available without opengl\n", dxVersion);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("Created WineD3D object @ %p for d3d%d support\n", object, dxVersion);
|
||||
|
||||
return (IWineD3D *)object;
|
||||
|
|
|
@ -670,6 +670,7 @@ typedef void (WINE_GLAPI *glAttribFunc)(const void *data);
|
|||
typedef void (WINE_GLAPI *glMultiTexCoordFunc)(GLenum unit, const void *data);
|
||||
extern glAttribFunc position_funcs[WINED3DDECLTYPE_UNUSED];
|
||||
extern glAttribFunc diffuse_funcs[WINED3DDECLTYPE_UNUSED];
|
||||
extern glAttribFunc specular_func_3ubv;
|
||||
extern glAttribFunc specular_funcs[WINED3DDECLTYPE_UNUSED];
|
||||
extern glAttribFunc normal_funcs[WINED3DDECLTYPE_UNUSED];
|
||||
extern glMultiTexCoordFunc multi_texcoord_funcs[WINED3DDECLTYPE_UNUSED];
|
||||
|
@ -937,7 +938,6 @@ struct WineD3DAdapter
|
|||
unsigned int UsedTextureRam;
|
||||
};
|
||||
|
||||
extern BOOL InitAdapters(void);
|
||||
extern BOOL initPixelFormats(WineD3D_GL_Info *gl_info);
|
||||
extern long WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *D3DDevice, long glram);
|
||||
extern void add_gl_compat_wrappers(WineD3D_GL_Info *gl_info);
|
||||
|
@ -1025,10 +1025,15 @@ typedef struct IWineD3DImpl
|
|||
/* WineD3D Information */
|
||||
IUnknown *parent;
|
||||
UINT dxVersion;
|
||||
|
||||
UINT adapter_count;
|
||||
struct WineD3DAdapter adapters[1];
|
||||
} IWineD3DImpl;
|
||||
|
||||
extern const IWineD3DVtbl IWineD3D_Vtbl;
|
||||
|
||||
BOOL InitAdapters(IWineD3DImpl *This);
|
||||
|
||||
/* TODO: setup some flags in the registry to enable, disable pbuffer support
|
||||
(since it will break quite a few things until contexts are managed properly!) */
|
||||
extern BOOL pbuffer_support;
|
||||
|
|
Loading…
Reference in New Issue