Updated wined3d-SWVP-shaders patchset.

This commit is contained in:
Paul Gofman 2020-03-05 11:25:14 +03:00
parent 7428dd8656
commit e61a75f75f

View File

@ -1,4 +1,4 @@
From ea7453fa9fef54f2dcdab78f0b634bc06f8dd832 Mon Sep 17 00:00:00 2001
From 61505b768160ab77740b5556abb3596c69054d00 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
@ -9,13 +9,13 @@ Subject: [PATCH] wined3d: Support SWVP vertex shader constants limit in state
dlls/d3d9/tests/visual.c | 1 -
dlls/wined3d/device.c | 17 +++++++++++++----
dlls/wined3d/glsl_shader.c | 2 +-
dlls/wined3d/stateblock.c | 12 ++++++++----
dlls/wined3d/stateblock.c | 30 ++++++++++++++++++++++--------
dlls/wined3d/wined3d_private.h | 4 ++--
include/wine/wined3d.h | 2 +-
7 files changed, 25 insertions(+), 18 deletions(-)
7 files changed, 39 insertions(+), 22 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 8c1ebc1719c..b60468e013e 100644
index 8c1ebc1719..b60468e013 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 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 cb84ef6f28..2d6e1fa688 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)
@ -61,10 +61,10 @@ index cb84ef6f284..2d6e1fa688f 100644
hr = IDirect3DDevice9_BeginScene(device);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index f6dd6d1d3b6..4ea93fc4e2b 100644
index e63d538bc1..2bc7ca8562 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2139,13 +2139,17 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
@@ -2116,13 +2116,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;
@ -84,7 +84,7 @@ index f6dd6d1d3b6..4ea93fc4e2b 100644
return WINED3DERR_INVALIDCALL;
memcpy(&device->state.vs_consts_f[start_idx], constants, count * sizeof(*constants));
@@ -3609,10 +3613,11 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
@@ -3586,10 +3590,11 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
struct wined3d_stateblock *stateblock)
{
const struct wined3d_stateblock_state *state = &stateblock->stateblock_state;
@ -97,7 +97,7 @@ index f6dd6d1d3b6..4ea93fc4e2b 100644
struct wined3d_color colour;
struct wined3d_range range;
BOOL set_blend_state;
@@ -3625,9 +3630,13 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
@@ -3602,9 +3607,13 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
if (changed->pixelShader)
wined3d_device_set_pixel_shader(device, state->ps);
@ -113,7 +113,7 @@ index f6dd6d1d3b6..4ea93fc4e2b 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
@ -126,10 +126,64 @@ 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 70943afddaa..8935926e88f 100644
index 70943afdda..22862403e9 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1207,12 +1207,16 @@ HRESULT CDECL wined3d_stateblock_set_vs_consts_f(struct wined3d_stateblock *stat
@@ -720,9 +720,10 @@ static void wined3d_state_record_lights(struct wined3d_light_state *dst_state,
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;
- unsigned int i, start;
DWORD map;
TRACE("stateblock %p, device_state %p.\n", stateblock, device_state);
@@ -738,9 +739,13 @@ 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;
+
for (start = 0; ; start = range.offset + range.size)
{
- if (!wined3d_bitmap_get_range(stateblock->changed.vs_consts_f, WINED3D_MAX_VS_CONSTS_F, start, &range))
+ if (!wined3d_bitmap_get_range(stateblock->changed.vs_consts_f, vs_uniform_count, start, &range))
break;
memcpy(&stateblock->stateblock_state.vs_consts_f[range.offset], &state->vs_consts_f[range.offset],
@@ -989,9 +994,10 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
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;
- unsigned int i, start;
DWORD map;
TRACE("stateblock %p, device_state %p.\n", stateblock, device_state);
@@ -999,9 +1005,13 @@ 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;
+
for (start = 0; ; start = range.offset + range.size)
{
- if (!wined3d_bitmap_get_range(stateblock->changed.vs_consts_f, WINED3D_MAX_VS_CONSTS_F, start, &range))
+ if (!wined3d_bitmap_get_range(stateblock->changed.vs_consts_f, vs_uniform_count, start, &range))
break;
wined3d_stateblock_set_vs_consts_f(device_state, range.offset, range.size, &state->vs_consts_f[range.offset]);
}
@@ -1207,12 +1217,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;
@ -148,7 +202,7 @@ index 70943afddaa..8935926e88f 100644
return WINED3DERR_INVALIDCALL;
memcpy(&stateblock->stateblock_state.vs_consts_f[start_idx], constants, count * sizeof(*constants));
@@ -1976,7 +1980,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
@@ -1976,7 +1990,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,
@ -157,7 +211,7 @@ index 70943afddaa..8935926e88f 100644
break;
case WINED3D_SBT_PIXEL_STATE:
@@ -1988,7 +1992,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
@@ -1988,7 +2002,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,
@ -167,10 +221,10 @@ index 70943afddaa..8935926e88f 100644
default:
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d09cea0bdfd..5b52fd87852 100644
index 46ffe40e6f..2f83e1dd19 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3204,7 +3204,7 @@ struct wined3d_state
@@ -3200,7 +3200,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];
@ -179,7 +233,7 @@ index d09cea0bdfd..5b52fd87852 100644
struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I];
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
@@ -3940,7 +3940,7 @@ struct wined3d_vertex_declaration
@@ -3918,7 +3918,7 @@ struct wined3d_vertex_declaration
struct wined3d_saved_states
{
@ -189,10 +243,10 @@ index d09cea0bdfd..5b52fd87852 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 10870ad6602..73d8c3a6ef6 100644
index 2eeb3aee11..0fc6dc0ba2 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;
@ -202,5 +256,5 @@ index 10870ad6602..73d8c3a6ef6 100644
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
--
2.17.1
2.24.1