Updated wined3d-SWVP-shaders patchset

This commit is contained in:
Paul Gofman 2020-01-28 19:15:18 +03:00
parent d83b9f53fb
commit 59f43478d6

View File

@ -1,4 +1,4 @@
From 3ee1f4691e18588fe0c7909d7cffbb5ec73c5738 Mon Sep 17 00:00:00 2001
From a5573f470aecb480177b66f585f90d4a53d5ad35 Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Mon, 25 Feb 2019 15:05:12 +0300
Subject: [PATCH 4/5] wined3d: Support SWVP vertex shader constants limit in
@ -8,15 +8,15 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
---
dlls/d3d9/tests/device.c | 5 -----
dlls/d3d9/tests/visual.c | 1 -
dlls/wined3d/device.c | 16 ++++++++++++----
dlls/wined3d/device.c | 24 ++++++++++++++++++------
dlls/wined3d/glsl_shader.c | 2 +-
dlls/wined3d/stateblock.c | 15 +++++++++++----
dlls/wined3d/wined3d_private.h | 6 +++---
include/wine/wined3d.h | 2 +-
7 files changed, 28 insertions(+), 19 deletions(-)
7 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 3ec5128667..c1fa73bd7a 100644
index 03ebe242e9..f1bad3b52e 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -6411,13 +6411,10 @@ static void test_vertex_shader_constant(void)
@ -50,10 +50,10 @@ index 3ec5128667..c1fa73bd7a 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 6a6523aa1d..ec15e4148d 100644
index 366862a05a..f46b85db8f 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -24817,7 +24817,6 @@ static void test_mvp_software_vertex_shaders(void)
@@ -24884,7 +24884,6 @@ static void test_mvp_software_vertex_shaders(void)
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, c_index, 1);
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, (unsigned int)c_index[0], c_color, 1);
@ -62,10 +62,10 @@ index 6a6523aa1d..ec15e4148d 100644
hr = IDirect3DDevice9_BeginScene(device);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 9d3f3dc00f..d61dee3a91 100644
index 3d666306b4..66a7c651e5 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2290,13 +2290,17 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
@@ -2268,13 +2268,17 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
{
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
@ -85,7 +85,7 @@ index 9d3f3dc00f..d61dee3a91 100644
return WINED3DERR_INVALIDCALL;
memcpy(&device->state.vs_consts_f[start_idx], constants, count * sizeof(*constants));
@@ -2315,12 +2319,16 @@ HRESULT CDECL wined3d_device_get_vs_consts_f(const struct wined3d_device *device
@@ -2293,12 +2297,16 @@ HRESULT CDECL wined3d_device_get_vs_consts_f(const struct wined3d_device *device
unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants)
{
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
@ -104,11 +104,34 @@ index 9d3f3dc00f..d61dee3a91 100644
return WINED3DERR_INVALIDCALL;
memcpy(constants, &device->state.vs_consts_f[start_idx], count * sizeof(*constants));
@@ -3836,7 +3844,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
{
const struct wined3d_d3d_info *d3d_info = &stateblock->device->adapter->d3d_info;
const struct wined3d_stateblock_state *state = &stateblock->stateblock_state;
- unsigned int i, j, count;
+ unsigned int i, j, count, vs_uniform_count;
TRACE("device %p, stateblock %p.\n", device, stateblock);
@@ -3845,8 +3853,12 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
if (stateblock->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;
+
count = 0;
- for (i = 0; i < d3d_info->limits.vs_uniform_count; ++i)
+ for (i = 0; i < vs_uniform_count; ++i)
{
if (stateblock->changed.vs_consts_f[i])
++count;
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index bcb1fd98fa..879edacff7 100644
index 54da6af825..6ac77d2147 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1911,7 +1911,7 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
@@ -1913,7 +1913,7 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
if (priv->consts_ubo)
return;
@ -118,10 +141,10 @@ index bcb1fd98fa..879edacff7 100644
update_heap_entry(heap, i, priv->next_constant_version);
}
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 1a0ba0a3d5..65b5df7b34 100644
index f6d36f8c25..b4f78441a0 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -312,7 +312,7 @@ void CDECL wined3d_stateblock_init_contained_states(struct wined3d_stateblock *s
@@ -311,7 +311,7 @@ void CDECL wined3d_stateblock_init_contained_states(struct wined3d_stateblock *s
}
}
@ -130,7 +153,7 @@ index 1a0ba0a3d5..65b5df7b34 100644
{
if (stateblock->changed.vs_consts_f[i])
{
@@ -1292,10 +1292,17 @@ void CDECL wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock *state
@@ -1283,10 +1283,17 @@ void CDECL wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock *state
HRESULT CDECL wined3d_stateblock_set_vs_consts_f(struct wined3d_stateblock *stateblock,
unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
{
@ -149,7 +172,7 @@ index 1a0ba0a3d5..65b5df7b34 100644
return WINED3DERR_INVALIDCALL;
memcpy(&stateblock->stateblock_state.vs_consts_f[start_idx], constants, count * sizeof(*constants));
@@ -2019,7 +2026,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
@@ -2011,7 +2018,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,
@ -158,7 +181,7 @@ index 1a0ba0a3d5..65b5df7b34 100644
break;
case WINED3D_SBT_PIXEL_STATE:
@@ -2031,7 +2038,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
@@ -2023,7 +2030,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,
@ -168,10 +191,10 @@ index 1a0ba0a3d5..65b5df7b34 100644
default:
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 540e56d9f9..2588900daa 100644
index b0e7fb70d4..78215d0f3e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3156,7 +3156,7 @@ struct wined3d_state
@@ -3196,7 +3196,7 @@ struct wined3d_state
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I];
@ -180,7 +203,7 @@ index 540e56d9f9..2588900daa 100644
BOOL ps_consts_b[WINED3D_MAX_CONSTS_B];
struct wined3d_ivec4 ps_consts_i[WINED3D_MAX_CONSTS_I];
@@ -3891,7 +3891,7 @@ struct wined3d_saved_states
@@ -3923,7 +3923,7 @@ struct wined3d_saved_states
BOOL ps_consts_f[WINED3D_MAX_PS_CONSTS_F];
WORD vertexShaderConstantsB; /* WINED3D_MAX_CONSTS_B, 16 */
WORD vertexShaderConstantsI; /* WINED3D_MAX_CONSTS_I, 16 */
@ -189,7 +212,7 @@ index 540e56d9f9..2588900daa 100644
DWORD textures : 20; /* WINED3D_MAX_COMBINED_SAMPLERS, 20 */
DWORD indices : 1;
DWORD material : 1;
@@ -3930,7 +3930,7 @@ struct wined3d_stateblock
@@ -3961,7 +3961,7 @@ struct wined3d_stateblock
unsigned int num_contained_vs_consts_i;
DWORD contained_vs_consts_b[WINED3D_MAX_CONSTS_B];
unsigned int num_contained_vs_consts_b;
@ -199,10 +222,10 @@ index 540e56d9f9..2588900daa 100644
DWORD contained_ps_consts_i[WINED3D_MAX_CONSTS_I];
unsigned int num_contained_ps_consts_i;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index d55719e961..73015bb062 100644
index eea62dd31a..a97a70474a 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2152,7 +2152,7 @@ struct wined3d_stateblock_state
@@ -2148,7 +2148,7 @@ struct wined3d_stateblock_state
int base_vertex_index;
struct wined3d_shader *vs;
@ -212,5 +235,5 @@ index d55719e961..73015bb062 100644
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
--
2.23.0
2.24.1