1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © 2020 Advanced Micro Devices, Inc. 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci * 11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 13bf215546Sopenharmony_ci * Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21bf215546Sopenharmony_ci * IN THE SOFTWARE. 22bf215546Sopenharmony_ci */ 23bf215546Sopenharmony_ci 24bf215546Sopenharmony_ci#include "main/glthread_marshal.h" 25bf215546Sopenharmony_ci#include "main/dispatch.h" 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ciuint32_t 28bf215546Sopenharmony_ci_mesa_unmarshal_GetIntegerv(struct gl_context *ctx, 29bf215546Sopenharmony_ci const struct marshal_cmd_GetIntegerv *cmd, 30bf215546Sopenharmony_ci const uint64_t *last) 31bf215546Sopenharmony_ci{ 32bf215546Sopenharmony_ci unreachable("never executed"); 33bf215546Sopenharmony_ci return 0; 34bf215546Sopenharmony_ci} 35bf215546Sopenharmony_ci 36bf215546Sopenharmony_civoid GLAPIENTRY 37bf215546Sopenharmony_ci_mesa_marshal_GetIntegerv(GLenum pname, GLint *p) 38bf215546Sopenharmony_ci{ 39bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 40bf215546Sopenharmony_ci 41bf215546Sopenharmony_ci /* TODO: Use get_hash_params.py to return values for items containing: 42bf215546Sopenharmony_ci * - CONST( 43bf215546Sopenharmony_ci * - CONTEXT_[A-Z]*(Const 44bf215546Sopenharmony_ci */ 45bf215546Sopenharmony_ci 46bf215546Sopenharmony_ci switch (pname) { 47bf215546Sopenharmony_ci case GL_ACTIVE_TEXTURE: 48bf215546Sopenharmony_ci *p = GL_TEXTURE0 + ctx->GLThread.ActiveTexture; 49bf215546Sopenharmony_ci return; 50bf215546Sopenharmony_ci case GL_ARRAY_BUFFER_BINDING: 51bf215546Sopenharmony_ci *p = ctx->GLThread.CurrentArrayBufferName; 52bf215546Sopenharmony_ci return; 53bf215546Sopenharmony_ci case GL_ATTRIB_STACK_DEPTH: 54bf215546Sopenharmony_ci *p = ctx->GLThread.AttribStackDepth; 55bf215546Sopenharmony_ci return; 56bf215546Sopenharmony_ci case GL_CLIENT_ACTIVE_TEXTURE: 57bf215546Sopenharmony_ci *p = ctx->GLThread.ClientActiveTexture; 58bf215546Sopenharmony_ci return; 59bf215546Sopenharmony_ci case GL_CLIENT_ATTRIB_STACK_DEPTH: 60bf215546Sopenharmony_ci *p = ctx->GLThread.ClientAttribStackTop; 61bf215546Sopenharmony_ci return; 62bf215546Sopenharmony_ci case GL_CURRENT_PROGRAM: 63bf215546Sopenharmony_ci *p = ctx->GLThread.CurrentProgram; 64bf215546Sopenharmony_ci return; 65bf215546Sopenharmony_ci case GL_DRAW_INDIRECT_BUFFER_BINDING: 66bf215546Sopenharmony_ci *p = ctx->GLThread.CurrentDrawIndirectBufferName; 67bf215546Sopenharmony_ci return; 68bf215546Sopenharmony_ci case GL_DRAW_FRAMEBUFFER_BINDING: /* == GL_FRAMEBUFFER_BINDING */ 69bf215546Sopenharmony_ci *p = ctx->GLThread.CurrentDrawFramebuffer; 70bf215546Sopenharmony_ci return; 71bf215546Sopenharmony_ci case GL_PIXEL_PACK_BUFFER_BINDING: 72bf215546Sopenharmony_ci *p = ctx->GLThread.CurrentPixelPackBufferName; 73bf215546Sopenharmony_ci return; 74bf215546Sopenharmony_ci case GL_PIXEL_UNPACK_BUFFER_BINDING: 75bf215546Sopenharmony_ci *p = ctx->GLThread.CurrentPixelUnpackBufferName; 76bf215546Sopenharmony_ci return; 77bf215546Sopenharmony_ci case GL_QUERY_BUFFER_BINDING: 78bf215546Sopenharmony_ci *p = ctx->GLThread.CurrentQueryBufferName; 79bf215546Sopenharmony_ci return; 80bf215546Sopenharmony_ci 81bf215546Sopenharmony_ci case GL_MATRIX_MODE: 82bf215546Sopenharmony_ci *p = ctx->GLThread.MatrixMode; 83bf215546Sopenharmony_ci return; 84bf215546Sopenharmony_ci case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: 85bf215546Sopenharmony_ci *p = ctx->GLThread.MatrixStackDepth[ctx->GLThread.MatrixIndex] + 1; 86bf215546Sopenharmony_ci return; 87bf215546Sopenharmony_ci case GL_MODELVIEW_STACK_DEPTH: 88bf215546Sopenharmony_ci *p = ctx->GLThread.MatrixStackDepth[M_MODELVIEW] + 1; 89bf215546Sopenharmony_ci return; 90bf215546Sopenharmony_ci case GL_PROJECTION_STACK_DEPTH: 91bf215546Sopenharmony_ci *p = ctx->GLThread.MatrixStackDepth[M_PROJECTION] + 1; 92bf215546Sopenharmony_ci return; 93bf215546Sopenharmony_ci case GL_TEXTURE_STACK_DEPTH: 94bf215546Sopenharmony_ci *p = ctx->GLThread.MatrixStackDepth[M_TEXTURE0 + ctx->GLThread.ActiveTexture] + 1; 95bf215546Sopenharmony_ci return; 96bf215546Sopenharmony_ci 97bf215546Sopenharmony_ci case GL_VERTEX_ARRAY: 98bf215546Sopenharmony_ci *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_POS)) != 0; 99bf215546Sopenharmony_ci return; 100bf215546Sopenharmony_ci case GL_NORMAL_ARRAY: 101bf215546Sopenharmony_ci *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_NORMAL)) != 0; 102bf215546Sopenharmony_ci return; 103bf215546Sopenharmony_ci case GL_COLOR_ARRAY: 104bf215546Sopenharmony_ci *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_COLOR0)) != 0; 105bf215546Sopenharmony_ci return; 106bf215546Sopenharmony_ci case GL_SECONDARY_COLOR_ARRAY: 107bf215546Sopenharmony_ci *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_COLOR1)) != 0; 108bf215546Sopenharmony_ci return; 109bf215546Sopenharmony_ci case GL_FOG_COORD_ARRAY: 110bf215546Sopenharmony_ci *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_FOG)) != 0; 111bf215546Sopenharmony_ci return; 112bf215546Sopenharmony_ci case GL_INDEX_ARRAY: 113bf215546Sopenharmony_ci *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_COLOR_INDEX)) != 0; 114bf215546Sopenharmony_ci return; 115bf215546Sopenharmony_ci case GL_EDGE_FLAG_ARRAY: 116bf215546Sopenharmony_ci *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_EDGEFLAG)) != 0; 117bf215546Sopenharmony_ci return; 118bf215546Sopenharmony_ci case GL_TEXTURE_COORD_ARRAY: 119bf215546Sopenharmony_ci *p = (ctx->GLThread.CurrentVAO->UserEnabled & 120bf215546Sopenharmony_ci (1 << (VERT_ATTRIB_TEX0 + ctx->GLThread.ClientActiveTexture))) != 0; 121bf215546Sopenharmony_ci return; 122bf215546Sopenharmony_ci case GL_POINT_SIZE_ARRAY_OES: 123bf215546Sopenharmony_ci *p = (ctx->GLThread.CurrentVAO->UserEnabled & (1 << VERT_ATTRIB_POINT_SIZE)) != 0; 124bf215546Sopenharmony_ci return; 125bf215546Sopenharmony_ci } 126bf215546Sopenharmony_ci 127bf215546Sopenharmony_ci _mesa_glthread_finish_before(ctx, "GetIntegerv"); 128bf215546Sopenharmony_ci CALL_GetIntegerv(ctx->CurrentServerDispatch, (pname, p)); 129bf215546Sopenharmony_ci} 130bf215546Sopenharmony_ci 131bf215546Sopenharmony_ci/* TODO: Implement glGetBooleanv, glGetFloatv, etc. if needed */ 132