Lines Matching refs:ctx
709 * \param ctx the current context
714 find_custom_value(struct gl_context *ctx, const struct value_desc *d, union value *v)
722 v->value_int = ctx->Version / 10;
725 v->value_int = ctx->Version % 10;
740 v->value_int = ctx->Line.StipplePattern;
744 unit = ctx->Texture.CurrentUnit;
745 v->value_float_4[0] = ctx->Current.RasterTexCoords[unit][0];
746 v->value_float_4[1] = ctx->Current.RasterTexCoords[unit][1];
747 v->value_float_4[2] = ctx->Current.RasterTexCoords[unit][2];
748 v->value_float_4[3] = ctx->Current.RasterTexCoords[unit][3];
752 unit = ctx->Texture.CurrentUnit;
753 v->value_float_4[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0];
754 v->value_float_4[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1];
755 v->value_float_4[2] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2];
756 v->value_float_4[3] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3];
760 v->value_int_4[0] = GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 0);
761 v->value_int_4[1] = GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 1);
762 v->value_int_4[2] = GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 2);
763 v->value_int_4[3] = GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 3);
767 v->value_bool = ctx->Transform.DepthClampNear || ctx->Transform.DepthClampFar;
771 v->value_bool = ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0F;
775 v->value_enum16 = ctx->ReadBuffer->ColorReadBuffer;
779 v->value_float_4[0] = ctx->Eval.MapGrid2u1;
780 v->value_float_4[1] = ctx->Eval.MapGrid2u2;
781 v->value_float_4[2] = ctx->Eval.MapGrid2v1;
782 v->value_float_4[3] = ctx->Eval.MapGrid2v2;
786 unit = ctx->Texture.CurrentUnit;
787 v->value_int = ctx->TextureMatrixStack[unit].Depth + 1;
790 unit = ctx->Texture.CurrentUnit;
791 v->value_matrix = ctx->TextureMatrixStack[unit].Top;
795 v->value_bool = !!(ctx->Array.VAO->Enabled & VERT_BIT_POS);
798 v->value_bool = !!(ctx->Array.VAO->Enabled & VERT_BIT_NORMAL);
801 v->value_bool = !!(ctx->Array.VAO->Enabled & VERT_BIT_COLOR0);
804 v->value_bool = !!(ctx->Array.VAO->Enabled & VERT_BIT_TEX(ctx->Array.ActiveTexture));
807 v->value_bool = !!(ctx->Array.VAO->Enabled & VERT_BIT_COLOR_INDEX);
810 v->value_bool = !!(ctx->Array.VAO->Enabled & VERT_BIT_EDGEFLAG);
813 v->value_bool = !!(ctx->Array.VAO->Enabled & VERT_BIT_COLOR1);
816 v->value_bool = !!(ctx->Array.VAO->Enabled & VERT_BIT_FOG);
819 v->value_bool = !!(ctx->Array.VAO->Enabled & VERT_BIT_POINT_SIZE);
824 array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)];
829 array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)];
834 array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS];
839 v->value_int = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit;
842 v->value_int = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture;
847 v->value_int = *(GLint *) ((char *) ctx + d->offset) + 1;
853 p = (GLuint *) ((char *) ctx + d->offset);
858 v->value_int_4[0] = ctx->Scissor.ScissorArray[0].X;
859 v->value_int_4[1] = ctx->Scissor.ScissorArray[0].Y;
860 v->value_int_4[2] = ctx->Scissor.ScissorArray[0].Width;
861 v->value_int_4[3] = ctx->Scissor.ScissorArray[0].Height;
865 v->value_bool = ctx->Scissor.EnableFlags & 1;
870 ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0;
873 if (!ctx->CompileFlag)
875 else if (ctx->ExecuteFlag)
882 v->value_float_4[0] = ctx->ViewportArray[0].X;
883 v->value_float_4[1] = ctx->ViewportArray[0].Y;
884 v->value_float_4[2] = ctx->ViewportArray[0].Width;
885 v->value_float_4[3] = ctx->ViewportArray[0].Height;
889 v->value_double_2[0] = ctx->ViewportArray[0].Near;
890 v->value_double_2[1] = ctx->ViewportArray[0].Far;
894 v->value_enum16 = ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT;
898 v->value_enum16 = ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace];
901 v->value_enum16 = ctx->Stencil.Function[ctx->Stencil.ActiveFace];
904 v->value_enum16 = ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace];
907 v->value_enum16 = ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace];
910 v->value_int = _mesa_get_stencil_ref(ctx, ctx->Stencil.ActiveFace);
913 v->value_int = _mesa_get_stencil_ref(ctx, 1);
916 v->value_int = ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace];
919 v->value_int = ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace];
923 v->value_int = _mesa_get_extension_count(ctx);
927 v->value_int = _mesa_get_color_read_type(ctx, NULL, "glGetIntegerv");
930 v->value_int = _mesa_get_color_read_format(ctx, NULL, "glGetIntegerv");
934 v->value_int = ctx->CurrentStack->Depth + 1;
938 v->value_matrix = ctx->CurrentStack->Top;
942 v->value_int = _mesa_get_compressed_formats(ctx, NULL);
946 _mesa_get_compressed_formats(ctx, v->value_int_n.ints);
951 v->value_int = ctx->Const.MaxVarying * 4;
967 unit = ctx->Texture.CurrentUnit;
969 ctx->Texture.Unit[unit].CurrentTex[d->offset]->Name;
977 _mesa_get_driver_uuid(ctx, v->value_int_4);
980 _mesa_get_device_uuid(ctx, v->value_int_4);
985 _mesa_get_device_luid(ctx, v->value_int_2);
988 v->value_int = ctx->pipe->screen->get_device_node_mask(ctx->pipe->screen);
996 ctx->DrawBuffer->_ColorDrawBuffers[0];
1039 ((char *) ctx->Array.VAO + d->offset);
1043 buf = ctx->Array.ArrayBufferObj;
1047 buf = ctx->Array.VAO->BufferBinding[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].BufferObj;
1051 buf = ctx->Array.VAO->IndexBufferObj;
1057 array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR0];
1061 array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR1];
1067 v->value_int = ctx->CopyReadBuffer ? ctx->CopyReadBuffer->Name : 0;
1070 v->value_int = ctx->CopyWriteBuffer ? ctx->CopyWriteBuffer->Name : 0;
1074 v->value_int = ctx->Pack.BufferObj ? ctx->Pack.BufferObj->Name : 0;
1077 v->value_int = ctx->Unpack.BufferObj ? ctx->Unpack.BufferObj->Name : 0;
1080 v->value_int = ctx->TransformFeedback.CurrentBuffer ?
1081 ctx->TransformFeedback.CurrentBuffer->Name : 0;
1084 v->value_int = ctx->TransformFeedback.CurrentObject->Paused;
1087 v->value_int = ctx->TransformFeedback.CurrentObject->Active;
1090 v->value_int = ctx->TransformFeedback.CurrentObject->Name;
1106 ctx->Shader.ActiveProgram ? ctx->Shader.ActiveProgram->Name : 0;
1109 v->value_int = ctx->ReadBuffer->Name;
1113 ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0;
1116 buf = ctx->Array.VAO->BufferBinding[VERT_ATTRIB_POINT_SIZE].BufferObj;
1121 if (_mesa_get_clamp_fragment_color(ctx, ctx->DrawBuffer))
1122 COPY_4FV(v->value_float_4, ctx->Fog.Color);
1124 COPY_4FV(v->value_float_4, ctx->Fog.ColorUnclamped);
1127 if (_mesa_get_clamp_fragment_color(ctx, ctx->DrawBuffer)) {
1128 v->value_float_4[0] = CLAMP(ctx->Color.ClearColor.f[0], 0.0F, 1.0F);
1129 v->value_float_4[1] = CLAMP(ctx->Color.ClearColor.f[1], 0.0F, 1.0F);
1130 v->value_float_4[2] = CLAMP(ctx->Color.ClearColor.f[2], 0.0F, 1.0F);
1131 v->value_float_4[3] = CLAMP(ctx->Color.ClearColor.f[3], 0.0F, 1.0F);
1133 COPY_4FV(v->value_float_4, ctx->Color.ClearColor.f);
1136 if (_mesa_get_clamp_fragment_color(ctx, ctx->DrawBuffer))
1137 COPY_4FV(v->value_float_4, ctx->Color.BlendColor);
1139 COPY_4FV(v->value_float_4, ctx->Color.BlendColorUnclamped);
1142 if (_mesa_get_clamp_fragment_color(ctx, ctx->DrawBuffer))
1143 v->value_float = ctx->Color.AlphaRef;
1145 v->value_float = ctx->Color.AlphaRefUnclamped;
1148 v->value_int = ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents / 4;
1152 v->value_int = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents / 4;
1157 v->value_int = ctx->Texture.BufferObject ? ctx->Texture.BufferObject->Name : 0;
1160 unit = ctx->Texture.CurrentUnit;
1162 ctx->Texture.Unit[unit].CurrentTex[TEXTURE_BUFFER_INDEX]->Name;
1167 ctx->Texture.Unit[ctx->Texture.CurrentUnit]
1173 v->value_int = ctx->Texture.Unit[ctx->Texture.CurrentUnit]
1181 ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler;
1187 v->value_int = ctx->UniformBuffer ? ctx->UniformBuffer->Name : 0;
1191 v->value_int = ctx->ShaderStorageBuffer ? ctx->ShaderStorageBuffer->Name : 0;
1195 v->value_int = ctx->QueryBuffer ? ctx->QueryBuffer->Name : 0;
1199 v->value_int64 = _mesa_get_timestamp(ctx);
1207 v->value_int = _mesa_get_debug_state_int(ctx, d->pname);
1211 v->value_int = ctx->AtomicBuffer ? ctx->AtomicBuffer->Name : 0;
1215 v->value_int = _mesa_get_shading_language_version(ctx, -1, NULL);
1219 v->value_int = ctx->DrawIndirectBuffer ? ctx->DrawIndirectBuffer->Name: 0;
1223 v->value_int = ctx->ParameterBuffer ? ctx->ParameterBuffer->Name : 0;
1227 if (ctx->Pipeline.Current) {
1228 v->value_int = ctx->Pipeline.Current->Name;
1235 v->value_int = ctx->DispatchIndirectBuffer ?
1236 ctx->DispatchIndirectBuffer->Name : 0;
1240 v->value_int = _mesa_geometric_samples(ctx->DrawBuffer);
1243 v->value_int = _mesa_geometric_samples(ctx->DrawBuffer) > 0;
1247 v->value_int = (ctx->DrawBuffer->_IntegerBuffers != 0);
1260 struct pipe_screen *screen = ctx->pipe->screen;
1301 assert(ctx->Const.NumProgramBinaryFormats <= 1);
1302 v->value_int_n.n = MIN2(ctx->Const.NumProgramBinaryFormats, 1);
1303 if (ctx->Const.NumProgramBinaryFormats > 0) {
1309 v->value_int = _mesa_get_spirv_extension_count(ctx);
1314 simple_mtx_lock(&ctx->Shared->Mutex);
1315 v->value_int = ctx->Shared->DisjointOperation;
1317 ctx->Shared->DisjointOperation = false;
1318 simple_mtx_unlock(&ctx->Shared->Mutex);
1328 if (ctx->NewState & _NEW_BUFFERS)
1329 _mesa_update_state(ctx);
1331 if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE) {
1336 _mesa_GetProgrammableSampleCaps(ctx, ctx->DrawBuffer,
1353 v->value_int_n.n = ctx->Const.NumSupportedMultisampleModes * 3;
1354 memcpy(v->value_int_n.ints, ctx->Const.SupportedMultisampleModes,
1360 v->value_enum = ctx->ViewportArray[0].SwizzleX;
1363 v->value_enum = ctx->ViewportArray[0].SwizzleY;
1366 v->value_enum = ctx->ViewportArray[0].SwizzleZ;
1369 v->value_enum = ctx->ViewportArray[0].SwizzleW;
1382 * \param ctx current context
1390 check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d)
1392 const GLuint version = ctx->Version;
1421 if (_mesa_is_desktop_gl(ctx) && version >= 43)
1426 if (ctx->API == API_OPENGLES2)
1431 if (_mesa_is_gles3(ctx))
1436 if (_mesa_is_gles31(ctx))
1441 if (_mesa_is_gles32(ctx))
1446 if (_mesa_is_desktop_gl(ctx))
1451 if (ctx->API == API_OPENGL_CORE)
1455 if (ctx->NewState & _NEW_BUFFERS)
1456 _mesa_update_state(ctx);
1459 FLUSH_CURRENT(ctx, 0);
1462 if (d->pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
1463 _mesa_error(ctx, GL_INVALID_OPERATION, "%s(draw buffer %u)",
1469 if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
1470 _mesa_error(ctx, GL_INVALID_OPERATION, "%s(texture %u)",
1471 func, ctx->Texture.CurrentUnit);
1476 if (d->pname - GL_CLIP_DISTANCE0 >= ctx->Const.MaxClipPlanes) {
1477 _mesa_error(ctx, GL_INVALID_ENUM, "%s(clip distance %u)",
1484 if (ctx->Const.GLSLVersion >= 130)
1489 if (ctx->Extensions.ARB_uniform_buffer_object &&
1490 _mesa_has_geometry_shaders(ctx))
1495 if (ctx->Extensions.ARB_shader_atomic_counters &&
1496 _mesa_has_geometry_shaders(ctx))
1501 if ((ctx->Extensions.ARB_shader_image_load_store ||
1502 _mesa_is_gles31(ctx)) &&
1503 _mesa_has_geometry_shaders(ctx))
1508 api_found = ctx->Extensions.ARB_shader_atomic_counters &&
1509 _mesa_has_tessellation(ctx);
1513 api_found = ctx->Extensions.ARB_shader_image_load_store &&
1514 _mesa_has_tessellation(ctx);
1518 if (ctx->Extensions.ARB_shader_storage_buffer_object &&
1519 _mesa_has_geometry_shaders(ctx))
1524 if (ctx->Extensions.ARB_framebuffer_no_attachments &&
1525 (_mesa_is_desktop_gl(ctx) ||
1526 _mesa_has_OES_geometry_shader(ctx)))
1531 if (_mesa_has_OES_geometry_shader(ctx))
1536 if (ctx->API == API_OPENGL_COMPAT || version == 32)
1537 api_found = ctx->Extensions.EXT_provoking_vertex;
1543 if (*(GLboolean *) ((char *) &ctx->Extensions + *e))
1550 _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
1586 GET_CURRENT_CONTEXT(ctx);
1593 api = ctx->API;
1600 if (ctx->API == API_OPENGLES2) {
1601 if (ctx->Version >= 32)
1603 else if (ctx->Version >= 31)
1605 else if (ctx->Version >= 30)
1617 _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
1629 if (unlikely(d->extra && !check_extra(ctx, func, d)))
1634 *p = ((char *) ctx->DrawBuffer + d->offset);
1637 *p = ((char *) ctx + d->offset);
1640 *p = ((char *) ctx->Array.VAO + d->offset);
1643 if (ctx->Texture.CurrentUnit < ARRAY_SIZE(ctx->Texture.FixedFuncUnit)) {
1644 unsigned index = ctx->Texture.CurrentUnit;
1645 *p = ((char *)&ctx->Texture.FixedFuncUnit[index] + d->offset);
1648 _mesa_error(ctx, GL_INVALID_VALUE, "%s(pname=%s,unit=%d)", func,
1650 ctx->Texture.CurrentUnit);
1653 find_custom_value(ctx, d, v);
2386 GET_CURRENT_CONTEXT(ctx);
2388 if (!ctx->Extensions.EXT_memory_object) {
2389 _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);
2459 tex_binding_to_index(const struct gl_context *ctx, GLenum binding)
2463 return _mesa_is_desktop_gl(ctx) ? TEXTURE_1D_INDEX : -1;
2467 return (ctx->API != API_OPENGLES &&
2468 !(ctx->API == API_OPENGLES2 && !ctx->Extensions.OES_texture_3D))
2473 return _mesa_is_desktop_gl(ctx) && ctx->Extensions.NV_texture_rectangle
2476 return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_array
2479 return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_array)
2480 || _mesa_is_gles3(ctx)
2483 return (_mesa_has_ARB_texture_buffer_object(ctx) ||
2484 _mesa_has_OES_texture_buffer(ctx)) ?
2487 return _mesa_has_texture_cube_map_array(ctx)
2490 return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_multisample
2493 return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_multisample
2503 GET_CURRENT_CONTEXT(ctx);
2509 if (index >= ctx->Const.MaxDrawBuffers)
2511 if (!ctx->Extensions.EXT_draw_buffers2)
2513 v->value_int = (ctx->Color.BlendEnabled >> index) & 1;
2519 if (index >= ctx->Const.MaxDrawBuffers)
2521 if (!ctx->Extensions.ARB_draw_buffers_blend)
2523 v->value_int = ctx->Color.Blend[index].SrcRGB;
2526 if (index >= ctx->Const.MaxDrawBuffers)
2528 if (!ctx->Extensions.ARB_draw_buffers_blend)
2530 v->value_int = ctx->Color.Blend[index].SrcA;
2535 if (index >= ctx->Const.MaxDrawBuffers)
2537 if (!ctx->Extensions.ARB_draw_buffers_blend)
2539 v->value_int = ctx->Color.Blend[index].DstRGB;
2542 if (index >= ctx->Const.MaxDrawBuffers)
2544 if (!ctx->Extensions.ARB_draw_buffers_blend)
2546 v->value_int = ctx->Color.Blend[index].DstA;
2549 if (index >= ctx->Const.MaxDrawBuffers)
2551 if (!ctx->Extensions.ARB_draw_buffers_blend)
2553 v->value_int = ctx->Color.Blend[index].EquationRGB;
2556 if (index >= ctx->Const.MaxDrawBuffers)
2558 if (!ctx->Extensions.ARB_draw_buffers_blend)
2560 v->value_int = ctx->Color.Blend[index].EquationA;
2564 if (index >= ctx->Const.MaxDrawBuffers)
2566 if (!ctx->Extensions.EXT_draw_buffers2)
2568 v->value_int_4[0] = GET_COLORMASK_BIT(ctx->Color.ColorMask, index, 0);
2569 v->value_int_4[1] = GET_COLORMASK_BIT(ctx->Color.ColorMask, index, 1);
2570 v->value_int_4[2] = GET_COLORMASK_BIT(ctx->Color.ColorMask, index, 2);
2571 v->value_int_4[3] = GET_COLORMASK_BIT(ctx->Color.ColorMask, index, 3);
2575 if (index >= ctx->Const.MaxViewports)
2577 v->value_int_4[0] = ctx->Scissor.ScissorArray[index].X;
2578 v->value_int_4[1] = ctx->Scissor.ScissorArray[index].Y;
2579 v->value_int_4[2] = ctx->Scissor.ScissorArray[index].Width;
2580 v->value_int_4[3] = ctx->Scissor.ScissorArray[index].Height;
2584 if (!ctx->Extensions.EXT_window_rectangles)
2586 if (index >= ctx->Const.MaxWindowRectangles)
2588 v->value_int_4[0] = ctx->Scissor.WindowRects[index].X;
2589 v->value_int_4[1] = ctx->Scissor.WindowRects[index].Y;
2590 v->value_int_4[2] = ctx->Scissor.WindowRects[index].Width;
2591 v->value_int_4[3] = ctx->Scissor.WindowRects[index].Height;
2595 if (index >= ctx->Const.MaxViewports)
2597 v->value_float_4[0] = ctx->ViewportArray[index].X;
2598 v->value_float_4[1] = ctx->ViewportArray[index].Y;
2599 v->value_float_4[2] = ctx->ViewportArray[index].Width;
2600 v->value_float_4[3] = ctx->ViewportArray[index].Height;
2604 if (index >= ctx->Const.MaxViewports)
2606 v->value_double_2[0] = ctx->ViewportArray[index].Near;
2607 v->value_double_2[1] = ctx->ViewportArray[index].Far;
2611 if (index >= ctx->Const.MaxTransformFeedbackBuffers)
2613 if (!ctx->Extensions.EXT_transform_feedback)
2615 v->value_int64 = ctx->TransformFeedback.CurrentObject->Offset[index];
2619 if (index >= ctx->Const.MaxTransformFeedbackBuffers)
2621 if (!ctx->Extensions.EXT_transform_feedback)
2624 = ctx->TransformFeedback.CurrentObject->RequestedSize[index];
2628 if (index >= ctx->Const.MaxTransformFeedbackBuffers)
2630 if (!ctx->Extensions.EXT_transform_feedback)
2632 v->value_int = ctx->TransformFeedback.CurrentObject->BufferNames[index];
2636 if (index >= ctx->Const.MaxUniformBufferBindings)
2638 if (!ctx->Extensions.ARB_uniform_buffer_object)
2640 buf = ctx->UniformBufferBindings[index].BufferObject;
2645 if (index >= ctx->Const.MaxUniformBufferBindings)
2647 if (!ctx->Extensions.ARB_uniform_buffer_object)
2649 v->value_int = ctx->UniformBufferBindings[index].Offset < 0 ? 0 :
2650 ctx->UniformBufferBindings[index].Offset;
2654 if (index >= ctx->Const.MaxUniformBufferBindings)
2656 if (!ctx->Extensions.ARB_uniform_buffer_object)
2658 v->value_int = ctx->UniformBufferBindings[index].Size < 0 ? 0 :
2659 ctx->UniformBufferBindings[index].Size;
2664 if (!ctx->Extensions.ARB_shader_storage_buffer_object && !_mesa_is_gles31(ctx))
2666 if (index >= ctx->Const.MaxShaderStorageBufferBindings)
2668 buf = ctx->ShaderStorageBufferBindings[index].BufferObject;
2673 if (!ctx->Extensions.ARB_shader_storage_buffer_object && !_mesa_is_gles31(ctx))
2675 if (index >= ctx->Const.MaxShaderStorageBufferBindings)
2677 v->value_int = ctx->ShaderStorageBufferBindings[index].Offset < 0 ? 0 :
2678 ctx->ShaderStorageBufferBindings[index].Offset;
2682 if (!ctx->Extensions.ARB_shader_storage_buffer_object && !_mesa_is_gles31(ctx))
2684 if (index >= ctx->Const.MaxShaderStorageBufferBindings)
2686 v->value_int = ctx->ShaderStorageBufferBindings[index].Size < 0 ? 0 :
2687 ctx->ShaderStorageBufferBindings[index].Size;
2694 if (!ctx->Extensions.ARB_texture_multisample)
2696 v->value_int = ctx->Multisample.SampleMaskValue;
2700 if (!ctx->Extensions.ARB_shader_atomic_counters && !_mesa_is_gles31(ctx))
2702 if (index >= ctx->Const.MaxAtomicBufferBindings)
2704 buf = ctx->AtomicBufferBindings[index].BufferObject;
2709 if (!ctx->Extensions.ARB_shader_atomic_counters && !_mesa_is_gles31(ctx))
2711 if (index >= ctx->Const.MaxAtomicBufferBindings)
2713 v->value_int64 = ctx->AtomicBufferBindings[index].Offset < 0 ? 0 :
2714 ctx->AtomicBufferBindings[index].Offset;
2718 if (!ctx->Extensions.ARB_shader_atomic_counters && !_mesa_is_gles31(ctx))
2720 if (index >= ctx->Const.MaxAtomicBufferBindings)
2722 v->value_int64 = ctx->AtomicBufferBindings[index].Size < 0 ? 0 :
2723 ctx->AtomicBufferBindings[index].Size;
2727 if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_instanced_arrays) &&
2728 !_mesa_is_gles31(ctx))
2730 if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
2732 v->value_int = ctx->Array.VAO->BufferBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;
2736 if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles31(ctx))
2738 if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
2740 v->value_int = ctx->Array.VAO->BufferBinding[VERT_ATTRIB_GENERIC(index)].Offset;
2744 if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles31(ctx))
2746 if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
2748 v->value_int = ctx->Array.VAO->BufferBinding[VERT_ATTRIB_GENERIC(index)].Stride;
2752 if (ctx->API == API_OPENGLES2 && ctx->Version < 31)
2754 if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
2756 buf = ctx->Array.VAO->BufferBinding[VERT_ATTRIB_GENERIC(index)].BufferObj;
2764 if (!ctx->Extensions.ARB_shader_image_load_store && !_mesa_is_gles31(ctx))
2766 if (index >= ctx->Const.MaxImageUnits)
2769 t = ctx->ImageUnits[index].TexObj;
2775 if (!ctx->Extensions.ARB_shader_image_load_store && !_mesa_is_gles31(ctx))
2777 if (index >= ctx->Const.MaxImageUnits)
2780 v->value_int = ctx->ImageUnits[index].Level;
2784 if (!ctx->Extensions.ARB_shader_image_load_store && !_mesa_is_gles31(ctx))
2786 if (index >= ctx->Const.MaxImageUnits)
2789 v->value_int = ctx->ImageUnits[index].Layered;
2793 if (!ctx->Extensions.ARB_shader_image_load_store && !_mesa_is_gles31(ctx))
2795 if (index >= ctx->Const.MaxImageUnits)
2798 v->value_int = ctx->ImageUnits[index].Layer;
2802 if (!ctx->Extensions.ARB_shader_image_load_store && !_mesa_is_gles31(ctx))
2804 if (index >= ctx->Const.MaxImageUnits)
2807 v->value_int = ctx->ImageUnits[index].Access;
2811 if (!ctx->Extensions.ARB_shader_image_load_store && !_mesa_is_gles31(ctx))
2813 if (index >= ctx->Const.MaxImageUnits)
2816 v->value_int = ctx->ImageUnits[index].Format;
2833 target = tex_binding_to_index(ctx, pname);
2836 if (index >= _mesa_max_tex_unit(ctx))
2839 v->value_int = ctx->Texture.Unit[index].CurrentTex[target]->Name;
2846 if (!_mesa_is_desktop_gl(ctx) || ctx->Version < 33)
2848 if (index >= _mesa_max_tex_unit(ctx))
2851 samp = ctx->Texture.Unit[index].Sampler;
2857 if (!_mesa_has_compute_shaders(ctx))
2861 v->value_uint = ctx->Const.MaxComputeWorkGroupCount[index];
2865 if (!_mesa_has_compute_shaders(ctx))
2869 v->value_int = ctx->Const.MaxComputeWorkGroupSize[index];
2874 if (!ctx->Extensions.ARB_compute_variable_group_size)
2878 v->value_int = ctx->Const.MaxComputeVariableGroupSize[index];
2888 _mesa_get_driver_uuid(ctx, v->value_int_4);
2893 _mesa_get_device_uuid(ctx, v->value_int_4);
2899 _mesa_get_device_luid(ctx, v->value_int_2);
2904 v->value_int = ctx->pipe->screen->get_device_node_mask(ctx->pipe->screen);
2917 if (index >= _mesa_max_tex_unit(ctx))
2919 curTexUnitSave = ctx->Texture.CurrentUnit;
2927 if (index >= ctx->Const.MaxTextureCoordUnits)
2929 curTexUnitSave = ctx->Array.ActiveTexture;
2936 if (index >= ARRAY_SIZE(ctx->TextureMatrixStack))
2938 v->value_matrix = ctx->TextureMatrixStack[index].Top;
2941 if (index >= ARRAY_SIZE(ctx->TextureMatrixStack))
2943 v->value_matrix = ctx->TextureMatrixStack[index].Top;
2947 if (!ctx->Extensions.NV_viewport_swizzle)
2949 if (index >= ctx->Const.MaxViewports)
2951 v->value_int = ctx->ViewportArray[index].SwizzleX;
2954 if (!ctx->Extensions.NV_viewport_swizzle)
2956 if (index >= ctx->Const.MaxViewports)
2958 v->value_int = ctx->ViewportArray[index].SwizzleY;
2961 if (!ctx->Extensions.NV_viewport_swizzle)
2963 if (index >= ctx->Const.MaxViewports)
2965 v->value_int = ctx->ViewportArray[index].SwizzleZ;
2968 if (!ctx->Extensions.NV_viewport_swizzle)
2970 if (index >= ctx->Const.MaxViewports)
2972 v->value_int = ctx->ViewportArray[index].SwizzleW;
2977 _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
2981 _mesa_error(ctx, GL_INVALID_VALUE, "%s(pname=%s)", func,
3315 GET_CURRENT_CONTEXT(ctx);
3317 if (!ctx->Extensions.EXT_memory_object) {
3318 _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);