fixing vulkan image view issue

This commit is contained in:
2025-03-01 16:01:37 +01:00
parent 7dad5fdecb
commit 4ac1b2b8de
4 changed files with 57 additions and 59 deletions

View File

@@ -250,8 +250,6 @@ void VulkanReturnDescriptorSetToPool(VulkanDescriptorSetPool* pool, const Vulkan
} }
} }
#include <stdio.h>
void VulkanBindDescriptorSets(PulseComputePass pass) void VulkanBindDescriptorSets(PulseComputePass pass)
{ {
VulkanComputePass* vulkan_pass = VULKAN_RETRIEVE_DRIVER_DATA_AS(pass, VulkanComputePass*); VulkanComputePass* vulkan_pass = VULKAN_RETRIEVE_DRIVER_DATA_AS(pass, VulkanComputePass*);
@@ -426,9 +424,7 @@ void VulkanBindDescriptorSets(PulseComputePass pass)
vulkan_pass->should_recreate_uniform_descriptor_sets = false; vulkan_pass->should_recreate_uniform_descriptor_sets = false;
} }
fprintf(stderr, "test device %p, fn %p, vkdevice %p, count %d\n", vulkan_device, vulkan_device->vkUpdateDescriptorSets, vulkan_device->device, write_count);
vulkan_device->vkUpdateDescriptorSets(vulkan_device->device, write_count, writes, 0, PULSE_NULLPTR); vulkan_device->vkUpdateDescriptorSets(vulkan_device->device, write_count, writes, 0, PULSE_NULLPTR);
fprintf(stderr, "end test\n");
VkDescriptorSet sets[3]; VkDescriptorSet sets[3];
sets[0] = vulkan_pass->read_only_descriptor_set->set; sets[0] = vulkan_pass->read_only_descriptor_set->set;

View File

@@ -140,8 +140,6 @@ PulseImage VulkanCreateImage(PulseDevice device, const PulseImageCreateInfo* cre
CHECK_VK_RETVAL(device->backend, vmaCreateImage(vulkan_device->allocator, &image_create_info, &allocation_create_info, &vulkan_image->image, &vulkan_image->allocation, PULSE_NULLPTR), PULSE_ERROR_INITIALIZATION_FAILED, PULSE_NULL_HANDLE); CHECK_VK_RETVAL(device->backend, vmaCreateImage(vulkan_device->allocator, &image_create_info, &allocation_create_info, &vulkan_image->image, &vulkan_image->allocation, PULSE_NULLPTR), PULSE_ERROR_INITIALIZATION_FAILED, PULSE_NULL_HANDLE);
vmaGetAllocationInfo(vulkan_device->allocator, vulkan_image->allocation, &vulkan_image->allocation_info); vmaGetAllocationInfo(vulkan_device->allocator, vulkan_image->allocation, &vulkan_image->allocation_info);
if(create_infos->usage & PULSE_IMAGE_USAGE_STORAGE_READ)
{
VkImageViewCreateInfo image_view_create_info = { 0 }; VkImageViewCreateInfo image_view_create_info = { 0 };
image_view_create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; image_view_create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
image_view_create_info.image = vulkan_image->image; image_view_create_info.image = vulkan_image->image;
@@ -165,7 +163,6 @@ PulseImage VulkanCreateImage(PulseDevice device, const PulseImageCreateInfo* cre
image_view_create_info.viewType = VK_IMAGE_VIEW_TYPE_2D; image_view_create_info.viewType = VK_IMAGE_VIEW_TYPE_2D;
CHECK_VK_RETVAL(device->backend, vulkan_device->vkCreateImageView(vulkan_device->device, &image_view_create_info, PULSE_NULLPTR, &vulkan_image->view), PULSE_ERROR_INITIALIZATION_FAILED, PULSE_NULL_HANDLE); CHECK_VK_RETVAL(device->backend, vulkan_device->vkCreateImageView(vulkan_device->device, &image_view_create_info, PULSE_NULLPTR, &vulkan_image->view), PULSE_ERROR_INITIALIZATION_FAILED, PULSE_NULL_HANDLE);
}
return image; return image;
} }

