blob: 2581135701fd9433c37911863377a1e5b0e75c2d [file] [log] [blame]
Jakob Bornecrantz31926332009-11-16 19:56:18 +01001/**********************************************************
2 * Copyright 2008-2009 VMware, Inc. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 *
24 **********************************************************/
25
26#ifndef SVGA_TGSI_H
27#define SVGA_TGSI_H
28
Brian Paule0542512015-08-13 11:00:58 -070029#include "pipe/p_compiler.h"
30#include "svga3d_reg.h"
Jakob Bornecrantz31926332009-11-16 19:56:18 +010031
Brian Paul58ea42b2011-11-03 17:40:56 -060032
Brian Paule0542512015-08-13 11:00:58 -070033#define MAX_VGPU10_ADDR_REGS 2
Brian Paul58ea42b2011-11-03 17:40:56 -060034
Brian Paule0542512015-08-13 11:00:58 -070035struct svga_compile_key;
36struct svga_context;
Jakob Bornecrantz31926332009-11-16 19:56:18 +010037struct svga_shader;
Brian Paule0542512015-08-13 11:00:58 -070038struct svga_shader_variant;
Jakob Bornecrantz31926332009-11-16 19:56:18 +010039
40
41/* TGSI doesn't provide use with VS input semantics (they're actually
42 * pretty meaningless), so we just generate some plausible ones here.
43 * This is called both from within the TGSI translator and when
44 * building vdecls to ensure they match up.
45 *
46 * The real use of this information is matching vertex elements to
47 * fragment shader inputs in the case where vertex shader is disabled.
48 */
Ilia Mirkina2a1a582015-07-20 19:58:43 -040049static inline void svga_generate_vdecl_semantics( unsigned idx,
Jakob Bornecrantz31926332009-11-16 19:56:18 +010050 unsigned *usage,
51 unsigned *usage_index )
52{
53 if (idx == 0) {
54 *usage = SVGA3D_DECLUSAGE_POSITION;
55 *usage_index = 0;
56 }
57 else {
58 *usage = SVGA3D_DECLUSAGE_TEXCOORD;
59 *usage_index = idx - 1;
60 }
61}
62
63
64
Brian Paule0542512015-08-13 11:00:58 -070065struct svga_shader_variant *
Brian Paul8d0d5dc2015-10-08 21:03:27 -060066svga_tgsi_vgpu9_translate(struct svga_context *svga,
67 const struct svga_shader *shader,
Brian Paule0542512015-08-13 11:00:58 -070068 const struct svga_compile_key *key, unsigned unit);
Jakob Bornecrantz31926332009-11-16 19:56:18 +010069
Brian Paul2a303792014-01-18 03:45:41 -080070struct svga_shader_variant *
Brian Paule0542512015-08-13 11:00:58 -070071svga_tgsi_vgpu10_translate(struct svga_context *svga,
72 const struct svga_shader *shader,
73 const struct svga_compile_key *key,
74 unsigned unit);
Jakob Bornecrantz31926332009-11-16 19:56:18 +010075
Brian Paule0542512015-08-13 11:00:58 -070076boolean svga_shader_verify(const uint32_t *tokens, unsigned nr_tokens);
Brian Paul58ea42b2011-11-03 17:40:56 -060077
Jakob Bornecrantz31926332009-11-16 19:56:18 +010078#endif