summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/get.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-02-02 01:22:52 +0100
committerMarek Olšák <[email protected]>2016-02-05 17:30:07 +0100
commit1d79b9958090d5606212a56c2173626519f00ca8 (patch)
tree9a6d210fce73116761c385d582ccd0b482021b37 /src/mesa/main/get.c
parentd2e4c9e7371c108a7655f78ae77f55ced812aba8 (diff)
mesa: implement GL_NVX_gpu_memory_info (v2)
v2: implement eviction queries properly add gl_memory_info structure Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r--src/mesa/main/get.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 73ff0b9687a..4ab683e93cc 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -450,6 +450,7 @@ EXTRA_EXT(ARB_tessellation_shader);
EXTRA_EXT(ARB_shader_subroutine);
EXTRA_EXT(ARB_shader_storage_buffer_object);
EXTRA_EXT(ARB_indirect_parameters);
+EXTRA_EXT(NVX_gpu_memory_info);
static const int
extra_ARB_color_buffer_float_or_glcore[] = {
@@ -1091,6 +1092,29 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
break;
case GL_SAMPLE_BUFFERS:
v->value_int = _mesa_geometric_samples(ctx->DrawBuffer) > 0;
+ /* GL_NVX_gpu_memory_info */
+ case GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX:
+ case GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX:
+ case GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX:
+ case GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX:
+ case GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX:
+ {
+ struct gl_memory_info info;
+
+ ctx->Driver.QueryMemoryInfo(ctx, &info);
+
+ if (d->pname == GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX)
+ v->value_int = info.total_device_memory;
+ else if (d->pname == GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX)
+ v->value_int = info.total_device_memory +
+ info.total_staging_memory;
+ else if (d->pname == GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX)
+ v->value_int = info.avail_device_memory;
+ else if (d->pname == GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX)
+ v->value_int = info.nr_device_memory_evictions;
+ else if (d->pname == GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX)
+ v->value_int = info.device_memory_evicted;
+ }
break;
}
}