static texmask emit_texture(struct fd_ringbuffer *ring, struct fd_context *ctx, struct fd_texture_stateobj *tex, unsigned samp_id, texmask emitted) { unsigned const_idx = fd2_get_const_idx(ctx, tex, samp_id); static const struct fd2_sampler_stateobj dummy_sampler = {}; const struct fd2_sampler_stateobj *sampler; struct fd2_pipe_sampler_view *view; if (emitted & (1 << const_idx)) return 0; sampler = tex->samplers[samp_id] ? fd2_sampler_stateobj(tex->samplers[samp_id]) : &dummy_sampler; view = fd2_pipe_sampler_view(tex->textures[samp_id]); OUT_PKT3(ring, CP_SET_CONSTANT, 7); OUT_RING(ring, 0x00010000 + (0x6 * const_idx)); OUT_RING(ring, sampler->tex0 | view->tex0); OUT_RELOC(ring, fd_resource(view->base.texture)->bo, 0, view->fmt, 0); OUT_RING(ring, view->tex2); OUT_RING(ring, sampler->tex3 | view->tex3); OUT_RING(ring, sampler->tex4); OUT_RING(ring, sampler->tex5); return (1 << const_idx); }
static texmask emit_texture(struct fd_ringbuffer *ring, struct fd_context *ctx, struct fd_texture_stateobj *tex, unsigned samp_id, texmask emitted) { unsigned const_idx = fd2_get_const_idx(ctx, tex, samp_id); static const struct fd2_sampler_stateobj dummy_sampler = {}; static const struct fd2_pipe_sampler_view dummy_view = {}; const struct fd2_sampler_stateobj *sampler; const struct fd2_pipe_sampler_view *view; struct fd_resource *rsc; if (emitted & (1 << const_idx)) return 0; sampler = tex->samplers[samp_id] ? fd2_sampler_stateobj(tex->samplers[samp_id]) : &dummy_sampler; view = tex->textures[samp_id] ? fd2_pipe_sampler_view(tex->textures[samp_id]) : &dummy_view; rsc = view->base.texture ? fd_resource(view->base.texture) : NULL; OUT_PKT3(ring, CP_SET_CONSTANT, 7); OUT_RING(ring, 0x00010000 + (0x6 * const_idx)); OUT_RING(ring, sampler->tex0 | view->tex0); if (rsc) OUT_RELOC(ring, rsc->bo, 0, view->tex1, 0); else OUT_RING(ring, 0); OUT_RING(ring, view->tex2); OUT_RING(ring, sampler->tex3 | view->tex3); OUT_RING(ring, sampler->tex4 | view->tex4); if (rsc && rsc->base.last_level) OUT_RELOC(ring, rsc->bo, fd_resource_offset(rsc, 1, 0), view->tex5, 0); else OUT_RING(ring, view->tex5); return (1 << const_idx); }