Rebase against 705c52691a4e8c6224cda5080fb88f257de5fd77.

This commit is contained in:
Sebastian Lackner
2016-12-06 21:52:20 +01:00
parent 5403b21e6a
commit 0d616d719e
18 changed files with 113 additions and 539 deletions

View File

@@ -1,4 +1,4 @@
From ff813bcf8c68aab5828a012d5242a72b8cdb6bc3 Mon Sep 17 00:00:00 2001
From 80118da171e87348ce58c22599202053fe95d3b6 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: wined3d: Create dummy 1d textures and surfaces.
@@ -9,7 +9,7 @@ Subject: wined3d: Create dummy 1d textures and surfaces.
2 files changed, 175 insertions(+)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 70474c6..4c6cc59 100644
index 611c61f..64dce8f 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -94,6 +94,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
@@ -21,11 +21,11 @@ index 70474c6..4c6cc59 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 7ab894b..e4ca54b 100644
index 90bd4a0..4ecd4ce 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1439,6 +1439,45 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
context, data, row_pitch, slice_pitch);
@@ -1448,6 +1448,45 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
context, box, data, row_pitch, slice_pitch);
}
+
@@ -33,11 +33,11 @@ index 7ab894b..e4ca54b 100644
+ * 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_const_bo_address *data,
+ 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)
+{
+ FIXME("texture %p, sub_resource_idx %u, context %p, data {%#x:%p}, row_pitch %#x, slice_pitch %#x: stub.\n",
+ texture, sub_resource_idx, context, data->buffer_object, data->addr, row_pitch, slice_pitch);
+ 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);
+}
+
+/* Context activation is done by the caller. */
@@ -68,9 +68,9 @@ index 7ab894b..e4ca54b 100644
+};
+
static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_const_bo_address *data,
unsigned int row_pitch, unsigned int slice_pitch)
@@ -1862,6 +1901,137 @@ static const struct wined3d_resource_ops texture_resource_ops =
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)
@@ -1882,6 +1921,137 @@ static const struct wined3d_resource_ops texture_resource_ops =
texture_resource_sub_resource_unmap,
};
@@ -208,7 +208,7 @@ index 7ab894b..e4ca54b 100644
static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3d_resource_desc *desc,
unsigned int layer_count, unsigned int level_count, DWORD flags, struct wined3d_device *device,
void *parent, const struct wined3d_parent_ops *parent_ops)
@@ -2789,6 +2959,10 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
@@ -2828,6 +2998,10 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
switch (desc->resource_type)
{
@@ -220,5 +220,5 @@ index 7ab894b..e4ca54b 100644
hr = texture_init(object, desc, layer_count, level_count, flags, device, parent, parent_ops);
break;
--
2.8.1
2.9.0

View File

@@ -1,34 +1,60 @@
From c80bcc9a789842075b2f68178a00525ac0cabcf7 Mon Sep 17 00:00:00 2001
From 736b314e18e7e4d3c7dc7732e2e38c6b8de7ddfd 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: wined3d: Implement uploading for 1d textures.
---
dlls/wined3d/texture.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
dlls/wined3d/device.c | 3 ++-
dlls/wined3d/texture.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 150f18f..c87b325 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4140,7 +4140,8 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
return;
}
- if (resource->type != WINED3D_RTYPE_TEXTURE_2D && resource->type != WINED3D_RTYPE_TEXTURE_3D)
+ if (resource->type != WINED3D_RTYPE_TEXTURE_1D &&
+ resource->type != WINED3D_RTYPE_TEXTURE_2D && resource->type != WINED3D_RTYPE_TEXTURE_3D)
{
FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type));
return;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 942337b..442ec27 100644
index 2b66b68..614b4cf 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1447,8 +1447,63 @@ static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int
const struct wined3d_context *context, const struct wined3d_const_bo_address *data,
@@ -1456,8 +1456,74 @@ 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)
{
- FIXME("texture %p, sub_resource_idx %u, context %p, data {%#x:%p}, row_pitch %#x, slice_pitch %#x: stub.\n",
- FIXME("texture %p, sub_resource_idx %u, context %p, box %p, data {%#x:%p}, row_pitch %#x, slice_pitch %#x: stub.\n",
+ struct wined3d_surface *surface = texture->sub_resources[sub_resource_idx].u.surface;
+ const struct wined3d_format *format = texture->resource.format;
+ unsigned int level = sub_resource_idx % texture->level_count;
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+ const void *mem = data->addr;
+ void *converted_mem = NULL;
+ unsigned int width;
+ unsigned int width, x, update_w;
+
+ TRACE("texture %p, sub_resource_idx %u, context %p, data {%#x:%p}, row_pitch %#x, slice_pitch %#x.\n",
texture, sub_resource_idx, context, data->buffer_object, data->addr, row_pitch, slice_pitch);
+ 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);
+
+ width = wined3d_texture_get_level_width(texture, level);
+
+ if (!box)
+ {
+ x = 0;
+ update_w = width;
+ }
+ else
+ {
+ x = box->left;
+ update_w = box->right - box->left;
+ }
+
+ if (format->convert)
+ {
+ unsigned int dst_row_pitch;
@@ -38,10 +64,10 @@ index 942337b..442ec27 100644
+ if (texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
+ ERR("Converting a block-based format.\n");
+
+ dst_row_pitch = width * format->conv_byte_count;
+ dst_row_pitch = update_w * format->conv_byte_count;
+
+ converted_mem = HeapAlloc(GetProcessHeap(), 0, dst_row_pitch);
+ format->convert(data->addr, converted_mem, row_pitch, slice_pitch, dst_row_pitch, dst_row_pitch, width, 1, 1);
+ format->convert(data->addr, converted_mem, row_pitch, slice_pitch, dst_row_pitch, dst_row_pitch, update_w, 1, 1);
+ mem = converted_mem;
+ }
+
@@ -55,14 +81,14 @@ index 942337b..442ec27 100644
+ {
+ gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, row_pitch / format->byte_count);
+
+ gl_info->gl_ops.gl.p_glTexSubImage2D(surface->texture_target, level, 0, surface->texture_layer, width, 1, format->glFormat, format->glType, mem);
+ gl_info->gl_ops.gl.p_glTexSubImage2D(surface->texture_target, level, x, surface->texture_layer, update_w, 1, format->glFormat, format->glType, mem);
+ checkGLcall("glTexSubImage2D");
+
+ gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ }
+ else
+ {
+ gl_info->gl_ops.gl.p_glTexSubImage1D(surface->texture_target, level, 0, width, format->glFormat, format->glType, mem);
+ gl_info->gl_ops.gl.p_glTexSubImage1D(surface->texture_target, level, x, update_w, format->glFormat, format->glType, mem);
+ checkGLcall("glTexSubImage1D");
+ }
+
@@ -77,5 +103,5 @@ index 942337b..442ec27 100644
/* Context activation is done by the caller. */
--
2.8.1
2.9.0

View File

@@ -1,4 +1,4 @@
From e73e778d3e02e0f4ce14f2f28811e14955d6fe9d Mon Sep 17 00:00:00 2001
From d0b2b377e3be8800332a32b7feb9e3c734a5b25a 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: wined3d: Implement loading from system memory and buffers to (s)rgb
@@ -9,10 +9,10 @@ Subject: wined3d: Implement loading from system memory and buffers to (s)rgb
1 file changed, 67 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 442ec27..72e2baf 100644
index 614b4cf..2accfe7 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1510,10 +1510,75 @@ static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int
@@ -1530,10 +1530,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 442ec27..72e2baf 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, &data, row_pitch, slice_pitch);
+ texture1d_upload_data(texture, sub_resource_idx, context, NULL, &data, row_pitch, slice_pitch);
+ }
+ 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, &data, row_pitch, slice_pitch);
+ texture1d_upload_data(texture, sub_resource_idx, context, NULL, &data, row_pitch, slice_pitch);
+ }
+ else
+ {
@@ -91,5 +91,5 @@ index 442ec27..72e2baf 100644
static void texture1d_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
--
2.8.1
2.9.0

View File

@@ -1,4 +1,4 @@
From 20fbaad604f6b979154d7b8d5b1e43a7f10f1d8d Mon Sep 17 00:00:00 2001
From b791c5d95a0526a52a4e9abef7e2809eaf6e6b2a 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:44:14 +0200
Subject: wined3d: Implement converting between (s)rgb 1d textures.
@@ -8,10 +8,10 @@ Subject: wined3d: Implement converting between (s)rgb 1d textures.
1 file changed, 31 insertions(+)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 48f3cde..9c17b45 100644
index 0b7c53d..74de20c 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1577,6 +1577,29 @@ static void texture1d_download_data(struct wined3d_texture *texture, unsigned in
@@ -1597,6 +1597,29 @@ static void texture1d_download_data(struct wined3d_texture *texture, unsigned in
}
/* Context activation is done by the caller. */
@@ -31,7 +31,7 @@ index 48f3cde..9c17b45 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,
+ texture1d_upload_data(texture, sub_resource_idx, context, NULL,
+ wined3d_const_bo_address(&data), row_pitch, slice_pitch);
+
+ HeapFree(GetProcessHeap(), 0, data.addr);
@@ -41,9 +41,9 @@ index 48f3cde..9c17b45 100644
static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD location)
{
@@ -1632,6 +1655,14 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
@@ -1652,6 +1675,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, &data, row_pitch, slice_pitch);
texture1d_upload_data(texture, sub_resource_idx, context, NULL, &data, row_pitch, slice_pitch);
}
+ else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
+ {
@@ -57,5 +57,5 @@ index 48f3cde..9c17b45 100644
{
FIXME("Implement 1d texture loading from %s.\n", wined3d_debug_location(sub_resource->locations));
--
2.8.1
2.9.0