1 /****************************************************************************
2 * Copyright (C) 2015 Intel Corporation. All Rights Reserved.
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:
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
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
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 ***************************************************************************/
26 struct swr_vertex_shader
;
27 struct swr_fragment_shader
;
28 struct swr_geometry_shader
;
29 struct swr_jit_fs_key
;
30 struct swr_jit_vs_key
;
31 struct swr_jit_gs_key
;
33 unsigned swr_so_adjust_attrib(unsigned in_attrib
,
34 swr_vertex_shader
*swr_vs
);
37 swr_compile_vs(struct swr_context
*ctx
, swr_jit_vs_key
&key
);
40 swr_compile_fs(struct swr_context
*ctx
, swr_jit_fs_key
&key
);
43 swr_compile_gs(struct swr_context
*ctx
, swr_jit_gs_key
&key
);
45 void swr_generate_fs_key(struct swr_jit_fs_key
&key
,
46 struct swr_context
*ctx
,
47 swr_fragment_shader
*swr_fs
);
49 void swr_generate_vs_key(struct swr_jit_vs_key
&key
,
50 struct swr_context
*ctx
,
51 swr_vertex_shader
*swr_vs
);
53 void swr_generate_fetch_key(struct swr_jit_fetch_key
&key
,
54 struct swr_vertex_element_state
*velems
);
56 void swr_generate_gs_key(struct swr_jit_gs_key
&key
,
57 struct swr_context
*ctx
,
58 swr_geometry_shader
*swr_gs
);
60 struct swr_jit_sampler_key
{
62 unsigned nr_sampler_views
;
63 struct swr_sampler_static_state sampler
[PIPE_MAX_SHADER_SAMPLER_VIEWS
];
66 struct swr_jit_fs_key
: swr_jit_sampler_key
{
68 unsigned light_twoside
;
69 unsigned sprite_coord_enable
;
70 ubyte vs_output_semantic_name
[PIPE_MAX_SHADER_OUTPUTS
];
71 ubyte vs_output_semantic_idx
[PIPE_MAX_SHADER_OUTPUTS
];
72 bool poly_stipple_enable
;
75 struct swr_jit_vs_key
: swr_jit_sampler_key
{
76 unsigned clip_plane_mask
; // from rasterizer state & vs_info
79 struct swr_jit_fetch_key
{
80 FETCH_COMPILE_STATE fsState
;
83 struct swr_jit_gs_key
: swr_jit_sampler_key
{
84 ubyte vs_output_semantic_name
[PIPE_MAX_SHADER_OUTPUTS
];
85 ubyte vs_output_semantic_idx
[PIPE_MAX_SHADER_OUTPUTS
];
90 template <> struct hash
<swr_jit_fs_key
> {
91 std::size_t operator()(const swr_jit_fs_key
&k
) const
93 return util_hash_crc32(&k
, sizeof(k
));
97 template <> struct hash
<swr_jit_vs_key
> {
98 std::size_t operator()(const swr_jit_vs_key
&k
) const
100 return util_hash_crc32(&k
, sizeof(k
));
104 template <> struct hash
<swr_jit_fetch_key
> {
105 std::size_t operator()(const swr_jit_fetch_key
&k
) const
107 return util_hash_crc32(&k
, sizeof(k
));
111 template <> struct hash
<swr_jit_gs_key
> {
112 std::size_t operator()(const swr_jit_gs_key
&k
) const
114 return util_hash_crc32(&k
, sizeof(k
));
119 bool operator==(const swr_jit_fs_key
&lhs
, const swr_jit_fs_key
&rhs
);
120 bool operator==(const swr_jit_vs_key
&lhs
, const swr_jit_vs_key
&rhs
);
121 bool operator==(const swr_jit_fetch_key
&lhs
, const swr_jit_fetch_key
&rhs
);
122 bool operator==(const swr_jit_gs_key
&lhs
, const swr_jit_gs_key
&rhs
);