1633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller/* 2633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * Copyright 2010 Ben Skeggs 3633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * 4633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * Permission is hereby granted, free of charge, to any person obtaining a 5633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * copy of this software and associated documentation files (the "Software"), 6633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * to deal in the Software without restriction, including without limitation 7633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * and/or sell copies of the Software, and to permit persons to whom the 9633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * Software is furnished to do so, subject to the following conditions: 10633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * 11633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * The above copyright notice and this permission notice shall be included in 12633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * all copies or substantial portions of the Software. 13633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * 14633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 19633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller * SOFTWARE. 21633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller */ 22633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller 23633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller#ifndef __NV50_PROG_H__ 24633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller#define __NV50_PROG_H__ 2547b418b8fa5fd242e9021503d6ec329ac3d56fb0Ben Skeggs 260bbf1659df3adf51784bcb376e681c05f49b6070Christoph Bumillerstruct nv50_context; 270bbf1659df3adf51784bcb376e681c05f49b6070Christoph Bumiller 2847b418b8fa5fd242e9021503d6ec329ac3d56fb0Ben Skeggs#include "pipe/p_state.h" 290bbf1659df3adf51784bcb376e681c05f49b6070Christoph Bumiller#include "pipe/p_shader_tokens.h" 3047b418b8fa5fd242e9021503d6ec329ac3d56fb0Ben Skeggs 31633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumillerstruct nv50_varying { 32633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller uint8_t id; /* tgsi index */ 33633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller uint8_t hw; /* hw index, nv50 wants flat FP inputs last */ 346516594c8eec1088ee59e7c3254b2fdced2ff04bChristoph Bumiller 3568cfc8e996fc33ec680c4153e862dcc762e760fcBrian Paul unsigned mask : 4; 3668cfc8e996fc33ec680c4153e862dcc762e760fcBrian Paul unsigned linear : 1; 3768cfc8e996fc33ec680c4153e862dcc762e760fcBrian Paul unsigned pad : 3; 38bbb615382d60aa927913b5d1e834727854419438Christoph Bumiller 39633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller ubyte sn; /* semantic name */ 40633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller ubyte si; /* semantic index */ 416516594c8eec1088ee59e7c3254b2fdced2ff04bChristoph Bumiller}; 426516594c8eec1088ee59e7c3254b2fdced2ff04bChristoph Bumiller 4302fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumillerstruct nv50_stream_output_state 4402fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller{ 4502fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller uint32_t ctrl; 4602fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller uint16_t stride[4]; 4702fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller uint8_t num_attribs[4]; 4802fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller uint8_t map_size; 4902fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller uint8_t map[128]; 5002fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller}; 5102fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller 52f722fd937db2f3cacf1947d538c66528fd16eb89Ben Skeggsstruct nv50_program { 53633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller struct pipe_shader_state pipe; 54633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller 55633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller ubyte type; 56633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller boolean translated; 57633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller 58633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller uint32_t *code; 59633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller unsigned code_size; 60f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller unsigned code_base; 61633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller uint32_t *immd; 62633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller unsigned immd_size; 63633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller unsigned parm_size; /* size limit of uniform buffer */ 641906d2b46b21a8e7496409e0639d8463ad86dcfeMarcin Slusarz uint32_t tls_space; /* required local memory per thread */ 65633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller 66633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller ubyte max_gpr; /* REG_ALLOC_TEMP */ 67633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller ubyte max_out; /* REG_ALLOC_RESULT or FP_RESULT_COUNT */ 68633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller 69633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller ubyte in_nr; 70633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller ubyte out_nr; 71633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller struct nv50_varying in[16]; 72633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller struct nv50_varying out[16]; 73633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller 74633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller struct { 75633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller uint32_t attrs[3]; /* VP_ATTR_EN_0,1 and VP_GP_BUILTIN_ATTR_EN */ 760bbf1659df3adf51784bcb376e681c05f49b6070Christoph Bumiller ubyte psiz; /* output slot of point size */ 770bbf1659df3adf51784bcb376e681c05f49b6070Christoph Bumiller ubyte bfc[2]; /* indices into varying for FFC (FP) or BFC (VP) */ 78633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller ubyte edgeflag; 790bbf1659df3adf51784bcb376e681c05f49b6070Christoph Bumiller ubyte clpd[2]; /* output slot of clip distance[i]'s 1st component */ 80633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller ubyte clpd_nr; 81633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller } vp; 82633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller 83633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller struct { 84633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller uint32_t flags[2]; /* 0x19a8, 196c */ 85633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller uint32_t interp; /* 0x1988 */ 86633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller uint32_t colors; /* 0x1904 */ 87633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller } fp; 88633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller 89633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller struct { 90633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller ubyte primid; /* primitive id output register */ 91633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller uint8_t vert_count; 92633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller uint8_t prim_type; /* point, line strip or tri strip */ 93633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller } gp; 94633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller 950bbf1659df3adf51784bcb376e681c05f49b6070Christoph Bumiller void *fixups; /* relocation records */ 96f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller 976d1cdec3ba151168bfc3aef222fba6265dfb41fbChristoph Bumiller struct nouveau_heap *mem; 9802fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller 9902fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller struct nv50_stream_output_state *so; 100f722fd937db2f3cacf1947d538c66528fd16eb89Ben Skeggs}; 10147b418b8fa5fd242e9021503d6ec329ac3d56fb0Ben Skeggs 1020bbf1659df3adf51784bcb376e681c05f49b6070Christoph Bumillerboolean nv50_program_translate(struct nv50_program *, uint16_t chipset); 1030bbf1659df3adf51784bcb376e681c05f49b6070Christoph Bumillerboolean nv50_program_upload_code(struct nv50_context *, struct nv50_program *); 1040bbf1659df3adf51784bcb376e681c05f49b6070Christoph Bumillervoid nv50_program_destroy(struct nv50_context *, struct nv50_program *); 105633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller 106633f5ac6124b1b57152c09becba92d176e905ae9Christoph Bumiller#endif /* __NV50_PROG_H__ */ 107