Path: blob/21.2-virgl/src/gallium/drivers/nouveau/nv50/nv50_program.h
4574 views
/*1* Copyright 2010 Ben Skeggs2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice shall be included in11* all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR17* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR19* OTHER DEALINGS IN THE SOFTWARE.20*/2122#ifndef __NV50_PROG_H__23#define __NV50_PROG_H__2425struct nv50_context;2627#include "pipe/p_state.h"2829struct nv50_varying {30uint8_t id; /* tgsi index */31uint8_t hw; /* hw index, nv50 wants flat FP inputs last */3233unsigned mask : 4;34unsigned linear : 1;35unsigned pad : 3;3637ubyte sn; /* semantic name */38ubyte si; /* semantic index */39};4041struct nv50_stream_output_state42{43uint32_t ctrl;44uint16_t stride[4];45uint8_t num_attribs[4];46uint8_t map_size;47uint8_t map[128];48};4950struct nv50_gmem_state {51unsigned valid : 1; /* whether there's something there */52unsigned image : 1; /* buffer or image */53unsigned slot : 6; /* slot in the relevant resource arrays */54};5556struct nv50_program {57struct pipe_shader_state pipe;5859ubyte type;60bool translated;6162uint32_t *code;63unsigned code_size;64unsigned code_base;65uint32_t *immd;66unsigned parm_size; /* size limit of uniform buffer */67uint32_t tls_space; /* required local memory per thread */6869ubyte max_gpr; /* REG_ALLOC_TEMP */70ubyte max_out; /* REG_ALLOC_RESULT or FP_RESULT_COUNT */7172ubyte in_nr;73ubyte out_nr;74struct nv50_varying in[16];75struct nv50_varying out[16];7677struct {78uint32_t attrs[3]; /* VP_ATTR_EN_0,1 and VP_GP_BUILTIN_ATTR_EN */79ubyte psiz; /* output slot of point size */80ubyte bfc[2]; /* indices into varying for FFC (FP) or BFC (VP) */81ubyte edgeflag;82ubyte clpd[2]; /* output slot of clip distance[i]'s 1st component */83ubyte clpd_nr;84bool need_vertex_id;85uint32_t clip_mode;86uint8_t clip_enable; /* mask of defined clip planes */87uint8_t cull_enable; /* mask of defined cull distances */88} vp;8990struct {91uint32_t flags[2]; /* 0x19a8, 196c */92uint32_t interp; /* 0x1988 */93uint32_t colors; /* 0x1904 */94uint8_t has_samplemask;95uint8_t force_persample_interp;96uint8_t alphatest;97} fp;9899struct {100uint32_t vert_count;101uint8_t prim_type; /* point, line strip or tri strip */102uint8_t has_layer;103ubyte layerid; /* hw value of layer output */104uint8_t has_viewport;105ubyte viewportid; /* hw value of viewport index output */106} gp;107108struct {109uint32_t lmem_size; /* local memory (TGSI PRIVATE resource) size */110uint32_t smem_size; /* shared memory (TGSI LOCAL resource) size */111struct nv50_gmem_state gmem[NV50_MAX_GLOBALS];112} cp;113114bool mul_zero_wins;115116void *fixups; /* relocation records */117void *interps; /* interpolation records */118119struct nouveau_heap *mem;120121struct nv50_stream_output_state *so;122};123124bool nv50_program_translate(struct nv50_program *, uint16_t chipset,125struct pipe_debug_callback *);126bool nv50_program_upload_code(struct nv50_context *, struct nv50_program *);127void nv50_program_destroy(struct nv50_context *, struct nv50_program *);128129#endif /* __NV50_PROG_H__ */130131132