[PATCH 3/8] wined3d: Keep track of renderbuffer capabilities.

Henri Verbeet hverbeet at gmail.com
Mon May 25 03:27:28 CDT 2015


On 22 May 2015 at 10:11, Stefan Dösinger <stefan at codeweavers.com> wrote:
> @@ -1145,18 +1151,21 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
>      /* WINED3DUSAGE_DEPTHSTENCIL needs WINED3DFMT_FLAG_DEPTH or WINED3DFMT_FLAG_STENCIL, not both. */
>
>      if ((format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & required_flags) == required_flags
> -            && (!(desc->usage & WINED3DUSAGE_DEPTHSTENCIL) || (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & ds_flags))
> +            && check_ds_support(format, WINED3D_GL_RES_TYPE_TEX_2D, desc->usage)
>              && (gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]
>              || (desc->width == pow2_width && desc->height == pow2_height)))
>          gl_type = WINED3D_GL_RES_TYPE_TEX_2D;
>      else if ((format->flags[WINED3D_GL_RES_TYPE_TEX_RECT] & required_flags) == required_flags
> -            && (!(desc->usage & WINED3DUSAGE_DEPTHSTENCIL) || (format->flags[WINED3D_GL_RES_TYPE_TEX_RECT] & ds_flags)))
> +            && check_ds_support(format, WINED3D_GL_RES_TYPE_TEX_RECT, desc->usage))
>          gl_type = WINED3D_GL_RES_TYPE_TEX_RECT;
> +    else if ((format->flags[WINED3D_GL_RES_TYPE_RB] & required_flags) == required_flags
> +            && check_ds_support(format, WINED3D_GL_RES_TYPE_RB, desc->usage))
> +        gl_type = WINED3D_GL_RES_TYPE_RB;
>      else
>          gl_type = WINED3D_GL_RES_TYPE_TEX_2D; /* No error, may be SCRATCH pool or emulated conditional np2. */
>
This is kind of ok because the existing code is like this, but notice
the similarity to some of the code in resource_init(). In fact, is
there any reason the caller needs to pass "gl_type" to resource_init()
instead of letting it figure it out on its own?

> -static void delete_fbo_attachment(const struct wined3d_gl_info *gl_info)
> +static void delete_fbo_attachment(const struct wined3d_gl_info *gl_info,
> +        enum wined3d_gl_resource_type d3d_type, GLuint *object)
>  {
> -    gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
> -            GL_TEXTURE_2D, 0, 0);
> +    switch (d3d_type)
> +    {
> +        case WINED3D_GL_RES_TYPE_TEX_1D:
> +        case WINED3D_GL_RES_TYPE_TEX_2D:
> +        case WINED3D_GL_RES_TYPE_TEX_RECT:
> +        case WINED3D_GL_RES_TYPE_TEX_3D:
> +        case WINED3D_GL_RES_TYPE_TEX_CUBE:
> +            gl_info->gl_ops.gl.p_glDeleteTextures(1, object);
> +            break;
> +
> +        case WINED3D_GL_RES_TYPE_RB:
> +            gl_info->fbo_ops.glDeleteRenderbuffers(1, object);
> +            break;
> +
> +        case WINED3D_GL_RES_TYPE_BUFFER:
> +        case WINED3D_GL_RES_TYPE_COUNT:
> +            break;
> +    }
>  }
Why is "object" a pointer?



More information about the wine-devel mailing list