mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 07:23:35 +00:00
improve image creation tests and windows opengl ci
This commit is contained in:
130
Tests/Image.c
130
Tests/Image.c
@@ -10,103 +10,45 @@ void TestImageCreation()
|
||||
PulseDevice device;
|
||||
SetupDevice(backend, &device);
|
||||
|
||||
{
|
||||
PulseImageCreateInfo image_create_info = { 0 };
|
||||
image_create_info.type = PULSE_IMAGE_TYPE_2D;
|
||||
image_create_info.format = PULSE_IMAGE_FORMAT_R8G8B8A8_UNORM;
|
||||
image_create_info.usage = PULSE_IMAGE_USAGE_STORAGE_READ;
|
||||
image_create_info.width = 256;
|
||||
image_create_info.height = 256;
|
||||
image_create_info.layer_count_or_depth = 1;
|
||||
PulseImage image = PulseCreateImage(device, &image_create_info);
|
||||
TEST_ASSERT_NOT_EQUAL_MESSAGE(image, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType()));
|
||||
PulseDestroyImage(device, image);
|
||||
}
|
||||
{
|
||||
PulseImageCreateInfo image_create_info = { 0 };
|
||||
image_create_info.type = PULSE_IMAGE_TYPE_2D_ARRAY;
|
||||
image_create_info.format = PULSE_IMAGE_FORMAT_R8G8B8A8_UNORM;
|
||||
image_create_info.usage = PULSE_IMAGE_USAGE_STORAGE_READ;
|
||||
image_create_info.width = 256;
|
||||
image_create_info.height = 256;
|
||||
image_create_info.layer_count_or_depth = 1;
|
||||
PulseImage image = PulseCreateImage(device, &image_create_info);
|
||||
TEST_ASSERT_NOT_EQUAL_MESSAGE(image, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType()));
|
||||
PulseDestroyImage(device, image);
|
||||
}
|
||||
PulseImageUsageFlags usages[] = {
|
||||
PULSE_IMAGE_USAGE_STORAGE_READ,
|
||||
PULSE_IMAGE_USAGE_STORAGE_WRITE,
|
||||
PULSE_IMAGE_USAGE_STORAGE_SIMULTANEOUS_READWRITE,
|
||||
PULSE_IMAGE_USAGE_STORAGE_WRITE | PULSE_IMAGE_USAGE_STORAGE_READ,
|
||||
};
|
||||
|
||||
for(unsigned int format = 0; format < (unsigned int)PULSE_IMAGE_FORMAT_MAX_ENUM; format++)
|
||||
{
|
||||
PulseImageCreateInfo image_create_info = { 0 };
|
||||
image_create_info.type = PULSE_IMAGE_TYPE_3D;
|
||||
image_create_info.format = PULSE_IMAGE_FORMAT_R8G8B8A8_UNORM;
|
||||
image_create_info.usage = PULSE_IMAGE_USAGE_STORAGE_READ;
|
||||
image_create_info.width = 256;
|
||||
image_create_info.height = 256;
|
||||
image_create_info.layer_count_or_depth = 1;
|
||||
PulseImage image = PulseCreateImage(device, &image_create_info);
|
||||
TEST_ASSERT_NOT_EQUAL_MESSAGE(image, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType()));
|
||||
PulseDestroyImage(device, image);
|
||||
}
|
||||
for(unsigned int type = 0; type < (unsigned int)PULSE_IMAGE_TYPE_MAX_ENUM; type++)
|
||||
{
|
||||
for(unsigned int usages = 0; usages < 4; usages++)
|
||||
{
|
||||
PulseImageCreateInfo image_create_info = { 0 };
|
||||
image_create_info.type = type;
|
||||
image_create_info.format = format;
|
||||
image_create_info.usage = usages;
|
||||
image_create_info.width = 256;
|
||||
image_create_info.height = 256;
|
||||
image_create_info.layer_count_or_depth = (type == PULSE_IMAGE_TYPE_CUBE || type == PULSE_IMAGE_TYPE_CUBE_ARRAY) ? 6 : 1;
|
||||
|
||||
{
|
||||
PulseImageCreateInfo image_create_info = { 0 };
|
||||
image_create_info.type = PULSE_IMAGE_TYPE_CUBE;
|
||||
image_create_info.format = PULSE_IMAGE_FORMAT_R8G8B8A8_UNORM;
|
||||
image_create_info.usage = PULSE_IMAGE_USAGE_STORAGE_READ;
|
||||
image_create_info.width = 256;
|
||||
image_create_info.height = 256;
|
||||
image_create_info.layer_count_or_depth = 6;
|
||||
PulseImage image = PulseCreateImage(device, &image_create_info);
|
||||
TEST_ASSERT_NOT_EQUAL_MESSAGE(image, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType()));
|
||||
PulseDestroyImage(device, image);
|
||||
}
|
||||
{
|
||||
PulseImageCreateInfo image_create_info = { 0 };
|
||||
image_create_info.type = PULSE_IMAGE_TYPE_CUBE_ARRAY;
|
||||
image_create_info.format = PULSE_IMAGE_FORMAT_R8G8B8A8_UNORM;
|
||||
image_create_info.usage = PULSE_IMAGE_USAGE_STORAGE_READ;
|
||||
image_create_info.width = 256;
|
||||
image_create_info.height = 256;
|
||||
image_create_info.layer_count_or_depth = 12;
|
||||
PulseImage image = PulseCreateImage(device, &image_create_info);
|
||||
TEST_ASSERT_NOT_EQUAL_MESSAGE(image, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType()));
|
||||
PulseDestroyImage(device, image);
|
||||
}
|
||||
{
|
||||
PulseImageCreateInfo image_create_info = { 0 };
|
||||
image_create_info.type = PULSE_IMAGE_TYPE_2D;
|
||||
image_create_info.format = PULSE_IMAGE_FORMAT_R8G8B8A8_UNORM;
|
||||
image_create_info.usage = PULSE_IMAGE_USAGE_STORAGE_WRITE;
|
||||
image_create_info.width = 256;
|
||||
image_create_info.height = 256;
|
||||
image_create_info.layer_count_or_depth = 1;
|
||||
PulseImage image = PulseCreateImage(device, &image_create_info);
|
||||
TEST_ASSERT_NOT_EQUAL_MESSAGE(image, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType()));
|
||||
PulseDestroyImage(device, image);
|
||||
}
|
||||
{
|
||||
PulseImageCreateInfo image_create_info = { 0 };
|
||||
image_create_info.type = PULSE_IMAGE_TYPE_2D;
|
||||
image_create_info.format = PULSE_IMAGE_FORMAT_R8G8B8A8_UNORM;
|
||||
image_create_info.usage = PULSE_IMAGE_USAGE_STORAGE_SIMULTANEOUS_READWRITE;
|
||||
image_create_info.width = 256;
|
||||
image_create_info.height = 256;
|
||||
image_create_info.layer_count_or_depth = 1;
|
||||
PulseImage image = PulseCreateImage(device, &image_create_info);
|
||||
TEST_ASSERT_NOT_EQUAL_MESSAGE(image, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType()));
|
||||
PulseDestroyImage(device, image);
|
||||
}
|
||||
{
|
||||
PulseImageCreateInfo image_create_info = { 0 };
|
||||
image_create_info.type = PULSE_IMAGE_TYPE_2D;
|
||||
image_create_info.format = PULSE_IMAGE_FORMAT_R8_SNORM;
|
||||
image_create_info.usage = PULSE_IMAGE_USAGE_STORAGE_READ;
|
||||
image_create_info.width = 256;
|
||||
image_create_info.height = 256;
|
||||
image_create_info.layer_count_or_depth = 1;
|
||||
PulseImage image = PulseCreateImage(device, &image_create_info);
|
||||
TEST_ASSERT_NOT_EQUAL_MESSAGE(image, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType()));
|
||||
PulseDestroyImage(device, image);
|
||||
if(PulseIsImageFormatValid(device, format, type, usages))
|
||||
{
|
||||
PulseImage image = PulseCreateImage(device, &image_create_info);
|
||||
TEST_ASSERT_NOT_EQUAL_MESSAGE(image, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType()));
|
||||
PulseDestroyImage(device, image);
|
||||
}
|
||||
else
|
||||
{
|
||||
DISABLE_ERRORS;
|
||||
|
||||
PulseImage image = PulseCreateImage(device, &image_create_info);
|
||||
TEST_ASSERT_EQUAL(image, PULSE_NULL_HANDLE);
|
||||
PulseDestroyImage(device, image);
|
||||
|
||||
ENABLE_ERRORS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DISABLE_ERRORS;
|
||||
|
||||
Reference in New Issue
Block a user