Path: blob/21.2-virgl/src/glx/indirect_transpose_matrix.c
4558 views
/*1* (C) Copyright IBM Corporation 20042* All Rights Reserved.3*4* Permission is hereby granted, free of charge, to any person obtaining a5* copy of this software and associated documentation files (the "Software"),6* to deal in the Software without restriction, including without limitation7* on the rights to use, copy, modify, merge, publish, distribute, sub8* license, and/or sell copies of the Software, and to permit persons to whom9* the Software is furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice (including the next12* paragraph) shall be included in all copies or substantial portions of the13* Software.14*15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL18* THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,19* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR20* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE21* USE OR OTHER DEALINGS IN THE SOFTWARE.22*/2324#include <GL/gl.h>25#include "indirect.h"2627static void28TransposeMatrixf(const GLfloat s[16], GLfloat d[16])29{30int i, j;31for (i = 0; i < 4; i++) {32for (j = 0; j < 4; j++) {33d[i * 4 + j] = s[j * 4 + i];34}35}36}3738static void39TransposeMatrixd(const GLdouble s[16], GLdouble d[16])40{41int i, j;42for (i = 0; i < 4; i++) {43for (j = 0; j < 4; j++) {44d[i * 4 + j] = s[j * 4 + i];45}46}47}484950void51__indirect_glLoadTransposeMatrixd(const GLdouble * m)52{53GLdouble mt[16];5455TransposeMatrixd(m, mt);56__indirect_glLoadMatrixd(mt);57}5859void60__indirect_glLoadTransposeMatrixf(const GLfloat * m)61{62GLfloat mt[16];6364TransposeMatrixf(m, mt);65__indirect_glLoadMatrixf(mt);66}6768void69__indirect_glMultTransposeMatrixd(const GLdouble * m)70{71GLdouble mt[16];7273TransposeMatrixd(m, mt);74__indirect_glMultMatrixd(mt);75}7677void78__indirect_glMultTransposeMatrixf(const GLfloat * m)79{80GLfloat mt[16];8182TransposeMatrixf(m, mt);83__indirect_glMultMatrixf(mt);84}858687