Module: wine Branch: master Commit: b5f1d3085f49b57b2d145c04522258bc428133eb URL: https://source.winehq.org/git/wine.git/?a=commit;h=b5f1d3085f49b57b2d145c045...
Author: Józef Kucia jkucia@codeweavers.com Date: Tue Feb 6 11:40:06 2018 +0100
wined3d: Factor out wined3d_texture_get_gl_sample_count() function.
For creating multisample textures.
Signed-off-by: Józef Kucia jkucia@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/wined3d/texture.c | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 29c4963..ed1ca21 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -456,6 +456,31 @@ static void gltexture_delete(struct wined3d_device *device, const struct wined3d tex->name = 0; }
+static unsigned int wined3d_texture_get_gl_sample_count(const struct wined3d_texture *texture) +{ + const struct wined3d_format *format = texture->resource.format; + + /* We advertise as many WINED3D_MULTISAMPLE_NON_MASKABLE quality + * levels as the count of advertised multisample types for the texture + * format. */ + if (texture->resource.multisample_type == WINED3D_MULTISAMPLE_NON_MASKABLE) + { + unsigned int i, count = 0; + + for (i = 0; i < sizeof(format->multisample_types) * CHAR_BIT; ++i) + { + if (format->multisample_types & 1u << i) + { + if (texture->resource.multisample_quality == count++) + break; + } + } + return i + 1; + } + + return texture->resource.multisample_type; +} + /* Context activation is done by the caller. */ /* The caller is responsible for binding the correct texture. */ static void wined3d_texture_allocate_gl_mutable_storage(struct wined3d_texture *texture, @@ -1484,27 +1509,7 @@ static void wined3d_texture_prepare_rb(struct wined3d_texture *texture, * AMD have a similar feature called Enhanced Quality Anti-Aliasing * (EQAA), but it does not have an equivalent OpenGL extension. */
- /* We advertise as many WINED3D_MULTISAMPLE_NON_MASKABLE quality - * levels as the count of advertised multisample types for the texture - * format. */ - if (texture->resource.multisample_type == WINED3D_MULTISAMPLE_NON_MASKABLE) - { - unsigned int i, count = 0; - - for (i = 0; i < sizeof(format->multisample_types) * 8; ++i) - { - if (format->multisample_types & 1u << i) - { - if (texture->resource.multisample_quality == count++) - break; - } - } - samples = i + 1; - } - else - { - samples = texture->resource.multisample_type; - } + samples = wined3d_texture_get_gl_sample_count(texture);
gl_info->fbo_ops.glGenRenderbuffers(1, &texture->rb_multisample); gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, texture->rb_multisample);