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
Updated wined3d-SWVP-shaders, wined3d-Indexed_Vertex_Blending patchsets.
Minor cleanup.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From be44f12b3c77f763a5eac9bb63d00cd71b4798fa Mon Sep 17 00:00:00 2001
|
||||
From 34d8cd36334b26598b18d865a412cfa6ea8c2c37 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <gofmanp@gmail.com>
|
||||
Date: Mon, 25 Feb 2019 13:17:01 +0300
|
||||
Subject: [PATCH] wined3d: Use UBO for vertex shader float constants if
|
||||
@@ -16,10 +16,10 @@ Subject: [PATCH] wined3d: Use UBO for vertex shader float constants if
|
||||
8 files changed, 148 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c
|
||||
index 0f283b55354..a69f7d8542b 100644
|
||||
index 343073f351..2154b49f49 100644
|
||||
--- a/dlls/d3d8/directx.c
|
||||
+++ b/dlls/d3d8/directx.c
|
||||
@@ -413,7 +413,7 @@ BOOL d3d8_init(struct d3d8 *d3d8)
|
||||
@@ -470,7 +470,7 @@ BOOL d3d8_init(struct d3d8 *d3d8)
|
||||
DWORD flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING
|
||||
| WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER
|
||||
| WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR | WINED3D_NO_PRIMITIVE_RESTART
|
||||
@@ -29,10 +29,10 @@ index 0f283b55354..a69f7d8542b 100644
|
||||
struct wined3d_adapter *wined3d_adapter;
|
||||
|
||||
diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c
|
||||
index 3e9fabf758b..924c2d2e8c5 100644
|
||||
index d79b32515f..7766fa8b33 100644
|
||||
--- a/dlls/d3d9/directx.c
|
||||
+++ b/dlls/d3d9/directx.c
|
||||
@@ -589,7 +589,7 @@ BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended)
|
||||
@@ -674,7 +674,7 @@ BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended)
|
||||
DWORD flags = WINED3D_PRESENT_CONVERSION | WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER
|
||||
| WINED3D_SRGB_READ_WRITE_CONTROL | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
|
||||
| WINED3D_NO_PRIMITIVE_RESTART | WINED3D_LEGACY_CUBEMAP_FILTERING
|
||||
@@ -42,10 +42,10 @@ index 3e9fabf758b..924c2d2e8c5 100644
|
||||
struct wined3d_adapter *wined3d_adapter;
|
||||
|
||||
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
|
||||
index 5e7ff6e2fae..0df82acc125 100644
|
||||
index 2fd061b74a..078a874e1c 100644
|
||||
--- a/dlls/wined3d/adapter_gl.c
|
||||
+++ b/dlls/wined3d/adapter_gl.c
|
||||
@@ -3145,6 +3145,9 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
|
||||
@@ -3144,6 +3144,9 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
|
||||
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_VERTEX] = min(gl_max, WINED3D_MAX_CBS);
|
||||
TRACE("Max vertex uniform blocks: %u (%d).\n",
|
||||
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_VERTEX], gl_max);
|
||||
@@ -56,7 +56,7 @@ index 5e7ff6e2fae..0df82acc125 100644
|
||||
}
|
||||
if (gl_info->supported[ARB_TESSELLATION_SHADER])
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index d48c35c9ce2..4b751cba161 100644
|
||||
index 4a2fbce553..e306694533 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -138,6 +138,10 @@ struct shader_glsl_priv
|
||||
@@ -257,7 +257,7 @@ index d48c35c9ce2..4b751cba161 100644
|
||||
}
|
||||
|
||||
/* Always declare the full set of constants, the compiler can remove the
|
||||
@@ -9904,17 +9994,36 @@ static struct glsl_ffp_fragment_shader *shader_glsl_find_ffp_fragment_shader(str
|
||||
@@ -9890,17 +9980,36 @@ static struct glsl_ffp_fragment_shader *shader_glsl_find_ffp_fragment_shader(str
|
||||
|
||||
|
||||
static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *gl_info,
|
||||
@@ -299,7 +299,7 @@ index d48c35c9ce2..4b751cba161 100644
|
||||
|
||||
for (i = 0; i < WINED3D_MAX_CONSTS_I; ++i)
|
||||
{
|
||||
@@ -10989,6 +11098,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
@@ -10975,6 +11084,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
const struct wined3d_fragment_pipe_ops *fragment_pipe)
|
||||
{
|
||||
SIZE_T stack_size = wined3d_log2i(max(WINED3D_MAX_VS_CONSTS_F, WINED3D_MAX_PS_CONSTS_F)) + 1;
|
||||
@@ -307,7 +307,7 @@ index d48c35c9ce2..4b751cba161 100644
|
||||
struct fragment_caps fragment_caps;
|
||||
void *vertex_priv, *fragment_priv;
|
||||
struct shader_glsl_priv *priv;
|
||||
@@ -10996,6 +11106,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
@@ -10982,6 +11092,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
if (!(priv = heap_alloc_zero(sizeof(*priv))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
@@ -316,7 +316,7 @@ index d48c35c9ce2..4b751cba161 100644
|
||||
string_buffer_list_init(&priv->string_buffers);
|
||||
|
||||
if (!(vertex_priv = vertex_pipe->vp_alloc(&glsl_shader_backend, priv)))
|
||||
@@ -11050,6 +11162,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
@@ -11036,6 +11148,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
device->fragment_priv = fragment_priv;
|
||||
device->shader_priv = priv;
|
||||
|
||||
@@ -325,7 +325,7 @@ index d48c35c9ce2..4b751cba161 100644
|
||||
return WINED3D_OK;
|
||||
|
||||
fail:
|
||||
@@ -11077,6 +11191,13 @@ static void shader_glsl_free(struct wined3d_device *device, struct wined3d_conte
|
||||
@@ -11063,6 +11177,13 @@ static void shader_glsl_free(struct wined3d_device *device, struct wined3d_conte
|
||||
priv->fragment_pipe->free_private(device, context);
|
||||
priv->vertex_pipe->vp_free(device, context);
|
||||
|
||||
@@ -340,7 +340,7 @@ index d48c35c9ce2..4b751cba161 100644
|
||||
device->shader_priv = NULL;
|
||||
}
|
||||
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
|
||||
index 7ebd8c0226a..23e21158d44 100644
|
||||
index d9ef1a96e2..f29b49b902 100644
|
||||
--- a/dlls/wined3d/shader.c
|
||||
+++ b/dlls/wined3d/shader.c
|
||||
@@ -767,6 +767,8 @@ static BOOL shader_record_register_usage(struct wined3d_shader *shader, struct w
|
||||
@@ -353,10 +353,10 @@ index 7ebd8c0226a..23e21158d44 100644
|
||||
}
|
||||
}
|
||||
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
|
||||
index 715d497d076..1a9a06d4c88 100644
|
||||
index 6289317936..099a612d05 100644
|
||||
--- a/dlls/wined3d/state.c
|
||||
+++ b/dlls/wined3d/state.c
|
||||
@@ -4401,6 +4401,11 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state
|
||||
@@ -4461,6 +4461,11 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state
|
||||
unsigned int i, base, count;
|
||||
|
||||
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
|
||||
@@ -369,7 +369,7 @@ index 715d497d076..1a9a06d4c88 100644
|
||||
if (STATE_IS_GRAPHICS_CONSTANT_BUFFER(state_id))
|
||||
shader_type = state_id - STATE_GRAPHICS_CONSTANT_BUFFER(0);
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 665c9a73982..481d5798c7d 100644
|
||||
index 9240b0e455..b09811b845 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -1070,6 +1070,7 @@ struct wined3d_shader_reg_maps
|
||||
@@ -380,7 +380,7 @@ index 665c9a73982..481d5798c7d 100644
|
||||
};
|
||||
|
||||
/* Keeps track of details for TEX_M#x# instructions which need to maintain
|
||||
@@ -2746,6 +2747,7 @@ struct wined3d_gl_limits
|
||||
@@ -2743,6 +2744,7 @@ struct wined3d_gl_limits
|
||||
UINT glsl_varyings;
|
||||
UINT glsl_vs_float_constants;
|
||||
UINT glsl_ps_float_constants;
|
||||
@@ -389,10 +389,10 @@ index 665c9a73982..481d5798c7d 100644
|
||||
UINT arb_vs_float_constants;
|
||||
UINT arb_vs_native_constants;
|
||||
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
|
||||
index 875bb6dfe40..581ed7b76fd 100644
|
||||
index d192266583..1199408ec6 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -1340,6 +1340,7 @@ enum wined3d_shader_type
|
||||
@@ -1335,6 +1335,7 @@ enum wined3d_shader_type
|
||||
#define WINED3D_NO_PRIMITIVE_RESTART 0x00000800
|
||||
#define WINED3D_LEGACY_CUBEMAP_FILTERING 0x00001000
|
||||
#define WINED3D_NORMALIZED_DEPTH_BIAS 0x00002000
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From d7aab74ca535217432f800c8243809359db2ba34 Mon Sep 17 00:00:00 2001
|
||||
From 0a28c2626c859cd92f22308443d77e5328ad6bee Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <gofmanp@gmail.com>
|
||||
Date: Mon, 25 Feb 2019 14:24:50 +0300
|
||||
Subject: [PATCH] d3d9: Support SWVP vertex shader float constants limits.
|
||||
@@ -10,7 +10,7 @@ Subject: [PATCH] d3d9: Support SWVP vertex shader float constants limits.
|
||||
3 files changed, 28 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
|
||||
index a0daaf42880..79ed44c2285 100644
|
||||
index a0daaf4288..79ed44c228 100644
|
||||
--- a/dlls/d3d9/d3d9_private.h
|
||||
+++ b/dlls/d3d9/d3d9_private.h
|
||||
@@ -40,6 +40,7 @@
|
||||
@@ -31,7 +31,7 @@ index a0daaf42880..79ed44c2285 100644
|
||||
struct d3d9
|
||||
{
|
||||
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
|
||||
index 85798db4440..bc3c65906ee 100644
|
||||
index 85798db444..bc3c65906e 100644
|
||||
--- a/dlls/d3d9/device.c
|
||||
+++ b/dlls/d3d9/device.c
|
||||
@@ -360,7 +360,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
|
||||
@@ -127,7 +127,7 @@ index 85798db4440..bc3c65906ee 100644
|
||||
WARN("Trying to access %u constants, but d3d9 only supports %u\n",
|
||||
start_idx + count, device->vs_uniform_count);
|
||||
diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c
|
||||
index 7766fa8b336..eddd9a8ff1a 100644
|
||||
index 7766fa8b33..eddd9a8ff1 100644
|
||||
--- a/dlls/d3d9/directx.c
|
||||
+++ b/dlls/d3d9/directx.c
|
||||
@@ -439,7 +439,7 @@ static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DD
|
||||
|
@@ -1,22 +1,22 @@
|
||||
From 284768caa7c7a7c2e46d3ec90226d57cddd6dfd7 Mon Sep 17 00:00:00 2001
|
||||
From de420388d95e30644947be15c42bfa51349f48f9 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <gofmanp@gmail.com>
|
||||
Date: Mon, 25 Feb 2019 14:47:28 +0300
|
||||
Subject: [PATCH] wined3d: Report actual vertex shader float constants limit
|
||||
for SWVP device.
|
||||
|
||||
---
|
||||
dlls/wined3d/adapter_gl.c | 3 ++-
|
||||
dlls/wined3d/device.c | 13 ++++++++++++-
|
||||
dlls/wined3d/glsl_shader.c | 5 ++++-
|
||||
dlls/wined3d/wined3d_private.h | 1 +
|
||||
include/wine/wined3d.h | 1 +
|
||||
5 files changed, 20 insertions(+), 3 deletions(-)
|
||||
dlls/wined3d/adapter_gl.c | 3 ++-
|
||||
dlls/wined3d/device.c | 9 ++++++++-
|
||||
dlls/wined3d/glsl_shader.c | 5 ++++-
|
||||
dlls/wined3d/wined3d_private.h | 1 +
|
||||
include/wine/wined3d.h | 1 +
|
||||
5 files changed, 16 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
|
||||
index aca36a2377a..38fb0712547 100644
|
||||
index 078a874e1c..f1cb7d9659 100644
|
||||
--- a/dlls/wined3d/adapter_gl.c
|
||||
+++ b/dlls/wined3d/adapter_gl.c
|
||||
@@ -5159,7 +5159,8 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_
|
||||
@@ -5140,7 +5140,8 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_
|
||||
d3d_info->limits.gs_version = shader_caps.gs_version;
|
||||
d3d_info->limits.ps_version = shader_caps.ps_version;
|
||||
d3d_info->limits.cs_version = shader_caps.cs_version;
|
||||
@@ -27,36 +27,32 @@ index aca36a2377a..38fb0712547 100644
|
||||
d3d_info->limits.varying_count = shader_caps.varying_count;
|
||||
d3d_info->limits.ffp_textures = fragment_caps.MaxSimultaneousTextures;
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 2cb5300e37e..a93c473d8da 100644
|
||||
index 42d645d201..b2db48ecf0 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -3819,9 +3819,20 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
||||
@@ -3796,9 +3796,16 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
||||
|
||||
HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device, struct wined3d_caps *caps)
|
||||
{
|
||||
+ const struct wined3d_adapter *adapter = device->wined3d->adapters[device->adapter->ordinal];
|
||||
+ struct wined3d_vertex_caps vertex_caps;
|
||||
+ HRESULT hr;
|
||||
+
|
||||
TRACE("device %p, caps %p.\n", device, caps);
|
||||
|
||||
- return wined3d_get_device_caps(device->adapter, device->create_parms.device_type, caps);
|
||||
+ hr = wined3d_get_device_caps(device->adapter, device->create_parms.device_type, caps);
|
||||
+ if (FAILED(hr))
|
||||
+ if (FAILED(hr = wined3d_get_device_caps(device->adapter, device->create_parms.device_type, caps)))
|
||||
+ return hr;
|
||||
+
|
||||
+ adapter->vertex_pipe->vp_get_caps(adapter, &vertex_caps);
|
||||
+ if (device->create_parms.flags & WINED3DCREATE_SOFTWARE_VERTEXPROCESSING)
|
||||
+ caps->MaxVertexShaderConst = adapter->d3d_info.limits.vs_uniform_count_swvp;
|
||||
+ caps->MaxVertexShaderConst = device->adapter->d3d_info.limits.vs_uniform_count_swvp;
|
||||
+ return hr;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx,
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index 4b751cba161..412b12184f1 100644
|
||||
index e306694533..4f7cc772be 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -11275,7 +11275,10 @@ static void shader_glsl_get_caps(const struct wined3d_adapter *adapter, struct s
|
||||
@@ -11261,7 +11261,10 @@ static void shader_glsl_get_caps(const struct wined3d_adapter *adapter, struct s
|
||||
caps->vs_version = gl_info->supported[ARB_VERTEX_SHADER] ? caps->vs_version : 0;
|
||||
caps->ps_version = gl_info->supported[ARB_FRAGMENT_SHADER] ? caps->ps_version : 0;
|
||||
|
||||
@@ -69,7 +65,7 @@ index 4b751cba161..412b12184f1 100644
|
||||
caps->varying_count = gl_info->limits.glsl_varyings;
|
||||
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 2a371d021aa..4a7f843a108 100644
|
||||
index b09811b845..51b5cc4ac7 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -173,6 +173,7 @@ struct wined3d_d3d_limits
|
||||
@@ -81,10 +77,10 @@ index 2a371d021aa..4a7f843a108 100644
|
||||
unsigned int varying_count;
|
||||
unsigned int ffp_textures;
|
||||
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
|
||||
index 95292faca5c..cdefb46e969 100644
|
||||
index 1199408ec6..3606c4e245 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -1604,6 +1604,7 @@ enum wined3d_shader_type
|
||||
@@ -1602,6 +1602,7 @@ enum wined3d_shader_type
|
||||
#define WINED3D_MAX_CONSTS_B 16
|
||||
#define WINED3D_MAX_CONSTS_I 16
|
||||
#define WINED3D_MAX_VS_CONSTS_F 256
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From d4dd6612e5d2ad13deb9b9e543ef73a5fd6c083f Mon Sep 17 00:00:00 2001
|
||||
From c08f3b5637a9d43e29b7d72cb61068f270d82133 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <gofmanp@gmail.com>
|
||||
Date: Mon, 25 Feb 2019 15:05:12 +0300
|
||||
Subject: [PATCH] wined3d: Support SWVP vertex shader constants limit in state
|
||||
@@ -7,15 +7,15 @@ Subject: [PATCH] wined3d: Support SWVP vertex shader constants limit in state
|
||||
---
|
||||
dlls/d3d9/tests/device.c | 5 -----
|
||||
dlls/d3d9/tests/visual.c | 1 -
|
||||
dlls/wined3d/device.c | 9 +++++++--
|
||||
dlls/wined3d/device.c | 6 ++++--
|
||||
dlls/wined3d/glsl_shader.c | 2 +-
|
||||
dlls/wined3d/stateblock.c | 30 ++++++++++++++++++++++--------
|
||||
dlls/wined3d/wined3d_private.h | 4 ++--
|
||||
dlls/wined3d/stateblock.c | 23 ++++++++++++++---------
|
||||
dlls/wined3d/wined3d_private.h | 13 +++++++++++--
|
||||
include/wine/wined3d.h | 2 +-
|
||||
7 files changed, 33 insertions(+), 20 deletions(-)
|
||||
7 files changed, 31 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
|
||||
index d00a26b942c..09446d0be62 100644
|
||||
index d00a26b942..09446d0be6 100644
|
||||
--- a/dlls/d3d9/tests/device.c
|
||||
+++ b/dlls/d3d9/tests/device.c
|
||||
@@ -6413,13 +6413,10 @@ static void test_vertex_shader_constant(void)
|
||||
@@ -49,7 +49,7 @@ index d00a26b942c..09446d0be62 100644
|
||||
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, consts_swvp - 1, c, 1);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
|
||||
index 9ceb758c605..0ae4eb7a347 100644
|
||||
index 9ceb758c60..0ae4eb7a34 100644
|
||||
--- a/dlls/d3d9/tests/visual.c
|
||||
+++ b/dlls/d3d9/tests/visual.c
|
||||
@@ -24877,7 +24877,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
@@ -61,14 +61,10 @@ index 9ceb758c605..0ae4eb7a347 100644
|
||||
|
||||
hr = IDirect3DDevice9_BeginScene(device);
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index a93c473d8da..ac855848f24 100644
|
||||
index b2db48ecf0..1db974f118 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -3504,10 +3504,11 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
||||
struct wined3d_stateblock *stateblock)
|
||||
{
|
||||
const struct wined3d_stateblock_state *state = &stateblock->stateblock_state;
|
||||
+ const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
|
||||
@@ -3484,7 +3484,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
||||
const struct wined3d_saved_states *changed = &stateblock->changed;
|
||||
const unsigned int word_bit_count = sizeof(DWORD) * CHAR_BIT;
|
||||
BOOL set_blend_state = FALSE, set_rasterizer_state = FALSE;
|
||||
@@ -77,13 +73,11 @@ index a93c473d8da..ac855848f24 100644
|
||||
struct wined3d_range range;
|
||||
uint32_t map;
|
||||
|
||||
@@ -3518,9 +3519,13 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
||||
@@ -3495,9 +3495,11 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
||||
if (changed->pixelShader)
|
||||
wined3d_device_set_pixel_shader(device, state->ps);
|
||||
|
||||
+ vs_uniform_count = device->create_parms.flags
|
||||
+ & (WINED3DCREATE_SOFTWARE_VERTEXPROCESSING | WINED3DCREATE_MIXED_VERTEXPROCESSING)
|
||||
+ ? d3d_info->limits.vs_uniform_count_swvp : d3d_info->limits.vs_uniform_count;
|
||||
+ vs_uniform_count = wined3d_device_get_vs_uniform_count(device);
|
||||
+
|
||||
for (start = 0; ; start = range.offset + range.size)
|
||||
{
|
||||
@@ -93,7 +87,7 @@ index a93c473d8da..ac855848f24 100644
|
||||
|
||||
wined3d_device_set_vs_consts_f(device, range.offset, range.size, &state->vs_consts_f[range.offset]);
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index 412b12184f1..33666d5eb8c 100644
|
||||
index 4f7cc772be..a88f92cc03 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -1913,7 +1913,7 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
|
||||
@@ -106,14 +100,12 @@ index 412b12184f1..33666d5eb8c 100644
|
||||
update_heap_entry(heap, i, priv->next_constant_version);
|
||||
}
|
||||
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
|
||||
index db0019adbf4..0641fb4b754 100644
|
||||
index db0019adbf..6be1115f82 100644
|
||||
--- a/dlls/wined3d/stateblock.c
|
||||
+++ b/dlls/wined3d/stateblock.c
|
||||
@@ -713,9 +713,10 @@ static void wined3d_state_record_lights(struct wined3d_light_state *dst_state,
|
||||
void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
|
||||
@@ -714,8 +714,8 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
|
||||
const struct wined3d_stateblock *device_state)
|
||||
{
|
||||
+ const struct wined3d_d3d_info *d3d_info = &stateblock->device->adapter->d3d_info;
|
||||
const struct wined3d_stateblock_state *state = &device_state->stateblock_state;
|
||||
+ unsigned int i, start, vs_uniform_count;
|
||||
struct wined3d_range range;
|
||||
@@ -121,13 +113,11 @@ index db0019adbf4..0641fb4b754 100644
|
||||
DWORD map;
|
||||
|
||||
TRACE("stateblock %p, device_state %p.\n", stateblock, device_state);
|
||||
@@ -731,9 +732,13 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
|
||||
@@ -731,9 +731,11 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
|
||||
stateblock->stateblock_state.vs = state->vs;
|
||||
}
|
||||
|
||||
+ vs_uniform_count = stateblock->device->create_parms.flags
|
||||
+ & (WINED3DCREATE_SOFTWARE_VERTEXPROCESSING | WINED3DCREATE_MIXED_VERTEXPROCESSING)
|
||||
+ ? d3d_info->limits.vs_uniform_count_swvp : d3d_info->limits.vs_uniform_count;
|
||||
+ vs_uniform_count = wined3d_device_get_vs_uniform_count(stateblock->device);
|
||||
+
|
||||
for (start = 0; ; start = range.offset + range.size)
|
||||
{
|
||||
@@ -136,11 +126,9 @@ index db0019adbf4..0641fb4b754 100644
|
||||
break;
|
||||
|
||||
memcpy(&stateblock->stateblock_state.vs_consts_f[range.offset], &state->vs_consts_f[range.offset],
|
||||
@@ -976,9 +981,10 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
|
||||
void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock,
|
||||
@@ -977,8 +979,8 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock,
|
||||
struct wined3d_stateblock *device_state)
|
||||
{
|
||||
+ const struct wined3d_d3d_info *d3d_info = &stateblock->device->adapter->d3d_info;
|
||||
const struct wined3d_stateblock_state *state = &stateblock->stateblock_state;
|
||||
+ unsigned int i, start, vs_uniform_count;
|
||||
struct wined3d_range range;
|
||||
@@ -148,13 +136,11 @@ index db0019adbf4..0641fb4b754 100644
|
||||
DWORD map;
|
||||
|
||||
TRACE("stateblock %p, device_state %p.\n", stateblock, device_state);
|
||||
@@ -986,9 +992,13 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock,
|
||||
@@ -986,9 +988,11 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock,
|
||||
if (stateblock->changed.vertexShader)
|
||||
wined3d_stateblock_set_vertex_shader(device_state, state->vs);
|
||||
|
||||
+ vs_uniform_count = stateblock->device->create_parms.flags
|
||||
+ & (WINED3DCREATE_SOFTWARE_VERTEXPROCESSING | WINED3DCREATE_MIXED_VERTEXPROCESSING)
|
||||
+ ? d3d_info->limits.vs_uniform_count_swvp : d3d_info->limits.vs_uniform_count;
|
||||
+ vs_uniform_count = wined3d_device_get_vs_uniform_count(stateblock->device);
|
||||
+
|
||||
for (start = 0; ; start = range.offset + range.size)
|
||||
{
|
||||
@@ -163,10 +149,11 @@ index db0019adbf4..0641fb4b754 100644
|
||||
break;
|
||||
wined3d_stateblock_set_vs_consts_f(device_state, range.offset, range.size, &state->vs_consts_f[range.offset]);
|
||||
}
|
||||
@@ -1184,12 +1194,16 @@ HRESULT CDECL wined3d_stateblock_set_vs_consts_f(struct wined3d_stateblock *stat
|
||||
@@ -1183,13 +1187,14 @@ static void wined3d_bitmap_set_bits(uint32_t *bitmap, unsigned int start, unsign
|
||||
HRESULT CDECL wined3d_stateblock_set_vs_consts_f(struct wined3d_stateblock *stateblock,
|
||||
unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
|
||||
{
|
||||
const struct wined3d_d3d_info *d3d_info = &stateblock->device->adapter->d3d_info;
|
||||
- const struct wined3d_d3d_info *d3d_info = &stateblock->device->adapter->d3d_info;
|
||||
+ unsigned int constants_count;
|
||||
|
||||
TRACE("stateblock %p, start_idx %u, count %u, constants %p.\n",
|
||||
@@ -174,15 +161,13 @@ index db0019adbf4..0641fb4b754 100644
|
||||
|
||||
- if (!constants || start_idx >= d3d_info->limits.vs_uniform_count
|
||||
- || count > d3d_info->limits.vs_uniform_count - start_idx)
|
||||
+ constants_count = stateblock->device->create_parms.flags
|
||||
+ & (WINED3DCREATE_SOFTWARE_VERTEXPROCESSING | WINED3DCREATE_MIXED_VERTEXPROCESSING)
|
||||
+ ? d3d_info->limits.vs_uniform_count_swvp : d3d_info->limits.vs_uniform_count;
|
||||
+ constants_count = wined3d_device_get_vs_uniform_count(stateblock->device);
|
||||
+
|
||||
+ if (!constants || start_idx >= constants_count || count > constants_count - start_idx)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
||||
memcpy(&stateblock->stateblock_state.vs_consts_f[start_idx], constants, count * sizeof(*constants));
|
||||
@@ -1937,7 +1951,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
|
||||
@@ -1937,7 +1942,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
|
||||
stateblock_init_lights(stateblock->stateblock_state.light_state->light_map,
|
||||
device_state->stateblock_state.light_state->light_map);
|
||||
stateblock_savedstates_set_all(&stateblock->changed,
|
||||
@@ -191,7 +176,7 @@ index db0019adbf4..0641fb4b754 100644
|
||||
break;
|
||||
|
||||
case WINED3D_SBT_PIXEL_STATE:
|
||||
@@ -1949,7 +1963,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
|
||||
@@ -1949,7 +1954,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
|
||||
stateblock_init_lights(stateblock->stateblock_state.light_state->light_map,
|
||||
device_state->stateblock_state.light_state->light_map);
|
||||
stateblock_savedstates_set_vertex(&stateblock->changed,
|
||||
@@ -201,10 +186,10 @@ index db0019adbf4..0641fb4b754 100644
|
||||
|
||||
default:
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 4a7f843a108..6073331b5d2 100644
|
||||
index 51b5cc4ac7..eef5d4fec2 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3210,7 +3210,7 @@ struct wined3d_state
|
||||
@@ -3206,7 +3206,7 @@ struct wined3d_state
|
||||
struct wined3d_shader_resource_view *shader_resource_view[WINED3D_SHADER_TYPE_COUNT][MAX_SHADER_RESOURCE_VIEWS];
|
||||
struct wined3d_unordered_access_view *unordered_access_view[WINED3D_PIPELINE_COUNT][MAX_UNORDERED_ACCESS_VIEWS];
|
||||
|
||||
@@ -213,7 +198,23 @@ index 4a7f843a108..6073331b5d2 100644
|
||||
struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I];
|
||||
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
|
||||
|
||||
@@ -3947,7 +3947,7 @@ struct wined3d_vertex_declaration
|
||||
@@ -3354,6 +3354,15 @@ HRESULT wined3d_device_set_implicit_swapchain(struct wined3d_device *device,
|
||||
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
void wined3d_device_uninit_3d(struct wined3d_device *device) DECLSPEC_HIDDEN;
|
||||
|
||||
+static inline unsigned int wined3d_device_get_vs_uniform_count(const struct wined3d_device *device)
|
||||
+{
|
||||
+ const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
|
||||
+
|
||||
+ return device->create_parms.flags
|
||||
+ & (WINED3DCREATE_SOFTWARE_VERTEXPROCESSING | WINED3DCREATE_MIXED_VERTEXPROCESSING)
|
||||
+ ? d3d_info->limits.vs_uniform_count_swvp : d3d_info->limits.vs_uniform_count;
|
||||
+}
|
||||
+
|
||||
struct wined3d_device_no3d
|
||||
{
|
||||
struct wined3d_device d;
|
||||
@@ -3923,7 +3932,7 @@ struct wined3d_vertex_declaration
|
||||
|
||||
struct wined3d_saved_states
|
||||
{
|
||||
@@ -223,10 +224,10 @@ index 4a7f843a108..6073331b5d2 100644
|
||||
WORD vertexShaderConstantsB; /* WINED3D_MAX_CONSTS_B, 16 */
|
||||
DWORD ps_consts_f[WINED3D_MAX_PS_CONSTS_F >> 5];
|
||||
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
|
||||
index cdefb46e969..3c109b8058c 100644
|
||||
index 3606c4e245..845cd6745f 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -2174,7 +2174,7 @@ struct wined3d_stateblock_state
|
||||
@@ -2165,7 +2165,7 @@ struct wined3d_stateblock_state
|
||||
int base_vertex_index;
|
||||
|
||||
struct wined3d_shader *vs;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 8e28a42c30774c48cbc5bc4c627357c4d26ed4cd Mon Sep 17 00:00:00 2001
|
||||
From ee17d52379ab1bf8ed5c19ce3658a1996d19808b Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <gofmanp@gmail.com>
|
||||
Date: Mon, 25 Feb 2019 15:23:33 +0300
|
||||
Subject: [PATCH] wined3d: Support SWVP mode vertex shaders.
|
||||
@@ -14,7 +14,7 @@ Subject: [PATCH] wined3d: Support SWVP mode vertex shaders.
|
||||
7 files changed, 104 insertions(+), 49 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
|
||||
index b60468e013..6e031be27f 100644
|
||||
index 09446d0be6..7d62fd5823 100644
|
||||
--- a/dlls/d3d9/tests/device.c
|
||||
+++ b/dlls/d3d9/tests/device.c
|
||||
@@ -6901,15 +6901,11 @@ float4 main(const float4 color : COLOR) : SV_TARGET
|
||||
@@ -59,10 +59,10 @@ index b60468e013..6e031be27f 100644
|
||||
cleanup:
|
||||
refcount = IDirect3DDevice9_Release(device);
|
||||
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
|
||||
index 2d6e1fa688..793b3f0c23 100644
|
||||
index 0ae4eb7a34..0463df7a56 100644
|
||||
--- a/dlls/d3d9/tests/visual.c
|
||||
+++ b/dlls/d3d9/tests/visual.c
|
||||
@@ -24810,7 +24810,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
@@ -24803,7 +24803,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
hr = IDirect3DDevice9_CreateVertexShader(device, reladdr_shader_code, &reladdr_shader);
|
||||
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_CreateVertexShader(device, pure_sw_shader_code, &pure_sw_shader);
|
||||
@@ -70,7 +70,7 @@ index 2d6e1fa688..793b3f0c23 100644
|
||||
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vertex_declaration);
|
||||
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
|
||||
@@ -24848,7 +24847,7 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
@@ -24841,7 +24840,7 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
|
||||
expected_color = 0x00ff0000; /* Color from vertex data and not from the shader. */
|
||||
color = getPixelColor(device, 5, 5);
|
||||
@@ -79,7 +79,7 @@ index 2d6e1fa688..793b3f0c23 100644
|
||||
expected_color, color);
|
||||
|
||||
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
||||
@@ -24867,7 +24866,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
@@ -24860,7 +24859,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
|
||||
expected_color = 0x00ffffff;
|
||||
color = getPixelColor(device, 5, 5);
|
||||
@@ -87,7 +87,7 @@ index 2d6e1fa688..793b3f0c23 100644
|
||||
ok(color == expected_color, "Expected color 0x%08x, got 0x%08x (sw shader in sw mode).\n",
|
||||
expected_color, color);
|
||||
|
||||
@@ -24917,7 +24915,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
@@ -24910,7 +24908,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
|
||||
expected_color = 0x0000ffff; /* c[256] is c_color for SW shader. */
|
||||
color = getPixelColor(device, 5, 5);
|
||||
@@ -96,10 +96,10 @@ index 2d6e1fa688..793b3f0c23 100644
|
||||
expected_color, color);
|
||||
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 3aa3d13314..4a9b9a7781 100644
|
||||
index 1db974f118..844d2f60ec 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -4524,6 +4524,14 @@ void CDECL wined3d_device_set_software_vertex_processing(struct wined3d_device *
|
||||
@@ -4256,6 +4256,14 @@ void CDECL wined3d_device_set_software_vertex_processing(struct wined3d_device *
|
||||
warned = TRUE;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ index 3aa3d13314..4a9b9a7781 100644
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index a88f92cc03..4b151baf97 100644
|
||||
index a88f92cc03..3ae361024e 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -140,7 +140,9 @@ struct shader_glsl_priv
|
||||
@@ -219,7 +219,7 @@ index a88f92cc03..4b151baf97 100644
|
||||
shader_glsl_load_constants_f(vshader, gl_info, state->vs_consts_f,
|
||||
- prog->vs.uniform_f_locations, &priv->vconst_heap, priv->stack, constant_version, priv);
|
||||
+ prog->vs.uniform_f_locations, &priv->vconst_heap, priv->stack,
|
||||
+ constant_version, priv, device_is_swvp(context->device));
|
||||
+ constant_version, priv, wined3d_device_is_swvp_mode(context->device));
|
||||
|
||||
if (update_mask & WINED3D_SHADER_CONST_VS_I)
|
||||
shader_glsl_load_constants_i(vshader, gl_info, state->vs_consts_i,
|
||||
@@ -272,7 +272,7 @@ index a88f92cc03..4b151baf97 100644
|
||||
}
|
||||
|
||||
+ if (vshader && vshader->reg_maps.constant_float_count > WINED3D_MAX_VS_CONSTS_F
|
||||
+ && !device_is_swvp(context_gl->c.device))
|
||||
+ && !wined3d_device_is_swvp_mode(context_gl->c.device))
|
||||
+ FIXME("Applying context with SW shader in HW mode.\n");
|
||||
+
|
||||
hshader = state->shader[WINED3D_SHADER_TYPE_HULL];
|
||||
@@ -316,7 +316,7 @@ index a88f92cc03..4b151baf97 100644
|
||||
ERR("Failed to initialize vertex shader constant heap\n");
|
||||
goto fail;
|
||||
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
|
||||
index a869b31a2c..b2145750d6 100644
|
||||
index f29b49b902..294b65260e 100644
|
||||
--- a/dlls/wined3d/shader.c
|
||||
+++ b/dlls/wined3d/shader.c
|
||||
@@ -592,7 +592,7 @@ static void shader_delete_constant_list(struct list *clist)
|
||||
@@ -482,23 +482,23 @@ index 0c6bb93317..1051307e88 100644
|
||||
WARN("Invalid shader version %u.%u (%#x).\n", major, minor, *byte_code);
|
||||
return NULL;
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index d07ac1ab0b..81dfb45ec5 100644
|
||||
index eef5d4fec2..cdfce0bea4 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -4864,6 +4864,13 @@ static inline BOOL shader_constant_is_local(const struct wined3d_shader *shader,
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3354,6 +3354,13 @@ HRESULT wined3d_device_set_implicit_swapchain(struct wined3d_device *device,
|
||||
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
void wined3d_device_uninit_3d(struct wined3d_device *device) DECLSPEC_HIDDEN;
|
||||
|
||||
+static inline BOOL device_is_swvp(const struct wined3d_device *device)
|
||||
+static inline BOOL wined3d_device_is_swvp_mode(const struct wined3d_device *device)
|
||||
+{
|
||||
+ return (device->create_parms.flags & WINED3DCREATE_SOFTWARE_VERTEXPROCESSING)
|
||||
+ || ((device->create_parms.flags & WINED3DCREATE_MIXED_VERTEXPROCESSING)
|
||||
+ && device->softwareVertexProcessing);
|
||||
+}
|
||||
+
|
||||
void get_identity_matrix(struct wined3d_matrix *mat) DECLSPEC_HIDDEN;
|
||||
void get_modelview_matrix(const struct wined3d_context *context, const struct wined3d_state *state,
|
||||
unsigned int index, struct wined3d_matrix *mat) DECLSPEC_HIDDEN;
|
||||
static inline unsigned int wined3d_device_get_vs_uniform_count(const struct wined3d_device *device)
|
||||
{
|
||||
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
|
||||
--
|
||||
2.24.1
|
||||
2.25.1
|
||||
|
||||
|
Reference in New Issue
Block a user