Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Don't call adapter_no3d_destroy() from wined3d_adapter_no3d_create().
dlls/wined3d/directx.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 533d99f026f0..e797f2188810 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2991,6 +2991,7 @@ static struct wined3d_adapter *wined3d_adapter_no3d_create(unsigned int ordinal,
if (!wined3d_adapter_no3d_init_format_info(adapter)) { + wined3d_adapter_cleanup(adapter); heap_free(adapter); return NULL; }
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v3: Properly clean up on driver info initialization failure, use bool instead of BOOL. v4: Don't call adapter_no3d_destroy() from wined3d_adapter_no3d_create().
dlls/wined3d/adapter_gl.c | 8 ++++++-- dlls/wined3d/adapter_vk.c | 13 +++++++------ dlls/wined3d/directx.c | 23 +++++++++++++---------- dlls/wined3d/wined3d_private.h | 2 +- 4 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index cc78c9046b6c..5bf9d179e4da 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -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);
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index cbfb29cdd43b..fd7b29fc8afe 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -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));
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index e797f2188810..67e96d1249c1 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -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));
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 82dfd507754a..83d790936f74 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- I picked the values reported by AMD since R600 at least. Nvidia always reports 1e6 bounds, not sure about Intel.
dlls/wined3d/directx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 67e96d1249c1..55ece68d5543 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2088,10 +2088,10 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d_adapter *adapter, caps->MaxTextureAspectRatio = d3d_info->limits.texture_size; caps->MaxVertexW = 1e10f;
- caps->GuardBandLeft = 0.0f; - caps->GuardBandTop = 0.0f; - caps->GuardBandRight = 0.0f; - caps->GuardBandBottom = 0.0f; + caps->GuardBandLeft = -32768.0f; + caps->GuardBandTop = -32768.0f; + caps->GuardBandRight = 32768.0f; + caps->GuardBandBottom = 32768.0f;
caps->ExtentsAdjust = 0.0f;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/glsl_shader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index a14682c95ac8..34736a802d26 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1037,7 +1037,7 @@ static void shader_glsl_init_transform_feedback(const struct wined3d_context_gl }
/* Context activation is done by the caller. */ -static inline void walk_constant_heap(const struct wined3d_gl_info *gl_info, const struct wined3d_vec4 *constants, +static void walk_constant_heap(const struct wined3d_gl_info *gl_info, const struct wined3d_vec4 *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version) { unsigned int start = ~0U, end = 0; @@ -1111,7 +1111,7 @@ static inline void walk_constant_heap(const struct wined3d_gl_info *gl_info, con }
/* Context activation is done by the caller. */ -static inline void apply_clamped_constant(const struct wined3d_gl_info *gl_info, +static void apply_clamped_constant(const struct wined3d_gl_info *gl_info, GLint location, const struct wined3d_vec4 *data) { GLfloat clamped_constant[4]; @@ -1127,7 +1127,7 @@ static inline void apply_clamped_constant(const struct wined3d_gl_info *gl_info, }
/* Context activation is done by the caller. */ -static inline void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_info, +static void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_info, const struct wined3d_vec4 *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version) { @@ -8536,7 +8536,7 @@ static GLuint find_glsl_fragment_shader(const struct wined3d_context_gl *context return ret; }
-static inline BOOL vs_args_equal(const struct vs_compile_args *stored, const struct vs_compile_args *new, +static BOOL vs_args_equal(const struct vs_compile_args *stored, const struct vs_compile_args *new, const DWORD use_map) { if ((stored->swizzle_map & use_map) != new->swizzle_map)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- So that if we forget to update the function when introducing a new CS operation we get a compiler warning. Idea spurred from a conversation with Andrew Eikum.
dlls/wined3d/cs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index b87003c53b83..908daa22a56a 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -510,9 +510,8 @@ static const char *debug_cs_op(enum wined3d_cs_op op) WINED3D_TO_STR(WINED3D_CS_OP_GENERATE_MIPMAPS); WINED3D_TO_STR(WINED3D_CS_OP_STOP); #undef WINED3D_TO_STR - default: - return wine_dbg_sprintf("UNKNOWN_OP(%#x)", op); } + return wine_dbg_sprintf("UNKNOWN_OP(%#x)", op); }
static void wined3d_cs_exec_nop(struct wined3d_cs *cs, const void *data)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com