diff options
author | Dave Airlie <[email protected]> | 2020-03-10 15:09:37 +1000 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-05-06 06:20:37 +0000 |
commit | 01e9779c004efa8acedff83d2560880be894e7fc (patch) | |
tree | eea958a8a46aebdf29ce3117adcda40b3f224974 /src/gallium | |
parent | a30db60edeb7814415b04537cee8cc306ad11fd7 (diff) |
llvmpipe: record sample info for color/depth buffers in scene
This adds the nr_samples + sample_stride to the scene records
for cbufs and zsbuf.
Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast_priv.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_scene.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_scene.h | 5 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_texture.h | 6 |
5 files changed, 26 insertions, 4 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 5309f306109..c9027e92d48 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -337,7 +337,7 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task, for (i = 0; i < scene->fb.nr_cbufs; i++){ if (scene->fb.cbufs[i]) { stride[i] = scene->cbufs[i].stride; - sample_stride[i] = 0; + sample_stride[i] = scene->cbufs[i].sample_stride; color[i] = lp_rast_get_color_block_pointer(task, i, tile_x + x, tile_y + y, inputs->layer); } @@ -353,6 +353,7 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task, depth = lp_rast_get_depth_block_pointer(task, tile_x + x, tile_y + y, inputs->layer); depth_stride = scene->zsbuf.stride; + depth_sample_stride = scene->zsbuf.sample_stride; } /* Propagate non-interpolated raster state. */ @@ -438,7 +439,7 @@ lp_rast_shade_quads_mask(struct lp_rasterizer_task *task, for (i = 0; i < scene->fb.nr_cbufs; i++) { if (scene->fb.cbufs[i]) { stride[i] = scene->cbufs[i].stride; - sample_stride[i] = 0; + sample_stride[i] = scene->cbufs[i].sample_stride; color[i] = lp_rast_get_color_block_pointer(task, i, x, y, inputs->layer); } @@ -452,6 +453,7 @@ lp_rast_shade_quads_mask(struct lp_rasterizer_task *task, /* depth buffer */ if (scene->zsbuf.map) { depth_stride = scene->zsbuf.stride; + depth_sample_stride = scene->zsbuf.sample_stride; depth = lp_rast_get_depth_block_pointer(task, x, y, inputs->layer); } diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h index 95454782977..d4a3e48eff4 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h @@ -240,7 +240,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task, for (i = 0; i < scene->fb.nr_cbufs; i++) { if (scene->fb.cbufs[i]) { stride[i] = scene->cbufs[i].stride; - sample_stride[i] = 0; + sample_stride[i] = scene->cbufs[i].sample_stride; color[i] = lp_rast_get_color_block_pointer(task, i, x, y, inputs->layer); } @@ -253,6 +253,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task, if (scene->zsbuf.map) { depth = lp_rast_get_depth_block_pointer(task, x, y, inputs->layer); + depth_sample_stride = scene->zsbuf.sample_stride; depth_stride = scene->zsbuf.stride; } diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c index beab118ac49..129f5e0b1a2 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.c +++ b/src/gallium/drivers/llvmpipe/lp_scene.c @@ -160,6 +160,8 @@ lp_scene_begin_rasterization(struct lp_scene *scene) if (!cbuf) { scene->cbufs[i].stride = 0; scene->cbufs[i].layer_stride = 0; + scene->cbufs[i].sample_stride = 0; + scene->cbufs[i].nr_samples = 0; scene->cbufs[i].map = NULL; continue; } @@ -169,18 +171,22 @@ lp_scene_begin_rasterization(struct lp_scene *scene) cbuf->u.tex.level); scene->cbufs[i].layer_stride = llvmpipe_layer_stride(cbuf->texture, cbuf->u.tex.level); + scene->cbufs[i].sample_stride = llvmpipe_sample_stride(cbuf->texture); scene->cbufs[i].map = llvmpipe_resource_map(cbuf->texture, cbuf->u.tex.level, cbuf->u.tex.first_layer, LP_TEX_USAGE_READ_WRITE); scene->cbufs[i].format_bytes = util_format_get_blocksize(cbuf->format); + scene->cbufs[i].nr_samples = util_res_sample_count(cbuf->texture); } else { struct llvmpipe_resource *lpr = llvmpipe_resource(cbuf->texture); unsigned pixstride = util_format_get_blocksize(cbuf->format); scene->cbufs[i].stride = cbuf->texture->width0; scene->cbufs[i].layer_stride = 0; + scene->cbufs[i].sample_stride = 0; + scene->cbufs[i].nr_samples = 1; scene->cbufs[i].map = lpr->data; scene->cbufs[i].map += cbuf->u.buf.first_element * pixstride; scene->cbufs[i].format_bytes = util_format_get_blocksize(cbuf->format); @@ -191,7 +197,8 @@ lp_scene_begin_rasterization(struct lp_scene *scene) struct pipe_surface *zsbuf = scene->fb.zsbuf; scene->zsbuf.stride = llvmpipe_resource_stride(zsbuf->texture, zsbuf->u.tex.level); scene->zsbuf.layer_stride = llvmpipe_layer_stride(zsbuf->texture, zsbuf->u.tex.level); - + scene->zsbuf.sample_stride = llvmpipe_sample_stride(zsbuf->texture); + scene->zsbuf.nr_samples = util_res_sample_count(zsbuf->texture); scene->zsbuf.map = llvmpipe_resource_map(zsbuf->texture, zsbuf->u.tex.level, zsbuf->u.tex.first_layer, @@ -545,6 +552,7 @@ void lp_scene_begin_binning(struct lp_scene *scene, max_layer = MIN2(max_layer, zsbuf->u.tex.last_layer - zsbuf->u.tex.first_layer); } scene->fb_max_layer = max_layer; + scene->fb_max_samples = util_framebuffer_get_num_samples(fb); } diff --git a/src/gallium/drivers/llvmpipe/lp_scene.h b/src/gallium/drivers/llvmpipe/lp_scene.h index b4ed8817ea7..41322baf14d 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.h +++ b/src/gallium/drivers/llvmpipe/lp_scene.h @@ -143,11 +143,16 @@ struct lp_scene { unsigned stride; unsigned layer_stride; unsigned format_bytes; + unsigned sample_stride; + unsigned nr_samples; } zsbuf, cbufs[PIPE_MAX_COLOR_BUFS]; /* The amount of layers in the fb (minimum of all attachments) */ unsigned fb_max_layer; + /* max samples for bound framebuffer */ + unsigned fb_max_samples; + /** the framebuffer to render the scene into */ struct pipe_framebuffer_state fb; diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h index f7219da75f2..5965ef8443f 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.h +++ b/src/gallium/drivers/llvmpipe/lp_texture.h @@ -195,6 +195,12 @@ llvmpipe_resource_stride(struct pipe_resource *resource, return lpr->row_stride[level]; } +static inline unsigned +llvmpipe_sample_stride(struct pipe_resource *resource) +{ + struct llvmpipe_resource *lpr = llvmpipe_resource(resource); + return lpr->sample_stride; +} void * llvmpipe_resource_map(struct pipe_resource *resource, |