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