You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Added patch for d3d11 1d textures.
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
From 880bec01dc7a6eac676233e4c3817371f6145f56 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Tue, 23 Aug 2016 22:54:14 +0200
|
||||
Subject: wined3d: Create dummy 1d textures.
|
||||
|
||||
---
|
||||
dlls/wined3d/context.c | 14 ++++++++++++++
|
||||
dlls/wined3d/device.c | 28 ++++++++++++++++++++++++++++
|
||||
dlls/wined3d/wined3d_private.h | 2 ++
|
||||
3 files changed, 44 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
|
||||
index f5311af..74c3a49 100644
|
||||
--- a/dlls/wined3d/context.c
|
||||
+++ b/dlls/wined3d/context.c
|
||||
@@ -1521,6 +1521,9 @@ static void bind_dummy_textures(const struct wined3d_device *device, const struc
|
||||
GL_EXTCALL(glActiveTexture(GL_TEXTURE0 + i));
|
||||
checkGLcall("glActiveTexture");
|
||||
|
||||
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, device->dummy_texture_1d[i]);
|
||||
+ checkGLcall("glBindTexture");
|
||||
+
|
||||
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, device->dummy_texture_2d[i]);
|
||||
checkGLcall("glBindTexture");
|
||||
|
||||
@@ -1544,6 +1547,9 @@ static void bind_dummy_textures(const struct wined3d_device *device, const struc
|
||||
|
||||
if (gl_info->supported[EXT_TEXTURE_ARRAY])
|
||||
{
|
||||
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, device->dummy_texture_1d_array[i]);
|
||||
+ checkGLcall("glBindTexture");
|
||||
+
|
||||
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, device->dummy_texture_2d_array[i]);
|
||||
checkGLcall("glBindTexture");
|
||||
}
|
||||
@@ -2392,6 +2398,14 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint
|
||||
case GL_NONE:
|
||||
/* nothing to do */
|
||||
break;
|
||||
+ case GL_TEXTURE_1D:
|
||||
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, device->dummy_texture_1d[unit]);
|
||||
+ checkGLcall("glBindTexture");
|
||||
+ break;
|
||||
+ case GL_TEXTURE_1D_ARRAY:
|
||||
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, device->dummy_texture_1d_array[unit]);
|
||||
+ checkGLcall("glBindTexture");
|
||||
+ break;
|
||||
case GL_TEXTURE_2D:
|
||||
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, device->dummy_texture_2d[unit]);
|
||||
checkGLcall("glBindTexture");
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index c2a8c55..1445399 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -702,6 +702,17 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
|
||||
/* Make appropriate texture active */
|
||||
context_active_texture(context, gl_info, i);
|
||||
|
||||
+ gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_texture_1d[i]);
|
||||
+ checkGLcall("glGenTextures");
|
||||
+ TRACE("Dummy 1D texture %u given name %u.\n", i, device->dummy_texture_1d[i]);
|
||||
+
|
||||
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, device->dummy_texture_1d[i]);
|
||||
+ checkGLcall("glBindTexture");
|
||||
+
|
||||
+ gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA8, 1, 0,
|
||||
+ GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color);
|
||||
+ checkGLcall("glTexImage1D");
|
||||
+
|
||||
gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_texture_2d[i]);
|
||||
checkGLcall("glGenTextures");
|
||||
TRACE("Dummy 2D texture %u given name %u.\n", i, device->dummy_texture_2d[i]);
|
||||
@@ -760,6 +771,17 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
|
||||
|
||||
if (gl_info->supported[EXT_TEXTURE_ARRAY])
|
||||
{
|
||||
+ gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_texture_1d_array[i]);
|
||||
+ checkGLcall("glGenTextures");
|
||||
+ TRACE("Dummy 1D array texture %u given name %u.\n", i, device->dummy_texture_1d_array[i]);
|
||||
+
|
||||
+ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, device->dummy_texture_1d_array[i]);
|
||||
+ checkGLcall("glBindTexture");
|
||||
+
|
||||
+ gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_1D_ARRAY, 0, GL_RGBA8, 1, 1, 0,
|
||||
+ GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color);
|
||||
+ checkGLcall("glTexImage2D");
|
||||
+
|
||||
gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_texture_2d_array[i]);
|
||||
checkGLcall("glGenTextures");
|
||||
TRACE("Dummy 2D array texture %u given name %u.\n", i, device->dummy_texture_2d_array[i]);
|
||||
@@ -783,6 +805,9 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w
|
||||
{
|
||||
gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_2d_array);
|
||||
checkGLcall("glDeleteTextures(count, device->dummy_texture_2d_array)");
|
||||
+
|
||||
+ gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_1d_array);
|
||||
+ checkGLcall("glDeleteTextures(count, device->dummy_texture_1d_array)");
|
||||
}
|
||||
|
||||
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
|
||||
@@ -806,6 +831,9 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w
|
||||
gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_2d);
|
||||
checkGLcall("glDeleteTextures(count, device->dummy_texture_2d)");
|
||||
|
||||
+ gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_1d);
|
||||
+ checkGLcall("glDeleteTextures(count, device->dummy_texture_1d)");
|
||||
+
|
||||
memset(device->dummy_texture_2d_array, 0, count * sizeof(*device->dummy_texture_2d_array));
|
||||
memset(device->dummy_texture_cube, 0, count * sizeof(*device->dummy_texture_cube));
|
||||
memset(device->dummy_texture_3d, 0, count * sizeof(*device->dummy_texture_3d));
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index e329962..dbb0a47 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -2481,10 +2481,12 @@ struct wined3d_device
|
||||
struct wined3d_texture *logo_texture;
|
||||
|
||||
/* Textures for when no other textures are mapped */
|
||||
+ GLuint dummy_texture_1d[MAX_COMBINED_SAMPLERS];
|
||||
GLuint dummy_texture_2d[MAX_COMBINED_SAMPLERS];
|
||||
GLuint dummy_texture_rect[MAX_COMBINED_SAMPLERS];
|
||||
GLuint dummy_texture_3d[MAX_COMBINED_SAMPLERS];
|
||||
GLuint dummy_texture_cube[MAX_COMBINED_SAMPLERS];
|
||||
+ GLuint dummy_texture_1d_array[MAX_COMBINED_SAMPLERS];
|
||||
GLuint dummy_texture_2d_array[MAX_COMBINED_SAMPLERS];
|
||||
|
||||
/* Default sampler used to emulate the direct resource access without using wined3d_sampler */
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,41 @@
|
||||
From 487882af653cb228767391dd106d74f75f39f621 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Tue, 23 Aug 2016 22:47:56 +0200
|
||||
Subject: wined3d: Add 1d texture resource type.
|
||||
|
||||
---
|
||||
dlls/wined3d/utils.c | 1 +
|
||||
include/wine/wined3d.h | 5 +++--
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
|
||||
index ee3af83..4e00aad 100644
|
||||
--- a/dlls/wined3d/utils.c
|
||||
+++ b/dlls/wined3d/utils.c
|
||||
@@ -3926,6 +3926,7 @@ const char *debug_d3dresourcetype(enum wined3d_resource_type resource_type)
|
||||
{
|
||||
#define WINED3D_TO_STR(x) case x: return #x
|
||||
WINED3D_TO_STR(WINED3D_RTYPE_BUFFER);
|
||||
+ WINED3D_TO_STR(WINED3D_RTYPE_TEXTURE_1D);
|
||||
WINED3D_TO_STR(WINED3D_RTYPE_TEXTURE_2D);
|
||||
WINED3D_TO_STR(WINED3D_RTYPE_TEXTURE_3D);
|
||||
#undef WINED3D_TO_STR
|
||||
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
|
||||
index 81dffea..1cf927a 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -667,8 +667,9 @@ enum wined3d_texture_filter_type
|
||||
enum wined3d_resource_type
|
||||
{
|
||||
WINED3D_RTYPE_BUFFER = 1,
|
||||
- WINED3D_RTYPE_TEXTURE_2D = 2,
|
||||
- WINED3D_RTYPE_TEXTURE_3D = 3,
|
||||
+ WINED3D_RTYPE_TEXTURE_1D = 2,
|
||||
+ WINED3D_RTYPE_TEXTURE_2D = 3,
|
||||
+ WINED3D_RTYPE_TEXTURE_3D = 4,
|
||||
};
|
||||
|
||||
enum wined3d_pool
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,57 @@
|
||||
From ff312baa8a0e884b148cba79f8a56f33312108dc 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:19:25 +0200
|
||||
Subject: wined3d: Add is_power_of_two helper function.
|
||||
|
||||
---
|
||||
dlls/wined3d/texture.c | 20 +++++++-------------
|
||||
1 file changed, 7 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index d2b1be5..7ab894b 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -101,6 +101,11 @@ static DWORD wined3d_resource_access_from_location(DWORD location)
|
||||
}
|
||||
}
|
||||
|
||||
+static BOOL is_power_of_two(UINT x)
|
||||
+{
|
||||
+ return (x != 0) && !(x & (x - 1));
|
||||
+}
|
||||
+
|
||||
static void wined3d_texture_evict_sysmem(struct wined3d_texture *texture)
|
||||
{
|
||||
struct wined3d_texture_sub_resource *sub_resource;
|
||||
@@ -1156,7 +1161,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
|
||||
sub_resource->size = texture->slice_pitch;
|
||||
sub_resource->locations = WINED3D_LOCATION_DISCARDED;
|
||||
|
||||
- if (((width & (width - 1)) || (height & (height - 1))) && !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]
|
||||
+ if ((!is_power_of_two(width) || !is_power_of_two(height)) && !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]
|
||||
&& !gl_info->supported[ARB_TEXTURE_RECTANGLE] && !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
|
||||
{
|
||||
texture->flags |= WINED3D_TEXTURE_COND_NP2_EMULATED;
|
||||
@@ -2460,18 +2465,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
|
||||
|
||||
if (!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO])
|
||||
{
|
||||
- UINT pow2_w, pow2_h, pow2_d;
|
||||
- pow2_w = 1;
|
||||
- while (pow2_w < desc->width)
|
||||
- pow2_w <<= 1;
|
||||
- pow2_h = 1;
|
||||
- while (pow2_h < desc->height)
|
||||
- pow2_h <<= 1;
|
||||
- pow2_d = 1;
|
||||
- while (pow2_d < desc->depth)
|
||||
- pow2_d <<= 1;
|
||||
-
|
||||
- if (pow2_w != desc->width || pow2_h != desc->height || pow2_d != desc->depth)
|
||||
+ if (!is_power_of_two(desc->width) || !is_power_of_two(desc->height) || !is_power_of_two(desc->depth))
|
||||
{
|
||||
if (desc->pool == WINED3D_POOL_SCRATCH)
|
||||
{
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,224 @@
|
||||
From ff813bcf8c68aab5828a012d5242a72b8cdb6bc3 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.
|
||||
|
||||
---
|
||||
dlls/wined3d/resource.c | 1 +
|
||||
dlls/wined3d/texture.c | 174 ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 175 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
|
||||
index 70474c6..4c6cc59 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 *
|
||||
resource_types[] =
|
||||
{
|
||||
{WINED3D_RTYPE_BUFFER, 0, WINED3D_GL_RES_TYPE_BUFFER},
|
||||
+ {WINED3D_RTYPE_TEXTURE_1D, 0, WINED3D_GL_RES_TYPE_TEX_1D},
|
||||
{WINED3D_RTYPE_TEXTURE_2D, 0, WINED3D_GL_RES_TYPE_TEX_2D},
|
||||
{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
|
||||
--- 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);
|
||||
}
|
||||
|
||||
+
|
||||
+/* 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_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);
|
||||
+}
|
||||
+
|
||||
+/* Context activation is done by the caller. */
|
||||
+static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
+ struct wined3d_context *context, DWORD location)
|
||||
+{
|
||||
+ FIXME("texture %p, sub_resource_idx %u, context %p, location %s: stub.\n",
|
||||
+ texture, sub_resource_idx, context, wined3d_debug_location(location));
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static void texture1d_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
|
||||
+{
|
||||
+ FIXME("stub.\n");
|
||||
+}
|
||||
+
|
||||
+static void texture1d_cleanup_sub_resources(struct wined3d_texture *texture)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static const struct wined3d_texture_ops texture1d_ops =
|
||||
+{
|
||||
+ texture1d_upload_data,
|
||||
+ texture1d_load_location,
|
||||
+ texture1d_prepare_texture,
|
||||
+ texture1d_cleanup_sub_resources,
|
||||
+};
|
||||
+
|
||||
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 =
|
||||
texture_resource_sub_resource_unmap,
|
||||
};
|
||||
|
||||
+static HRESULT texture1d_init(struct wined3d_texture *texture, const struct wined3d_resource_desc *desc,
|
||||
+ UINT layer_count, UINT level_count, struct wined3d_device *device, void *parent,
|
||||
+ const struct wined3d_parent_ops *parent_ops)
|
||||
+{
|
||||
+ struct wined3d_device_parent *device_parent = device->device_parent;
|
||||
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
+ struct wined3d_surface *surfaces;
|
||||
+ unsigned int i, j;
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ if (layer_count > 1 && !gl_info->supported[EXT_TEXTURE_ARRAY])
|
||||
+ {
|
||||
+ WARN("OpenGL implementation does not support array textures.\n");
|
||||
+ return WINED3DERR_INVALIDCALL;
|
||||
+ }
|
||||
+
|
||||
+ /* TODO: It should only be possible to create textures for formats
|
||||
+ * that are reported as supported. */
|
||||
+ if (WINED3DFMT_UNKNOWN >= desc->format)
|
||||
+ {
|
||||
+ WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture);
|
||||
+ return WINED3DERR_INVALIDCALL;
|
||||
+ }
|
||||
+
|
||||
+ if (desc->usage & WINED3DUSAGE_LEGACY_CUBEMAP)
|
||||
+ {
|
||||
+ WARN("1d textures can not be used for cube mapping, returning D3DERR_INVALIDCALL.\n");
|
||||
+ return WINED3DERR_INVALIDCALL;
|
||||
+ }
|
||||
+
|
||||
+ if (desc->usage & WINED3DUSAGE_DYNAMIC && (desc->pool == WINED3D_POOL_MANAGED
|
||||
+ || desc->pool == WINED3D_POOL_SCRATCH))
|
||||
+ {
|
||||
+ WARN("Attempted to create a DYNAMIC texture in pool %s.\n", debug_d3dpool(desc->pool));
|
||||
+ return WINED3DERR_INVALIDCALL;
|
||||
+ }
|
||||
+
|
||||
+ if (!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] && !is_power_of_two(desc->width))
|
||||
+ {
|
||||
+ if (desc->pool == WINED3D_POOL_SCRATCH)
|
||||
+ {
|
||||
+ WARN("Creating a scratch NPOT 1d texture despite lack of HW support.\n");
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ WARN("Attempted to create a NPOT 1d texture (%u, %u, %u) without GL support.\n",
|
||||
+ desc->width, desc->height, desc->depth);
|
||||
+ return WINED3DERR_INVALIDCALL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (desc->usage & WINED3DUSAGE_AUTOGENMIPMAP)
|
||||
+ {
|
||||
+ if (!gl_info->supported[SGIS_GENERATE_MIPMAP])
|
||||
+ {
|
||||
+ WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n");
|
||||
+ return WINED3DERR_INVALIDCALL;
|
||||
+ }
|
||||
+
|
||||
+ if (level_count != 1)
|
||||
+ {
|
||||
+ WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning WINED3DERR_INVALIDCALL.\n");
|
||||
+ return WINED3DERR_INVALIDCALL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (FAILED(hr = wined3d_texture_init(texture, &texture1d_ops, layer_count, level_count, desc,
|
||||
+ 0, device, parent, parent_ops, &texture_resource_ops)))
|
||||
+ {
|
||||
+ WARN("Failed to initialize texture, returning %#x.\n", hr);
|
||||
+ return hr;
|
||||
+ }
|
||||
+
|
||||
+ texture->pow2_matrix[0] = 1.0f;
|
||||
+ texture->pow2_matrix[5] = 1.0f;
|
||||
+ texture->pow2_matrix[10] = 1.0f;
|
||||
+ texture->pow2_matrix[15] = 1.0f;
|
||||
+ texture->target = (layer_count > 1) ? GL_TEXTURE_1D_ARRAY : GL_TEXTURE_1D;
|
||||
+
|
||||
+ if (wined3d_texture_use_pbo(texture, gl_info))
|
||||
+ {
|
||||
+ wined3d_resource_free_sysmem(&texture->resource);
|
||||
+ texture->resource.map_binding = WINED3D_LOCATION_BUFFER;
|
||||
+ }
|
||||
+
|
||||
+ if (level_count > ~(SIZE_T)0 / layer_count
|
||||
+ || !(surfaces = wined3d_calloc(level_count * layer_count, sizeof(*surfaces))))
|
||||
+ {
|
||||
+ wined3d_texture_cleanup_sync(texture);
|
||||
+ return E_OUTOFMEMORY;
|
||||
+ }
|
||||
+
|
||||
+ /* Generate all the surfaces. */
|
||||
+ for (i = 0; i < texture->level_count; ++i)
|
||||
+ {
|
||||
+ for (j = 0; j < texture->layer_count; ++j)
|
||||
+ {
|
||||
+ struct wined3d_texture_sub_resource *sub_resource;
|
||||
+ unsigned int idx = j * texture->level_count + i;
|
||||
+ struct wined3d_surface *surface;
|
||||
+
|
||||
+ surface = &surfaces[idx];
|
||||
+ surface->container = texture;
|
||||
+ surface->texture_target = texture->target;
|
||||
+ surface->texture_level = i;
|
||||
+ surface->texture_layer = j;
|
||||
+ list_init(&surface->renderbuffers);
|
||||
+ list_init(&surface->overlays);
|
||||
+
|
||||
+ sub_resource = &texture->sub_resources[idx];
|
||||
+ sub_resource->locations = WINED3D_LOCATION_DISCARDED;
|
||||
+ sub_resource->u.surface = surface;
|
||||
+
|
||||
+ if (FAILED(hr = device_parent->ops->surface_created(device_parent,
|
||||
+ texture, idx, &sub_resource->parent, &sub_resource->parent_ops)))
|
||||
+ {
|
||||
+ WARN("Failed to create texture1d parent, hr %#x.\n", hr);
|
||||
+ sub_resource->parent = NULL;
|
||||
+ wined3d_texture_cleanup_sync(texture);
|
||||
+ return hr;
|
||||
+ }
|
||||
+
|
||||
+ TRACE("parent %p, parent_ops %p.\n", parent, parent_ops);
|
||||
+
|
||||
+ TRACE("Created 1d texture surface level %u, layer %u @ %p.\n", i, j, surface);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return WINED3D_OK;
|
||||
+}
|
||||
+
|
||||
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
|
||||
|
||||
switch (desc->resource_type)
|
||||
{
|
||||
+ case WINED3D_RTYPE_TEXTURE_1D:
|
||||
+ hr = texture1d_init(object, desc, layer_count, level_count, device, parent, parent_ops);
|
||||
+ break;
|
||||
+
|
||||
case WINED3D_RTYPE_TEXTURE_2D:
|
||||
hr = texture_init(object, desc, layer_count, level_count, flags, device, parent, parent_ops);
|
||||
break;
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,78 @@
|
||||
From 5011cd6f4e78bb9d00c5264e3b5033e36fe6b986 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: wined3d: Implement preparation for 1d textures.
|
||||
|
||||
---
|
||||
dlls/wined3d/texture.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 54 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index e4ca54b..942337b 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -1463,7 +1463,60 @@ 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)
|
||||
+ {
|
||||
+ struct wined3d_surface *surface = texture->sub_resources[i].u.surface;
|
||||
+ width = wined3d_texture_get_level_width(texture, surface->texture_level);
|
||||
+
|
||||
+ if (texture->target == GL_TEXTURE_1D_ARRAY)
|
||||
+ {
|
||||
+ gl_info->gl_ops.gl.p_glTexImage2D(surface->texture_target, surface->texture_level,
|
||||
+ internal, width, texture->layer_count, 0, format->glFormat, format->glType, NULL);
|
||||
+ checkGLcall("glTexImage2D");
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ gl_info->gl_ops.gl.p_glTexImage1D(surface->texture_target, surface->texture_level,
|
||||
+ internal, width, 0, format->glFormat, format->glType, NULL);
|
||||
+ checkGLcall("glTexImage1D");
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
static void texture1d_cleanup_sub_resources(struct wined3d_texture *texture)
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,81 @@
|
||||
From c80bcc9a789842075b2f68178a00525ac0cabcf7 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(-)
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 942337b..442ec27 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,
|
||||
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",
|
||||
+ 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;
|
||||
+
|
||||
+ 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);
|
||||
+
|
||||
+ width = wined3d_texture_get_level_width(texture, level);
|
||||
+
|
||||
+ if (format->convert)
|
||||
+ {
|
||||
+ unsigned int dst_row_pitch;
|
||||
+
|
||||
+ if (data->buffer_object)
|
||||
+ ERR("Loading a converted texture from a PBO.\n");
|
||||
+ if (texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
|
||||
+ ERR("Converting a block-based format.\n");
|
||||
+
|
||||
+ dst_row_pitch = width * 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);
|
||||
+ mem = converted_mem;
|
||||
+ }
|
||||
+
|
||||
+ if (data->buffer_object)
|
||||
+ {
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, data->buffer_object));
|
||||
+ checkGLcall("glBindBuffer");
|
||||
+ }
|
||||
+
|
||||
+ if (surface->texture_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_glTexSubImage2D(surface->texture_target, level, 0, surface->texture_layer, width, 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);
|
||||
+ checkGLcall("glTexSubImage1D");
|
||||
+ }
|
||||
+
|
||||
+ if (data->buffer_object)
|
||||
+ {
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
|
||||
+ checkGLcall("glBindBuffer");
|
||||
+ }
|
||||
+
|
||||
+ HeapFree(GetProcessHeap(), 0, converted_mem);
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,95 @@
|
||||
From e73e778d3e02e0f4ce14f2f28811e14955d6fe9d 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
|
||||
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 442ec27..72e2baf 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
|
||||
static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
struct wined3d_context *context, DWORD location)
|
||||
{
|
||||
- FIXME("texture %p, sub_resource_idx %u, context %p, location %s: stub.\n",
|
||||
+ struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
|
||||
+ DWORD required_access = wined3d_resource_access_from_location(location);
|
||||
+ unsigned int row_pitch, slice_pitch;
|
||||
+
|
||||
+ TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n",
|
||||
texture, sub_resource_idx, context, wined3d_debug_location(location));
|
||||
|
||||
- return FALSE;
|
||||
+ TRACE("Current resource location %s.\n", wined3d_debug_location(sub_resource->locations));
|
||||
+
|
||||
+ if ((sub_resource->locations & location) == location)
|
||||
+ {
|
||||
+ TRACE("Location(s) already up to date.\n");
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ if ((texture->resource.access_flags & required_access) != required_access)
|
||||
+ {
|
||||
+ ERR("Operation requires %#x access, but 1d texture only has %#x.\n",
|
||||
+ required_access, texture->resource.access_flags);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ if (!wined3d_texture_prepare_location(texture, sub_resource_idx, context, location))
|
||||
+ return FALSE;
|
||||
+
|
||||
+ if (sub_resource->locations & WINED3D_LOCATION_DISCARDED)
|
||||
+ {
|
||||
+ TRACE("1d texture previously discarded, nothing to do.\n");
|
||||
+ wined3d_texture_validate_location(texture, sub_resource_idx, location);
|
||||
+ wined3d_texture_invalidate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED);
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
+ switch (location)
|
||||
+ {
|
||||
+ case WINED3D_LOCATION_TEXTURE_RGB:
|
||||
+ case WINED3D_LOCATION_TEXTURE_SRGB:
|
||||
+ if (sub_resource->locations & WINED3D_LOCATION_SYSMEM)
|
||||
+ {
|
||||
+ struct wined3d_const_bo_address data = {0, texture->resource.heap_memory};
|
||||
+ 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);
|
||||
+ }
|
||||
+ 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);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ FIXME("Implement 1d texture loading from %s.\n", wined3d_debug_location(sub_resource->locations));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ FIXME("Implement %s loading from %s.\n", wined3d_debug_location(location),
|
||||
+ wined3d_debug_location(sub_resource->locations));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+done:
|
||||
+ wined3d_texture_validate_location(texture, sub_resource_idx, location);
|
||||
+
|
||||
+ return TRUE;
|
||||
}
|
||||
|
||||
static void texture1d_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,143 @@
|
||||
From 17119e7e24b0d78fa85945afba9e92349c69c03c 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:41:05 +0200
|
||||
Subject: wined3d: Implement downloading from (s)rgb 1d textures to system
|
||||
memory.
|
||||
|
||||
---
|
||||
dlls/wined3d/texture.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 112 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 72e2baf..48f3cde 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -1507,6 +1507,76 @@ static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
+static void texture1d_download_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
+ const struct wined3d_context *context, const struct wined3d_bo_address *data)
|
||||
+{
|
||||
+ struct wined3d_surface *surface = texture->sub_resources[sub_resource_idx].u.surface;
|
||||
+ const struct wined3d_format *format = texture->resource.format;
|
||||
+ const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
+ struct wined3d_texture_sub_resource *sub_resource;
|
||||
+ BYTE *temporary_mem = NULL;
|
||||
+ void *mem;
|
||||
+
|
||||
+ sub_resource = &texture->sub_resources[sub_resource_idx];
|
||||
+
|
||||
+ if (format->convert)
|
||||
+ {
|
||||
+ FIXME("Attempting to download a converted 1d texture, format %s.\n",
|
||||
+ debug_d3dformat(format->id));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (surface->texture_target == GL_TEXTURE_1D_ARRAY)
|
||||
+ {
|
||||
+ WARN_(d3d_perf)("Downloading all miplevel layers to get the surface data for a single sub-resource.\n");
|
||||
+
|
||||
+ if (!(temporary_mem = wined3d_calloc(texture->layer_count, sub_resource->size)))
|
||||
+ {
|
||||
+ ERR("Out of memory.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ mem = temporary_mem;
|
||||
+ }
|
||||
+ else if (data->buffer_object)
|
||||
+ {
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, data->buffer_object));
|
||||
+ checkGLcall("glBindBuffer");
|
||||
+ mem = data->addr;
|
||||
+ }
|
||||
+ else
|
||||
+ mem = data->addr;
|
||||
+
|
||||
+ gl_info->gl_ops.gl.p_glGetTexImage(surface->texture_target, sub_resource_idx,
|
||||
+ format->glFormat, format->glType, mem);
|
||||
+ checkGLcall("glGetTexImage");
|
||||
+
|
||||
+ if (temporary_mem)
|
||||
+ {
|
||||
+ void *src_data = temporary_mem + surface->texture_layer * sub_resource->size;
|
||||
+ if (data->buffer_object)
|
||||
+ {
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, data->buffer_object));
|
||||
+ checkGLcall("glBindBuffer");
|
||||
+ GL_EXTCALL(glBufferSubData(GL_PIXEL_PACK_BUFFER, 0, sub_resource->size, src_data));
|
||||
+ checkGLcall("glBufferSubData");
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ memcpy(data->addr, src_data, sub_resource->size);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (data->buffer_object)
|
||||
+ {
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, 0));
|
||||
+ checkGLcall("glBindBuffer");
|
||||
+ }
|
||||
+
|
||||
+ HeapFree(GetProcessHeap(), 0, temporary_mem);
|
||||
+}
|
||||
+
|
||||
+/* Context activation is done by the caller. */
|
||||
static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
struct wined3d_context *context, DWORD location)
|
||||
{
|
||||
@@ -1569,6 +1639,48 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
|
||||
}
|
||||
break;
|
||||
|
||||
+ case WINED3D_LOCATION_SYSMEM:
|
||||
+ if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
|
||||
+ {
|
||||
+ struct wined3d_bo_address data = {0, texture->resource.heap_memory};
|
||||
+
|
||||
+ data.addr += sub_resource->offset;
|
||||
+ if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
|
||||
+ wined3d_texture_bind_and_dirtify(texture, context, FALSE);
|
||||
+ else
|
||||
+ wined3d_texture_bind_and_dirtify(texture, context, TRUE);
|
||||
+
|
||||
+ texture1d_download_data(texture, sub_resource_idx, context, &data);
|
||||
+ ++texture->download_count;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ FIXME("Implement WINED3D_LOCATION_SYSMEM loading from %s.\n",
|
||||
+ wined3d_debug_location(sub_resource->locations));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case WINED3D_LOCATION_BUFFER:
|
||||
+ if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
|
||||
+ {
|
||||
+ struct wined3d_bo_address data = {sub_resource->buffer_object, NULL};
|
||||
+
|
||||
+ if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
|
||||
+ wined3d_texture_bind_and_dirtify(texture, context, FALSE);
|
||||
+ else
|
||||
+ wined3d_texture_bind_and_dirtify(texture, context, TRUE);
|
||||
+
|
||||
+ texture1d_download_data(texture, sub_resource_idx, context, &data);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ FIXME("Implement WINED3D_LOCATION_BUFFER loading from %s.\n",
|
||||
+ wined3d_debug_location(sub_resource->locations));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
FIXME("Implement %s loading from %s.\n", wined3d_debug_location(location),
|
||||
wined3d_debug_location(sub_resource->locations));
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,61 @@
|
||||
From 20fbaad604f6b979154d7b8d5b1e43a7f10f1d8d 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.
|
||||
|
||||
---
|
||||
dlls/wined3d/texture.c | 31 +++++++++++++++++++++++++++++++
|
||||
1 file changed, 31 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 48f3cde..9c17b45 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
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
+static void texture1d_srgb_transfer(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
+ struct wined3d_context *context, BOOL dest_is_srgb)
|
||||
+{
|
||||
+ struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
|
||||
+ unsigned int row_pitch, slice_pitch;
|
||||
+ struct wined3d_bo_address data;
|
||||
+
|
||||
+ WARN_(d3d_perf)("Performing slow rgb/srgb 1d texture transfer.\n");
|
||||
+ data.buffer_object = 0;
|
||||
+ if (!(data.addr = HeapAlloc(GetProcessHeap(), 0, sub_resource->size)))
|
||||
+ return;
|
||||
+
|
||||
+ wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
||||
+ 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,
|
||||
+ wined3d_const_bo_address(&data), row_pitch, slice_pitch);
|
||||
+
|
||||
+ HeapFree(GetProcessHeap(), 0, data.addr);
|
||||
+}
|
||||
+
|
||||
+/* Context activation is done by the caller. */
|
||||
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
|
||||
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);
|
||||
}
|
||||
+ else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
|
||||
+ {
|
||||
+ texture1d_srgb_transfer(texture, sub_resource_idx, context, TRUE);
|
||||
+ }
|
||||
+ else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_SRGB)
|
||||
+ {
|
||||
+ texture1d_srgb_transfer(texture, sub_resource_idx, context, FALSE);
|
||||
+ }
|
||||
else
|
||||
{
|
||||
FIXME("Implement 1d texture loading from %s.\n", wined3d_debug_location(sub_resource->locations));
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,29 @@
|
||||
From d2b758c7547d63af92250da595967923b1c4ecca 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:11:03 +0200
|
||||
Subject: wined3d: Check for 1d textures in wined3d_texture_update_desc.
|
||||
|
||||
---
|
||||
dlls/wined3d/texture.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 9c17b45..4703bc8 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -1113,6 +1113,12 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
+ if (texture->resource.type == WINED3D_RTYPE_TEXTURE_1D)
|
||||
+ {
|
||||
+ FIXME("Not yet supported for 1D textures.\n");
|
||||
+ return WINED3DERR_INVALIDCALL;
|
||||
+ }
|
||||
+
|
||||
if (texture->resource.map_count)
|
||||
{
|
||||
WARN("Texture is mapped.\n");
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,24 @@
|
||||
From d11ec46eaaa4f0cd22684502ea9513198cc7f1c0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Thu, 25 Aug 2016 17:00:12 +0200
|
||||
Subject: wined3d: Check if 1d teture is still in use before releasing.
|
||||
|
||||
---
|
||||
dlls/wined3d/device.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 1445399..f67627a 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -5000,6 +5000,7 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
|
||||
|
||||
switch (type)
|
||||
{
|
||||
+ case WINED3D_RTYPE_TEXTURE_1D:
|
||||
case WINED3D_RTYPE_TEXTURE_2D:
|
||||
case WINED3D_RTYPE_TEXTURE_3D:
|
||||
for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,30 @@
|
||||
From d899bbed65bd73ee3c18a55bda617b96d19c126e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Thu, 25 Aug 2016 17:06:41 +0200
|
||||
Subject: wined3d: Generate glsl samplers for 1d texture arrays.
|
||||
|
||||
---
|
||||
dlls/wined3d/glsl_shader.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index 5ccb027..654a988 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -2005,6 +2005,13 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
sampler_type = "samplerCube";
|
||||
break;
|
||||
|
||||
+ case WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY:
|
||||
+ if (shadow_sampler)
|
||||
+ sampler_type = "sampler1DArrayShadow";
|
||||
+ else
|
||||
+ sampler_type = "sampler1DArray";
|
||||
+ break;
|
||||
+
|
||||
case WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY:
|
||||
if (shadow_sampler)
|
||||
sampler_type = "sampler2DArrayShadow";
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,39 @@
|
||||
From 628042ee68362bf3d57801084143e9e7d724b262 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:09:41 +0200
|
||||
Subject: wined3d: Add support for 1d textures in
|
||||
context_attach_gl_texture_fbo.
|
||||
|
||||
---
|
||||
dlls/wined3d/context.c | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
|
||||
index 74c3a49..1cd2463 100644
|
||||
--- a/dlls/wined3d/context.c
|
||||
+++ b/dlls/wined3d/context.c
|
||||
@@ -128,7 +128,7 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context,
|
||||
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, attachment, GL_TEXTURE_2D, 0, 0);
|
||||
checkGLcall("glFramebufferTexture2D()");
|
||||
}
|
||||
- else if (resource->target == GL_TEXTURE_2D_ARRAY)
|
||||
+ else if (resource->target == GL_TEXTURE_2D_ARRAY || resource->target == GL_TEXTURE_1D_ARRAY)
|
||||
{
|
||||
if (!gl_info->fbo_ops.glFramebufferTextureLayer)
|
||||
{
|
||||
@@ -140,6 +140,12 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context,
|
||||
resource->object, resource->level, resource->layer);
|
||||
checkGLcall("glFramebufferTextureLayer()");
|
||||
}
|
||||
+ else if (resource->target == GL_TEXTURE_1D)
|
||||
+ {
|
||||
+ gl_info->fbo_ops.glFramebufferTexture1D(fbo_target, attachment,
|
||||
+ resource->target, resource->object, resource->level);
|
||||
+ checkGLcall("glFramebufferTexture1D()");
|
||||
+ }
|
||||
else
|
||||
{
|
||||
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, attachment,
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,79 @@
|
||||
From 2fa42aeeeeafb6eb2da908b43ee8137249fcfeb4 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:21:20 +0200
|
||||
Subject: wined3d: Handle 1d textures in texture_activate_dimensions.
|
||||
|
||||
---
|
||||
dlls/wined3d/utils.c | 28 ++++++++++++++++++++++++++++
|
||||
1 file changed, 28 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
|
||||
index 4e00aad..b903bb6 100644
|
||||
--- a/dlls/wined3d/utils.c
|
||||
+++ b/dlls/wined3d/utils.c
|
||||
@@ -5425,7 +5425,27 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st
|
||||
{
|
||||
switch (texture->target)
|
||||
{
|
||||
+ case GL_TEXTURE_1D:
|
||||
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
|
||||
+ checkGLcall("glDisable(GL_TEXTURE_2D)");
|
||||
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
|
||||
+ checkGLcall("glDisable(GL_TEXTURE_3D)");
|
||||
+ if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
|
||||
+ {
|
||||
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||
+ checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
|
||||
+ }
|
||||
+ if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
|
||||
+ {
|
||||
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
|
||||
+ checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
|
||||
+ }
|
||||
+ gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_1D);
|
||||
+ checkGLcall("glEnable(GL_TEXTURE_1D)");
|
||||
+ break;
|
||||
case GL_TEXTURE_2D:
|
||||
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
|
||||
+ checkGLcall("glDisable(GL_TEXTURE_1D)");
|
||||
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
|
||||
checkGLcall("glDisable(GL_TEXTURE_3D)");
|
||||
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
|
||||
@@ -5442,6 +5462,8 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st
|
||||
checkGLcall("glEnable(GL_TEXTURE_2D)");
|
||||
break;
|
||||
case GL_TEXTURE_RECTANGLE_ARB:
|
||||
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
|
||||
+ checkGLcall("glDisable(GL_TEXTURE_1D)");
|
||||
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
|
||||
checkGLcall("glDisable(GL_TEXTURE_2D)");
|
||||
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
|
||||
@@ -5465,12 +5487,16 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st
|
||||
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
|
||||
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
|
||||
}
|
||||
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
|
||||
+ checkGLcall("glDisable(GL_TEXTURE_1D)");
|
||||
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
|
||||
checkGLcall("glDisable(GL_TEXTURE_2D)");
|
||||
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_3D);
|
||||
checkGLcall("glEnable(GL_TEXTURE_3D)");
|
||||
break;
|
||||
case GL_TEXTURE_CUBE_MAP_ARB:
|
||||
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
|
||||
+ checkGLcall("glDisable(GL_TEXTURE_1D)");
|
||||
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
|
||||
checkGLcall("glDisable(GL_TEXTURE_2D)");
|
||||
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
|
||||
@@ -5487,6 +5513,8 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st
|
||||
}
|
||||
else
|
||||
{
|
||||
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
|
||||
+ checkGLcall("glDisable(GL_TEXTURE_1D)");
|
||||
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_2D);
|
||||
checkGLcall("glEnable(GL_TEXTURE_2D)");
|
||||
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
|
||||
--
|
||||
2.8.1
|
||||
|
@@ -0,0 +1,27 @@
|
||||
From 403ca5c3b1f87c94c800e2a40480083eec09ebf5 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:26:07 +0200
|
||||
Subject: wined3d: Allow creation of 1d shader views.
|
||||
|
||||
---
|
||||
dlls/wined3d/view.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
|
||||
index 7f07d57..97cc11e 100644
|
||||
--- a/dlls/wined3d/view.c
|
||||
+++ b/dlls/wined3d/view.c
|
||||
@@ -291,6 +291,10 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
|
||||
}
|
||||
view_types[] =
|
||||
{
|
||||
+ {GL_TEXTURE_1D, 0, GL_TEXTURE_1D},
|
||||
+ {GL_TEXTURE_1D, WINED3D_VIEW_TEXTURE_ARRAY, GL_TEXTURE_1D_ARRAY},
|
||||
+ {GL_TEXTURE_1D_ARRAY, 0, GL_TEXTURE_1D},
|
||||
+ {GL_TEXTURE_1D_ARRAY, WINED3D_VIEW_TEXTURE_ARRAY, GL_TEXTURE_1D_ARRAY},
|
||||
{GL_TEXTURE_2D, 0, GL_TEXTURE_2D},
|
||||
{GL_TEXTURE_2D, WINED3D_VIEW_TEXTURE_ARRAY, GL_TEXTURE_2D_ARRAY},
|
||||
{GL_TEXTURE_2D_ARRAY, 0, GL_TEXTURE_2D},
|
||||
--
|
||||
2.8.1
|
||||
|
Reference in New Issue
Block a user