mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d: Do not allow synchronization primitives to fail.
In practice they never fail. If they fail, it means that there is some underlying platform problem and there is little we can do anyway. Under pthreads function prototypes allow returning failure, but that's only used for "error checking" mutexes, which we don't use. On the other hand, error handling in vkd3d is rather inconsistent: sometimes the errors are ignored, sometimes logged, sometimes passed to the caller. It's hard to handle failures appropriately if you can't even keep your state consistent, so I think it's better to avoid trying, assume that synchronization primitives do not fail and at least have consistent logging if something goes wrong.
This commit is contained in:
committed by
Alexandre Julliard
parent
a66fe31fe5
commit
552926cfca
Notes:
Alexandre Julliard
2023-02-02 22:14:51 +01:00
Approved-by: Conor McCarthy (@cmccarthy) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/75
@@ -1689,14 +1689,8 @@ HRESULT vkd3d_render_pass_cache_find(struct vkd3d_render_pass_cache *cache,
|
||||
bool found = false;
|
||||
HRESULT hr = S_OK;
|
||||
unsigned int i;
|
||||
int rc;
|
||||
|
||||
if ((rc = vkd3d_mutex_lock(&device->mutex)))
|
||||
{
|
||||
ERR("Failed to lock mutex, error %d.\n", rc);
|
||||
*vk_render_pass = VK_NULL_HANDLE;
|
||||
return hresult_from_errno(rc);
|
||||
}
|
||||
vkd3d_mutex_lock(&device->mutex);
|
||||
|
||||
for (i = 0; i < cache->render_pass_count; ++i)
|
||||
{
|
||||
@@ -3371,28 +3365,23 @@ static VkPipeline d3d12_pipeline_state_find_compiled_pipeline(const struct d3d12
|
||||
struct d3d12_device *device = state->device;
|
||||
VkPipeline vk_pipeline = VK_NULL_HANDLE;
|
||||
struct vkd3d_compiled_pipeline *current;
|
||||
int rc;
|
||||
|
||||
*vk_render_pass = VK_NULL_HANDLE;
|
||||
|
||||
if (!(rc = vkd3d_mutex_lock(&device->mutex)))
|
||||
vkd3d_mutex_lock(&device->mutex);
|
||||
|
||||
LIST_FOR_EACH_ENTRY(current, &graphics->compiled_pipelines, struct vkd3d_compiled_pipeline, entry)
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY(current, &graphics->compiled_pipelines, struct vkd3d_compiled_pipeline, entry)
|
||||
if (!memcmp(¤t->key, key, sizeof(*key)))
|
||||
{
|
||||
if (!memcmp(¤t->key, key, sizeof(*key)))
|
||||
{
|
||||
vk_pipeline = current->vk_pipeline;
|
||||
*vk_render_pass = current->vk_render_pass;
|
||||
break;
|
||||
}
|
||||
vk_pipeline = current->vk_pipeline;
|
||||
*vk_render_pass = current->vk_render_pass;
|
||||
break;
|
||||
}
|
||||
vkd3d_mutex_unlock(&device->mutex);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("Failed to lock mutex, error %d.\n", rc);
|
||||
}
|
||||
|
||||
vkd3d_mutex_unlock(&device->mutex);
|
||||
|
||||
return vk_pipeline;
|
||||
}
|
||||
|
||||
@@ -3402,7 +3391,6 @@ static bool d3d12_pipeline_state_put_pipeline_to_cache(struct d3d12_pipeline_sta
|
||||
struct d3d12_graphics_pipeline_state *graphics = &state->u.graphics;
|
||||
struct vkd3d_compiled_pipeline *compiled_pipeline, *current;
|
||||
struct d3d12_device *device = state->device;
|
||||
int rc;
|
||||
|
||||
if (!(compiled_pipeline = vkd3d_malloc(sizeof(*compiled_pipeline))))
|
||||
return false;
|
||||
@@ -3411,12 +3399,7 @@ static bool d3d12_pipeline_state_put_pipeline_to_cache(struct d3d12_pipeline_sta
|
||||
compiled_pipeline->vk_pipeline = vk_pipeline;
|
||||
compiled_pipeline->vk_render_pass = vk_render_pass;
|
||||
|
||||
if ((rc = vkd3d_mutex_lock(&device->mutex)))
|
||||
{
|
||||
ERR("Failed to lock mutex, error %d.\n", rc);
|
||||
vkd3d_free(compiled_pipeline);
|
||||
return false;
|
||||
}
|
||||
vkd3d_mutex_lock(&device->mutex);
|
||||
|
||||
LIST_FOR_EACH_ENTRY(current, &graphics->compiled_pipelines, struct vkd3d_compiled_pipeline, entry)
|
||||
{
|
||||
|
Reference in New Issue
Block a user