wined3d: Fail adapter creation if driver version info can't be found.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2020-07-22 19:00:55 +02:00 committed by Alexandre Julliard
parent 1e25ff3cc4
commit adf73f7371
4 changed files with 27 additions and 19 deletions

View File

@ -5214,8 +5214,12 @@ static BOOL wined3d_adapter_gl_init(struct wined3d_adapter_gl *adapter_gl,
gl_info->supported[ARB_TEXTURE_STORAGE] = FALSE;
}
wined3d_driver_info_init(driver_info, caps_gl_ctx.gpu_description, adapter_gl->a.d3d_info.feature_level,
caps_gl_ctx.vram_bytes, 0);
if (!wined3d_driver_info_init(driver_info, caps_gl_ctx.gpu_description, adapter_gl->a.d3d_info.feature_level,
caps_gl_ctx.vram_bytes, 0))
{
wined3d_caps_gl_ctx_destroy(&caps_gl_ctx);
return FALSE;
}
TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n",
driver_info->version_high, driver_info->version_low);

View File

@ -2037,7 +2037,7 @@ static enum wined3d_display_driver guess_display_driver(enum wined3d_pci_vendor
}
}
static void adapter_vk_init_driver_info(struct wined3d_adapter_vk *adapter_vk,
static bool adapter_vk_init_driver_info(struct wined3d_adapter_vk *adapter_vk,
const VkPhysicalDeviceProperties *properties)
{
const VkPhysicalDeviceMemoryProperties *memory_properties = &adapter_vk->memory_properties;
@ -2082,10 +2082,8 @@ static void adapter_vk_init_driver_info(struct wined3d_adapter_vk *adapter_vk,
gpu_description = &description;
}
wined3d_driver_info_init(&adapter_vk->a.driver_info, gpu_description, adapter_vk->a.d3d_info.feature_level,
vram_bytes, sysmem_bytes);
TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n",
adapter_vk->a.driver_info.version_high, adapter_vk->a.driver_info.version_low);
return wined3d_driver_info_init(&adapter_vk->a.driver_info, gpu_description,
adapter_vk->a.d3d_info.feature_level, vram_bytes, sysmem_bytes);
}
static enum wined3d_feature_level feature_level_from_caps(const struct shader_caps *shader_caps)
@ -2209,7 +2207,10 @@ static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk,
wined3d_adapter_vk_init_d3d_info(adapter_vk, wined3d_creation_flags);
adapter_vk_init_driver_info(adapter_vk, &properties2.properties);
if (!adapter_vk_init_driver_info(adapter_vk, &properties2.properties))
goto fail;
TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n",
adapter_vk->a.driver_info.version_high, adapter_vk->a.driver_info.version_low);
adapter->vram_bytes_used = 0;
TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->driver_info.vram_bytes));

View File

@ -672,7 +672,7 @@ static void wined3d_copy_name(char *dst, const char *src, unsigned int dst_size)
}
}
void wined3d_driver_info_init(struct wined3d_driver_info *driver_info,
bool wined3d_driver_info_init(struct wined3d_driver_info *driver_info,
const struct wined3d_gpu_description *gpu_desc, enum wined3d_feature_level feature_level,
UINT64 vram_bytes, UINT64 sysmem_bytes)
{
@ -849,15 +849,13 @@ void wined3d_driver_info_init(struct wined3d_driver_info *driver_info,
driver_info->name = version_info->driver_name;
driver_info->version_high = MAKEDWORD_VERSION(driver_os_version, driver_feature_level);
driver_info->version_low = MAKEDWORD_VERSION(version_info->subversion, version_info->build);
return true;
}
else
{
ERR("No driver version info found for device %04x:%04x, driver model %#x.\n",
driver_info->vendor, driver_info->device, driver_model);
driver_info->name = "Display";
driver_info->version_high = MAKEDWORD_VERSION(driver_os_version, driver_feature_level);
driver_info->version_low = MAKEDWORD_VERSION(8, 6); /* NVIDIA RIVA TNT, arbitrary */
}
ERR("No driver version info found for device %04x:%04x, driver model %#x.\n",
driver_info->vendor, driver_info->device, driver_model);
return false;
}
enum wined3d_pci_device wined3d_gpu_from_feature_level(enum wined3d_pci_vendor *vendor,
@ -2996,7 +2994,12 @@ static struct wined3d_adapter *wined3d_adapter_no3d_create(unsigned int ordinal,
return NULL;
}
wined3d_driver_info_init(&adapter->driver_info, &gpu_description, WINED3D_FEATURE_LEVEL_NONE, 0, 0);
if (!wined3d_driver_info_init(&adapter->driver_info, &gpu_description, WINED3D_FEATURE_LEVEL_NONE, 0, 0))
{
wined3d_adapter_cleanup(adapter);
heap_free(adapter);
return NULL;
}
adapter->vram_bytes_used = 0;
TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->driver_info.vram_bytes));

View File

@ -3199,7 +3199,7 @@ struct wined3d_driver_info
DWORD version_low;
};
void wined3d_driver_info_init(struct wined3d_driver_info *driver_info,
bool wined3d_driver_info_init(struct wined3d_driver_info *driver_info,
const struct wined3d_gpu_description *gpu_description, enum wined3d_feature_level feature_level,
UINT64 vram_bytes, UINT64 sysmem_bytes) DECLSPEC_HIDDEN;