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);
}
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. */
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);
}
/* 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);
}
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);
}
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;
}
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;
}
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);
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,
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);
}
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;
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,