[Mesa-dev] [PATCH] gallium: add MULTISAMPLE_Z_RESOLVE cap
Marek Olšák
maraeo at gmail.com
Sun Jan 18 13:03:12 PST 2015
Yes, reading depth textures with sampler2DMS is allowed. There is
GL_MAX_DEPTH_TEXTURE_SAMPLES added by GL_ARB_texture_multisample I think.
Both solutions (the new CAP and using is_format_supported) are okay with me.
Marek
On Sun, Jan 18, 2015 at 8:23 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> I'm confused by what this flag is allowing. Are we talking about a
> blit from MS -> non-MS? texelFetch(sampler2DMS) for a depth buffer?
> texelFetch(sampler2D) for a MS surface? (is that even allowed in GL?)
> Or are we talking about mixing MS and non-MS buffers in the fb? These
> are all separate things. Your description is of the first (the blit)
> but I've seen you talk about the last (mixing MS + non-MS rt's).
>
> On Sun, Jan 18, 2015 at 11:24 AM, Marek Olšák <maraeo at gmail.com> wrote:
>> This looks good.
>>
>> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
>>
>> Marek
>>
>> On Sat, Jan 17, 2015 at 2:44 PM, Axel Davy <axel.davy at ens.fr> wrote:
>>> Resolving a multisampled depth texture into
>>> a single sampled texture is supported on >= SM4.1
>>> hw. It is possible some previous hw support it.
>>>
>>> The ability was tested on radeonsi and nvc0.
>>> Apparently is is also supported for radeon >= r700.
>>>
>>> This patch adds the MULTISAMPLE_Z_RESOLVE cap and
>>> add it to the drivers. It is advertised for drivers
>>> for which it is sure the ability is supported.
>>> A comment was added for drivers for which the feature
>>> is probably supported.
>>>
>>> Signed-off-by: Axel Davy <axel.davy at ens.fr>
>>> ---
>>> This feature corresponds to the RESZ d3d9 hack.
>>> d3d9 hacks are equivalent to GL extensions.
>>>
>>> RESZ is advertised under win by amd >= r700 and intel >= G45.
>>> Nv doesn't advertise the extension but allows similar feature
>>> in some Nv specific Api.
>>>
>>> I don't send right away the gallium Nine RESZ support patch,
>>> as I want other patches be merged first.
>>>
>>> src/gallium/docs/source/screen.rst | 2 ++
>>> src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
>>> src/gallium/drivers/i915/i915_screen.c | 1 +
>>> src/gallium/drivers/ilo/ilo_screen.c | 1 +
>>> src/gallium/drivers/llvmpipe/lp_screen.c | 2 ++
>>> src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 +
>>> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 +
>>> src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 +
>>> src/gallium/drivers/r300/r300_screen.c | 1 +
>>> src/gallium/drivers/r600/r600_pipe.c | 2 ++
>>> src/gallium/drivers/radeonsi/si_pipe.c | 1 +
>>> src/gallium/drivers/softpipe/sp_screen.c | 2 ++
>>> src/gallium/drivers/svga/svga_screen.c | 1 +
>>> src/gallium/drivers/vc4/vc4_screen.c | 1 +
>>> src/gallium/include/pipe/p_defines.h | 1 +
>>> 15 files changed, 19 insertions(+)
>>>
>>> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
>>> index 55d114c..b2485bc 100644
>>> --- a/src/gallium/docs/source/screen.rst
>>> +++ b/src/gallium/docs/source/screen.rst
>>> @@ -241,6 +241,8 @@ The integer capabilities:
>>> semantics. Only relevant if geometry shaders are supported.
>>> (Currently not possible to query availability of these two semantics outside
>>> this, at least BASEVERTEX should be exposed separately too).
>>> +* ``PIPE_CAP_MULTISAMPLE_Z_RESOLVE``: Whether the driver supports blitting
>>> + a multisampled depth buffer into a single-sampled texture (or depth buffer).
>>>
>>>
>>> .. _pipe_capf:
>>> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
>>> index 084a0ec..bf8d4e9 100644
>>> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
>>> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
>>> @@ -229,6 +229,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>> case PIPE_CAP_SAMPLER_VIEW_TARGET:
>>> case PIPE_CAP_CLIP_HALFZ:
>>> case PIPE_CAP_VERTEXID_NOBASE:
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
>>> return 0;
>>>
>>> case PIPE_CAP_MAX_VIEWPORTS:
>>> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
>>> index 1277de3..1393e7e 100644
>>> --- a/src/gallium/drivers/i915/i915_screen.c
>>> +++ b/src/gallium/drivers/i915/i915_screen.c
>>> @@ -227,6 +227,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
>>> case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>>> case PIPE_CAP_CLIP_HALFZ:
>>> case PIPE_CAP_VERTEXID_NOBASE:
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
>>> return 0;
>>>
>>> case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
>>> diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
>>> index 0c948f4..a4c9b03 100644
>>> --- a/src/gallium/drivers/ilo/ilo_screen.c
>>> +++ b/src/gallium/drivers/ilo/ilo_screen.c
>>> @@ -470,6 +470,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>> case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
>>> case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>>> case PIPE_CAP_SAMPLER_VIEW_TARGET:
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: /* may be supported */
>>> return 0;
>>>
>>> case PIPE_CAP_VENDOR_ID:
>>> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
>>> index 0e4456a..f6e1e52 100644
>>> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
>>> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
>>> @@ -284,6 +284,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>> return 1;
>>> case PIPE_CAP_VERTEXID_NOBASE:
>>> return 0;
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: /* may be supported */
>>> + return 0;
>>> }
>>> /* should only get here on unhandled cases */
>>> debug_printf("Unexpected PIPE_CAP %d query\n", param);
>>> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>>> index 46c21a1..f7809cb 100644
>>> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>>> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>>> @@ -158,6 +158,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>> case PIPE_CAP_SAMPLER_VIEW_TARGET:
>>> case PIPE_CAP_CLIP_HALFZ:
>>> case PIPE_CAP_VERTEXID_NOBASE:
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
>>> return 0;
>>>
>>> case PIPE_CAP_VENDOR_ID:
>>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>>> index da237f9..97d0702 100644
>>> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>>> @@ -206,6 +206,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>> case PIPE_CAP_COMPUTE:
>>> case PIPE_CAP_DRAW_INDIRECT:
>>> case PIPE_CAP_VERTEXID_NOBASE:
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: /* potentially supported on some hw */
>>> return 0;
>>>
>>> case PIPE_CAP_VENDOR_ID:
>>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>>> index 1d7caf8..03d48fe 100644
>>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>>> @@ -172,6 +172,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>> case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>>> case PIPE_CAP_SAMPLER_VIEW_TARGET:
>>> case PIPE_CAP_CLIP_HALFZ:
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
>>> return 1;
>>> case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
>>> return (class_3d >= NVE4_3D_CLASS) ? 1 : 0;
>>> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
>>> index f226d7f..87d662a 100644
>>> --- a/src/gallium/drivers/r300/r300_screen.c
>>> +++ b/src/gallium/drivers/r300/r300_screen.c
>>> @@ -182,6 +182,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>>> case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>>> case PIPE_CAP_SAMPLER_VIEW_TARGET:
>>> case PIPE_CAP_VERTEXID_NOBASE:
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
>>> return 0;
>>>
>>> /* SWTCL-only features. */
>>> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
>>> index b6f7859..90167c5 100644
>>> --- a/src/gallium/drivers/r600/r600_pipe.c
>>> +++ b/src/gallium/drivers/r600/r600_pipe.c
>>> @@ -400,6 +400,8 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>>> return rscreen->b.info.vram_size >> 20;
>>> case PIPE_CAP_UMA:
>>> return 0;
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
>>> + return rscreen->b.chip_class >= R700;
>>> }
>>> return 0;
>>> }
>>> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
>>> index e3f8fcf..4704a3e 100644
>>> --- a/src/gallium/drivers/radeonsi/si_pipe.c
>>> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
>>> @@ -219,6 +219,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>>> case PIPE_CAP_DRAW_INDIRECT:
>>> case PIPE_CAP_CLIP_HALFZ:
>>> case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
>>> return 1;
>>>
>>> case PIPE_CAP_TEXTURE_MULTISAMPLE:
>>> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
>>> index 8efc88f..1d869a5 100644
>>> --- a/src/gallium/drivers/softpipe/sp_screen.c
>>> +++ b/src/gallium/drivers/softpipe/sp_screen.c
>>> @@ -233,6 +233,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>> return 1;
>>> case PIPE_CAP_VERTEXID_NOBASE:
>>> return 0;
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: /* may be supported */
>>> + return 0;
>>> }
>>> /* should only get here on unhandled cases */
>>> debug_printf("Unexpected PIPE_CAP %d query\n", param);
>>> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
>>> index 32578c8..09749b1 100644
>>> --- a/src/gallium/drivers/svga/svga_screen.c
>>> +++ b/src/gallium/drivers/svga/svga_screen.c
>>> @@ -283,6 +283,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>> case PIPE_CAP_SAMPLER_VIEW_TARGET:
>>> case PIPE_CAP_CLIP_HALFZ:
>>> case PIPE_CAP_VERTEXID_NOBASE:
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
>>> return 0;
>>> case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
>>> return 64;
>>> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
>>> index 8d21633..9358d0a 100644
>>> --- a/src/gallium/drivers/vc4/vc4_screen.c
>>> +++ b/src/gallium/drivers/vc4/vc4_screen.c
>>> @@ -170,6 +170,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>> case PIPE_CAP_SAMPLER_VIEW_TARGET:
>>> case PIPE_CAP_CLIP_HALFZ:
>>> case PIPE_CAP_VERTEXID_NOBASE:
>>> + case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
>>> return 0;
>>>
>>> /* Stream output. */
>>> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
>>> index 6c5703a..351f3c2 100644
>>> --- a/src/gallium/include/pipe/p_defines.h
>>> +++ b/src/gallium/include/pipe/p_defines.h
>>> @@ -573,6 +573,7 @@ enum pipe_cap {
>>> PIPE_CAP_SAMPLER_VIEW_TARGET = 110,
>>> PIPE_CAP_CLIP_HALFZ = 111,
>>> PIPE_CAP_VERTEXID_NOBASE,
>>> + PIPE_CAP_MULTISAMPLE_Z_RESOLVE,
>>> };
>>>
>>> #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
>>> --
>>> 2.1.0
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list