resource_written(batch, pfb->cbufs[i]->texture);
}
- /* Mark SSBOs as being written.. we don't actually know which ones are
- * read vs written, so just assume the worst
- */
+ /* Mark SSBOs */
if (ctx->dirty_shader[PIPE_SHADER_FRAGMENT] & FD_DIRTY_SHADER_SSBO) {
- foreach_bit(i, ctx->shaderbuf[PIPE_SHADER_FRAGMENT].enabled_mask)
- resource_written(batch, ctx->shaderbuf[PIPE_SHADER_FRAGMENT].sb[i].buffer);
+ const struct fd_shaderbuf_stateobj *so = &ctx->shaderbuf[PIPE_SHADER_FRAGMENT];
+
+ foreach_bit (i, so->enabled_mask & so->writable_mask)
+ resource_written(batch, so->sb[i].buffer);
+
+ foreach_bit (i, so->enabled_mask & ~so->writable_mask)
+ resource_read(batch, so->sb[i].buffer);
}
if (ctx->dirty_shader[PIPE_SHADER_FRAGMENT] & FD_DIRTY_SHADER_IMAGE) {
fd_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
{
struct fd_context *ctx = fd_context(pctx);
+ const struct fd_shaderbuf_stateobj *so = &ctx->shaderbuf[PIPE_SHADER_COMPUTE];
struct fd_batch *batch, *save_batch = NULL;
unsigned i;
mtx_lock(&ctx->screen->lock);
- /* Mark SSBOs as being written.. we don't actually know which ones are
- * read vs written, so just assume the worst
- */
- foreach_bit(i, ctx->shaderbuf[PIPE_SHADER_COMPUTE].enabled_mask)
- resource_written(batch, ctx->shaderbuf[PIPE_SHADER_COMPUTE].sb[i].buffer);
+ /* Mark SSBOs */
+ foreach_bit (i, so->enabled_mask & so->writable_mask)
+ resource_written(batch, so->sb[i].buffer);
+
+ foreach_bit (i, so->enabled_mask & ~so->writable_mask)
+ resource_read(batch, so->sb[i].buffer);
foreach_bit(i, ctx->shaderimg[PIPE_SHADER_COMPUTE].enabled_mask) {
struct pipe_image_view *img =