Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libobs/build/libobs.graphics+.h.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "libobs/graphics/effect-parser.c.h"
#include "libobs/graphics/graphics-device-load-fields.c.h"
#include "libobs/graphics/graphics-device-queries-fields.c.h"
#include "libobs/graphics/graphics-gpu-metadata.c.h"
#include "libobs/graphics/graphics-imports.c.h"
#include "libobs/graphics/graphics-indexbuffer-maintenance-fields.c.h"
#include "libobs/graphics/graphics-render-target-setters-fields.c.h"
Expand Down
57 changes: 57 additions & 0 deletions libobs/graphics/graphics-gpu-metadata.c.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include "libobs/build/libobs-graphics.pch.h"

/* Private dependencies defined in graphics.c.h, later in the unity group. */
static THREAD_LOCAL graphics_t *thread_graphics;
static inline bool gs_valid(const char *f);

const char *gs_get_driver_version(void)
{
graphics_t *graphics = thread_graphics;

if (!gs_valid("gs_get_driver_version"))
return NULL;

if (graphics->exports.gpu_get_driver_version)
return (graphics->exports.gpu_get_driver_version());
else
return NULL;
}

const char *gs_get_renderer(void)
{
graphics_t *graphics = thread_graphics;

if (!gs_valid("gs_get_renderer"))
return NULL;

if (graphics->exports.gpu_get_renderer)
return (graphics->exports.gpu_get_renderer());
else
return NULL;
}

uint64_t gs_get_gpu_dmem(void)
{
graphics_t *graphics = thread_graphics;

if (!gs_valid("gs_get_gpu_dmem"))
return 0;

if (graphics->exports.gpu_get_dmem)
return (graphics->exports.gpu_get_dmem());
else
return 0;
}

uint64_t gs_get_gpu_smem(void)
{
graphics_t *graphics = thread_graphics;

if (!gs_valid("gs_get_gpu_smem"))
return 0;

if (graphics->exports.gpu_get_smem)
return (graphics->exports.gpu_get_smem());
else
return 0;
}
52 changes: 0 additions & 52 deletions libobs/graphics/graphics.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,58 +334,6 @@ const char *gs_get_device_name(void)
return gs_valid("gs_get_device_name") ? thread_graphics->exports.device_get_name() : NULL;
}

const char *gs_get_driver_version(void)
{
graphics_t *graphics = thread_graphics;

if (!gs_valid("gs_get_driver_version"))
return NULL;

if (graphics->exports.gpu_get_driver_version)
return (graphics->exports.gpu_get_driver_version());
else
return NULL;
}

const char *gs_get_renderer(void)
{
graphics_t *graphics = thread_graphics;

if (!gs_valid("gs_get_renderer"))
return NULL;

if (graphics->exports.gpu_get_renderer)
return (graphics->exports.gpu_get_renderer());
else
return NULL;
}

uint64_t gs_get_gpu_dmem(void)
{
graphics_t *graphics = thread_graphics;

if (!gs_valid("gs_get_gpu_dmem"))
return 0;

if (graphics->exports.gpu_get_dmem)
return (graphics->exports.gpu_get_dmem());
else
return 0;
}

uint64_t gs_get_gpu_smem(void)
{
graphics_t *graphics = thread_graphics;

if (!gs_valid("gs_get_gpu_smem"))
return 0;

if (graphics->exports.gpu_get_smem)
return (graphics->exports.gpu_get_smem());
else
return 0;
}

static inline void reset_immediate_arrays(graphics_t *graphics)
{
da_init(graphics->verts);
Expand Down
19 changes: 19 additions & 0 deletions test/cmocka/build/test-graph.json
Original file line number Diff line number Diff line change
Expand Up @@ -5284,6 +5284,19 @@
"SIMDe::SIMDe"
]
},
"test_graphics_gpu_metadata": {
"sources": [
"test/cmocka/test_graphics_gpu_metadata.c"
],
"libraries": [
"OBS::libobs",
"OBS::native-test-cmocka",
{
"name": "OBS::w32-pthreads",
"requires": "OS_WINDOWS"
}
]
},
"test_graphics_host_exports": {
"sources": [
"test/cmocka/test_graphics_host_exports.c"
Expand Down Expand Up @@ -24137,6 +24150,12 @@
"${target}"
]
},
"test_graphics_gpu_metadata": {
"target": "test_graphics_gpu_metadata",
"command": [
"${target}"
]
},
"test_graphics_host_exports": {
"target": "test_graphics_host_exports",
"requires": "OS_LINUX"
Expand Down
Loading
Loading