Add gpu_device_name

This commit is contained in:
luboslenco
2025-08-24 10:30:41 +02:00
parent 81567a584e
commit 8384b3ae67
6 changed files with 18 additions and 29 deletions
+5
View File
@@ -46,6 +46,7 @@ static ID3D12Resource *upload_buffer = NULL;
static int upload_buffer_size = 0;
static ID3D12Resource *resources_to_destroy[256];
static int resources_to_destroy_count = 0;
static char device_name[256];
static D3D12_BLEND convert_blend_factor(gpu_blending_factor_t factor) {
switch (factor) {
@@ -1114,6 +1115,10 @@ void gpu_buffer_destroy_internal(gpu_buffer_t *buffer) {
buffer->impl.buffer = NULL;
}
char *gpu_device_name() {
return device_name;
}
typedef struct inst {
iron_matrix4x4_t m;
int i;
+4
View File
@@ -643,6 +643,10 @@ void *gpu_index_buffer_lock(gpu_buffer_t *buffer) {
void gpu_index_buffer_unlock(gpu_buffer_t *buffer) {
}
char *gpu_device_name() {
return "";
}
typedef struct inst {
iron_matrix4x4_t m;
int i;
+6
View File
@@ -42,6 +42,7 @@ static VkCommandBuffer command_buffer;
static VkBuffer buffers_to_destroy[256];
static VkDeviceMemory buffer_memories_to_destroy[256];
static int buffers_to_destroy_count = 0;
static char device_name[256];
static VkInstance instance;
static VkPhysicalDevice gpu;
@@ -753,6 +754,7 @@ void gpu_init_internal(int depth_buffer_bits, bool vsync) {
VkPhysicalDeviceProperties properties;
vkGetPhysicalDeviceProperties(gpu, &properties);
iron_log("Chosen Vulkan device: %s", properties.deviceName);
strcpy(device_name, properties.deviceName);
is_amd = properties.vendorID == 0x1002;
free(physical_devices);
}
@@ -1872,6 +1874,10 @@ void gpu_buffer_destroy_internal(gpu_buffer_t *buffer) {
vkDestroyBuffer(device, buffer->impl.buf, NULL);
}
char *gpu_device_name() {
return device_name;
}
typedef struct inst {
iron_matrix4x4_t m;
int i;
+1
View File
@@ -209,6 +209,7 @@ void gpu_set_constant_buffer(gpu_buffer_t *buffer, int offset, size_t size);
void gpu_get_render_target_pixels(gpu_texture_t *render_target, uint8_t *data);
void gpu_set_texture(int unit, gpu_texture_t *texture);
void gpu_use_linear_sampling(bool b);
char *gpu_device_name();
bool gpu_raytrace_supported(void);
void gpu_raytrace_pipeline_init(gpu_raytrace_pipeline_t *pipeline, void *ray_shader, int ray_shader_size, gpu_buffer_t *constant_buffer);
+1
View File
@@ -249,6 +249,7 @@ declare function gpu_set_floats(location: i32, values: f32_array_t): void;
declare function gpu_set_matrix4(location: i32, matrix: mat4_t): void;
declare function gpu_set_matrix3(location: i32, matrix: mat3_t): void;
declare function gpu_use_linear_sampling(b: bool): void;
declare function gpu_device_name(): string;
declare function iron_time(): f32;
declare function iron_window_width(): i32;
+1 -29
View File
@@ -674,36 +674,8 @@ function ui_menubar_draw_category_items() {
let msg: string = manifest_title + ".org - v" + manifest_version + " (" + config_get_date() + ") - " + config_get_sha() + "\n";
msg += iron_system_id() + " - " + strings_graphics_api();
///if arm_windows
let save: string;
if (path_is_protected()) {
save = iron_internal_save_path();
}
else {
save = path_data();
}
save += path_sep + "tmp.txt";
iron_sys_command("wmic path win32_VideoController get name > \"" + save + "\"");
let blob: buffer_t = iron_load_blob(save);
let u8: u8_array_t = blob;
let gpu_raw: string = "";
for (let i: i32 = 0; i < math_floor(u8.length / 2); ++i) {
let c: string = string_from_char_code(u8[i * 2]);
gpu_raw += c;
}
let gpus: string[] = string_split(gpu_raw, "\n");
array_splice(gpus, 1, gpus.length - 2);
let gpu: string = "";
for (let i: i32 = 0; i < gpus.length; ++i) {
let g: string = gpus[i];
gpu += trim_end(g) + ", ";
}
gpu = substring(gpu, 0, gpu.length - 2);
let gpu: string = gpu_device_name();
msg += "\n" + gpu;
///else
// { lshw -C display }
///end
_ui_menu_render_msg = msg;