OUT_RING(ring, CP_LOAD_STATE_1_STATE_TYPE(ST_CONSTANTS) |
CP_LOAD_STATE_1_EXT_SRC_ADDR(0));
for (i = 0; i < tex->num_textures; i++) {
- static const struct fd4_pipe_sampler_view dummy_view = {
- .base.target = PIPE_TEXTURE_1D,
- };
+ static const struct fd4_pipe_sampler_view dummy_view = {};
const struct fd4_pipe_sampler_view *view = tex->textures[i] ?
fd4_pipe_sampler_view(tex->textures[i]) :
&dummy_view;
OUT_RING(ring, view->texconst3);
if (view->base.texture) {
struct fd_resource *rsc = fd_resource(view->base.texture);
- unsigned start = fd_sampler_first_level(&view->base);
- uint32_t offset;
- if (rsc->base.b.target == PIPE_BUFFER) {
- offset = view->base.u.buf.first_element *
- util_format_get_blocksize(view->base.format);
- } else {
- offset = fd_resource_offset(
- rsc, start, view->base.u.tex.first_layer);
- }
- OUT_RELOC(ring, rsc->bo, offset, view->texconst4, 0);
+ OUT_RELOC(ring, rsc->bo, view->offset, view->texconst4, 0);
} else {
OUT_RING(ring, 0x00000000);
}
so->texconst2 =
A4XX_TEX_CONST_2_FETCHSIZE(fd4_pipe2fetchsize(cso->format)) |
A4XX_TEX_CONST_2_PITCH(elements * rsc->cpp);
+ so->offset = cso->u.buf.first_element *
+ util_format_get_blocksize(cso->format);
} else {
unsigned miplevels;
A4XX_TEX_CONST_2_PITCH(
util_format_get_nblocksx(
cso->format, rsc->slices[lvl].pitch) * rsc->cpp);
+ so->offset = fd_resource_offset(rsc, lvl, cso->u.tex.first_layer);
}
switch (cso->target) {
struct fd4_pipe_sampler_view {
struct pipe_sampler_view base;
uint32_t texconst0, texconst1, texconst2, texconst3, texconst4;
+ uint32_t offset;
};
static inline struct fd4_pipe_sampler_view *