nv50_program.h revision 0bbf1659df3adf51784bcb376e681c05f49b6070
1/* 2 * Copyright 2010 Ben Skeggs 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 19 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 * SOFTWARE. 21 */ 22 23#ifndef __NV50_PROG_H__ 24#define __NV50_PROG_H__ 25 26struct nv50_context; 27 28#include "pipe/p_state.h" 29#include "pipe/p_shader_tokens.h" 30 31#define NV50_CAP_MAX_PROGRAM_TEMPS 64 32 33struct nv50_varying { 34 uint8_t id; /* tgsi index */ 35 uint8_t hw; /* hw index, nv50 wants flat FP inputs last */ 36 37 unsigned mask : 4; 38 unsigned linear : 1; 39 unsigned pad : 3; 40 41 ubyte sn; /* semantic name */ 42 ubyte si; /* semantic index */ 43}; 44 45struct nv50_program { 46 struct pipe_shader_state pipe; 47 48 ubyte type; 49 boolean translated; 50 boolean uses_lmem; 51 52 uint32_t *code; 53 unsigned code_size; 54 unsigned code_base; 55 uint32_t *immd; 56 unsigned immd_size; 57 unsigned parm_size; /* size limit of uniform buffer */ 58 59 ubyte max_gpr; /* REG_ALLOC_TEMP */ 60 ubyte max_out; /* REG_ALLOC_RESULT or FP_RESULT_COUNT */ 61 62 ubyte in_nr; 63 ubyte out_nr; 64 struct nv50_varying in[16]; 65 struct nv50_varying out[16]; 66 67 struct { 68 uint32_t attrs[3]; /* VP_ATTR_EN_0,1 and VP_GP_BUILTIN_ATTR_EN */ 69 ubyte psiz; /* output slot of point size */ 70 ubyte bfc[2]; /* indices into varying for FFC (FP) or BFC (VP) */ 71 ubyte edgeflag; 72 ubyte clpd[2]; /* output slot of clip distance[i]'s 1st component */ 73 ubyte clpd_nr; 74 } vp; 75 76 struct { 77 uint32_t flags[2]; /* 0x19a8, 196c */ 78 uint32_t interp; /* 0x1988 */ 79 uint32_t colors; /* 0x1904 */ 80 } fp; 81 82 struct { 83 ubyte primid; /* primitive id output register */ 84 uint8_t vert_count; 85 uint8_t prim_type; /* point, line strip or tri strip */ 86 } gp; 87 88 void *fixups; /* relocation records */ 89 90 struct nouveau_heap *mem; 91}; 92 93boolean nv50_program_translate(struct nv50_program *, uint16_t chipset); 94boolean nv50_program_upload_code(struct nv50_context *, struct nv50_program *); 95void nv50_program_destroy(struct nv50_context *, struct nv50_program *); 96 97#endif /* __NV50_PROG_H__ */ 98