1848b8605Smrg/* 2848b8605Smrg * Mesa 3-D graphics library 3848b8605Smrg * 4848b8605Smrg * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the "Software"), 8848b8605Smrg * to deal in the Software without restriction, including without limitation 9848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the 11848b8605Smrg * Software is furnished to do so, subject to the following conditions: 12848b8605Smrg * 13848b8605Smrg * The above copyright notice and this permission notice shall be included 14848b8605Smrg * in all copies or substantial portions of the Software. 15848b8605Smrg * 16848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE. 23848b8605Smrg */ 24848b8605Smrg 25848b8605Smrg#ifndef PROG_EXECUTE_H 26848b8605Smrg#define PROG_EXECUTE_H 27848b8605Smrg 28848b8605Smrg#include "main/config.h" 29b8e80941Smrg#include "main/glheader.h" 30b8e80941Smrg#include "compiler/shader_enums.h" 31848b8605Smrg 32b8e80941Smrgstruct gl_context; 33848b8605Smrg 34848b8605Smrgtypedef void (*FetchTexelLodFunc)(struct gl_context *ctx, const GLfloat texcoord[4], 35848b8605Smrg GLfloat lambda, GLuint unit, GLfloat color[4]); 36848b8605Smrg 37848b8605Smrgtypedef void (*FetchTexelDerivFunc)(struct gl_context *ctx, const GLfloat texcoord[4], 38848b8605Smrg const GLfloat texdx[4], 39848b8605Smrg const GLfloat texdy[4], 40848b8605Smrg GLfloat lodBias, 41848b8605Smrg GLuint unit, GLfloat color[4]); 42848b8605Smrg 43848b8605Smrg 44848b8605Smrg/** NOTE: This must match SWRAST_MAX_WIDTH */ 45848b8605Smrg#define PROG_MAX_WIDTH 16384 46848b8605Smrg 47848b8605Smrg 48848b8605Smrg/** 49848b8605Smrg * Virtual machine state used during execution of vertex/fragment programs. 50848b8605Smrg */ 51848b8605Smrgstruct gl_program_machine 52848b8605Smrg{ 53848b8605Smrg const struct gl_program *CurProgram; 54848b8605Smrg 55848b8605Smrg /** Fragment Input attributes */ 56848b8605Smrg GLfloat (*Attribs)[PROG_MAX_WIDTH][4]; 57848b8605Smrg GLfloat (*DerivX)[4]; 58848b8605Smrg GLfloat (*DerivY)[4]; 59848b8605Smrg GLuint NumDeriv; /**< Max index into DerivX/Y arrays */ 60848b8605Smrg GLuint CurElement; /**< Index into Attribs arrays */ 61848b8605Smrg 62848b8605Smrg /** Vertex Input attribs */ 63848b8605Smrg GLfloat VertAttribs[VERT_ATTRIB_MAX][4]; 64848b8605Smrg 65848b8605Smrg GLfloat Temporaries[MAX_PROGRAM_TEMPS][4]; 66848b8605Smrg GLfloat Outputs[MAX_PROGRAM_OUTPUTS][4]; 67848b8605Smrg GLfloat (*EnvParams)[4]; /**< Vertex or Fragment env parameters */ 68848b8605Smrg GLint AddressReg[MAX_PROGRAM_ADDRESS_REGS][4]; 69848b8605Smrg GLfloat SystemValues[SYSTEM_VALUE_MAX][4]; 70848b8605Smrg 71848b8605Smrg const GLubyte *Samplers; /** Array mapping sampler var to tex unit */ 72848b8605Smrg 73848b8605Smrg GLuint CallStack[MAX_PROGRAM_CALL_DEPTH]; /**< For CAL/RET instructions */ 74848b8605Smrg GLuint StackDepth; /**< Index/ptr to top of CallStack[] */ 75848b8605Smrg 76848b8605Smrg /** Texture fetch functions */ 77848b8605Smrg FetchTexelLodFunc FetchTexelLod; 78848b8605Smrg FetchTexelDerivFunc FetchTexelDeriv; 79848b8605Smrg}; 80848b8605Smrg 81848b8605Smrg 82848b8605Smrgextern GLboolean 83848b8605Smrg_mesa_execute_program(struct gl_context *ctx, 84848b8605Smrg const struct gl_program *program, 85848b8605Smrg struct gl_program_machine *machine); 86848b8605Smrg 87848b8605Smrg 88848b8605Smrg#endif /* PROG_EXECUTE_H */ 89