From 8632626c81a09315276d7defa63092247d7fd308 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 23 May 2018 22:25:12 -0400 Subject: [PATCH] gallium: add pipe_resource::nr_storage_samples, and set it same as nr_samples MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Tested-by: Dieter Nützel --- .../auxiliary/driver_trace/tr_dump_state.c | 1 + src/gallium/auxiliary/postprocess/pp_mlaa.c | 2 +- src/gallium/auxiliary/util/u_dump_state.c | 1 + src/gallium/auxiliary/util/u_tests.c | 1 + src/gallium/docs/source/screen.rst | 23 +++++++++++++++++-- src/gallium/include/pipe/p_state.h | 18 ++++++++++++--- src/gallium/state_trackers/dri/dri2.c | 3 +++ src/gallium/state_trackers/glx/xlib/xm_st.c | 1 + src/gallium/state_trackers/nine/buffer9.c | 1 + .../state_trackers/nine/cubetexture9.c | 1 + src/gallium/state_trackers/nine/device9.c | 2 +- src/gallium/state_trackers/nine/surface9.c | 2 ++ src/gallium/state_trackers/nine/swapchain9.c | 3 +++ src/gallium/state_trackers/nine/texture9.c | 1 + src/gallium/state_trackers/nine/volume9.c | 1 + .../state_trackers/nine/volumetexture9.c | 1 + src/gallium/state_trackers/wgl/stw_st.c | 1 + src/gallium/tests/graw/clear.c | 1 - src/gallium/tests/graw/fs-test.c | 2 -- src/gallium/tests/graw/graw_util.h | 3 --- src/gallium/tests/graw/gs-test.c | 3 --- src/gallium/tests/graw/quad-sample.c | 2 -- src/gallium/tests/graw/shader-leak.c | 1 - src/gallium/tests/graw/tri-gs.c | 1 - src/gallium/tests/graw/tri-instanced.c | 1 - src/gallium/tests/graw/vs-test.c | 3 --- src/mesa/state_tracker/st_cb_copyimage.c | 7 +++--- src/mesa/state_tracker/st_cb_fbo.c | 2 ++ src/mesa/state_tracker/st_cb_texture.c | 2 ++ src/mesa/state_tracker/st_texture.c | 1 + 30 files changed, 65 insertions(+), 27 deletions(-) diff --git a/src/gallium/auxiliary/driver_trace/tr_dump_state.c b/src/gallium/auxiliary/driver_trace/tr_dump_state.c index 2d12720ddd9..46fa5747460 100644 --- a/src/gallium/auxiliary/driver_trace/tr_dump_state.c +++ b/src/gallium/auxiliary/driver_trace/tr_dump_state.c @@ -69,6 +69,7 @@ void trace_dump_resource_template(const struct pipe_resource *templat) 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); diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c index 610cedbd1b3..f003ee75fd5 100644 --- a/src/gallium/auxiliary/postprocess/pp_mlaa.c +++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c @@ -240,7 +240,7 @@ pp_jimenezmlaa_init_run(struct pp_queue_t *ppq, unsigned int n, 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)) diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c index b68de134275..286d5fad75b 100644 --- a/src/gallium/auxiliary/util/u_dump_state.c +++ b/src/gallium/auxiliary/util/u_dump_state.c @@ -319,6 +319,7 @@ util_dump_resource(FILE *stream, const struct pipe_resource *state) 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); diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c index bae3fa111a4..f8c001813c1 100644 --- a/src/gallium/auxiliary/util/u_tests.c +++ b/src/gallium/auxiliary/util/u_tests.c @@ -55,6 +55,7 @@ util_create_texture2d(struct pipe_screen *screen, unsigned width, 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 | diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 5fc49e24403..ecff0800bf8 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -789,8 +789,27 @@ For cube maps this must be 6, for other textures 1. **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. diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 809aa087ce0..671cccda4eb 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -519,7 +519,6 @@ struct pipe_box 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. */ @@ -529,9 +528,20 @@ struct pipe_resource 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 */ @@ -540,6 +550,8 @@ struct pipe_resource * 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 */ }; diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index 34205853335..9a22e47693b 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -832,6 +832,7 @@ dri2_allocate_textures(struct dri_context *ctx, 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) @@ -883,10 +884,12 @@ dri2_allocate_textures(struct dri_context *ctx, 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]; } diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c index 9def70fc746..2fa80f4da28 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_st.c +++ b/src/gallium/state_trackers/glx/xlib/xm_st.c @@ -136,6 +136,7 @@ xmesa_st_framebuffer_validate_textures(struct st_framebuffer_iface *stfbi, 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; diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index ca4e4380277..69b08e8c10e 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -121,6 +121,7 @@ NineBuffer9_ctor( struct NineBuffer9 *This, 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); diff --git a/src/gallium/state_trackers/nine/cubetexture9.c b/src/gallium/state_trackers/nine/cubetexture9.c index 65251ad2b7e..89821682f8f 100644 --- a/src/gallium/state_trackers/nine/cubetexture9.c +++ b/src/gallium/state_trackers/nine/cubetexture9.c @@ -90,6 +90,7 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This, 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; diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 127f2ae195b..c434efb8bc7 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -3008,7 +3008,7 @@ NineDevice9_ProcessVertices( struct NineDevice9 *This, 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) diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index d917fa1f868..4c6a6957703 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -104,6 +104,7 @@ NineSurface9_ctor( struct NineSurface9 *This, 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 */ @@ -803,6 +804,7 @@ NineSurface9_SetResourceResize( struct NineSurface9 *This, 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); diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c index 7cf5c54bfa8..aa485a6268b 100644 --- a/src/gallium/state_trackers/nine/swapchain9.c +++ b/src/gallium/state_trackers/nine/swapchain9.c @@ -307,6 +307,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, 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, @@ -345,6 +346,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, 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) @@ -361,6 +363,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, 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, diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c index 78ca4add4ae..fca5e603230 100644 --- a/src/gallium/state_trackers/nine/texture9.c +++ b/src/gallium/state_trackers/nine/texture9.c @@ -131,6 +131,7 @@ NineTexture9_ctor( struct NineTexture9 *This, 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; diff --git a/src/gallium/state_trackers/nine/volume9.c b/src/gallium/state_trackers/nine/volume9.c index 62af3e62251..ec811aeba13 100644 --- a/src/gallium/state_trackers/nine/volume9.c +++ b/src/gallium/state_trackers/nine/volume9.c @@ -92,6 +92,7 @@ NineVolume9_ctor( struct NineVolume9 *This, 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; diff --git a/src/gallium/state_trackers/nine/volumetexture9.c b/src/gallium/state_trackers/nine/volumetexture9.c index c836dd21023..5dec4844864 100644 --- a/src/gallium/state_trackers/nine/volumetexture9.c +++ b/src/gallium/state_trackers/nine/volumetexture9.c @@ -88,6 +88,7 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This, 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; diff --git a/src/gallium/state_trackers/wgl/stw_st.c b/src/gallium/state_trackers/wgl/stw_st.c index 7cf18f0a8b0..2445c33a293 100644 --- a/src/gallium/state_trackers/wgl/stw_st.c +++ b/src/gallium/state_trackers/wgl/stw_st.c @@ -95,6 +95,7 @@ stw_st_framebuffer_validate_locked(struct st_framebuffer_iface *stfb, 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; diff --git a/src/gallium/tests/graw/clear.c b/src/gallium/tests/graw/clear.c index 45b0cc069bd..2a08ae15485 100644 --- a/src/gallium/tests/graw/clear.c +++ b/src/gallium/tests/graw/clear.c @@ -73,7 +73,6 @@ static void init( void ) 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); diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index d1ade1d2b4b..cc87b02a0a2 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -301,7 +301,6 @@ static void init_tex( void ) templat.depth0 = 1; templat.array_size = 1; templat.last_level = 0; - templat.nr_samples = 1; templat.bind = PIPE_BIND_SAMPLER_VIEW; @@ -411,7 +410,6 @@ static void init( void ) 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); diff --git a/src/gallium/tests/graw/graw_util.h b/src/gallium/tests/graw/graw_util.h index 36064e18a25..c919ec77198 100644 --- a/src/gallium/tests/graw/graw_util.h +++ b/src/gallium/tests/graw/graw_util.h @@ -77,7 +77,6 @@ graw_util_create_window(struct graw_info *info, 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, @@ -109,7 +108,6 @@ graw_util_create_window(struct graw_info *info, 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) { @@ -233,7 +231,6 @@ graw_util_create_tex2d(const struct graw_info *info, 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); diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index dad3298d159..9c3c29bc3c6 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -158,7 +158,6 @@ static void init_fs_constbuf( void ) 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); @@ -392,7 +391,6 @@ static void init_tex( void ) templat.depth0 = 1; templat.array_size = 1; templat.last_level = 0; - templat.nr_samples = 1; templat.bind = PIPE_BIND_SAMPLER_VIEW; @@ -502,7 +500,6 @@ static void init( void ) 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); diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c index 79174204dbb..d532e60e1e2 100644 --- a/src/gallium/tests/graw/quad-sample.c +++ b/src/gallium/tests/graw/quad-sample.c @@ -216,7 +216,6 @@ static void init_tex( void ) templat.height0 = SIZE; templat.depth0 = 1; templat.last_level = 0; - templat.nr_samples = 1; templat.bind = PIPE_BIND_SAMPLER_VIEW; @@ -326,7 +325,6 @@ static void init( void ) 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); diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c index fb4344c088e..4178448f768 100644 --- a/src/gallium/tests/graw/shader-leak.c +++ b/src/gallium/tests/graw/shader-leak.c @@ -199,7 +199,6 @@ static void init( void ) templat.height0 = HEIGHT; templat.depth0 = 1; templat.last_level = 0; - templat.nr_samples = 1; templat.bind = (PIPE_BIND_RENDER_TARGET | PIPE_BIND_DISPLAY_TARGET); diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c index 2ca36ce91ba..5efc9e87c4c 100644 --- a/src/gallium/tests/graw/tri-gs.c +++ b/src/gallium/tests/graw/tri-gs.c @@ -207,7 +207,6 @@ static void init( void ) 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); diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c index 6c6783c930c..9bd2ff58687 100644 --- a/src/gallium/tests/graw/tri-instanced.c +++ b/src/gallium/tests/graw/tri-instanced.c @@ -258,7 +258,6 @@ static void init( void ) 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); diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index e3b50ea8f89..26976f41682 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -90,7 +90,6 @@ static void init_fs_constbuf( void ) 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, @@ -290,7 +289,6 @@ static void init_tex( void ) templat.depth0 = 1; templat.array_size = 1; templat.last_level = 0; - templat.nr_samples = 1; templat.bind = PIPE_BIND_SAMPLER_VIEW; @@ -400,7 +398,6 @@ static void init( void ) 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); diff --git a/src/mesa/state_tracker/st_cb_copyimage.c b/src/mesa/state_tracker/st_cb_copyimage.c index f5d8c047800..6d3eda014dc 100644 --- a/src/mesa/state_tracker/st_cb_copyimage.c +++ b/src/mesa/state_tracker/st_cb_copyimage.c @@ -360,7 +360,7 @@ same_size_and_swizzle(const struct util_format_description *d1, 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; @@ -372,6 +372,7 @@ create_texture(struct pipe_screen *screen, enum pipe_format format, 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; @@ -443,7 +444,7 @@ handle_complex_copy(struct pipe_context *pipe, * 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, @@ -468,7 +469,7 @@ handle_complex_copy(struct pipe_context *pipe, /* 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, diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 698c7046c1a..fb41b7b73cf 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -204,6 +204,8 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, 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; } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 56d8c411472..d1f060dc979 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -2791,6 +2791,7 @@ st_texture_create_from_memory(struct st_context *st, /* 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); @@ -2956,6 +2957,7 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target, 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, diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 7d8303615e9..09314519d48 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -95,6 +95,7 @@ st_texture_create(struct st_context *st, /* 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); -- 2.30.2