[PATCH] wined3d: Issue texture barrier before using a texture attached to FBO.

Paul Gofman gofmanp at gmail.com
Mon Oct 21 07:55:55 CDT 2019


On 10/21/19 15:47, Henri Verbeet wrote:
> On Mon, 21 Oct 2019 at 15:53, Paul Gofman <gofmanp at gmail.com> wrote:
>> +static void context_texture_check_fbo_attached(struct wined3d_context *context,
>> +        const struct wined3d_state *state, const struct wined3d_resource *resource)
>> +{
>> +    struct wined3d_rendertarget_view * const *rts = &state->fb->render_targets[0];
>> +    unsigned int i;
>> +
>> +    for (i = 0; i < MAX_RENDER_TARGET_VIEWS; ++i)
>> +        if (rts[i] && rts[i]->resource == resource)
>> +        {
>> +            context->uses_fbo_attached_resources = 1;
>> +            return;
>> +        }
> This can only happen if the resource has WINED3D_BIND_RENDER_TARGET.
>
>> +    if (state->fb->depth_stencil && state->fb->depth_stencil->resource == resource)
>> +        context->uses_fbo_attached_resources = 1;
> And this can only happen for resources with
> WINED3D_BIND_DEPTH_STENCIL. It may not be worth checking for that
> individually since it's only a single bind point, but if the resource
> has neither WINED3D_BIND_RENDER_TARGET nor WINED3D_BIND_DEPTH_STENCIL,
> you wouldn't need to call context_texture_check_fbo_attached() at all.
Yeah, sure, I will improve this.
>
> Note that this doesn't handle resources bound through SRVs. I don't
> know for sure whether it should, but it doesn't seem unlikely.

I did not test this with d3d10+ yet, but I suspect it might behave
differently, so I intentionally tried not to touch it behaviour here. I 
read somewhere that d3d11 silently unbinds texture if it is bound to
output through RTV, but this of course need to verified.




More information about the wine-devel mailing list