mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
zink: move ntv shader info to single-use screen member
this is a bit cleaner Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39359>
This commit is contained in:
parent
4a2b4257d4
commit
1895762182
5 changed files with 57 additions and 57 deletions
|
|
@ -54,7 +54,7 @@ struct ntv_context {
|
|||
SpvId GLSL_std_450;
|
||||
|
||||
mesa_shader_stage stage;
|
||||
const struct zink_shader_info *sinfo;
|
||||
const struct ntv_info *sinfo;
|
||||
|
||||
SpvId ubos[PIPE_MAX_CONSTANT_BUFFERS][5]; //8, 16, 32, unused, 64
|
||||
nir_variable *ubo_vars[PIPE_MAX_CONSTANT_BUFFERS];
|
||||
|
|
@ -4779,7 +4779,7 @@ get_spacing(enum gl_tess_spacing spacing)
|
|||
}
|
||||
|
||||
struct spirv_shader *
|
||||
nir_to_spirv(struct nir_shader *s, const struct zink_shader_info *sinfo)
|
||||
nir_to_spirv(struct nir_shader *s, const struct ntv_info *sinfo)
|
||||
{
|
||||
struct spirv_shader *ret = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,13 @@
|
|||
#include "compiler/glsl_types.h"
|
||||
#include "compiler/shader_enums.h"
|
||||
#include "pipe/p_state.h"
|
||||
|
||||
#include "zink_compiler.h"
|
||||
#include "util/hash_table.h"
|
||||
|
||||
#define SPIRV_VERSION(major, minor) (((major) << 16) | ((minor) << 8))
|
||||
#define ZINK_WORKGROUP_SIZE_X 1
|
||||
#define ZINK_WORKGROUP_SIZE_Y 2
|
||||
#define ZINK_WORKGROUP_SIZE_Z 3
|
||||
#define ZINK_VARIABLE_SHARED_MEM 4
|
||||
|
||||
struct spirv_shader {
|
||||
uint32_t *words;
|
||||
|
|
@ -42,11 +45,26 @@ struct spirv_shader {
|
|||
uint32_t tcs_vertices_out_word;
|
||||
};
|
||||
|
||||
struct ntv_info {
|
||||
bool have_vulkan_memory_model;
|
||||
bool have_workgroup_memory_explicit_layout;
|
||||
bool broken_arbitary_type_const;
|
||||
bool has_demote_to_helper;
|
||||
struct {
|
||||
uint8_t flush_denorms:3; // 16, 32, 64
|
||||
uint8_t preserve_denorms:3; // 16, 32, 64
|
||||
bool denorms_32_bit_independence:1;
|
||||
bool denorms_all_independence:1;
|
||||
} float_controls;
|
||||
uint32_t spirv_version;
|
||||
unsigned bindless_set_idx;
|
||||
};
|
||||
|
||||
struct nir_shader;
|
||||
struct pipe_stream_output_info;
|
||||
|
||||
struct spirv_shader *
|
||||
nir_to_spirv(struct nir_shader *s, const struct zink_shader_info *so_info);
|
||||
nir_to_spirv(struct nir_shader *s, const struct ntv_info *sinfo);
|
||||
|
||||
void
|
||||
spirv_shader_delete(struct spirv_shader *s);
|
||||
|
|
|
|||
|
|
@ -1358,6 +1358,35 @@ zink_screen_init_compiler(struct zink_screen *screen)
|
|||
BITFIELD_BIT(MESA_SHADER_TESS_EVAL) |
|
||||
BITFIELD_BIT(MESA_SHADER_FRAGMENT);
|
||||
screen->nir_options.support_indirect_outputs = (uint8_t)BITFIELD_MASK(MESA_SHADER_STAGES);
|
||||
|
||||
screen->ntv_info.have_vulkan_memory_model = screen->info.have_KHR_vulkan_memory_model;
|
||||
screen->ntv_info.have_workgroup_memory_explicit_layout = screen->info.have_KHR_workgroup_memory_explicit_layout;
|
||||
screen->ntv_info.has_demote_to_helper = screen->info.have_EXT_shader_demote_to_helper_invocation;
|
||||
screen->ntv_info.broken_arbitary_type_const = screen->driver_compiler_workarounds.broken_const;
|
||||
screen->ntv_info.spirv_version = screen->spirv_version;
|
||||
if (screen->info.have_KHR_shader_float_controls) {
|
||||
if (screen->info.props12.shaderDenormFlushToZeroFloat16)
|
||||
screen->ntv_info.float_controls.flush_denorms |= 0x1;
|
||||
if (screen->info.props12.shaderDenormFlushToZeroFloat32)
|
||||
screen->ntv_info.float_controls.flush_denorms |= 0x2;
|
||||
if (screen->info.props12.shaderDenormFlushToZeroFloat64)
|
||||
screen->ntv_info.float_controls.flush_denorms |= 0x4;
|
||||
|
||||
if (screen->info.props12.shaderDenormPreserveFloat16)
|
||||
screen->ntv_info.float_controls.preserve_denorms |= 0x1;
|
||||
if (screen->info.props12.shaderDenormPreserveFloat32)
|
||||
screen->ntv_info.float_controls.preserve_denorms |= 0x2;
|
||||
if (screen->info.props12.shaderDenormPreserveFloat64)
|
||||
screen->ntv_info.float_controls.preserve_denorms |= 0x4;
|
||||
|
||||
screen->ntv_info.float_controls.denorms_all_independence =
|
||||
screen->info.props12.denormBehaviorIndependence == VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL;
|
||||
|
||||
screen->ntv_info.float_controls.denorms_32_bit_independence =
|
||||
screen->ntv_info.float_controls.denorms_all_independence ||
|
||||
screen->info.props12.denormBehaviorIndependence == VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY;
|
||||
}
|
||||
screen->ntv_info.bindless_set_idx = screen->desc_set_id[ZINK_DESCRIPTOR_BINDLESS];
|
||||
}
|
||||
|
||||
struct nir_shader *
|
||||
|
|
@ -3846,7 +3875,6 @@ add_derefs(nir_shader *nir)
|
|||
static struct zink_shader_object
|
||||
compile_module(struct zink_screen *screen, struct zink_shader *zs, nir_shader *nir, bool can_shobj, struct zink_program *pg)
|
||||
{
|
||||
struct zink_shader_info *sinfo = &zs->sinfo;
|
||||
prune_io(nir);
|
||||
|
||||
NIR_PASS(_, nir, nir_convert_from_ssa, true, false);
|
||||
|
|
@ -3860,7 +3888,7 @@ compile_module(struct zink_screen *screen, struct zink_shader *zs, nir_shader *n
|
|||
}
|
||||
|
||||
struct zink_shader_object obj = {0};
|
||||
struct spirv_shader *spirv = nir_to_spirv(nir, sinfo);
|
||||
struct spirv_shader *spirv = nir_to_spirv(nir, &screen->ntv_info);
|
||||
if (spirv)
|
||||
obj = zink_shader_spirv_compile(screen, zs, spirv, can_shobj, pg);
|
||||
|
||||
|
|
@ -6113,35 +6141,6 @@ zink_shader_create(struct zink_screen *screen, struct nir_shader *nir)
|
|||
zs->has_edgeflags = nir->info.stage == MESA_SHADER_VERTEX &&
|
||||
nir->info.outputs_written & VARYING_BIT_EDGE;
|
||||
|
||||
zs->sinfo.have_vulkan_memory_model = screen->info.have_KHR_vulkan_memory_model;
|
||||
zs->sinfo.have_workgroup_memory_explicit_layout = screen->info.have_KHR_workgroup_memory_explicit_layout;
|
||||
zs->sinfo.has_demote_to_helper = screen->info.have_EXT_shader_demote_to_helper_invocation;
|
||||
zs->sinfo.broken_arbitary_type_const = screen->driver_compiler_workarounds.broken_const;
|
||||
zs->sinfo.spirv_version = screen->spirv_version;
|
||||
if (screen->info.have_KHR_shader_float_controls) {
|
||||
if (screen->info.props12.shaderDenormFlushToZeroFloat16)
|
||||
zs->sinfo.float_controls.flush_denorms |= 0x1;
|
||||
if (screen->info.props12.shaderDenormFlushToZeroFloat32)
|
||||
zs->sinfo.float_controls.flush_denorms |= 0x2;
|
||||
if (screen->info.props12.shaderDenormFlushToZeroFloat64)
|
||||
zs->sinfo.float_controls.flush_denorms |= 0x4;
|
||||
|
||||
if (screen->info.props12.shaderDenormPreserveFloat16)
|
||||
zs->sinfo.float_controls.preserve_denorms |= 0x1;
|
||||
if (screen->info.props12.shaderDenormPreserveFloat32)
|
||||
zs->sinfo.float_controls.preserve_denorms |= 0x2;
|
||||
if (screen->info.props12.shaderDenormPreserveFloat64)
|
||||
zs->sinfo.float_controls.preserve_denorms |= 0x4;
|
||||
|
||||
zs->sinfo.float_controls.denorms_all_independence =
|
||||
screen->info.props12.denormBehaviorIndependence == VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL;
|
||||
|
||||
zs->sinfo.float_controls.denorms_32_bit_independence =
|
||||
zs->sinfo.float_controls.denorms_all_independence ||
|
||||
screen->info.props12.denormBehaviorIndependence == VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY;
|
||||
}
|
||||
zs->sinfo.bindless_set_idx = screen->desc_set_id[ZINK_DESCRIPTOR_BINDLESS];
|
||||
|
||||
util_queue_fence_init(&zs->precompile.fence);
|
||||
util_dynarray_init(&zs->pipeline_libs, zs);
|
||||
zs->hash = _mesa_hash_pointer(zs);
|
||||
|
|
|
|||
|
|
@ -26,10 +26,7 @@
|
|||
|
||||
#include "zink_types.h"
|
||||
|
||||
#define ZINK_WORKGROUP_SIZE_X 1
|
||||
#define ZINK_WORKGROUP_SIZE_Y 2
|
||||
#define ZINK_WORKGROUP_SIZE_Z 3
|
||||
#define ZINK_VARIABLE_SHARED_MEM 4
|
||||
|
||||
#define ZINK_INLINE_VAL_FLAT_MASK 0
|
||||
#define ZINK_INLINE_VAL_PV_LAST_VERT 2
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@
|
|||
#include "vk_dispatch_table.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
|
||||
#include "nir_to_spirv/nir_to_spirv.h"
|
||||
|
||||
#if HAVE_RENDERDOC_INTEGRATION
|
||||
#include "renderdoc_app.h"
|
||||
#endif
|
||||
|
|
@ -768,22 +770,6 @@ struct zink_framebuffer_clear {
|
|||
|
||||
|
||||
/** compiler types */
|
||||
struct zink_shader_info {
|
||||
bool have_sparse;
|
||||
bool have_vulkan_memory_model;
|
||||
bool have_workgroup_memory_explicit_layout;
|
||||
bool broken_arbitary_type_const;
|
||||
bool has_demote_to_helper;
|
||||
struct {
|
||||
uint8_t flush_denorms:3; // 16, 32, 64
|
||||
uint8_t preserve_denorms:3; // 16, 32, 64
|
||||
bool denorms_32_bit_independence:1;
|
||||
bool denorms_all_independence:1;
|
||||
} float_controls;
|
||||
uint32_t spirv_version;
|
||||
unsigned bindless_set_idx;
|
||||
};
|
||||
|
||||
enum zink_rast_prim {
|
||||
ZINK_PRIM_POINTS,
|
||||
ZINK_PRIM_LINES,
|
||||
|
|
@ -807,7 +793,6 @@ struct zink_shader {
|
|||
/* this is deleted in zink_shader_init */
|
||||
nir_shader *nir;
|
||||
|
||||
struct zink_shader_info sinfo;
|
||||
uint16_t xfb_stride[PIPE_MAX_SO_BUFFERS];
|
||||
|
||||
struct {
|
||||
|
|
@ -1464,6 +1449,7 @@ struct zink_screen {
|
|||
|
||||
struct zink_device_info info;
|
||||
struct nir_shader_compiler_options nir_options;
|
||||
struct ntv_info ntv_info;
|
||||
|
||||
bool optimal_keys;
|
||||
bool have_full_ds3;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue