17ec681f3Smrg/* 27ec681f3Smrg * Copyright © 2020 Advanced Micro Devices, Inc. 37ec681f3Smrg * 47ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 57ec681f3Smrg * copy of this software and associated documentation files (the "Software"), 67ec681f3Smrg * to deal in the Software without restriction, including without limitation 77ec681f3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 87ec681f3Smrg * and/or sell copies of the Software, and to permit persons to whom the 97ec681f3Smrg * Software is furnished to do so, subject to the following conditions: 107ec681f3Smrg * 117ec681f3Smrg * The above copyright notice and this permission notice (including the next 127ec681f3Smrg * paragraph) shall be included in all copies or substantial portions of the 137ec681f3Smrg * Software. 147ec681f3Smrg * 157ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 167ec681f3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 177ec681f3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 187ec681f3Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 197ec681f3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 207ec681f3Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 217ec681f3Smrg * IN THE SOFTWARE. 227ec681f3Smrg */ 237ec681f3Smrg 247ec681f3Smrg#include "main/glthread_marshal.h" 257ec681f3Smrg#include "main/dispatch.h" 267ec681f3Smrg 277ec681f3Smrguint32_t 287ec681f3Smrg_mesa_unmarshal_GetIntegerv(struct gl_context *ctx, 297ec681f3Smrg const struct marshal_cmd_GetIntegerv *cmd, 307ec681f3Smrg const uint64_t *last) 317ec681f3Smrg{ 327ec681f3Smrg unreachable("never executed"); 337ec681f3Smrg return 0; 347ec681f3Smrg} 357ec681f3Smrg 367ec681f3Smrgvoid GLAPIENTRY 377ec681f3Smrg_mesa_marshal_GetIntegerv(GLenum pname, GLint *p) 387ec681f3Smrg{ 397ec681f3Smrg GET_CURRENT_CONTEXT(ctx); 407ec681f3Smrg 417ec681f3Smrg /* TODO: Use get_hash_params.py to return values for items containing: 427ec681f3Smrg * - CONST( 437ec681f3Smrg * - CONTEXT_[A-Z]*(Const 447ec681f3Smrg */ 457ec681f3Smrg 467ec681f3Smrg if (ctx->API != API_OPENGL_COMPAT) { 477ec681f3Smrg /* glthread only tracks these states for the compatibility profile. */ 487ec681f3Smrg _mesa_glthread_finish_before(ctx, "GetIntegerv"); 497ec681f3Smrg CALL_GetIntegerv(ctx->CurrentServerDispatch, (pname, p)); 507ec681f3Smrg return; 517ec681f3Smrg } 527ec681f3Smrg 537ec681f3Smrg switch (pname) { 547ec681f3Smrg case GL_ACTIVE_TEXTURE: 557ec681f3Smrg *p = GL_TEXTURE0 + ctx->GLThread.ActiveTexture; 567ec681f3Smrg return; 577ec681f3Smrg case GL_ARRAY_BUFFER_BINDING: 587ec681f3Smrg *p = ctx->GLThread.CurrentArrayBufferName; 597ec681f3Smrg return; 607ec681f3Smrg case GL_ATTRIB_STACK_DEPTH: 617ec681f3Smrg *p = ctx->GLThread.AttribStackDepth; 627ec681f3Smrg return; 637ec681f3Smrg case GL_CLIENT_ACTIVE_TEXTURE: 647ec681f3Smrg *p = ctx->GLThread.ClientActiveTexture; 657ec681f3Smrg return; 667ec681f3Smrg case GL_CLIENT_ATTRIB_STACK_DEPTH: 677ec681f3Smrg *p = ctx->GLThread.ClientAttribStackTop; 687ec681f3Smrg return; 697ec681f3Smrg case GL_DRAW_INDIRECT_BUFFER_BINDING: 707ec681f3Smrg *p = ctx->GLThread.CurrentDrawIndirectBufferName; 717ec681f3Smrg return; 727ec681f3Smrg 737ec681f3Smrg case GL_MATRIX_MODE: 747ec681f3Smrg *p = ctx->GLThread.MatrixMode; 757ec681f3Smrg return; 767ec681f3Smrg case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: 777ec681f3Smrg *p = ctx->GLThread.MatrixStackDepth[ctx->GLThread.MatrixIndex] + 1; 787ec681f3Smrg return; 797ec681f3Smrg case GL_MODELVIEW_STACK_DEPTH: 807ec681f3Smrg *p = ctx->GLThread.MatrixStackDepth[M_MODELVIEW] + 1; 817ec681f3Smrg return; 827ec681f3Smrg case GL_PROJECTION_STACK_DEPTH: 837ec681f3Smrg *p = ctx->GLThread.MatrixStackDepth[M_PROJECTION] + 1; 847ec681f3Smrg return; 857ec681f3Smrg case GL_TEXTURE_STACK_DEPTH: 867ec681f3Smrg *p = ctx->GLThread.MatrixStackDepth[M_TEXTURE0 + ctx->GLThread.ActiveTexture] + 1; 877ec681f3Smrg return; 887ec681f3Smrg 897ec681f3Smrg case GL_VERTEX_ARRAY: 907ec681f3Smrg *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_POS)) != 0; 917ec681f3Smrg return; 927ec681f3Smrg case GL_NORMAL_ARRAY: 937ec681f3Smrg *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_NORMAL)) != 0; 947ec681f3Smrg return; 957ec681f3Smrg case GL_COLOR_ARRAY: 967ec681f3Smrg *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_COLOR0)) != 0; 977ec681f3Smrg return; 987ec681f3Smrg case GL_SECONDARY_COLOR_ARRAY: 997ec681f3Smrg *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_COLOR1)) != 0; 1007ec681f3Smrg return; 1017ec681f3Smrg case GL_FOG_COORD_ARRAY: 1027ec681f3Smrg *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_FOG)) != 0; 1037ec681f3Smrg return; 1047ec681f3Smrg case GL_INDEX_ARRAY: 1057ec681f3Smrg *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_COLOR_INDEX)) != 0; 1067ec681f3Smrg return; 1077ec681f3Smrg case GL_EDGE_FLAG_ARRAY: 1087ec681f3Smrg *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_EDGEFLAG)) != 0; 1097ec681f3Smrg return; 1107ec681f3Smrg case GL_TEXTURE_COORD_ARRAY: 1117ec681f3Smrg *p = (ctx->GLThread.CurrentVAO->UserEnabled & 1127ec681f3Smrg (1 << (VERT_ATTRIB_TEX0 + ctx->GLThread.ClientActiveTexture))) != 0; 1137ec681f3Smrg return; 1147ec681f3Smrg case GL_POINT_SIZE_ARRAY_OES: 1157ec681f3Smrg *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_POINT_SIZE)) != 0; 1167ec681f3Smrg return; 1177ec681f3Smrg } 1187ec681f3Smrg 1197ec681f3Smrg _mesa_glthread_finish_before(ctx, "GetIntegerv"); 1207ec681f3Smrg CALL_GetIntegerv(ctx->CurrentServerDispatch, (pname, p)); 1217ec681f3Smrg} 1227ec681f3Smrg 1237ec681f3Smrg/* TODO: Implement glGetBooleanv, glGetFloatv, etc. if needed */ 124