Updated wined3d-SWVP-shaders, wined3d-Indexed_Vertex_Blending patchsets

This commit is contained in:
Alistair Leslie-Hughes
2019-03-05 09:53:07 +11:00
parent c043d43772
commit 06fbe73760
10 changed files with 101 additions and 91 deletions

View File

@@ -1,4 +1,4 @@
From 6b44ab2e3f778bf8b7837ea02dca26abdc1547a2 Mon Sep 17 00:00:00 2001
From 168e4d29d3880dcb9db75c0a90a459037ee707d5 Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Mon, 25 Feb 2019 13:17:01 +0300
Subject: [PATCH 1/5] wined3d: Use UBO for vertex shader float constants if
@@ -14,10 +14,10 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
5 files changed, 114 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index 48eca14fe2..493bca5d90 100644
index 964e51944f..86df4003db 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -3081,6 +3081,9 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info, struct
@@ -3087,6 +3087,9 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info, struct
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);
@@ -28,7 +28,7 @@ index 48eca14fe2..493bca5d90 100644
}
if (gl_info->supported[ARB_TESSELLATION_SHADER])
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 470cb0c3ba..625997470f 100644
index 476ae2fae0..ecc1d7fbf8 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -138,6 +138,10 @@ struct shader_glsl_priv
@@ -136,7 +136,7 @@ index 470cb0c3ba..625997470f 100644
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_shader_indexable_temp *idx_temp_reg;
unsigned int uniform_block_base, uniform_block_count;
@@ -2425,7 +2470,15 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
@@ -2428,7 +2473,15 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
}
/* Declare the constants (aka uniforms) */
@@ -153,7 +153,7 @@ index 470cb0c3ba..625997470f 100644
{
unsigned max_constantsF;
@@ -2490,11 +2543,12 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
@@ -2493,11 +2546,12 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
}
else
{
@@ -168,7 +168,7 @@ index 470cb0c3ba..625997470f 100644
}
/* Always declare the full set of constants, the compiler can remove the
@@ -10101,17 +10155,44 @@ static struct glsl_ffp_fragment_shader *shader_glsl_find_ffp_fragment_shader(str
@@ -10104,17 +10158,44 @@ 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,
@@ -218,7 +218,7 @@ index 470cb0c3ba..625997470f 100644
for (i = 0; i < WINED3D_MAX_CONSTS_I; ++i)
{
@@ -11191,6 +11272,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
@@ -11194,6 +11275,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
if (!(priv = heap_alloc_zero(sizeof(*priv))))
return E_OUTOFMEMORY;
@@ -226,7 +226,7 @@ index 470cb0c3ba..625997470f 100644
string_buffer_list_init(&priv->string_buffers);
if (!(vertex_priv = vertex_pipe->vp_alloc(&glsl_shader_backend, priv)))
@@ -11245,6 +11327,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
@@ -11248,6 +11330,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
device->fragment_priv = fragment_priv;
device->shader_priv = priv;
@@ -235,7 +235,7 @@ index 470cb0c3ba..625997470f 100644
return WINED3D_OK;
fail:
@@ -11272,6 +11356,13 @@ static void shader_glsl_free(struct wined3d_device *device)
@@ -11275,6 +11359,13 @@ static void shader_glsl_free(struct wined3d_device *device)
priv->fragment_pipe->free_private(device);
priv->vertex_pipe->vp_free(device);
@@ -279,10 +279,10 @@ index d77cb1ce11..104e276585 100644
ERR("Unrecognized shader type %#x.\n", shader_type);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f23b84a6f4..b9ec04080d 100644
index ea41abdaf8..5edff2ecee 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1042,6 +1042,7 @@ struct wined3d_shader_reg_maps
@@ -1051,6 +1051,7 @@ struct wined3d_shader_reg_maps
struct wined3d_shader_tgsm *tgsm;
SIZE_T tgsm_capacity;
unsigned int tgsm_count;
@@ -290,7 +290,7 @@ index f23b84a6f4..b9ec04080d 100644
};
/* Keeps track of details for TEX_M#x# instructions which need to maintain
@@ -2580,6 +2581,7 @@ struct wined3d_gl_limits
@@ -2590,6 +2591,7 @@ struct wined3d_gl_limits
UINT glsl_varyings;
UINT glsl_vs_float_constants;
UINT glsl_ps_float_constants;

View File

@@ -1,4 +1,4 @@
From b6f4150aa69d697f08abcf82ee59ffadb2fa6ad2 Mon Sep 17 00:00:00 2001
From 93e394cd34fa63e16adeee0bf87537256c071fe7 Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Mon, 25 Feb 2019 14:24:50 +0300
Subject: [PATCH 2/5] d3d9: Support SWVP vertex shader float constants limits.

View File

@@ -1,4 +1,4 @@
From c028015c9ec3bcbeac6a57315f81e61f5b56a196 Mon Sep 17 00:00:00 2001
From 37d7d2673047b10e356541e113c8d35d893a0ebb Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Mon, 25 Feb 2019 14:47:28 +0300
Subject: [PATCH 3/5] wined3d: Report actual vertex shader float constants
@@ -13,10 +13,10 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
4 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index 493bca5d90..1b386a7b8e 100644
index 86df4003db..89d887e0fc 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -3731,7 +3731,8 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
@@ -3737,7 +3737,8 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *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;
@@ -54,10 +54,10 @@ index af73751dbf..0be43d4551 100644
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 625997470f..a1e75bf4d4 100644
index ecc1d7fbf8..ac77a6a178 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -11438,7 +11438,10 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
@@ -11441,7 +11441,10 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, 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;
@@ -70,7 +70,7 @@ index 625997470f..a1e75bf4d4 100644
caps->varying_count = gl_info->limits.glsl_varyings;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b9ec04080d..7100816279 100644
index 5edff2ecee..9e5665165f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -163,6 +163,7 @@ struct wined3d_d3d_limits
@@ -81,7 +81,7 @@ index b9ec04080d..7100816279 100644
DWORD ps_uniform_count;
unsigned int varying_count;
unsigned int ffp_textures;
@@ -672,6 +673,7 @@ enum wined3d_shader_conditional_op
@@ -681,6 +682,7 @@ enum wined3d_shader_conditional_op
#define WINED3D_MAX_CONSTS_B 16
#define WINED3D_MAX_CONSTS_I 16
#define WINED3D_MAX_VS_CONSTS_F 256

View File

@@ -1,4 +1,4 @@
From 991225512f6251e7567d510028c69344811e7544 Mon Sep 17 00:00:00 2001
From 220fe2d54e6a022f263ccfc014e31ef239f9c6a6 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,11 +8,11 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
---
dlls/d3d9/tests/device.c | 5 -----
dlls/d3d9/tests/visual.c | 1 -
dlls/wined3d/device.c | 15 +++++++++++----
dlls/wined3d/device.c | 16 ++++++++++++----
dlls/wined3d/glsl_shader.c | 2 +-
dlls/wined3d/stateblock.c | 6 +++---
dlls/wined3d/wined3d_private.h | 8 ++++----
6 files changed, 19 insertions(+), 18 deletions(-)
6 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 030b34c4e4..5f7944b93a 100644
@@ -49,7 +49,7 @@ index 030b34c4e4..5f7944b93a 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 e8279213d0..26085440fd 100644
index 659d074149..a0d7b9caaf 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -23948,7 +23948,6 @@ static void test_mvp_software_vertex_shaders(void)
@@ -61,7 +61,7 @@ index e8279213d0..26085440fd 100644
hr = IDirect3DDevice9_BeginScene(device);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0be43d4551..ff0cb61f08 100644
index 0be43d4551..6649e5078d 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2557,13 +2557,17 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
@@ -84,7 +84,7 @@ index 0be43d4551..ff0cb61f08 100644
return WINED3DERR_INVALIDCALL;
memcpy(&device->update_stateblock_state->vs_consts_f[start_idx], constants, count * sizeof(*constants));
@@ -2590,12 +2594,15 @@ HRESULT CDECL wined3d_device_get_vs_consts_f(const struct wined3d_device *device
@@ -2590,12 +2594,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;
@@ -95,15 +95,16 @@ index 0be43d4551..ff0cb61f08 100644
- if (!constants || start_idx >= d3d_info->limits.vs_uniform_count
- || count > d3d_info->limits.vs_uniform_count - start_idx)
+ constants_count = device->create_parms.flags & WINED3DCREATE_HARDWARE_VERTEXPROCESSING
+ ? d3d_info->limits.vs_uniform_count : d3d_info->limits.vs_uniform_count_swvp;
+ constants_count = device->create_parms.flags
+ & (WINED3DCREATE_SOFTWARE_VERTEXPROCESSING | WINED3DCREATE_MIXED_VERTEXPROCESSING)
+ ? d3d_info->limits.vs_uniform_count_swvp : d3d_info->limits.vs_uniform_count;
+ if (!constants || start_idx >= constants_count
+ || count > constants_count - start_idx)
return WINED3DERR_INVALIDCALL;
memcpy(constants, &device->state.vs_consts_f[start_idx], count * sizeof(*constants));
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index a1e75bf4d4..8fdab07ab0 100644
index ac77a6a178..6acb730fe4 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -2137,7 +2137,7 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
@@ -147,10 +148,10 @@ index 820089d0b8..cd5c8bd5dc 100644
default:
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7100816279..51214d89dc 100644
index 9e5665165f..9655660a5b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2937,7 +2937,7 @@ struct wined3d_state
@@ -2947,7 +2947,7 @@ struct wined3d_state
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I];
@@ -159,7 +160,7 @@ index 7100816279..51214d89dc 100644
BOOL ps_consts_b[WINED3D_MAX_CONSTS_B];
struct wined3d_ivec4 ps_consts_i[WINED3D_MAX_CONSTS_I];
@@ -3009,7 +3009,7 @@ struct wined3d_stateblock_state
@@ -3019,7 +3019,7 @@ struct wined3d_stateblock_state
int base_vertex_index;
struct wined3d_shader *vs;
@@ -168,7 +169,7 @@ index 7100816279..51214d89dc 100644
struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I];
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
@@ -3604,7 +3604,7 @@ struct wined3d_saved_states
@@ -3614,7 +3614,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 */
@@ -177,7 +178,7 @@ index 7100816279..51214d89dc 100644
DWORD textures : 20; /* WINED3D_MAX_COMBINED_SAMPLERS, 20 */
DWORD indices : 1;
DWORD material : 1;
@@ -3640,7 +3640,7 @@ struct wined3d_stateblock
@@ -3650,7 +3650,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;

