asahi: use zero sink for vbuf
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33682>
This commit is contained in:
committed by
Marge Bot
parent
c14df405b9
commit
eff6b884cb
@@ -8,6 +8,7 @@
|
||||
#include <stdbool.h>
|
||||
#include "asahi/compiler/agx_compile.h"
|
||||
#include "asahi/layout/layout.h"
|
||||
#include "agx_abi.h"
|
||||
#include "agx_pack.h"
|
||||
#include "agx_ppp.h"
|
||||
#include "libagx_shaders.h"
|
||||
@@ -219,8 +220,8 @@ agx_set_null_pbe(struct agx_pbe_packed *pbe, uint64_t sink)
|
||||
* i <= floor((size - src_offset - elsize_B) / stride)
|
||||
*/
|
||||
static inline uint32_t
|
||||
agx_calculate_vbo_clamp(uint64_t vbuf, uint64_t sink, enum pipe_format format,
|
||||
uint32_t size_B, uint32_t stride_B, uint32_t offset_B,
|
||||
agx_calculate_vbo_clamp(uint64_t vbuf, enum pipe_format format, uint32_t size_B,
|
||||
uint32_t stride_B, uint32_t offset_B,
|
||||
uint64_t *vbuf_out)
|
||||
{
|
||||
unsigned elsize_B = util_format_get_blocksize(format);
|
||||
@@ -238,7 +239,7 @@ agx_calculate_vbo_clamp(uint64_t vbuf, uint64_t sink, enum pipe_format format,
|
||||
else
|
||||
return UINT32_MAX;
|
||||
} else {
|
||||
*vbuf_out = sink;
|
||||
*vbuf_out = AGX_ZERO_PAGE_ADDRESS;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include "agx_abi.h"
|
||||
#include "agx_bg_eot.h"
|
||||
#include "agx_bo.h"
|
||||
#include "agx_compile.h"
|
||||
@@ -2611,8 +2612,6 @@ hk_flush_dynamic_state(struct hk_cmd_buffer *cmd, struct hk_cs *cs,
|
||||
if (IS_DIRTY(VI) || IS_DIRTY(VI_BINDINGS_VALID) || vgt_dirty ||
|
||||
(gfx->dirty & HK_DIRTY_VB)) {
|
||||
|
||||
uint64_t sink = dev->rodata.zero_sink;
|
||||
|
||||
unsigned slot = 0;
|
||||
u_foreach_bit(a, sw_vs->info.vs.attribs_read) {
|
||||
if (dyn->vi->attributes_valid & BITFIELD_BIT(a)) {
|
||||
@@ -2620,11 +2619,11 @@ hk_flush_dynamic_state(struct hk_cmd_buffer *cmd, struct hk_cs *cs,
|
||||
struct hk_addr_range vb = gfx->vb[attr.binding];
|
||||
|
||||
desc->root.draw.attrib_clamps[slot] = agx_calculate_vbo_clamp(
|
||||
vb.addr, sink, hk_format_to_pipe_format(attr.format), vb.range,
|
||||
vb.addr, hk_format_to_pipe_format(attr.format), vb.range,
|
||||
dyn->vi_binding_strides[attr.binding], attr.offset,
|
||||
&desc->root.draw.attrib_base[slot]);
|
||||
} else {
|
||||
desc->root.draw.attrib_base[slot] = sink;
|
||||
desc->root.draw.attrib_base[slot] = AGX_ZERO_PAGE_ADDRESS;
|
||||
desc->root.draw.attrib_clamps[slot] = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "util/format/u_format.h"
|
||||
#include "util/half_float.h"
|
||||
#include "util/macros.h"
|
||||
#include "agx_abi.h"
|
||||
#include "agx_device.h"
|
||||
#include "agx_state.h"
|
||||
#include "pool.h"
|
||||
@@ -30,7 +31,6 @@ agx_upload_vbos(struct agx_batch *batch)
|
||||
{
|
||||
struct agx_context *ctx = batch->ctx;
|
||||
struct agx_vertex_elements *attribs = ctx->attributes;
|
||||
struct agx_device *dev = agx_device(ctx->base.screen);
|
||||
uint64_t buffers[PIPE_MAX_ATTRIBS] = {0};
|
||||
size_t buf_sizes[PIPE_MAX_ATTRIBS] = {0};
|
||||
|
||||
@@ -47,22 +47,12 @@ agx_upload_vbos(struct agx_batch *batch)
|
||||
}
|
||||
}
|
||||
|
||||
/* NULL vertex buffers read zeroes from NULL. This depends on soft fault.
|
||||
* Without soft fault, we just upload zeroes to read from.
|
||||
*/
|
||||
uint64_t sink = 0;
|
||||
|
||||
if (!agx_has_soft_fault(dev)) {
|
||||
uint32_t zeroes[4] = {0};
|
||||
sink = agx_pool_upload_aligned(&batch->pool, &zeroes, 16, 16);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < PIPE_MAX_ATTRIBS; ++i) {
|
||||
unsigned buf = attribs->buffers[i];
|
||||
uint64_t addr;
|
||||
|
||||
batch->uniforms.attrib_clamp[i] = agx_calculate_vbo_clamp(
|
||||
buffers[buf], sink, attribs->key[i].format, buf_sizes[buf],
|
||||
buffers[buf], attribs->key[i].format, buf_sizes[buf],
|
||||
attribs->key[i].stride, attribs->src_offsets[i], &addr);
|
||||
|
||||
batch->uniforms.attrib_base[i] = addr;
|
||||
|
||||
Reference in New Issue
Block a user