On Mon, 21 Oct 2019 at 15:53, Paul Gofman gofmanp@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.
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.