dzn: Skip dxil validator and some Windows-only debug flags for Linux
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Bill Kristiansen <billkris@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17340>
This commit is contained in:
@@ -46,8 +46,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <directx/d3d12sdklayers.h>
|
#include <directx/d3d12sdklayers.h>
|
||||||
|
|
||||||
@@ -146,8 +148,10 @@ dzn_instance_destroy(struct dzn_instance *instance, const VkAllocationCallbacks
|
|||||||
if (!instance)
|
if (!instance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
if (instance->dxil_validator)
|
if (instance->dxil_validator)
|
||||||
dxil_destroy_validator(instance->dxil_validator);
|
dxil_destroy_validator(instance->dxil_validator);
|
||||||
|
#endif
|
||||||
|
|
||||||
list_for_each_entry_safe(struct dzn_physical_device, pdev,
|
list_for_each_entry_safe(struct dzn_physical_device, pdev,
|
||||||
&instance->physical_devices, link) {
|
&instance->physical_devices, link) {
|
||||||
@@ -188,6 +192,7 @@ dzn_instance_create(const VkInstanceCreateInfo *pCreateInfo,
|
|||||||
instance->debug_flags =
|
instance->debug_flags =
|
||||||
parse_debug_string(getenv("DZN_DEBUG"), dzn_debug_options);
|
parse_debug_string(getenv("DZN_DEBUG"), dzn_debug_options);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
if (instance->debug_flags & DZN_DEBUG_DEBUGGER) {
|
if (instance->debug_flags & DZN_DEBUG_DEBUGGER) {
|
||||||
/* wait for debugger to attach... */
|
/* wait for debugger to attach... */
|
||||||
while (!IsDebuggerPresent()) {
|
while (!IsDebuggerPresent()) {
|
||||||
@@ -204,11 +209,17 @@ dzn_instance_create(const VkInstanceCreateInfo *pCreateInfo,
|
|||||||
freopen(path, "w", stdout);
|
freopen(path, "w", stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool missing_validator = false;
|
||||||
|
#ifdef _WIN32
|
||||||
instance->dxil_validator = dxil_create_validator(NULL);
|
instance->dxil_validator = dxil_create_validator(NULL);
|
||||||
|
missing_validator = !instance->dxil_validator;
|
||||||
|
#endif
|
||||||
|
|
||||||
instance->d3d12.serialize_root_sig = d3d12_get_serialize_root_sig();
|
instance->d3d12.serialize_root_sig = d3d12_get_serialize_root_sig();
|
||||||
|
|
||||||
if (!instance->dxil_validator ||
|
if (missing_validator ||
|
||||||
!instance->d3d12.serialize_root_sig) {
|
!instance->d3d12.serialize_root_sig) {
|
||||||
dzn_instance_destroy(instance, pAllocator);
|
dzn_instance_destroy(instance, pAllocator);
|
||||||
return vk_error(NULL, VK_ERROR_INITIALIZATION_FAILED);
|
return vk_error(NULL, VK_ERROR_INITIALIZATION_FAILED);
|
||||||
|
@@ -48,6 +48,7 @@ dzn_meta_compile_shader(struct dzn_device *device, nir_shader *nir,
|
|||||||
ASSERTED bool ret = nir_to_dxil(nir, &opts, &dxil_blob);
|
ASSERTED bool ret = nir_to_dxil(nir, &opts, &dxil_blob);
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
char *err = NULL;
|
char *err = NULL;
|
||||||
bool res = dxil_validate_module(instance->dxil_validator,
|
bool res = dxil_validate_module(instance->dxil_validator,
|
||||||
dxil_blob.data,
|
dxil_blob.data,
|
||||||
@@ -79,6 +80,7 @@ dzn_meta_compile_shader(struct dzn_device *device, nir_shader *nir,
|
|||||||
ralloc_free(err);
|
ralloc_free(err);
|
||||||
}
|
}
|
||||||
assert(res);
|
assert(res);
|
||||||
|
#endif
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@@ -367,6 +367,7 @@ dzn_pipeline_compile_shader(struct dzn_device *device,
|
|||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
char *err;
|
char *err;
|
||||||
bool res = dxil_validate_module(instance->dxil_validator,
|
bool res = dxil_validate_module(instance->dxil_validator,
|
||||||
(void *)slot->pShaderBytecode,
|
(void *)slot->pShaderBytecode,
|
||||||
@@ -397,6 +398,7 @@ dzn_pipeline_compile_shader(struct dzn_device *device,
|
|||||||
}
|
}
|
||||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user