Rebase against b253bd65658fe7dde8e50d7f7e6930cd215282df.

This commit is contained in:
Zebediah Figura
2020-02-21 19:06:44 -06:00
parent 1fe141dd3e
commit 469cbe7ed8
4 changed files with 58 additions and 76 deletions

View File

@@ -1,4 +1,4 @@
From c292c41275966f933680f698d00626566c349ad1 Mon Sep 17 00:00:00 2001
From 346f4479e046a8b786f4fb9df2a1706f3e1fddc5 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
@@ -10,13 +10,13 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
dlls/d3d9/tests/visual.c | 1 -
dlls/wined3d/device.c | 24 ++++++++++++++++++------
dlls/wined3d/glsl_shader.c | 2 +-
dlls/wined3d/stateblock.c | 15 +++++++++++----
dlls/wined3d/wined3d_private.h | 6 +++---
dlls/wined3d/stateblock.c | 12 ++++++++----
dlls/wined3d/wined3d_private.h | 4 ++--
include/wine/wined3d.h | 2 +-
7 files changed, 34 insertions(+), 21 deletions(-)
7 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 8c1ebc1719c..b60468e013e 100644
index 8c1ebc171..b60468e01 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -6413,13 +6413,10 @@ static void test_vertex_shader_constant(void)
@@ -50,7 +50,7 @@ index 8c1ebc1719c..b60468e013e 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 cb84ef6f284..2d6e1fa688f 100644
index cb84ef6f2..2d6e1fa68 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -24884,7 +24884,6 @@ static void test_mvp_software_vertex_shaders(void)
@@ -62,10 +62,10 @@ index cb84ef6f284..2d6e1fa688f 100644
hr = IDirect3DDevice9_BeginScene(device);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 7b9e40d479f..66825bba0a2 100644
index 9aa2c10bc..3aa3d1331 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2293,13 +2293,17 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
@@ -2269,13 +2269,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 7b9e40d479f..66825bba0a2 100644
return WINED3DERR_INVALIDCALL;
memcpy(&device->state.vs_consts_f[start_idx], constants, count * sizeof(*constants));
@@ -2318,12 +2322,16 @@ HRESULT CDECL wined3d_device_get_vs_consts_f(const struct wined3d_device *device
@@ -2294,12 +2298,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,7 +104,7 @@ index 7b9e40d479f..66825bba0a2 100644
return WINED3DERR_INVALIDCALL;
memcpy(constants, &device->state.vs_consts_f[start_idx], count * sizeof(*constants));
@@ -3864,7 +3872,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
@@ -3840,7 +3848,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
const struct wined3d_saved_states *changed = &stateblock->changed;
struct wined3d_blend_state *blend_state;
struct wined3d_color colour;
@@ -113,7 +113,7 @@ index 7b9e40d479f..66825bba0a2 100644
BOOL set_blend_state;
TRACE("device %p, stateblock %p.\n", device, stateblock);
@@ -3874,8 +3882,12 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
@@ -3850,8 +3858,12 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
if (changed->pixelShader)
wined3d_device_set_pixel_shader(device, state->ps);
@@ -125,10 +125,10 @@ index 7b9e40d479f..66825bba0a2 100644
- for (i = 0; i < d3d_info->limits.vs_uniform_count; ++i)
+ for (i = 0; i < vs_uniform_count; ++i)
{
if (changed->vs_consts_f[i])
if (wined3d_bitmap_is_set(changed->vs_consts_f, i))
++count;
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 412b12184f1..33666d5eb8c 100644
index 4f7cc772b..a88f92cc0 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
@@ -141,29 +141,20 @@ 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 d787eef0d99..2ad9b97e8fb 100644
index 69210e1fb..7e7bb4d6a 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -313,7 +313,7 @@ void CDECL wined3d_stateblock_init_contained_states(struct wined3d_stateblock *s
}
}
- for (i = 0; i < d3d_info->limits.vs_uniform_count; ++i)
+ for (i = 0; i < d3d_info->limits.vs_uniform_count_swvp; ++i)
{
if (stateblock->changed.vs_consts_f[i])
{
@@ -1336,10 +1336,17 @@ void CDECL wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock *state
HRESULT CDECL wined3d_stateblock_set_vs_consts_f(struct wined3d_stateblock *stateblock,
@@ -1331,12 +1331,16 @@ HRESULT CDECL wined3d_stateblock_set_vs_consts_f(struct wined3d_stateblock *stat
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",
stateblock, start_idx, count, constants);
- if (!constants || start_idx >= WINED3D_MAX_VS_CONSTS_F || count > WINED3D_MAX_VS_CONSTS_F - start_idx)
- 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;
@@ -172,7 +163,7 @@ index d787eef0d99..2ad9b97e8fb 100644
return WINED3DERR_INVALIDCALL;
memcpy(&stateblock->stateblock_state.vs_consts_f[start_idx], constants, count * sizeof(*constants));
@@ -2096,7 +2103,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
@@ -2096,7 +2100,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,
@@ -181,7 +172,7 @@ index d787eef0d99..2ad9b97e8fb 100644
break;
case WINED3D_SBT_PIXEL_STATE:
@@ -2108,7 +2115,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
@@ -2108,7 +2112,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,
@@ -191,10 +182,10 @@ index d787eef0d99..2ad9b97e8fb 100644
default:
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 988332e225b..618399470a3 100644
index 73834233a..d07ac1ab0 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3205,7 +3205,7 @@ struct wined3d_state
@@ -3201,7 +3201,7 @@ struct wined3d_state
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I];
@@ -203,29 +194,20 @@ index 988332e225b..618399470a3 100644
BOOL ps_consts_b[WINED3D_MAX_CONSTS_B];
struct wined3d_ivec4 ps_consts_i[WINED3D_MAX_CONSTS_I];
@@ -3951,7 +3951,7 @@ struct wined3d_saved_states
BOOL ps_consts_f[WINED3D_MAX_PS_CONSTS_F];
@@ -3929,7 +3929,7 @@ struct wined3d_saved_states
DWORD ps_consts_f[WINED3D_MAX_PS_CONSTS_F >> 5];
WORD vertexShaderConstantsB; /* WINED3D_MAX_CONSTS_B, 16 */
WORD vertexShaderConstantsI; /* WINED3D_MAX_CONSTS_I, 16 */
- BOOL vs_consts_f[WINED3D_MAX_VS_CONSTS_F];
+ BOOL vs_consts_f[WINED3D_MAX_VS_CONSTS_F_SWVP];
- DWORD vs_consts_f[WINED3D_MAX_VS_CONSTS_F >> 5];
+ DWORD vs_consts_f[WINED3D_MAX_VS_CONSTS_F_SWVP >> 5];
DWORD textures : 20; /* WINED3D_MAX_COMBINED_SAMPLERS, 20 */
DWORD indices : 1;
DWORD material : 1;
@@ -3990,7 +3990,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;
- DWORD contained_vs_consts_f[WINED3D_MAX_VS_CONSTS_F];
+ DWORD contained_vs_consts_f[WINED3D_MAX_VS_CONSTS_F_SWVP];
unsigned int num_contained_vs_consts_f;
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 605e44589dd..e9025f72015 100644
index 3608d414d..8327f43ec 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2158,7 +2158,7 @@ struct wined3d_stateblock_state
@@ -2149,7 +2149,7 @@ struct wined3d_stateblock_state
int base_vertex_index;
struct wined3d_shader *vs;