Rebase against cfb67712ce35c05d6b7d27ece84c9192e66290b4

This commit is contained in:
Alistair Leslie-Hughes
2018-03-21 11:18:03 +11:00
parent b05c091935
commit e38104d365
10 changed files with 84 additions and 380 deletions

View File

@@ -1,15 +1,15 @@
From 011a76f062774cfa6a4f6081d3ab773ffbb9f93f Mon Sep 17 00:00:00 2001
From 1cf2b72c0c5760e6cae88c0f5a0327193899f591 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 Aug 2016 19:24:47 +0200
Subject: [PATCH] wined3d: Create dummy 1d textures and surfaces.
---
dlls/wined3d/resource.c | 1 +
dlls/wined3d/texture.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 168 insertions(+)
dlls/wined3d/texture.c | 163 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 164 insertions(+)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 97f7aec4e12..f3402179acf 100644
index 8968c164ed5..bcd06103bde 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -75,6 +75,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
@@ -21,23 +21,25 @@ index 97f7aec4e12..f3402179acf 100644
{WINED3D_RTYPE_TEXTURE_2D, 0, WINED3D_GL_RES_TYPE_TEX_RECT},
{WINED3D_RTYPE_TEXTURE_2D, 0, WINED3D_GL_RES_TYPE_RB},
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 9fc0d22ed41..73874725ca6 100644
index 907d5bec69c..71f59d74258 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1715,6 +1715,40 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
context, box, data, row_pitch, slice_pitch);
@@ -1758,6 +1758,36 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
format, src_box, data, row_pitch, slice_pitch, dst_x, dst_y, dst_z, srgb);
}
+
+/* This call just uploads data, the caller is responsible for binding the
+ * correct texture. */
+/* Context activation is done by the caller. */
+static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+ const struct wined3d_context *context, const struct wined3d_box *box, const struct wined3d_const_bo_address *data,
+ unsigned int row_pitch, unsigned int slice_pitch)
+ const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *src_box,
+ const struct wined3d_const_bo_address *data, unsigned int src_row_pitch, unsigned int src_slice_pitch,
+ unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, BOOL srgb)
+{
+ FIXME("texture %p, sub_resource_idx %u, context %p, box %p, data {%#x:%p}, row_pitch %#x, slice_pitch %#x: stub.\n",
+ texture, sub_resource_idx, context, box, data->buffer_object, data->addr, row_pitch, slice_pitch);
+ FIXME("texture %p, sub_resource_idx %u, context %p, format %s, src_box %s, data {%#x:%p}, "
+ "src_row_pitch %#x, src_slice_pitch %#x, dst_x %u, dst_y %u, dst_z %u, srgb %#x.\n",
+ texture, sub_resource_idx, context, debug_d3dformat(format->id), debug_box(src_box),
+ data->buffer_object, data->addr, src_row_pitch, src_slice_pitch, dst_x, dst_y, dst_z, srgb);
+}
+
+/* Context activation is done by the caller. */
@@ -50,22 +52,16 @@ index 9fc0d22ed41..73874725ca6 100644
+ return FALSE;
+}
+
+static void texture1d_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
+{
+ FIXME("stub.\n");
+}
+
+static const struct wined3d_texture_ops texture1d_ops =
+{
+ texture1d_upload_data,
+ texture1d_load_location,
+ texture1d_prepare_texture
+ texture1d_load_location
+};
+
static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_box *box,
const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch)
@@ -2411,6 +2445,135 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
/* This call just uploads data, the caller is responsible for binding the
* correct texture. */
/* Context activation is done by the caller. */
@@ -2534,6 +2564,135 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
return WINED3D_OK;
}
@@ -201,7 +197,7 @@ index 9fc0d22ed41..73874725ca6 100644
/* This call just uploads data, the caller is responsible for binding the
* correct texture. */
/* Context activation is done by the caller. */
@@ -2985,6 +3148,10 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
@@ -3073,6 +3232,10 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
switch (desc->resource_type)
{

View File

@@ -1,81 +1,48 @@
From 47673255ab05a81d7fd5e917d7ffc749c269af29 Mon Sep 17 00:00:00 2001
From 5a362a78214110a3671d6aeab8d60f79164c6f28 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 22:22:26 +0200
Subject: [PATCH] wined3d: Implement preparation for 1d textures.
---
dlls/wined3d/texture.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 57 insertions(+), 1 deletion(-)
dlls/wined3d/texture.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 5685acc..718c939 100644
index 71f59d74258..6957e01e556 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1825,7 +1825,63 @@ 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("stub.\n");
+ const struct wined3d_format *format = texture->resource.format;
+ unsigned int sub_count = texture->level_count * texture->layer_count;
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+ unsigned int width;
+ GLenum internal;
+
+ wined3d_texture_bind_and_dirtify(texture, context, srgb);
+
+ if (srgb)
+ internal = format->glGammaInternal;
+ else if (texture->resource.usage & WINED3DUSAGE_RENDERTARGET
+ && wined3d_resource_is_offscreen(&texture->resource))
+ internal = format->rtInternal;
+ else
+ internal = format->glInternal;
+
+ if (wined3d_texture_use_immutable_storage(texture, gl_info))
+ {
+ width = wined3d_texture_get_level_width(texture, 0);
+
+ if (texture->target == GL_TEXTURE_1D_ARRAY)
+ {
+ GL_EXTCALL(glTexStorage2D(texture->target, texture->level_count, internal, width, texture->layer_count));
+ checkGLcall("glTexStorage2D");
+ }
+ else
+ {
+ GL_EXTCALL(glTexStorage1D(texture->target, texture->level_count, internal, width));
+ checkGLcall("glTexStorage1D");
+ }
+ }
+ else
+ {
+ unsigned int i;
+
+ for (i = 0; i < sub_count; ++i)
+ {
+ GLenum target;
+ unsigned int level = i % texture->level_count;
+
+ width = wined3d_texture_get_level_width(texture, level);
+ target = wined3d_texture_get_sub_resource_target(texture, i);
+
+ if (texture->target == GL_TEXTURE_1D_ARRAY)
@@ -477,6 +477,18 @@ static void wined3d_texture_allocate_gl_mutable_storage(struct wined3d_texture *
format->glFormat, format->glType, NULL));
checkGLcall("glTexImage3D");
}
+ else if (texture->target == GL_TEXTURE_1D_ARRAY)
+ {
+ gl_info->gl_ops.gl.p_glTexImage2D(target, level,
+ internal, width, texture->layer_count, 0, format->glFormat, format->glType, NULL);
+ gl_info->gl_ops.gl.p_glTexImage2D(target, level, gl_internal_format,
+ width, height, 0, format->glFormat, format->glType, NULL);
+ checkGLcall("glTexImage2D");
+ }
+ else
+ else if (texture->target == GL_TEXTURE_1D)
+ {
+ gl_info->gl_ops.gl.p_glTexImage1D(target, level,
+ internal, width, 0, format->glFormat, format->glType, NULL);
+ gl_internal_format, width, 0, format->glFormat, format->glType, NULL);
+ checkGLcall("glTexImage1D");
+ }
+ }
+ }
}
static const struct wined3d_texture_ops texture1d_ops =
else
{
gl_info->gl_ops.gl.p_glTexImage2D(target, level, gl_internal_format,
@@ -514,6 +526,12 @@ static void wined3d_texture_allocate_gl_immutable_storage(struct wined3d_texture
GL_EXTCALL(glTexStorage3DMultisample(texture->target, samples,
gl_internal_format, width, height, texture->layer_count, GL_FALSE));
break;
+ case GL_TEXTURE_1D:
+ GL_EXTCALL(glTexStorage1D(texture->target, texture->level_count, gl_internal_format, width));
+ break;
+ case GL_TEXTURE_1D_ARRAY:
+ GL_EXTCALL(glTexStorage2D(texture->target, texture->level_count, gl_internal_format, width, height));
+ break;
default:
GL_EXTCALL(glTexStorage2D(texture->target, texture->level_count,
gl_internal_format, width, height));
--
1.9.1
2.16.2

View File

@@ -1,15 +1,15 @@
From d0d4a459ee524b4c91fa4591386f7f5e7af8a3dc Mon Sep 17 00:00:00 2001
From af097346c9265b21cc2f823cdd347a976fa7c09b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 22:25:20 +0200
Subject: [PATCH] wined3d: Implement uploading for 1d textures.
---
dlls/wined3d/device.c | 3 ++-
dlls/wined3d/texture.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 71 insertions(+), 2 deletions(-)
dlls/wined3d/texture.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 70 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index bdc551e..bb61f78 100644
index bdc551e5054..bb61f78d62d 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4272,7 +4272,8 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -23,15 +23,14 @@ index bdc551e..bb61f78 100644
struct wined3d_texture *texture = texture_from_resource(resource);
unsigned int level;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 718c939..c19849f 100644
index 6957e01e556..fd95963b7dc 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1809,8 +1809,76 @@ static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int
const struct wined3d_context *context, const struct wined3d_box *box, const struct wined3d_const_bo_address *data,
unsigned int row_pitch, unsigned int slice_pitch)
@@ -1784,10 +1784,77 @@ static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int
const struct wined3d_const_bo_address *data, unsigned int src_row_pitch, unsigned int src_slice_pitch,
unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, BOOL srgb)
{
- FIXME("texture %p, sub_resource_idx %u, context %p, box %p, data {%#x:%p}, row_pitch %#x, slice_pitch %#x: stub.\n",
+ const struct wined3d_format *format = texture->resource.format;
- FIXME("texture %p, sub_resource_idx %u, context %p, format %s, src_box %s, data {%#x:%p}, "
+ unsigned int level = sub_resource_idx % texture->level_count;
+ unsigned int layer = sub_resource_idx / texture->level_count;
+ const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -40,20 +39,22 @@ index 718c939..c19849f 100644
+ unsigned int width, x, update_w;
+ GLenum target;
+
+ TRACE("texture %p, sub_resource_idx %u, context %p, box %p, data {%#x:%p}, row_pitch %#x, slice_pitch %#x.\n",
texture, sub_resource_idx, context, box, data->buffer_object, data->addr, row_pitch, slice_pitch);
+ TRACE("texture %p, sub_resource_idx %u, context %p, format %s, src_box %s, data {%#x:%p}, "
"src_row_pitch %#x, src_slice_pitch %#x, dst_x %u, dst_y %u, dst_z %u, srgb %#x.\n",
texture, sub_resource_idx, context, debug_d3dformat(format->id), debug_box(src_box),
data->buffer_object, data->addr, src_row_pitch, src_slice_pitch, dst_x, dst_y, dst_z, srgb);
+
+ width = wined3d_texture_get_level_width(texture, level);
+
+ if (!box)
+ if (!src_box)
+ {
+ x = 0;
+ update_w = width;
+ }
+ else
+ {
+ x = box->left;
+ update_w = box->right - box->left;
+ x = src_box->left;
+ update_w = src_box->right - src_box->left;
+ }
+
+ if (format->upload)
@@ -68,7 +69,7 @@ index 718c939..c19849f 100644
+ dst_row_pitch = update_w * format->conv_byte_count;
+
+ converted_mem = HeapAlloc(GetProcessHeap(), 0, dst_row_pitch);
+ format->upload(data->addr, converted_mem, row_pitch, slice_pitch, dst_row_pitch, dst_row_pitch, update_w, 1, 1);
+ format->upload(data->addr, converted_mem, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_row_pitch, update_w, 1, 1);
+ mem = converted_mem;
+ }
+
@@ -81,7 +82,7 @@ index 718c939..c19849f 100644
+ target = wined3d_texture_get_sub_resource_target(texture, sub_resource_idx);
+ if (target == GL_TEXTURE_1D_ARRAY)
+ {
+ gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, row_pitch / format->byte_count);
+ gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, src_row_pitch / format->byte_count);
+
+ gl_info->gl_ops.gl.p_glTexSubImage2D(target, level, x, layer, update_w, 1, format->glFormat, format->glType, mem);
+ checkGLcall("glTexSubImage2D");
@@ -105,5 +106,5 @@ index 718c939..c19849f 100644
/* Context activation is done by the caller. */
--
1.9.1
2.16.2

View File

@@ -1,18 +1,18 @@
From 001138256720603e42416e17d89f23b871857624 Mon Sep 17 00:00:00 2001
From 0e991598b502b33723a96212a3509c37c8054ab5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Aug 2016 22:38:47 +0200
Subject: [PATCH] wined3d: Implement loading from system memory and buffers to
(s)rgb 1d textures.
Subject: [PATCH 1/3] wined3d: Implement loading from system memory and buffers
to (s)rgb 1d textures.
---
dlls/wined3d/texture.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 67 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index c19849f..40ce11b 100644
index fd95963b7dc..6c8e09db4f2 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1885,10 +1885,75 @@ static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int
@@ -1861,10 +1861,75 @@ static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int
static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD location)
{
@@ -61,14 +61,14 @@ index c19849f..40ce11b 100644
+ data.addr += sub_resource->offset;
+ wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB);
+ wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
+ texture1d_upload_data(texture, sub_resource_idx, context, NULL, &data, row_pitch, slice_pitch);
+ texture1d_upload_data(texture, sub_resource_idx, context, NULL, NULL, &data, row_pitch, slice_pitch, 0, 0, 0, FALSE);
+ }
+ else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
+ {
+ struct wined3d_const_bo_address data = {sub_resource->buffer_object, NULL};
+ wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB);
+ wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
+ texture1d_upload_data(texture, sub_resource_idx, context, NULL, &data, row_pitch, slice_pitch);
+ texture1d_upload_data(texture, sub_resource_idx, context, NULL, NULL, &data, row_pitch, slice_pitch, 0, 0, 0, FALSE);
+ }
+ else
+ {
@@ -89,7 +89,7 @@ index c19849f..40ce11b 100644
+ return TRUE;
}
static void texture1d_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
static const struct wined3d_texture_ops texture1d_ops =
--
1.9.1
2.16.2

View File

@@ -31,8 +31,8 @@ index 81a638e..0755d4d 100644
+ wined3d_texture_bind_and_dirtify(texture, context, !dest_is_srgb);
+ texture1d_download_data(texture, sub_resource_idx, context, &data);
+ wined3d_texture_bind_and_dirtify(texture, context, dest_is_srgb);
+ texture1d_upload_data(texture, sub_resource_idx, context, NULL,
+ wined3d_const_bo_address(&data), row_pitch, slice_pitch);
+ texture1d_upload_data(texture, sub_resource_idx, context, NULL, NULL,
+ wined3d_const_bo_address(&data), row_pitch, slice_pitch, 0, 0, 0, FALSE);
+
+ HeapFree(GetProcessHeap(), 0, data.addr);
+}
@@ -43,7 +43,7 @@ index 81a638e..0755d4d 100644
{
@@ -2009,6 +2032,14 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
texture1d_upload_data(texture, sub_resource_idx, context, NULL, &data, row_pitch, slice_pitch);
texture1d_upload_data(texture, sub_resource_idx, context, NULL, NULL, &data, row_pitch, slice_pitch, 0, 0, 0, FALSE);
}
+ else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
+ {