1848b8605Smrg/********************************************************** 2848b8605Smrg * Copyright 2008-2009 VMware, Inc. All rights reserved. 3848b8605Smrg * 4848b8605Smrg * Permission is hereby granted, free of charge, to any person 5848b8605Smrg * obtaining a copy of this software and associated documentation 6848b8605Smrg * files (the "Software"), to deal in the Software without 7848b8605Smrg * restriction, including without limitation the rights to use, copy, 8848b8605Smrg * modify, merge, publish, distribute, sublicense, and/or sell copies 9848b8605Smrg * of the Software, and to permit persons to whom the Software is 10848b8605Smrg * furnished to do so, subject to the following conditions: 11848b8605Smrg * 12848b8605Smrg * The above copyright notice and this permission notice shall be 13848b8605Smrg * included in all copies or substantial portions of the Software. 14848b8605Smrg * 15848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16848b8605Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18848b8605Smrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19848b8605Smrg * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20848b8605Smrg * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21848b8605Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22848b8605Smrg * SOFTWARE. 23848b8605Smrg * 24848b8605Smrg **********************************************************/ 25848b8605Smrg 26848b8605Smrg#ifndef SVGA_TGSI_H 27848b8605Smrg#define SVGA_TGSI_H 28848b8605Smrg 29b8e80941Smrg#include "pipe/p_compiler.h" 30b8e80941Smrg#include "svga3d_reg.h" 31848b8605Smrg 32848b8605Smrg 33b8e80941Smrg#define MAX_VGPU10_ADDR_REGS 2 34848b8605Smrg 35b8e80941Smrgstruct svga_compile_key; 36b8e80941Smrgstruct svga_context; 37848b8605Smrgstruct svga_shader; 38b8e80941Smrgstruct svga_shader_variant; 39848b8605Smrg 40848b8605Smrg 41848b8605Smrg/* TGSI doesn't provide use with VS input semantics (they're actually 42848b8605Smrg * pretty meaningless), so we just generate some plausible ones here. 43848b8605Smrg * This is called both from within the TGSI translator and when 44848b8605Smrg * building vdecls to ensure they match up. 45848b8605Smrg * 46848b8605Smrg * The real use of this information is matching vertex elements to 47848b8605Smrg * fragment shader inputs in the case where vertex shader is disabled. 48848b8605Smrg */ 49b8e80941Smrgstatic inline void svga_generate_vdecl_semantics( unsigned idx, 50848b8605Smrg unsigned *usage, 51848b8605Smrg unsigned *usage_index ) 52848b8605Smrg{ 53848b8605Smrg if (idx == 0) { 54848b8605Smrg *usage = SVGA3D_DECLUSAGE_POSITION; 55848b8605Smrg *usage_index = 0; 56848b8605Smrg } 57848b8605Smrg else { 58848b8605Smrg *usage = SVGA3D_DECLUSAGE_TEXCOORD; 59848b8605Smrg *usage_index = idx - 1; 60848b8605Smrg } 61848b8605Smrg} 62848b8605Smrg 63848b8605Smrg 64848b8605Smrg 65848b8605Smrgstruct svga_shader_variant * 66b8e80941Smrgsvga_tgsi_vgpu9_translate(struct svga_context *svga, 67b8e80941Smrg const struct svga_shader *shader, 68b8e80941Smrg const struct svga_compile_key *key, 69b8e80941Smrg enum pipe_shader_type unit); 70848b8605Smrg 71848b8605Smrgstruct svga_shader_variant * 72b8e80941Smrgsvga_tgsi_vgpu10_translate(struct svga_context *svga, 73b8e80941Smrg const struct svga_shader *shader, 74b8e80941Smrg const struct svga_compile_key *key, 75b8e80941Smrg enum pipe_shader_type unit); 76848b8605Smrg 77b8e80941Smrgboolean svga_shader_verify(const uint32_t *tokens, unsigned nr_tokens); 78848b8605Smrg 79848b8605Smrg#endif 80