Path: blob/21.2-virgl/src/gallium/drivers/zink/zink_shader_keys.h
4570 views
/*1* Copyright 2020 Mike Blumenkrantz2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* on the rights to use, copy, modify, merge, publish, distribute, sub7* license, and/or sell copies of the Software, and to permit persons to whom8* the Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL17* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,18* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR19* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE20* USE OR OTHER DEALINGS IN THE SOFTWARE.21*/222324/** this file exists for organization and to be included in nir_to_spirv/ without pulling in extra deps */25#ifndef ZINK_SHADER_KEYS_H26# define ZINK_SHADER_KEYS_H2728struct zink_vs_key {29bool clip_halfz;30bool push_drawid;31bool last_vertex_stage;32};3334struct zink_fs_key {35uint8_t coord_replace_bits;36bool coord_replace_yinvert;37bool samples;38bool force_dual_color_blend;39};4041struct zink_tcs_key {42unsigned vertices_per_patch;43uint64_t vs_outputs_written;44};4546struct zink_shader_key_base {47uint32_t inlined_uniform_values[MAX_INLINABLE_UNIFORMS];48};4950/* a shader key is used for swapping out shader modules based on pipeline states,51* e.g., if sampleCount changes, we must verify that the fs doesn't need a recompile52* to account for GL ignoring gl_SampleMask in some cases when VK will not53* which allows us to avoid recompiling shaders when the pipeline state changes repeatedly54*/55struct zink_shader_key {56union {57/* reuse vs key for now with tes/gs since we only use clip_halfz */58struct zink_vs_key vs;59struct zink_fs_key fs;60struct zink_tcs_key tcs;61} key;62struct zink_shader_key_base base;63unsigned inline_uniforms:1;64uint32_t size;65bool is_default_variant;66};6768static inline const struct zink_fs_key *69zink_fs_key(const struct zink_shader_key *key)70{71return &key->key.fs;72}7374static inline const struct zink_vs_key *75zink_vs_key(const struct zink_shader_key *key)76{77return &key->key.vs;78}79808182#endif838485