+ /* GL_ARB_compute_shader */
+ case GL_DISPATCH_INDIRECT_BUFFER_BINDING:
+ v->value_int = ctx->DispatchIndirectBuffer->Name;
+ break;
+ /* GL_ARB_multisample */
+ case GL_SAMPLES:
+ v->value_int = _mesa_geometric_samples(ctx->DrawBuffer);
+ break;
+ case GL_SAMPLE_BUFFERS:
+ v->value_int = _mesa_geometric_samples(ctx->DrawBuffer) > 0;
+ break;
+ /* GL_EXT_textrue_integer */
+ case GL_RGBA_INTEGER_MODE_EXT:
+ v->value_int = (ctx->DrawBuffer->_IntegerBuffers != 0);
+ break;
+ /* GL_ATI_meminfo & GL_NVX_gpu_memory_info */
+ case GL_VBO_FREE_MEMORY_ATI:
+ case GL_TEXTURE_FREE_MEMORY_ATI:
+ case GL_RENDERBUFFER_FREE_MEMORY_ATI:
+ 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;
+ else {
+ /* ATI free memory enums.
+ *
+ * Since the GPU memory is (usually) page-table based, every two
+ * consecutive elements are equal. From the GL_ATI_meminfo
+ * specification:
+ *
+ * "param[0] - total memory free in the pool
+ * param[1] - largest available free block in the pool
+ * param[2] - total auxiliary memory free
+ * param[3] - largest auxiliary free block"
+ *
+ * All three (VBO, TEXTURE, RENDERBUFFER) queries return
+ * the same numbers here.
+ */
+ v->value_int_4[0] = info.avail_device_memory;
+ v->value_int_4[1] = info.avail_device_memory;
+ v->value_int_4[2] = info.avail_staging_memory;
+ v->value_int_4[3] = info.avail_staging_memory;
+ }
+ }
+ break;
+
+ /* GL_ARB_get_program_binary */
+ case GL_PROGRAM_BINARY_FORMATS:
+ assert(ctx->Const.NumProgramBinaryFormats <= 1);
+ v->value_int_n.n = MIN2(ctx->Const.NumProgramBinaryFormats, 1);
+ if (ctx->Const.NumProgramBinaryFormats > 0) {
+ v->value_int_n.ints[0] = GL_PROGRAM_BINARY_FORMAT_MESA;
+ }
+ break;
+ /* GL_EXT_disjoint_timer_query */
+ case GL_GPU_DISJOINT_EXT:
+ {
+ simple_mtx_lock(&ctx->Shared->Mutex);
+ v->value_int = ctx->Shared->DisjointOperation;
+ /* Reset state as expected by the spec. */
+ ctx->Shared->DisjointOperation = false;
+ simple_mtx_unlock(&ctx->Shared->Mutex);
+ }
+ break;
+ /* GL_ARB_sample_locations */
+ case GL_SAMPLE_LOCATION_SUBPIXEL_BITS_ARB:
+ case GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_ARB:
+ case GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_ARB:
+ {
+ GLuint bits, width, height;
+
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
+
+ if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE) {
+ v->value_uint = 0;
+ break;
+ }
+
+ ctx->Driver.GetProgrammableSampleCaps(ctx, ctx->DrawBuffer,
+ &bits, &width, &height);
+
+ if (d->pname == GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_ARB)
+ v->value_uint = width;
+ else if (d->pname == GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_ARB)
+ v->value_uint = height;
+ else
+ v->value_uint = bits;
+ }
+ break;
+ case GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_ARB:
+ v->value_uint = MAX_SAMPLE_LOCATION_TABLE_SIZE;
+ break;
+
+ /* GL_AMD_framebuffer_multisample_advanced */
+ case GL_SUPPORTED_MULTISAMPLE_MODES_AMD:
+ v->value_int_n.n = ctx->Const.NumSupportedMultisampleModes * 3;
+ memcpy(v->value_int_n.ints, ctx->Const.SupportedMultisampleModes,
+ v->value_int_n.n * sizeof(GLint));
+ break;