View File

@@ -1,20 +1,21 @@
#include <signal.h> #include <signal.h>
#include <backtrace.h>
#include <unity/unity.h> #include <unity/unity.h>
#include <Pulse.h> #include <Pulse.h>
struct backtrace_state* state = NULL; #ifdef BACKTRACE
static size_t trace_count = 0; #include <backtrace.h>
struct backtrace_state* state = NULL;
static size_t trace_count = 0;
void ErrorCallback(void* data, const char* msg, int errnum) void ErrorCallback(void* data, const char* msg, int errnum)
{ {
(void)data; (void)data;
fprintf(stderr, "Error in backtrace: %s (error %d)\n", msg, errnum); fprintf(stderr, "Error in backtrace: %s (error %d)\n", msg, errnum);
} }
int SymbolCallback(void* data, unsigned long pc, const char* filename, int lineno, const char* function) int SymbolCallback(void* data, unsigned long pc, const char* filename, int lineno, const char* function)
{ {
(void)data; (void)data;
if(filename && function) if(filename && function)
fprintf(stderr, "\t#%zu\033[1;34m 0x%lx\033[1;0m in\033[1;33m %s() from %s:%d\033[1;0m\n", trace_count, pc, function, filename, lineno); fprintf(stderr, "\t#%zu\033[1;34m 0x%lx\033[1;0m in\033[1;33m %s() from %s:%d\033[1;0m\n", trace_count, pc, function, filename, lineno);
@@ -24,16 +25,17 @@ int SymbolCallback(void* data, unsigned long pc, const char* filename, int linen
fprintf(stderr, "\t#%zu\033[1;34m 0x%lx\033[1;0m in\033[1;33m ??\()\033[1;0m\n", trace_count, pc); fprintf(stderr, "\t#%zu\033[1;34m 0x%lx\033[1;0m in\033[1;33m ??\()\033[1;0m\n", trace_count, pc);
trace_count++; trace_count++;
return 0; return 0;
} }
void SignalHandler(int sig) void SignalHandler(int sig)
{ {
fprintf(stderr, "\n==========================================================\nFatal error: %s.\n<Begin of stack trace>\n", sig == SIGSEGV ? "segmentation fault" : "aborted"); fprintf(stderr, "\n==========================================================\nFatal error: %s.\n<Begin of stack trace>\n", sig == SIGSEGV ? "segmentation fault" : "aborted");
trace_count = 0; trace_count = 0;
backtrace_full(state, 0, SymbolCallback, ErrorCallback, NULL); backtrace_full(state, 0, SymbolCallback, ErrorCallback, NULL);
fprintf(stderr, "<End of stack trace>\n==========================================================\n"); fprintf(stderr, "<End of stack trace>\n==========================================================\n");
exit(1); exit(1);
} }
#endif
extern void TestBackend(); extern void TestBackend();
extern void TestDevice(); extern void TestDevice();
@@ -43,9 +45,11 @@ extern void TestPipeline();
int main(void) int main(void)
{ {
#ifdef BACKTRACE
state = backtrace_create_state(NULL, 1, ErrorCallback, NULL); state = backtrace_create_state(NULL, 1, ErrorCallback, NULL);
signal(SIGSEGV, SignalHandler); signal(SIGSEGV, SignalHandler);
signal(SIGABRT, SignalHandler); signal(SIGABRT, SignalHandler);
#endif
UNITY_BEGIN(); UNITY_BEGIN();
TestBackend(); TestBackend();

View File

@@ -108,6 +108,7 @@ if has_config("vulkan-tests") then
if is_plat("linux") then if is_plat("linux") then
add_packages("libbacktrace") add_packages("libbacktrace")
set_extension(".x86_64") set_extension(".x86_64")
add_defines("BACKTRACE")
end end
target_end() target_end()
end end