1 /**************************************************************************** 2 * Copyright (C) 2015 Intel Corporation. All Rights Reserved. 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 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 ***************************************************************************/ 23 24 #pragma once 25 26 struct swr_vertex_shader; 27 struct swr_fragment_shader; 28 struct swr_jit_fs_key; 29 struct swr_jit_vs_key; 30 31 PFN_VERTEX_FUNC 32 swr_compile_vs(struct swr_context *ctx, swr_jit_vs_key &key); 33 34 PFN_PIXEL_KERNEL 35 swr_compile_fs(struct swr_context *ctx, swr_jit_fs_key &key); 36 37 void swr_generate_fs_key(struct swr_jit_fs_key &key, 38 struct swr_context *ctx, 39 swr_fragment_shader *swr_fs); 40 41 void swr_generate_vs_key(struct swr_jit_vs_key &key, 42 struct swr_context *ctx, 43 swr_vertex_shader *swr_vs); 44 45 struct swr_jit_sampler_key { 46 unsigned nr_samplers; 47 unsigned nr_sampler_views; 48 struct swr_sampler_static_state sampler[PIPE_MAX_SHADER_SAMPLER_VIEWS]; 49 }; 50 51 struct swr_jit_fs_key : swr_jit_sampler_key { 52 unsigned nr_cbufs; 53 unsigned light_twoside; 54 unsigned sprite_coord_enable; 55 ubyte vs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; 56 ubyte vs_output_semantic_idx[PIPE_MAX_SHADER_OUTPUTS]; 57 }; 58 59 struct swr_jit_vs_key : swr_jit_sampler_key { 60 unsigned clip_plane_mask; // from rasterizer state & vs_info 61 }; 62 63 namespace std 64 { 65 template <> struct hash<swr_jit_fs_key> { 66 std::size_t operator()(const swr_jit_fs_key &k) const 67 { 68 return util_hash_crc32(&k, sizeof(k)); 69 } 70 }; 71 72 template <> struct hash<swr_jit_vs_key> { 73 std::size_t operator()(const swr_jit_vs_key &k) const 74 { 75 return util_hash_crc32(&k, sizeof(k)); 76 } 77 }; 78 }; 79 80 bool operator==(const swr_jit_fs_key &lhs, const swr_jit_fs_key &rhs); 81 bool operator==(const swr_jit_vs_key &lhs, const swr_jit_vs_key &rhs); 82