trace_dump_member(uint, templat, last_level);
trace_dump_member(uint, templat, nr_samples);
+ trace_dump_member(uint, templat, nr_storage_samples);
trace_dump_member(uint, templat, usage);
trace_dump_member(uint, templat, bind);
trace_dump_member(uint, templat, flags);
res.width0 = res.height0 = 165;
res.bind = PIPE_BIND_SAMPLER_VIEW;
res.usage = PIPE_USAGE_DEFAULT;
- res.depth0 = res.array_size = res.nr_samples = 1;
+ res.depth0 = res.array_size = res.nr_samples = res.nr_storage_samples = 1;
if (!ppq->p->screen->is_format_supported(ppq->p->screen, res.format,
res.target, 1, res.bind))
util_dump_member(stream, uint, state, last_level);
util_dump_member(stream, uint, state, nr_samples);
+ util_dump_member(stream, uint, state, nr_storage_samples);
util_dump_member(stream, uint, state, usage);
util_dump_member(stream, uint, state, bind);
util_dump_member(stream, uint, state, flags);
templ.depth0 = 1;
templ.array_size = 1;
templ.nr_samples = num_samples;
+ templ.nr_storage_samples = num_samples;
templ.format = format;
templ.usage = PIPE_USAGE_DEFAULT;
templ.bind = PIPE_BIND_SAMPLER_VIEW |
**last_level** the last mip map level present.
-**nr_samples** the nr of msaa samples. 0 (or 1) specifies a resource
-which isn't multisampled.
+**nr_samples**: Number of samples determining quality, driving the rasterizer,
+shading, and framebuffer. It is the number of samples seen by the whole
+graphics pipeline. 0 and 1 specify a resource which isn't multisampled.
+
+**nr_storage_samples**: Only color buffers can set this lower than nr_samples.
+Multiple samples within a pixel can have the same color. ``nr_storage_samples``
+determines how many slots for different colors there are per pixel.
+If there are not enough slots to store all sample colors, some samples will
+have an undefined color (called "undefined samples").
+
+The resolve blit behavior is driver-specific, but can be one of these two:
+1. Only defined samples will be averaged. Undefined samples will be ignored.
+2. Undefined samples will be approximated by looking at surrounding defined
+ samples (even in different pixels).
+
+Blits and MSAA texturing: If the sample being fetched is undefined, one of
+the defined samples is returned instead.
+
+Sample shading (``set_min_samples``) will operate at a sample frequency that
+is at most ``nr_storage_samples``. Greater ``min_samples`` values will be
+replaced by ``nr_storage_samples``.
**usage** one of the :ref:`PIPE_USAGE` flags.
struct pipe_resource
{
struct pipe_reference reference;
- struct pipe_screen *screen; /**< screen that this texture belongs to */
unsigned width0; /**< Used by both buffers and textures. */
uint16_t height0; /* Textures: The maximum height/depth/array_size is 16k. */
enum pipe_format format:16; /**< PIPE_FORMAT_x */
enum pipe_texture_target target:8; /**< PIPE_TEXTURE_x */
unsigned last_level:8; /**< Index of last mipmap level present/defined */
- unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */
- unsigned usage:8; /**< PIPE_USAGE_x (not a bitmask) */
+ /** Number of samples determining quality, driving rasterizer, shading,
+ * and framebuffer.
+ */
+ unsigned nr_samples:8;
+
+ /** Multiple samples within a pixel can have the same value.
+ * nr_storage_samples determines how many slots for different values
+ * there are per pixel. Only color buffers can set this lower than
+ * nr_samples.
+ */
+ unsigned nr_storage_samples:8;
+
+ unsigned usage:8; /**< PIPE_USAGE_x (not a bitmask) */
unsigned bind; /**< bitmask of PIPE_BIND_x */
unsigned flags; /**< bitmask of PIPE_RESOURCE_FLAG_x */
* next plane.
*/
struct pipe_resource *next;
+ /* The screen pointer should be last for optimal structure packing. */
+ struct pipe_screen *screen; /**< screen that this texture belongs to */
};
templ.bind = drawable->textures[statt]->bind &
~(PIPE_BIND_SCANOUT | PIPE_BIND_SHARED);
templ.nr_samples = drawable->stvis.samples;
+ templ.nr_storage_samples = drawable->stvis.samples;
/* Try to reuse the resource.
* (the other resource parameters should be constant)
if (drawable->stvis.samples > 1) {
templ.nr_samples = drawable->stvis.samples;
+ templ.nr_storage_samples = drawable->stvis.samples;
zsbuf = &drawable->msaa_textures[statt];
}
else {
templ.nr_samples = 0;
+ templ.nr_storage_samples = 0;
zsbuf = &drawable->textures[statt];
}
templ.array_size = 1;
templ.last_level = 0;
templ.nr_samples = xstfb->stvis.samples;
+ templ.nr_storage_samples = xstfb->stvis.samples;
for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
enum pipe_format format;
info->array_size = 1;
info->last_level = 0;
info->nr_samples = 0;
+ info->nr_storage_samples = 0;
hr = NineResource9_ctor(&This->base, pParams, NULL, TRUE,
Type, Pool, Usage);
info->last_level = util_logbase2(EdgeLength);
info->array_size = 6;
info->nr_samples = 0;
+ info->nr_storage_samples = 0;
info->bind = PIPE_BIND_SAMPLER_VIEW;
info->usage = PIPE_USAGE_DEFAULT;
info->flags = 0;
templ.bind = PIPE_BIND_STREAM_OUTPUT;
templ.usage = PIPE_USAGE_STREAM;
templ.height0 = templ.depth0 = templ.array_size = 1;
- templ.last_level = templ.nr_samples = 0;
+ templ.last_level = templ.nr_samples = templ.nr_storage_samples = 0;
resource = screen_sw->resource_create(screen_sw, &templ);
if (!resource)
This->base.info.last_level = 0;
This->base.info.array_size = 1;
This->base.info.nr_samples = multisample_type;
+ This->base.info.nr_storage_samples = multisample_type;
This->base.info.usage = PIPE_USAGE_DEFAULT;
This->base.info.bind = PIPE_BIND_SAMPLER_VIEW; /* StretchRect */
This->desc.Width = This->base.info.width0 = resource->width0;
This->desc.Height = This->base.info.height0 = resource->height0;
This->base.info.nr_samples = resource->nr_samples;
+ This->base.info.nr_storage_samples = resource->nr_storage_samples;
This->stride = nine_format_get_stride(This->base.info.format,
This->desc.Width);
for (i = 0; i < newBufferCount; ++i) {
tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
tmplt.nr_samples = multisample_type;
+ tmplt.nr_storage_samples = multisample_type;
if (!has_present_buffers)
tmplt.bind |= NINE_BIND_PRESENTBUFFER_FLAGS;
tmplt.format = d3d9_to_pipe_format_checked(This->screen,
tmplt.format = PIPE_FORMAT_B8G8R8X8_UNORM;
tmplt.bind = NINE_BIND_PRESENTBUFFER_FLAGS;
tmplt.nr_samples = 0;
+ tmplt.nr_storage_samples = 0;
if (This->actx->linear_framebuffer)
tmplt.bind |= PIPE_BIND_LINEAR;
if (pParams->SwapEffect != D3DSWAPEFFECT_DISCARD)
if (pParams->EnableAutoDepthStencil) {
tmplt.bind = d3d9_get_pipe_depth_format_bindings(pParams->AutoDepthStencilFormat);
tmplt.nr_samples = multisample_type;
+ tmplt.nr_storage_samples = multisample_type;
tmplt.format = d3d9_to_pipe_format_checked(This->screen,
pParams->AutoDepthStencilFormat,
PIPE_TEXTURE_2D,
info->last_level = util_logbase2(MAX2(Width, Height));
info->array_size = 1;
info->nr_samples = 0;
+ info->nr_storage_samples = 0;
info->bind = PIPE_BIND_SAMPLER_VIEW;
info->usage = PIPE_USAGE_DEFAULT;
info->flags = 0;
This->info.last_level = 0;
This->info.array_size = 1;
This->info.nr_samples = 0;
+ This->info.nr_storage_samples = 0;
This->info.usage = PIPE_USAGE_DEFAULT;
This->info.bind = PIPE_BIND_SAMPLER_VIEW;
This->info.flags = 0;
info->last_level = util_logbase2(MAX2(MAX2(Width, Height), Depth));
info->array_size = 1;
info->nr_samples = 0;
+ info->nr_storage_samples = 0;
info->bind = PIPE_BIND_SAMPLER_VIEW;
info->usage = PIPE_USAGE_DEFAULT;
info->flags = 0;
templ.array_size = 1;
templ.last_level = 0;
templ.nr_samples = stwfb->stvis.samples;
+ templ.nr_storage_samples = stwfb->stvis.samples;;
for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
enum pipe_format format;
templat.depth0 = 1;
templat.array_size = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET);
templat.depth0 = 1;
templat.array_size = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = PIPE_BIND_SAMPLER_VIEW;
templat.depth0 = 1;
templat.array_size = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET);
resource_temp.depth0 = 1;
resource_temp.array_size = 1;
resource_temp.last_level = 0;
- resource_temp.nr_samples = 1;
resource_temp.bind = (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET);
info->color_buf[i] = info->screen->resource_create(info->screen,
resource_temp.depth0 = 1;
resource_temp.array_size = 1;
resource_temp.last_level = 0;
- resource_temp.nr_samples = 1;
resource_temp.bind = PIPE_BIND_DEPTH_STENCIL;
info->zs_buf = info->screen->resource_create(info->screen, &resource_temp);
if (!info->zs_buf) {
temp.depth0 = 1;
temp.last_level = 0;
temp.array_size = 1;
- temp.nr_samples = 1;
temp.bind = PIPE_BIND_SAMPLER_VIEW;
tex = info->screen->resource_create(info->screen, &temp);
templat.depth0 = 1;
templat.array_size = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = PIPE_BIND_CONSTANT_BUFFER;
constbuf1 = screen->resource_create(screen, &templat);
templat.depth0 = 1;
templat.array_size = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = PIPE_BIND_SAMPLER_VIEW;
templat.depth0 = 1;
templat.array_size = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET);
templat.height0 = SIZE;
templat.depth0 = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = PIPE_BIND_SAMPLER_VIEW;
templat.depth0 = 1;
templat.array_size = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET);
templat.height0 = HEIGHT;
templat.depth0 = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET);
templat.depth0 = 1;
templat.array_size = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET);
templat.depth0 = 1;
templat.array_size = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET);
templat.depth0 = 1;
templat.array_size = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = PIPE_BIND_CONSTANT_BUFFER;
constbuf = screen->resource_create(screen,
templat.depth0 = 1;
templat.array_size = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = PIPE_BIND_SAMPLER_VIEW;
templat.depth0 = 1;
templat.array_size = 1;
templat.last_level = 0;
- templat.nr_samples = 1;
templat.bind = (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET);
static struct pipe_resource *
create_texture(struct pipe_screen *screen, enum pipe_format format,
- unsigned nr_samples,
+ unsigned nr_samples, unsigned nr_storage_samples,
unsigned width, unsigned height, unsigned depth)
{
struct pipe_resource templ;
templ.depth0 = 1;
templ.array_size = depth;
templ.nr_samples = nr_samples;
+ templ.nr_storage_samples = nr_storage_samples;
templ.usage = PIPE_USAGE_DEFAULT;
templ.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
* then proceed the generic swizzled_copy.
*/
temp = create_texture(pipe->screen, canon_format, src->nr_samples,
- src_box->width,
+ src->nr_storage_samples, src_box->width,
src_box->height, src_box->depth);
u_box_3d(0, 0, 0, src_box->width, src_box->height, src_box->depth,
/* Use the temporary texture. First, use the generic copy, but use
* a canonical format in the destination. Then convert */
temp = create_texture(pipe->screen, canon_format, dst->nr_samples,
- src_box->width,
+ dst->nr_storage_samples, src_box->width,
src_box->height, src_box->depth);
u_box_3d(0, 0, 0, src_box->width, src_box->height, src_box->depth,
templ.depth0 = 1;
templ.array_size = 1;
templ.nr_samples = rb->NumSamples;
+ templ.nr_storage_samples = rb->NumSamples;
+
if (util_format_is_depth_or_stencil(format)) {
templ.bind = PIPE_BIND_DEPTH_STENCIL;
}
/* only set this for OpenGL textures, not renderbuffers */
pt.flags = PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY;
pt.nr_samples = nr_samples;
+ pt.nr_storage_samples = nr_samples;
newtex = screen->resource_from_memobj(screen, &pt, memObj->memory, offset);
pt.target = gl_target_to_pipe(target);
pt.format = st_mesa_format_to_pipe_format(st, format);
pt.nr_samples = numSamples;
+ pt.nr_storage_samples = numSamples;
st_gl_texture_dims_to_pipe_dims(target,
width, height, depth,
/* only set this for OpenGL textures, not renderbuffers */
pt.flags = PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY;
pt.nr_samples = nr_samples;
+ pt.nr_storage_samples = nr_samples;
newtex = screen->resource_create(screen, &pt);