From 86de08f36be413eba46a6bb493911838ad52dbf6 Mon Sep 17 00:00:00 2001 From: Robert Konrad Date: Mon, 30 Sep 2024 14:47:07 +0200 Subject: [PATCH] Set more names --- .../Direct3D12/Sources/kope/direct3d12/buffer.cpp | 8 ++++++++ .../Direct3D12/Sources/kope/direct3d12/buffer_functions.h | 1 + .../Direct3D12/Sources/kope/direct3d12/sampler.cpp | 4 ++++ .../Sources/kope/direct3d12/sampler_functions.h | 2 ++ .../Direct3D12/Sources/kope/direct3d12/texture.cpp | 6 ++++++ .../Sources/kope/direct3d12/texture_functions.h | 2 ++ Sources/kope/graphics5/buffer.c | 4 ++++ Sources/kope/graphics5/buffer.h | 1 + Sources/kope/graphics5/sampler.c | 4 ++++ Sources/kope/graphics5/sampler.h | 2 ++ Sources/kope/graphics5/texture.c | 4 ++++ Sources/kope/graphics5/texture.h | 2 ++ 12 files changed, 40 insertions(+) diff --git a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/buffer.cpp b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/buffer.cpp index 58570b01a..c528fd232 100644 --- a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/buffer.cpp +++ b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/buffer.cpp @@ -2,6 +2,14 @@ #include +#include + +void kope_d3d12_buffer_set_name(kope_g5_buffer *buffer, const char *name) { + wchar_t wstr[1024]; + kinc_microsoft_convert_string(wstr, name, 1024); + buffer->d3d12.resource->SetName(wstr); +} + void kope_d3d12_buffer_destroy(kope_g5_buffer *buffer) { buffer->d3d12.resource->Release(); } diff --git a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/buffer_functions.h b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/buffer_functions.h index e1cca83c7..223274544 100644 --- a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/buffer_functions.h +++ b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/buffer_functions.h @@ -7,6 +7,7 @@ extern "C" { #endif +void kope_d3d12_buffer_set_name(kope_g5_buffer *buffer, const char *name); void kope_d3d12_buffer_destroy(kope_g5_buffer *buffer); void *kope_d3d12_buffer_lock(kope_g5_buffer *buffer); void kope_d3d12_buffer_unlock(kope_g5_buffer *buffer); diff --git a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/sampler.cpp b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/sampler.cpp index 56bba09cd..02a635f72 100644 --- a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/sampler.cpp +++ b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/sampler.cpp @@ -3,3 +3,7 @@ #include "d3d12unit.h" #include + +void kope_d3d12_sampler_set_name(kope_g5_sampler *sampler, const char *name) { + // not supported I think +} diff --git a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/sampler_functions.h b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/sampler_functions.h index 73e694cda..5eca69701 100644 --- a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/sampler_functions.h +++ b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/sampler_functions.h @@ -7,6 +7,8 @@ extern "C" { #endif +void kope_d3d12_sampler_set_name(kope_g5_sampler *sampler, const char *name); + #ifdef __cplusplus } #endif diff --git a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/texture.cpp b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/texture.cpp index 32de0a3a9..4ffca3783 100644 --- a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/texture.cpp +++ b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/texture.cpp @@ -7,3 +7,9 @@ uint32_t kope_d3d12_texture_resource_state_index(kope_g5_texture *texture, uint32_t mip_level, uint32_t array_layer) { return mip_level + (array_layer * texture->d3d12.mip_level_count); } + +void kope_d3d12_texture_set_name(kope_g5_texture *texture, const char *name) { + wchar_t wstr[1024]; + kinc_microsoft_convert_string(wstr, name, 1024); + texture->d3d12.resource->SetName(wstr); +} diff --git a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/texture_functions.h b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/texture_functions.h index ce7035356..de25e8420 100644 --- a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/texture_functions.h +++ b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/texture_functions.h @@ -9,6 +9,8 @@ extern "C" { uint32_t kope_d3d12_texture_resource_state_index(kope_g5_texture *texture, uint32_t mip_level, uint32_t array_layer); +void kope_d3d12_texture_set_name(kope_g5_texture *texture, const char *name); + #ifdef __cplusplus } #endif diff --git a/Sources/kope/graphics5/buffer.c b/Sources/kope/graphics5/buffer.c index 80426c27d..1c431362b 100644 --- a/Sources/kope/graphics5/buffer.c +++ b/Sources/kope/graphics5/buffer.c @@ -8,6 +8,10 @@ #include #endif +void kope_g5_buffer_set_name(kope_g5_buffer *buffer, const char *name) { + KOPE_G5_CALL2(buffer_set_name, buffer, name); +} + void kope_g5_buffer_destroy(kope_g5_buffer *buffer) { KOPE_G5_CALL1(buffer_destroy, buffer); } diff --git a/Sources/kope/graphics5/buffer.h b/Sources/kope/graphics5/buffer.h index cae0b0b11..ae75df41a 100644 --- a/Sources/kope/graphics5/buffer.h +++ b/Sources/kope/graphics5/buffer.h @@ -26,6 +26,7 @@ typedef struct kope_g5_buffer { KOPE_G5_IMPL(buffer); } kope_g5_buffer; +void kope_g5_buffer_set_name(kope_g5_buffer *buffer, const char *name); void kope_g5_buffer_destroy(kope_g5_buffer *buffer); void *kope_g5_buffer_lock(kope_g5_buffer *buffer); // TODO void kope_g5_buffer_unlock(kope_g5_buffer *buffer); diff --git a/Sources/kope/graphics5/sampler.c b/Sources/kope/graphics5/sampler.c index 3c472b616..c4d36c046 100644 --- a/Sources/kope/graphics5/sampler.c +++ b/Sources/kope/graphics5/sampler.c @@ -7,3 +7,7 @@ #ifdef KOPE_VULKAN #include #endif + +void kope_g5_sampler_set_name(kope_g5_sampler *sampler, const char *name) { + KOPE_G5_CALL2(sampler_set_name, sampler, name); +} diff --git a/Sources/kope/graphics5/sampler.h b/Sources/kope/graphics5/sampler.h index cba669a64..b43080a1e 100644 --- a/Sources/kope/graphics5/sampler.h +++ b/Sources/kope/graphics5/sampler.h @@ -21,6 +21,8 @@ typedef struct kope_g5_sampler { KOPE_G5_IMPL(sampler); } kope_g5_sampler; +KOPE_FUNC void kope_g5_sampler_set_name(kope_g5_sampler *sampler, const char *name); + #ifdef __cplusplus } #endif diff --git a/Sources/kope/graphics5/texture.c b/Sources/kope/graphics5/texture.c index ecc45745f..6a864978a 100644 --- a/Sources/kope/graphics5/texture.c +++ b/Sources/kope/graphics5/texture.c @@ -7,3 +7,7 @@ #ifdef KOPE_VULKAN #include #endif + +void kope_g5_texture_set_name(kope_g5_texture *texture, const char *name) { + KOPE_G5_CALL2(texture_set_name, texture, name); +} diff --git a/Sources/kope/graphics5/texture.h b/Sources/kope/graphics5/texture.h index 705765562..841817c4a 100644 --- a/Sources/kope/graphics5/texture.h +++ b/Sources/kope/graphics5/texture.h @@ -51,6 +51,8 @@ typedef struct kope_g5_texture_view { uint32_t array_layer_count; } kope_g5_texture_view; +KOPE_FUNC void kope_g5_texture_set_name(kope_g5_texture *texture, const char *name); + #ifdef __cplusplus } #endif