Jakob Bornecrantz | 3192633 | 2009-11-16 19:56:18 +0100 | [diff] [blame] | 1 | /********************************************************** |
| 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 Paul | e054251 | 2015-08-13 11:00:58 -0700 | [diff] [blame] | 29 | #include "pipe/p_compiler.h" |
| 30 | #include "svga3d_reg.h" |
Jakob Bornecrantz | 3192633 | 2009-11-16 19:56:18 +0100 | [diff] [blame] | 31 | |
Brian Paul | 58ea42b | 2011-11-03 17:40:56 -0600 | [diff] [blame] | 32 | |
Brian Paul | e054251 | 2015-08-13 11:00:58 -0700 | [diff] [blame] | 33 | #define MAX_VGPU10_ADDR_REGS 2 |
Brian Paul | 58ea42b | 2011-11-03 17:40:56 -0600 | [diff] [blame] | 34 | |
Brian Paul | e054251 | 2015-08-13 11:00:58 -0700 | [diff] [blame] | 35 | struct svga_compile_key; |
| 36 | struct svga_context; |
Jakob Bornecrantz | 3192633 | 2009-11-16 19:56:18 +0100 | [diff] [blame] | 37 | struct svga_shader; |
Brian Paul | e054251 | 2015-08-13 11:00:58 -0700 | [diff] [blame] | 38 | struct svga_shader_variant; |
Jakob Bornecrantz | 3192633 | 2009-11-16 19:56:18 +0100 | [diff] [blame] | 39 | |
| 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 Mirkin | a2a1a58 | 2015-07-20 19:58:43 -0400 | [diff] [blame] | 49 | static inline void svga_generate_vdecl_semantics( unsigned idx, |
Jakob Bornecrantz | 3192633 | 2009-11-16 19:56:18 +0100 | [diff] [blame] | 50 | 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 Paul | e054251 | 2015-08-13 11:00:58 -0700 | [diff] [blame] | 65 | struct svga_shader_variant * |
Brian Paul | 8d0d5dc | 2015-10-08 21:03:27 -0600 | [diff] [blame] | 66 | svga_tgsi_vgpu9_translate(struct svga_context *svga, |
| 67 | const struct svga_shader *shader, |
Brian Paul | e054251 | 2015-08-13 11:00:58 -0700 | [diff] [blame] | 68 | const struct svga_compile_key *key, unsigned unit); |
Jakob Bornecrantz | 3192633 | 2009-11-16 19:56:18 +0100 | [diff] [blame] | 69 | |
Brian Paul | 2a30379 | 2014-01-18 03:45:41 -0800 | [diff] [blame] | 70 | struct svga_shader_variant * |
Brian Paul | e054251 | 2015-08-13 11:00:58 -0700 | [diff] [blame] | 71 | svga_tgsi_vgpu10_translate(struct svga_context *svga, |
| 72 | const struct svga_shader *shader, |
| 73 | const struct svga_compile_key *key, |
| 74 | unsigned unit); |
Jakob Bornecrantz | 3192633 | 2009-11-16 19:56:18 +0100 | [diff] [blame] | 75 | |
Brian Paul | e054251 | 2015-08-13 11:00:58 -0700 | [diff] [blame] | 76 | boolean svga_shader_verify(const uint32_t *tokens, unsigned nr_tokens); |
Brian Paul | 58ea42b | 2011-11-03 17:40:56 -0600 | [diff] [blame] | 77 | |
Jakob Bornecrantz | 3192633 | 2009-11-16 19:56:18 +0100 | [diff] [blame] | 78 | #endif |