zink: rename zink_so_info -> zink_shader_info
start passing more useful info to ntv Acked-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14381>
This commit is contained in:
parent
73ef54e342
commit
0af2b7740b
|
@ -50,7 +50,7 @@ struct ntv_context {
|
|||
SpvId GLSL_std_450;
|
||||
|
||||
gl_shader_stage stage;
|
||||
const struct zink_so_info *so_info;
|
||||
const struct zink_shader_info *sinfo;
|
||||
|
||||
SpvId ubos[PIPE_MAX_CONSTANT_BUFFERS][5]; //8, 16, 32, unused, 64
|
||||
nir_variable *ubo_vars[PIPE_MAX_CONSTANT_BUFFERS];
|
||||
|
@ -1292,7 +1292,7 @@ get_output_type(struct ntv_context *ctx, unsigned register_index, unsigned num_c
|
|||
/* for streamout create new outputs, as streamout can be done on individual components,
|
||||
from complete outputs, so we just can't use the created packed outputs */
|
||||
static void
|
||||
emit_so_info(struct ntv_context *ctx, const struct zink_so_info *so_info,
|
||||
emit_so_info(struct ntv_context *ctx, const struct zink_shader_info *so_info,
|
||||
unsigned first_so)
|
||||
{
|
||||
unsigned output = 0;
|
||||
|
@ -1341,7 +1341,7 @@ emit_so_info(struct ntv_context *ctx, const struct zink_so_info *so_info,
|
|||
|
||||
static void
|
||||
emit_so_outputs(struct ntv_context *ctx,
|
||||
const struct zink_so_info *so_info)
|
||||
const struct zink_shader_info *so_info)
|
||||
{
|
||||
for (unsigned i = 0; i < so_info->so_info.num_outputs; i++) {
|
||||
uint32_t components[NIR_MAX_VEC_COMPONENTS];
|
||||
|
@ -2635,8 +2635,8 @@ emit_intrinsic(struct ntv_context *ctx, nir_intrinsic_instr *intr)
|
|||
/* geometry shader emits copied xfb outputs just prior to EmitVertex(),
|
||||
* since that's the end of the shader
|
||||
*/
|
||||
if (ctx->so_info)
|
||||
emit_so_outputs(ctx, ctx->so_info);
|
||||
if (ctx->sinfo)
|
||||
emit_so_outputs(ctx, ctx->sinfo);
|
||||
spirv_builder_emit_vertex(&ctx->builder, nir_intrinsic_stream_id(intr));
|
||||
break;
|
||||
|
||||
|
@ -3609,7 +3609,7 @@ get_spacing(enum gl_tess_spacing spacing)
|
|||
}
|
||||
|
||||
struct spirv_shader *
|
||||
nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info, uint32_t spirv_version)
|
||||
nir_to_spirv(struct nir_shader *s, const struct zink_shader_info *sinfo, uint32_t spirv_version)
|
||||
{
|
||||
struct spirv_shader *ret = NULL;
|
||||
|
||||
|
@ -3700,7 +3700,7 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info, uint32_t
|
|||
}
|
||||
|
||||
ctx.stage = s->info.stage;
|
||||
ctx.so_info = so_info;
|
||||
ctx.sinfo = sinfo;
|
||||
ctx.GLSL_std_450 = spirv_builder_import(&ctx.builder, "GLSL.std.450");
|
||||
ctx.explicit_lod = true;
|
||||
spirv_builder_emit_source(&ctx.builder, SpvSourceLanguageUnknown, 0);
|
||||
|
@ -3781,8 +3781,8 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info, uint32_t
|
|||
}
|
||||
|
||||
|
||||
if (so_info)
|
||||
emit_so_info(&ctx, so_info, max_output + 1);
|
||||
if (sinfo)
|
||||
emit_so_info(&ctx, sinfo, max_output + 1);
|
||||
|
||||
/* we have to reverse iterate to match what's done in zink_compiler.c */
|
||||
foreach_list_typed_reverse(nir_variable, var, node, &s->variables)
|
||||
|
@ -3941,8 +3941,8 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info, uint32_t
|
|||
emit_cf_list(&ctx, &entry->body);
|
||||
|
||||
/* vertex/tess shader emits copied xfb outputs at the end of the shader */
|
||||
if (so_info && (ctx.stage == MESA_SHADER_VERTEX || ctx.stage == MESA_SHADER_TESS_EVAL))
|
||||
emit_so_outputs(&ctx, so_info);
|
||||
if (sinfo && (ctx.stage == MESA_SHADER_VERTEX || ctx.stage == MESA_SHADER_TESS_EVAL))
|
||||
emit_so_outputs(&ctx, sinfo);
|
||||
|
||||
spirv_builder_return(&ctx.builder); // doesn't belong here, but whatevz
|
||||
spirv_builder_function_end(&ctx.builder);
|
||||
|
|
|
@ -45,7 +45,7 @@ struct nir_shader;
|
|||
struct pipe_stream_output_info;
|
||||
|
||||
struct spirv_shader *
|
||||
nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info,
|
||||
nir_to_spirv(struct nir_shader *s, const struct zink_shader_info *so_info,
|
||||
uint32_t spirv_version);
|
||||
|
||||
void
|
||||
|
|
|
@ -591,7 +591,7 @@ update_so_info(struct zink_shader *zs, const struct pipe_stream_output_info *so_
|
|||
const struct pipe_stream_output *output = &so_info->output[i];
|
||||
unsigned slot = reverse_map[output->register_index];
|
||||
/* always set stride to be used during draw */
|
||||
zs->streamout.so_info.stride[output->output_buffer] = so_info->stride[output->output_buffer];
|
||||
zs->sinfo.so_info.stride[output->output_buffer] = so_info->stride[output->output_buffer];
|
||||
if (zs->nir->info.stage != MESA_SHADER_GEOMETRY || util_bitcount(zs->nir->info.gs.active_stream_mask) == 1) {
|
||||
nir_variable *var = NULL;
|
||||
while (!var)
|
||||
|
@ -662,11 +662,11 @@ update_so_info(struct zink_shader *zs, const struct pipe_stream_output_info *so_
|
|||
}
|
||||
}
|
||||
}
|
||||
zs->streamout.so_info.output[zs->streamout.so_info.num_outputs] = *output;
|
||||
zs->sinfo.so_info.output[zs->sinfo.so_info.num_outputs] = *output;
|
||||
/* Map Gallium's condensed "slots" back to real VARYING_SLOT_* enums */
|
||||
zs->streamout.so_info_slots[zs->streamout.so_info.num_outputs++] = reverse_map[output->register_index];
|
||||
zs->sinfo.so_info_slots[zs->sinfo.so_info.num_outputs++] = reverse_map[output->register_index];
|
||||
}
|
||||
zs->streamout.have_xfb = !!zs->streamout.so_info.num_outputs;
|
||||
zs->sinfo.have_xfb = !!zs->sinfo.so_info.num_outputs;
|
||||
}
|
||||
|
||||
struct decompose_state {
|
||||
|
@ -1086,7 +1086,7 @@ VkShaderModule
|
|||
zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, nir_shader *base_nir, const struct zink_shader_key *key)
|
||||
{
|
||||
VkShaderModule mod = VK_NULL_HANDLE;
|
||||
void *streamout = NULL;
|
||||
void *sinfo = NULL;
|
||||
nir_shader *nir = nir_shader_clone(NULL, base_nir);
|
||||
bool need_optimize = false;
|
||||
bool inlined_uniforms = false;
|
||||
|
@ -1128,8 +1128,8 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, nir_shad
|
|||
case MESA_SHADER_TESS_EVAL:
|
||||
case MESA_SHADER_GEOMETRY:
|
||||
if (zink_vs_key_base(key)->last_vertex_stage) {
|
||||
if (zs->streamout.have_xfb)
|
||||
streamout = &zs->streamout;
|
||||
if (zs->sinfo.have_xfb)
|
||||
sinfo = &zs->sinfo;
|
||||
|
||||
if (!zink_vs_key_base(key)->clip_halfz) {
|
||||
NIR_PASS_V(nir, nir_lower_clip_halfz);
|
||||
|
@ -1189,7 +1189,7 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, nir_shad
|
|||
|
||||
NIR_PASS_V(nir, nir_convert_from_ssa, true);
|
||||
|
||||
struct spirv_shader *spirv = nir_to_spirv(nir, streamout, screen->spirv_version);
|
||||
struct spirv_shader *spirv = nir_to_spirv(nir, sinfo, screen->spirv_version);
|
||||
if (!spirv)
|
||||
goto done;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ struct nir_shader;
|
|||
struct set;
|
||||
|
||||
struct tgsi_token;
|
||||
struct zink_so_info {
|
||||
struct zink_shader_info {
|
||||
struct pipe_stream_output_info so_info;
|
||||
unsigned so_info_slots[PIPE_MAX_SO_OUTPUTS];
|
||||
bool have_xfb;
|
||||
|
@ -72,7 +72,7 @@ struct zink_shader {
|
|||
struct nir_shader *nir;
|
||||
enum pipe_prim_type reduced_prim; // PIPE_PRIM_MAX for vs
|
||||
|
||||
struct zink_so_info streamout;
|
||||
struct zink_shader_info sinfo;
|
||||
|
||||
struct {
|
||||
int index;
|
||||
|
|
|
@ -804,7 +804,7 @@ zink_draw(struct pipe_context *pctx,
|
|||
counter_buffers[i] = VK_NULL_HANDLE;
|
||||
if (t) {
|
||||
struct zink_resource *res = zink_resource(t->counter_buffer);
|
||||
t->stride = ctx->last_vertex_stage->streamout.so_info.stride[i] * sizeof(uint32_t);
|
||||
t->stride = ctx->last_vertex_stage->sinfo.so_info.stride[i] * sizeof(uint32_t);
|
||||
zink_batch_reference_resource_rw(batch, res, true);
|
||||
if (t->counter_buffer_valid) {
|
||||
counter_buffers[i] = res->obj->buffer;
|
||||
|
|
Loading…
Reference in New Issue