[PATCH v2 5/9] wined3d: Implement texture1d_prepare_texture().

Sven Hesse shesse at codeweavers.com
Wed Jan 3 09:18:36 CST 2018


Signed-off-by: Sven Hesse <shesse at codeweavers.com>
---
 dlls/wined3d/texture.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 03871d7158..ac441fe677 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1643,7 +1643,30 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
 
 static void texture1d_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
 {
-    FIXME("Not implemented.\n");
+    const struct wined3d_format *format = texture->resource.format;
+    GLenum internal = srgb ? format->glGammaInternal : format->glInternal;
+    unsigned int sub_count = texture->level_count * texture->layer_count;
+    const struct wined3d_gl_info *gl_info = context->gl_info;
+    unsigned int i;
+
+    wined3d_texture_bind_and_dirtify(texture, context, srgb);
+
+    if (wined3d_texture_use_immutable_storage(texture, gl_info))
+    {
+        GL_EXTCALL(glTexStorage1D(GL_TEXTURE_1D, texture->level_count, internal,
+                wined3d_texture_get_level_width(texture, 0)));
+        checkGLcall("glTexStorage1D");
+    }
+    else
+    {
+        for (i = 0; i < sub_count; ++i)
+        {
+            gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, i, internal,
+                    wined3d_texture_get_level_width(texture, i),
+                    0, format->glFormat, format->glType, NULL);
+            checkGLcall("glTexImage1D");
+        }
+    }
 }
 
 static void texture1d_cleanup_sub_resources(struct wined3d_texture *texture)
-- 
2.15.1




More information about the wine-devel mailing list