2020-11-26 17:08:46 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2020 Mike Blumenkrantz
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
|
|
|
* license, and/or sell copies of the Software, and to permit persons to whom
|
|
|
|
* the Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
|
|
|
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
|
|
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
|
|
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/** this file exists for organization and to be included in nir_to_spirv/ without pulling in extra deps */
|
|
|
|
#ifndef ZINK_SHADER_KEYS_H
|
|
|
|
# define ZINK_SHADER_KEYS_H
|
|
|
|
|
2020-08-18 20:05:15 +01:00
|
|
|
struct zink_vs_key {
|
|
|
|
unsigned shader_id;
|
|
|
|
bool clip_halfz;
|
2021-01-23 15:42:48 +00:00
|
|
|
bool last_vertex_stage;
|
2020-08-18 20:05:15 +01:00
|
|
|
};
|
|
|
|
|
2020-11-26 17:08:46 +00:00
|
|
|
struct zink_fs_key {
|
|
|
|
unsigned shader_id;
|
|
|
|
//bool flat_shade;
|
|
|
|
bool samples;
|
|
|
|
};
|
|
|
|
|
2020-07-19 14:12:40 +01:00
|
|
|
struct zink_tcs_key {
|
|
|
|
unsigned shader_id;
|
|
|
|
unsigned vertices_per_patch;
|
|
|
|
uint64_t vs_outputs_written;
|
|
|
|
};
|
|
|
|
|
2020-11-26 17:08:46 +00:00
|
|
|
/* a shader key is used for swapping out shader modules based on pipeline states,
|
|
|
|
* e.g., if sampleCount changes, we must verify that the fs doesn't need a recompile
|
|
|
|
* to account for GL ignoring gl_SampleMask in some cases when VK will not
|
|
|
|
* which allows us to avoid recompiling shaders when the pipeline state changes repeatedly
|
|
|
|
*/
|
|
|
|
struct zink_shader_key {
|
|
|
|
union {
|
2020-08-18 20:05:15 +01:00
|
|
|
/* reuse vs key for now with tes/gs since we only use clip_halfz */
|
|
|
|
struct zink_vs_key vs;
|
2020-11-26 17:08:46 +00:00
|
|
|
struct zink_fs_key fs;
|
2020-07-19 14:12:40 +01:00
|
|
|
struct zink_tcs_key tcs;
|
2020-11-26 17:08:46 +00:00
|
|
|
} key;
|
|
|
|
uint32_t size;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline const struct zink_fs_key *
|
|
|
|
zink_fs_key(const struct zink_shader_key *key)
|
|
|
|
{
|
|
|
|
return &key->key.fs;
|
|
|
|
}
|
|
|
|
|
2020-08-18 20:05:15 +01:00
|
|
|
static inline const struct zink_vs_key *
|
|
|
|
zink_vs_key(const struct zink_shader_key *key)
|
|
|
|
{
|
|
|
|
return &key->key.vs;
|
|
|
|
}
|
|
|
|
|
2020-11-26 17:08:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|