• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2009 Corbin Simpson <MostAwesomeDude@gmail.com>
3  * Copyright 2009 Marek Olšák <maraeo@gmail.com>
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * on the rights to use, copy, modify, merge, publish, distribute, sub
9  * license, and/or sell copies of the Software, and to permit persons to whom
10  * the Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
23 
24 #ifndef R300_VS_H
25 #define R300_VS_H
26 
27 #include "pipe/p_state.h"
28 #include "tgsi/tgsi_scan.h"
29 #include "compiler/radeon_code.h"
30 
31 #include "r300_context.h"
32 #include "r300_shader_semantics.h"
33 
34 struct r300_context;
35 
36 struct r300_vertex_shader_code {
37     /* Parent class */
38 
39     struct tgsi_shader_info info;
40     struct r300_shader_semantics outputs;
41 
42     /* Whether the shader was replaced by a dummy one due to a shader
43      * compilation failure. */
44     boolean dummy;
45 
46     boolean wpos;
47 
48     /* Numbers of constants for each type. */
49     unsigned externals_count;
50     unsigned immediates_count;
51 
52     /* HWTCL-specific.  */
53     /* Machine code (if translated) */
54     struct r300_vertex_program_code code;
55 
56     struct r300_vertex_shader_code *next;
57 };
58 
59 struct r300_vertex_shader {
60     /* Parent class */
61     struct pipe_shader_state state;
62 
63     /* Currently-bound vertex shader. */
64     struct r300_vertex_shader_code *shader;
65 
66     /* List of the same shaders compiled with different states. */
67     struct r300_vertex_shader_code *first;
68 
69     /* SWTCL-specific. */
70     void *draw_vs;
71 };
72 
73 struct nir_shader;
74 
75 void r300_init_vs_outputs(struct r300_context *r300,
76                           struct r300_vertex_shader *vs);
77 
78 void r300_translate_vertex_shader(struct r300_context *r300,
79                                   struct r300_vertex_shader *vs);
80 
81 void r300_draw_init_vertex_shader(struct r300_context *r300,
82                                   struct r300_vertex_shader *vs);
83 
84 extern bool r300_transform_vs_trig_input(struct nir_shader *shader);
85 
86 extern bool r300_transform_fs_trig_input(struct nir_shader *shader);
87 
88 #endif /* R300_VS_H */
89