1 #include <kiba/gpu/texture.h>
3 #include <kiba/gpu/device.h>
8 if (desc.dimension != GPU_TEXTURE_DIMENSION_D2) {
11 KB_ERROR(
"render attachments can only be 2D, but found {u32}", desc.dimension);
15 if (desc.sample_count > 1) {
22 if (!gpu_device_resource_texture_create(device, texture)) {
23 KB_ERROR(
"could not create device-tracked texture");
28 return gpu_backend_texture_create(&tex->bt, device->bd, desc);
31 void gpu_texture_destroy(
gpu_texture texture) { gpu_device_resource_texture_enqueue_destroy(texture); }
33 void gpu_texture_destroy_internal(
gpu_texture texture) {
34 gpu_backend_texture_destroy(&texture->bt, texture->device->bd);
43 if (!gpu_device_resource_texture_view_create(texture->device, view)) {
44 KB_ERROR(
"could not create device-tracked texture");
50 if (!gpu_backend_texture_view_create(&v->btv, v->device->bd, texture->bt, desc)) {
51 KB_ERROR(
"cannot create backend texture view");
57 void gpu_texture_view_destroy(
gpu_texture_view view) { gpu_device_resource_texture_view_enqueue_destroy(view); }
60 gpu_backend_texture_view_destroy(&view->btv, view->device->bd);
#define KB_FLAGS_ANY_SET(value, flags)
Check if any of the flags are set inside value.
#define KB_ERROR(...)
Log entry with error log level.