[Mesa-dev] [PATCH 36/43] st/nine: Fix multisampling support detection

Axel Davy axel.davy at ens.fr
Sun Feb 1 11:28:56 PST 2015


I checked, and the application is allowed to lock the backbuffer if it 
specified a specific flag.

However it seems locking a multisampled buffer is forbidden.

So probably here the PIPE_BIND_TRANSFER_* flags could be removed for 
multisampling,
should I add that behaviour ? Does it matter for some drivers ?

Axel

On 31/01/2015 07:04, Axel Davy wrote :
> The patch modifies the code used to check for format support.
>
> It needs to test for these flags for render targets because we create 
> the back buffers
> with these. Probably these flags are not required for back buffers, 
> I'll investigate.
>
> Axel
>
> On 31/01/2015 00:36, Marek Olšák wrote :
>> I recommend not using PIPE_BIND_TRANSFER_READ/WRITE. Transfers with
>> multisample textures should be supported, but the mapped texture is
>> always a resolved single-sample copy, so it's not really an MSAA
>> transfer.
>>
>> Marek
>>
>> On Fri, Jan 30, 2015 at 9:34 PM, Axel Davy <axel.davy at ens.fr> wrote:
>>> Signed-off-by: Axel Davy <axel.davy at ens.fr>
>>> ---
>>>   src/gallium/state_trackers/nine/adapter9.c  | 12 +++++++++---
>>>   src/gallium/state_trackers/nine/nine_pipe.h | 25 
>>> -------------------------
>>>   2 files changed, 9 insertions(+), 28 deletions(-)
>>>
>>> diff --git a/src/gallium/state_trackers/nine/adapter9.c 
>>> b/src/gallium/state_trackers/nine/adapter9.c
>>> index e9bb9c0..069cc03 100644
>>> --- a/src/gallium/state_trackers/nine/adapter9.c
>>> +++ b/src/gallium/state_trackers/nine/adapter9.c
>>> @@ -359,6 +359,7 @@ NineAdapter9_CheckDeviceMultiSampleType( struct 
>>> NineAdapter9 *This,
>>>       struct pipe_screen *screen;
>>>       HRESULT hr;
>>>       enum pipe_format pf;
>>> +    unsigned bind;
>>>
>>>       DBG("This=%p DeviceType=%s SurfaceFormat=%s Windowed=%i 
>>> MultiSampleType=%u "
>>>           "pQualityLevels=%p\n", This, 
>>> nine_D3DDEVTYPE_to_str(DeviceType),
>>> @@ -369,9 +370,14 @@ NineAdapter9_CheckDeviceMultiSampleType( struct 
>>> NineAdapter9 *This,
>>>       if (FAILED(hr))
>>>           return hr;
>>>
>>> -    pf = d3d9_to_pipe_format_checked_no_bind(screen, SurfaceFormat,
>>> -                                             PIPE_TEXTURE_2D,
>>> -                                             MultiSampleType, FALSE);
>>> +    if (depth_stencil_format(SurfaceFormat))
>>> +        bind = d3d9_get_pipe_depth_format_bindings(SurfaceFormat);
>>> +    else /* render-target */
>>> +        bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_TRANSFER_READ |
>>> +               PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_RENDER_TARGET;
>>> +
>>> +    pf = d3d9_to_pipe_format_checked(screen, SurfaceFormat, 
>>> PIPE_TEXTURE_2D,
>>> +                                     MultiSampleType, bind, FALSE);
>>>
>>>       if (pf == PIPE_FORMAT_NONE) {
>>>           DBG("%s with %u samples not available.\n",
>>> diff --git a/src/gallium/state_trackers/nine/nine_pipe.h 
>>> b/src/gallium/state_trackers/nine/nine_pipe.h
>>> index 7295bdf..17844d5 100644
>>> --- a/src/gallium/state_trackers/nine/nine_pipe.h
>>> +++ b/src/gallium/state_trackers/nine/nine_pipe.h
>>> @@ -309,31 +309,6 @@ d3d9_to_pipe_format_checked(struct pipe_screen 
>>> *screen,
>>>       return PIPE_FORMAT_NONE;
>>>   }
>>>
>>> -/* same that above, but determines binding flags */
>>> -static INLINE enum pipe_format
>>> -d3d9_to_pipe_format_checked_no_bind(struct pipe_screen *screen,
>>> -                                    D3DFORMAT format,
>>> -                                    enum pipe_texture_target target,
>>> -                                    unsigned sample_count,
>>> -                                    boolean srgb)
>>> -{
>>> -    enum pipe_format result;
>>> -    unsigned bindings;
>>> -
>>> -    result = d3d9_to_pipe_format_internal(format);
>>> -    if (result == PIPE_FORMAT_NONE)
>>> -        return PIPE_FORMAT_NONE;
>>> -
>>> -    bindings = util_format_is_depth_or_stencil(result) ?
>>> -        PIPE_BIND_DEPTH_STENCIL : PIPE_BIND_RENDER_TARGET;
>>> -    if (srgb)
>>> -        result = util_format_srgb(result);
>>> -
>>> -    if (format_check_internal(result))
>>> -        return result;
>>> -    return PIPE_FORMAT_NONE;
>>> -}
>>> -
>>>   static INLINE const char *
>>>   d3dformat_to_string(D3DFORMAT fmt)
>>>   {
>>> -- 
>>> 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