ctx->block->instructions.emplace_back(std::move(mubuf));
}
-void visit_get_buffer_size(isel_context *ctx, nir_intrinsic_instr *instr) {
+void visit_get_ssbo_size(isel_context *ctx, nir_intrinsic_instr *instr) {
Temp index = convert_pointer_to_64_bit(ctx, get_ssa_temp(ctx, instr->src[0].ssa));
Builder bld(ctx->program, ctx->block);
case nir_intrinsic_store_scratch:
visit_store_scratch(ctx, instr);
break;
- case nir_intrinsic_get_buffer_size:
- visit_get_buffer_size(ctx, instr);
+ case nir_intrinsic_get_ssbo_size:
+ visit_get_ssbo_size(ctx, instr);
break;
case nir_intrinsic_scoped_barrier:
emit_scoped_barrier(ctx, instr);
case nir_intrinsic_load_num_subgroups:
case nir_intrinsic_load_first_vertex:
case nir_intrinsic_load_base_instance:
- case nir_intrinsic_get_buffer_size:
+ case nir_intrinsic_get_ssbo_size:
case nir_intrinsic_vote_all:
case nir_intrinsic_vote_any:
case nir_intrinsic_read_first_invocation:
return LLVMBuildLoad(ctx->ac.builder, ptr, "");
}
-static LLVMValueRef visit_get_buffer_size(struct ac_nir_context *ctx,
- const nir_intrinsic_instr *instr)
+static LLVMValueRef visit_get_ssbo_size(struct ac_nir_context *ctx,
+ const nir_intrinsic_instr *instr)
{
LLVMValueRef index = get_src(ctx, instr->src[0]);
case nir_intrinsic_load_ubo:
result = visit_load_ubo_buffer(ctx, instr);
break;
- case nir_intrinsic_get_buffer_size:
- result = visit_get_buffer_size(ctx, instr);
+ case nir_intrinsic_get_ssbo_size:
+ result = visit_get_ssbo_size(ctx, instr);
break;
case nir_intrinsic_load_deref:
result = visit_load_var(ctx, instr);
v3d40_vir_emit_image_load_store(c, instr);
break;
- case nir_intrinsic_get_buffer_size:
+ case nir_intrinsic_get_ssbo_size:
ntq_store_dest(c, &instr->dest, 0,
vir_uniform(c, QUNIFORM_GET_BUFFER_SIZE,
nir_src_as_uint(instr->src[0])));
case ir_unop_get_buffer_size: {
nir_intrinsic_instr *load = nir_intrinsic_instr_create(
this->shader,
- nir_intrinsic_get_buffer_size);
+ nir_intrinsic_get_ssbo_size);
load->num_components = ir->type->vector_elements;
load->src[0] = nir_src_for_ssa(evaluate_rvalue(ir->operands[0]));
unsigned bit_size = glsl_get_bit_size(ir->type);
case nir_intrinsic_image_samples:
case nir_intrinsic_image_deref_samples:
case nir_intrinsic_bindless_image_samples:
- case nir_intrinsic_get_buffer_size:
+ case nir_intrinsic_get_ssbo_size:
case nir_intrinsic_image_size:
case nir_intrinsic_image_deref_size:
case nir_intrinsic_bindless_image_size:
intrinsic("deref_buffer_array_length", src_comp=[-1], dest_comp=1,
flags=[CAN_ELIMINATE, CAN_REORDER])
-# Ask the driver for the size of a given buffer. It takes the buffer index
+# Ask the driver for the size of a given SSBO. It takes the buffer index
# as source.
-intrinsic("get_buffer_size", src_comp=[-1], dest_comp=1,
+intrinsic("get_ssbo_size", src_comp=[-1], dest_comp=1,
flags=[CAN_ELIMINATE, CAN_REORDER])
# a barrier is an intrinsic with no inputs/outputs but which can't be moved
assert(glsl_type_is_array(deref->type));
assert(glsl_get_length(deref->type) == 0);
+ assert(deref->mode == nir_var_mem_ssbo);
unsigned stride = glsl_get_explicit_stride(deref->type);
assert(stride > 0);
nir_ssa_def *offset = addr_to_offset(b, addr, addr_format);
nir_intrinsic_instr *bsize =
- nir_intrinsic_instr_create(b->shader, nir_intrinsic_get_buffer_size);
+ nir_intrinsic_instr_create(b->shader, nir_intrinsic_get_ssbo_size);
bsize->src[0] = nir_src_for_ssa(index);
nir_ssa_dest_init(&bsize->instr, &bsize->dest, 1, 32, NULL);
nir_builder_instr_insert(b, &bsize->instr);
nir_intrinsic_instr *instr =
nir_intrinsic_instr_create(b->nb.shader,
- nir_intrinsic_get_buffer_size);
+ nir_intrinsic_get_ssbo_size);
instr->src[0] = nir_src_for_ssa(ptr->block_index);
nir_ssa_dest_init(&instr->instr, &instr->dest, 1, 32, NULL);
nir_builder_instr_insert(&b->nb, &instr->instr);
ctx->so->no_earlyz = true;
ctx->funcs->emit_intrinsic_store_ssbo(ctx, intr);
break;
- case nir_intrinsic_get_buffer_size:
+ case nir_intrinsic_get_ssbo_size:
emit_intrinsic_ssbo_size(ctx, intr, dst);
break;
case nir_intrinsic_ssbo_atomic_add_ir3:
unsigned idx;
switch (intr->intrinsic) {
- case nir_intrinsic_get_buffer_size:
+ case nir_intrinsic_get_ssbo_size:
if (ir3_bindless_resource(intr->src[0]))
break;
idx = nir_src_as_uint(intr->src[0]);
* be required, rather than allocating worst-case const space, we scan the
* shader and allocate consts as-needed:
*
- * + SSBO sizes: only needed if shader has a get_buffer_size intrinsic
+ * + SSBO sizes: only needed if shader has a get_ssbo_size intrinsic
* for a given SSBO
*
* + Image dimensions: needed to calculate pixel offset, but only for
} offsets;
struct {
- uint32_t mask; /* bitmask of SSBOs that have get_buffer_size */
+ uint32_t mask; /* bitmask of SSBOs that have get_ssbo_size */
uint32_t count; /* number of consts allocated */
- /* one const allocated per SSBO which has get_buffer_size,
+ /* one const allocated per SSBO which has get_ssbo_size,
* ssbo_sizes.off[ssbo_id] is offset from start of ssbo_sizes
* consts:
*/
case nir_intrinsic_ssbo_atomic_fmin:
case nir_intrinsic_ssbo_atomic_fmax:
case nir_intrinsic_ssbo_atomic_fcomp_swap:
- case nir_intrinsic_get_buffer_size:
+ case nir_intrinsic_get_ssbo_size:
lower_ssbo_ubo_intrinsic(b, instr);
return true;
bld_base->store_mem(bld_base, writemask, nc, bitsize, idx, offset, val);
}
-static void visit_get_buffer_size(struct lp_build_nir_context *bld_base,
- nir_intrinsic_instr *instr,
- LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
+static void visit_get_ssbo_size(struct lp_build_nir_context *bld_base,
+ nir_intrinsic_instr *instr,
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
LLVMValueRef idx = get_src(bld_base, instr->src[0]);
- result[0] = bld_base->get_buffer_size(bld_base, idx);
+ result[0] = bld_base->get_ssbo_size(bld_base, idx);
}
static void visit_ssbo_atomic(struct lp_build_nir_context *bld_base,
case nir_intrinsic_store_ssbo:
visit_store_ssbo(bld_base, instr);
break;
- case nir_intrinsic_get_buffer_size:
- visit_get_buffer_size(bld_base, instr, result);
+ case nir_intrinsic_get_ssbo_size:
+ visit_get_ssbo_size(bld_base, instr, result);
break;
case nir_intrinsic_load_vertex_id:
case nir_intrinsic_load_primitive_id:
struct lp_img_params *params);
void (*image_size)(struct lp_build_nir_context *bld_base,
struct lp_sampler_size_query_params *params);
- LLVMValueRef (*get_buffer_size)(struct lp_build_nir_context *bld_base,
- LLVMValueRef index);
+ LLVMValueRef (*get_ssbo_size)(struct lp_build_nir_context *bld_base,
+ LLVMValueRef index);
void (*load_var)(struct lp_build_nir_context *bld_base,
nir_variable_mode deref_mode,
LLVMPositionBuilderAtEnd(gallivm->builder, resume);
}
-static LLVMValueRef emit_get_buffer_size(struct lp_build_nir_context *bld_base,
- LLVMValueRef index)
+static LLVMValueRef emit_get_ssbo_size(struct lp_build_nir_context *bld_base,
+ LLVMValueRef index)
{
struct gallivm_state *gallivm = bld_base->base.gallivm;
struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
bld.bld_base.end_primitive = end_primitive;
bld.bld_base.load_mem = emit_load_mem;
bld.bld_base.store_mem = emit_store_mem;
- bld.bld_base.get_buffer_size = emit_get_buffer_size;
+ bld.bld_base.get_ssbo_size = emit_get_ssbo_size;
bld.bld_base.atomic_mem = emit_atomic_mem;
bld.bld_base.barrier = emit_barrier;
bld.bld_base.image_op = emit_image_op;
mark_used_with_src(bt, &intrin->src[1], IRIS_SURFACE_GROUP_SSBO);
break;
- case nir_intrinsic_get_buffer_size:
+ case nir_intrinsic_get_ssbo_size:
case nir_intrinsic_ssbo_atomic_add:
case nir_intrinsic_ssbo_atomic_imin:
case nir_intrinsic_ssbo_atomic_umin:
}
break;
- case nir_intrinsic_get_buffer_size:
+ case nir_intrinsic_get_ssbo_size:
case nir_intrinsic_ssbo_atomic_add:
case nir_intrinsic_ssbo_atomic_imin:
case nir_intrinsic_ssbo_atomic_umin:
}
break;
}
- case nir_intrinsic_get_buffer_size: {
+ case nir_intrinsic_get_ssbo_size: {
LValues &newDefs = convert(&insn->dest);
const DataType dType = getDType(insn);
Value *indirectBuffer;
return emit_image_load(intr);
case nir_intrinsic_image_size:
return emit_image_size(intr);
- case nir_intrinsic_get_buffer_size:
+ case nir_intrinsic_get_ssbo_size:
return emit_buffer_size(intr);
default:
return false;
nir_emit_ssbo_atomic_float(bld, brw_aop_for_nir_intrinsic(instr), instr);
break;
- case nir_intrinsic_get_buffer_size: {
+ case nir_intrinsic_get_ssbo_size: {
assert(nir_src_num_components(instr->src[0]) == 1);
unsigned ssbo_index = nir_src_is_const(instr->src[0]) ?
nir_src_as_uint(instr->src[0]) : 0;
break;
}
- case nir_intrinsic_get_buffer_size: {
+ case nir_intrinsic_get_ssbo_size: {
assert(nir_src_num_components(instr->src[0]) == 1);
unsigned ssbo_index = nir_src_is_const(instr->src[0]) ?
nir_src_as_uint(instr->src[0]) : 0;
try_lower_direct_buffer_intrinsic(intrin, true, state);
break;
- case nir_intrinsic_get_buffer_size: {
- /* The get_buffer_size intrinsic always just takes a
+ case nir_intrinsic_get_ssbo_size: {
+ /* The get_ssbo_size intrinsic always just takes a
* index/reindex intrinsic.
*/
if (!find_descriptor_for_index_src(intrin->src[0], state))
}
static void
-lower_get_buffer_size(nir_intrinsic_instr *intrin,
- struct apply_pipeline_layout_state *state)
+lower_get_ssbo_size(nir_intrinsic_instr *intrin,
+ struct apply_pipeline_layout_state *state)
{
if (_mesa_set_search(state->lowered_instrs, intrin))
return;
case nir_intrinsic_load_vulkan_descriptor:
lower_load_vulkan_descriptor(intrin, state);
break;
- case nir_intrinsic_get_buffer_size:
- lower_get_buffer_size(intrin, state);
+ case nir_intrinsic_get_ssbo_size:
+ lower_get_ssbo_size(intrin, state);
break;
case nir_intrinsic_image_deref_load:
case nir_intrinsic_image_deref_store:
bi_emit_sysval(ctx, &instr->instr, 1, 0);
break;
- case nir_intrinsic_get_buffer_size:
+ case nir_intrinsic_get_ssbo_size:
bi_emit_sysval(ctx, &instr->instr, 1, 8);
break;
emit_sysval_read(ctx, &instr->instr, 1, 0);
break;
- case nir_intrinsic_get_buffer_size:
+ case nir_intrinsic_get_ssbo_size:
emit_sysval_read(ctx, &instr->instr, 1, 8);
break;
case nir_intrinsic_load_num_work_groups:
return PAN_SYSVAL_NUM_WORK_GROUPS;
case nir_intrinsic_load_ssbo_address:
- case nir_intrinsic_get_buffer_size:
+ case nir_intrinsic_get_ssbo_size:
return panfrost_sysval_for_ssbo(instr);
case nir_intrinsic_load_sampler_lod_parameters_pan:
return panfrost_sysval_for_sampler(instr);