• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2012-2013 Rob Clark <robclark@freedesktop.org>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  *
23  * Authors:
24  *    Rob Clark <robclark@freedesktop.org>
25  */
26 
27 #ifndef FD2_PROGRAM_H_
28 #define FD2_PROGRAM_H_
29 
30 #include "pipe/p_context.h"
31 
32 #include "freedreno_context.h"
33 
34 #include "disasm.h"
35 #include "ir2.h"
36 
37 struct fd2_shader_stateobj {
38    nir_shader *nir;
39    gl_shader_stage type;
40    bool is_a20x;
41 
42    /* note: using same set of immediates for all variants
43     * it doesn't matter, other than the slightly larger command stream
44     */
45    unsigned first_immediate; /* const reg # of first immediate */
46    unsigned num_immediates;
47    struct {
48       uint32_t val[4];
49       unsigned ncomp;
50    } immediates[64];
51 
52    bool writes_psize;
53    bool need_param;
54    bool has_kill;
55 
56    /* note:
57     * fragment shader only has one variant
58     * first vertex shader variant is always binning shader
59     * we should use a dynamic array but in normal case there is
60     * only 2 variants (and 3 sometimes with GALLIUM_HUD)
61     */
62    struct ir2_shader_variant variant[8];
63 };
64 
65 void fd2_program_emit(struct fd_context *ctx, struct fd_ringbuffer *ring,
66                       struct fd_program_stateobj *prog) assert_dt;
67 
68 void fd2_prog_init(struct pipe_context *pctx);
69 
70 #endif /* FD2_PROGRAM_H_ */
71