View File

@@ -1,4 +1,4 @@
From dd16fac7bbbc3a9197d1866e59d945a1552cc654 Mon Sep 17 00:00:00 2001
From 9507b08a2a3e640879f69bbfac0dd600eb127580 Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Mon, 25 Feb 2019 15:23:33 +0300
Subject: [PATCH 5/5] wined3d: Support SWVP mode vertex shaders.
@@ -60,7 +60,7 @@ index 5f7944b93a..cef0759610 100644
cleanup:
refcount = IDirect3DDevice9_Release(device);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 26085440fd..67e1133c51 100644
index a0d7b9caaf..09cd09db94 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -23874,7 +23874,6 @@ static void test_mvp_software_vertex_shaders(void)
@@ -97,10 +97,10 @@ index 26085440fd..67e1133c51 100644
expected_color, color);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index ff0cb61f08..307993286c 100644
index 6649e5078d..8d7f03ecc3 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4079,6 +4079,14 @@ void CDECL wined3d_device_set_software_vertex_processing(struct wined3d_device *
@@ -4080,6 +4080,14 @@ void CDECL wined3d_device_set_software_vertex_processing(struct wined3d_device *
warned = TRUE;
}
@@ -116,7 +116,7 @@ index ff0cb61f08..307993286c 100644
}
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 8fdab07ab0..b7ccfc633e 100644
index 6acb730fe4..8bdb952f38 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -140,7 +140,9 @@ struct shader_glsl_priv
@@ -230,7 +230,7 @@ index 8fdab07ab0..b7ccfc633e 100644
{
update_heap_entry(heap, i, priv->next_constant_version);
}
@@ -2476,7 +2492,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
@@ -2479,7 +2495,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
shader_addline(buffer,"layout(std140) uniform vs_c_ubo\n"
"{ \n"
" vec4 %s_c[%u];\n"
@@ -239,7 +239,7 @@ index 8fdab07ab0..b7ccfc633e 100644
}
else if (shader->limits->constant_float > 0)
{
@@ -10186,12 +10202,13 @@ static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *
@@ -10189,12 +10205,13 @@ static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *
}
else if (!priv->consts_ubo)
{
@@ -255,7 +255,7 @@ index 8fdab07ab0..b7ccfc633e 100644
}
for (i = 0; i < WINED3D_MAX_CONSTS_I; ++i)
@@ -10510,6 +10527,10 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
@@ -10513,6 +10530,10 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
vs_list = &ffp_shader->linked_programs;
}
@@ -266,7 +266,7 @@ index 8fdab07ab0..b7ccfc633e 100644
hshader = state->shader[WINED3D_SHADER_TYPE_HULL];
if (!(context->shader_update_mask & (1u << WINED3D_SHADER_TYPE_HULL)) && ctx_data->glsl_program)
hs_id = ctx_data->glsl_program->hs.id;
@@ -11263,7 +11284,7 @@ static void constant_heap_free(struct constant_heap *heap)
@@ -11266,7 +11287,7 @@ static void constant_heap_free(struct constant_heap *heap)
static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe,
const struct fragment_pipeline *fragment_pipe)
{
@@ -275,7 +275,7 @@ index 8fdab07ab0..b7ccfc633e 100644
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct fragment_caps fragment_caps;
void *vertex_priv, *fragment_priv;
@@ -11273,6 +11294,18 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
@@ -11276,6 +11297,18 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
return E_OUTOFMEMORY;
priv->consts_ubo = gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT];
@@ -294,7 +294,7 @@ index 8fdab07ab0..b7ccfc633e 100644
string_buffer_list_init(&priv->string_buffers);
if (!(vertex_priv = vertex_pipe->vp_alloc(&glsl_shader_backend, priv)))
@@ -11302,7 +11335,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
@@ -11305,7 +11338,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
goto fail;
}
@@ -470,10 +470,10 @@ 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 51214d89dc..7014e6760d 100644
index 9655660a5b..e48c2a730d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4415,6 +4415,13 @@ static inline BOOL shader_constant_is_local(const struct wined3d_shader *shader,
@@ -4425,6 +4425,13 @@ static inline BOOL shader_constant_is_local(const struct wined3d_shader *shader,
return FALSE;
}