2016-12-06 12:52:20 -08:00
|
|
|
From b791c5d95a0526a52a4e9abef7e2809eaf6e6b2a Mon Sep 17 00:00:00 2001
|
2016-08-31 08:42:50 -07:00
|
|
|
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
|
2016-12-06 12:52:20 -08:00
|
|
|
index 0b7c53d..74de20c 100644
|
2016-08-31 08:42:50 -07:00
|
|
|
--- a/dlls/wined3d/texture.c
|
|
|
|
+++ b/dlls/wined3d/texture.c
|
2016-12-06 12:52:20 -08:00
|
|
|
@@ -1597,6 +1597,29 @@ static void texture1d_download_data(struct wined3d_texture *texture, unsigned in
|
2016-08-31 08:42:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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);
|
2016-12-06 12:52:20 -08:00
|
|
|
+ texture1d_upload_data(texture, sub_resource_idx, context, NULL,
|
2016-08-31 08:42:50 -07:00
|
|
|
+ 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)
|
|
|
|
{
|
2016-12-06 12:52:20 -08:00
|
|
|
@@ -1652,6 +1675,14 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
|
2016-08-31 08:42:50 -07:00
|
|
|
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
2016-12-06 12:52:20 -08:00
|
|
|
texture1d_upload_data(texture, sub_resource_idx, context, NULL, &data, row_pitch, slice_pitch);
|
2016-08-31 08:42:50 -07:00
|
|
|
}
|
|
|
|
+ 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));
|
|
|
|
--
|
2016-12-06 12:52:20 -08:00
|
|
|
2.9.0
|
2016-08-31 08:42:50 -07:00
|
|
|
|