Rebase against 6763ed84cf0629dd7d1495263e1e3ea9aaf3d663.

This commit is contained in:
Alistair Leslie-Hughes
2021-07-08 11:16:34 +10:00
parent a0716c9cfe
commit e59eb7639a
11 changed files with 72 additions and 163 deletions

View File

@@ -1,4 +1,4 @@
From a53e3b95850d3af54f919c219a2fc02e88f3f965 Mon Sep 17 00:00:00 2001
From 474a1f4337afc7d612dda95b607fd01652aae8f1 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, 29 insertions(+), 9 deletions(-)
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index 7bb277c2a75..eff04c448d7 100644
index 50c3b38d795..13e93316c6f 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -40,6 +40,7 @@
@@ -31,7 +31,7 @@ index 7bb277c2a75..eff04c448d7 100644
struct fvf_declaration
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 2cd9d73d0d9..6df6f0099ee 100644
index c8b906a981f..b271d8385b8 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -367,7 +367,7 @@ static BOOL wined3d_swapchain_desc_from_d3d9(struct wined3d_swapchain_desc *swap
@@ -80,7 +80,7 @@ index 2cd9d73d0d9..6df6f0099ee 100644
return hr;
}
@@ -3647,14 +3653,20 @@ static HRESULT WINAPI d3d9_device_SetVertexShaderConstantF(IDirect3DDevice9Ex *i
@@ -3654,14 +3660,20 @@ static HRESULT WINAPI d3d9_device_SetVertexShaderConstantF(IDirect3DDevice9Ex *i
UINT reg_idx, const float *data, UINT count)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
@@ -103,7 +103,7 @@ index 2cd9d73d0d9..6df6f0099ee 100644
return D3DERR_INVALIDCALL;
}
@@ -3670,14 +3682,21 @@ static HRESULT WINAPI d3d9_device_GetVertexShaderConstantF(IDirect3DDevice9Ex *i
@@ -3677,14 +3689,21 @@ static HRESULT WINAPI d3d9_device_GetVertexShaderConstantF(IDirect3DDevice9Ex *i
UINT start_idx, float *constants, UINT count)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
@@ -116,17 +116,17 @@ index 2cd9d73d0d9..6df6f0099ee 100644
if (!constants)
return D3DERR_INVALIDCALL;
- if (start_idx >= device->vs_uniform_count || count > device->vs_uniform_count - start_idx)
- if (!wined3d_bound_range(start_idx, count, device->vs_uniform_count))
+ wined3d_device_get_creation_parameters(device->wined3d_device, &creation_parameters);
+ max_constants = creation_parameters.flags
+ & (WINED3DCREATE_SOFTWARE_VERTEXPROCESSING | WINED3DCREATE_MIXED_VERTEXPROCESSING)
+ ? D3D9_MAX_VERTEX_SHADER_CONSTANTF_SWVP : D3D9_MAX_VERTEX_SHADER_CONSTANTF;
+
+ if (start_idx >= max_constants || count > max_constants - start_idx)
+ if (!wined3d_bound_range(start_idx, count, max_constants))
{
WARN("Trying to access %u constants, but d3d9 only supports %u\n",
start_idx + count, device->vs_uniform_count);
@@ -4735,7 +4754,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
@@ -4742,7 +4761,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
device->immediate_context = wined3d_device_get_immediate_context(device->wined3d_device);
wined3d_get_device_caps(wined3d_adapter, wined3d_device_type_from_d3d(device_type), &wined3d_caps);

View File

@@ -1,4 +1,4 @@
From 734d51c817f0a3d3775716fbe3e66ccbbd04ad65 Mon Sep 17 00:00:00 2001
From f3d97f4e2e9e720a0b75666b05362f3450b2496e 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,10 +9,10 @@ Subject: [PATCH] wined3d: Support SWVP vertex shader constants limit in state
dlls/d3d9/tests/visual.c | 1 -
dlls/wined3d/device.c | 6 ++++--
dlls/wined3d/glsl_shader.c | 2 +-
dlls/wined3d/stateblock.c | 23 ++++++++++++++---------
dlls/wined3d/stateblock.c | 22 ++++++++++++++--------
dlls/wined3d/wined3d_private.h | 13 +++++++++++--
include/wine/wined3d.h | 2 +-
7 files changed, 31 insertions(+), 21 deletions(-)
7 files changed, 31 insertions(+), 20 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 3ef9361886d..86dd47383df 100644
@@ -61,10 +61,10 @@ index 40585d5257d..6377addec24 100644
hr = IDirect3DDevice9_BeginScene(device);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index f2ed842a0bb..1181e311075 100644
index 09c1dce8dd9..91cfde663d1 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3558,7 +3558,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
@@ -3606,7 +3606,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;
struct wined3d_device_context *context = &device->cs->c;
@@ -73,7 +73,7 @@ index f2ed842a0bb..1181e311075 100644
struct wined3d_range range;
uint32_t map;
@@ -3569,9 +3569,11 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
@@ -3617,9 +3617,11 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
if (changed->pixelShader)
wined3d_device_context_set_shader(context, WINED3D_SHADER_TYPE_PIXEL, state->ps);
@@ -87,7 +87,7 @@ index f2ed842a0bb..1181e311075 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 e6a5f3f3b88..1f719688b9d 100644
index 152139757c6..e4cafd6a4cc 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1910,7 +1910,7 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
@@ -100,7 +100,7 @@ index e6a5f3f3b88..1f719688b9d 100644
update_heap_entry(heap, i, priv->next_constant_version);
}
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 1f1ba262336..b939da02e61 100644
index 4cf30941d62..363bfb3b900 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -731,8 +731,8 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
@@ -149,7 +149,7 @@ index 1f1ba262336..b939da02e61 100644
break;
wined3d_stateblock_set_vs_consts_f(device_state, range.offset, range.size, &state->vs_consts_f[range.offset]);
}
@@ -1199,13 +1203,14 @@ static void wined3d_bitmap_set_bits(uint32_t *bitmap, unsigned int start, unsign
@@ -1199,12 +1203,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)
{
@@ -159,15 +159,14 @@ index 1f1ba262336..b939da02e61 100644
TRACE("stateblock %p, start_idx %u, count %u, constants %p.\n",
stateblock, start_idx, count, constants);
- if (!constants || start_idx >= d3d_info->limits.vs_uniform_count
- || count > d3d_info->limits.vs_uniform_count - start_idx)
- if (!constants || !wined3d_bound_range(start_idx, count, 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)
+ if (!constants || !wined3d_bound_range(start_idx, count, constants_count))
return WINED3DERR_INVALIDCALL;
memcpy(&stateblock->stateblock_state.vs_consts_f[start_idx], constants, count * sizeof(*constants));
@@ -2013,7 +2018,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
@@ -2011,7 +2017,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,
@@ -176,7 +175,7 @@ index 1f1ba262336..b939da02e61 100644
break;
case WINED3D_SBT_PIXEL_STATE:
@@ -2025,7 +2030,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
@@ -2023,7 +2029,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,
@@ -186,10 +185,10 @@ index 1f1ba262336..b939da02e61 100644
default:
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 3c2d2da4ac9..8ce9eeb0dda 100644
index 28390d8f348..6afbcfb2cfd 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3696,7 +3696,7 @@ struct wined3d_state
@@ -3717,7 +3717,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];
@@ -198,7 +197,7 @@ index 3c2d2da4ac9..8ce9eeb0dda 100644
struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I];
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
@@ -3869,6 +3869,15 @@ HRESULT wined3d_device_set_implicit_swapchain(struct wined3d_device *device,
@@ -3893,6 +3893,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;
@@ -214,7 +213,7 @@ index 3c2d2da4ac9..8ce9eeb0dda 100644
struct wined3d_device_no3d
{
struct wined3d_device d;
@@ -4593,7 +4602,7 @@ struct wined3d_vertex_declaration
@@ -4625,7 +4634,7 @@ struct wined3d_vertex_declaration
struct wined3d_saved_states
{
@@ -224,10 +223,10 @@ index 3c2d2da4ac9..8ce9eeb0dda 100644
WORD vertexShaderConstantsB; /* WINED3D_MAX_CONSTS_B, 16 */
uint32_t ps_consts_f[WINED3D_BITMAP_SIZE(WINED3D_MAX_PS_CONSTS_F)];
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 85416b4594a..7a2829179a4 100644
index cab4a2bc958..5cd71b8268c 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2191,7 +2191,7 @@ struct wined3d_stateblock_state
@@ -2189,7 +2189,7 @@ struct wined3d_stateblock_state
int base_vertex_index;
struct wined3d_shader *vs;