Rebase against a8c1d5c108fc57e4d78e9db126f395c89083a83d.

This commit is contained in:
Zebediah Figura
2022-11-14 17:51:19 -06:00
parent a16b6b9c1e
commit 5088fc67ba
8 changed files with 84 additions and 200 deletions

View File

@@ -1,4 +1,4 @@
From 13edfeb4deb5766367080ff778d16d94b5afbabc Mon Sep 17 00:00:00 2001
From e18ad6deca23d2e49f898692a3127f58fd5cc5d8 Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Mon, 25 Feb 2019 13:17:01 +0300
Subject: [PATCH] wined3d: Use UBO for vertex shader float constants if
@@ -16,36 +16,36 @@ Subject: [PATCH] wined3d: Use UBO for vertex shader float constants if
8 files changed, 148 insertions(+), 14 deletions(-)
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c
index 3818cb79952..f5ae6af08ad 100644
index 973c7fea779..3c2f270015e 100644
--- a/dlls/d3d8/directx.c
+++ b/dlls/d3d8/directx.c
@@ -476,7 +476,7 @@ BOOL d3d8_init(struct d3d8 *d3d8)
DWORD flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING
| WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER
| WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR | WINED3D_NO_PRIMITIVE_RESTART
- | WINED3D_LEGACY_CUBEMAP_FILTERING;
+ | WINED3D_LEGACY_CUBEMAP_FILTERING | WINED3D_LEGACY_SHADER_CONSTANTS;
- | WINED3D_LEGACY_CUBEMAP_FILTERING | WINED3D_NO_DRAW_INDIRECT;
+ | WINED3D_LEGACY_CUBEMAP_FILTERING | WINED3D_NO_DRAW_INDIRECT | WINED3D_LEGACY_SHADER_CONSTANTS;
unsigned int adapter_idx, output_idx, adapter_count, output_count = 0;
struct wined3d_adapter *wined3d_adapter;
diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c
index a1ebc986226..7ac9e9010ec 100644
index 64291c586bb..cd76dfdcf74 100644
--- a/dlls/d3d9/directx.c
+++ b/dlls/d3d9/directx.c
@@ -686,7 +686,7 @@ BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended)
@@ -685,7 +685,7 @@ BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended)
DWORD flags = WINED3D_PRESENT_CONVERSION | WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER
| WINED3D_SRGB_READ_WRITE_CONTROL | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
| WINED3D_NO_PRIMITIVE_RESTART | WINED3D_LEGACY_CUBEMAP_FILTERING
- | WINED3D_NORMALIZED_DEPTH_BIAS;
+ | WINED3D_NORMALIZED_DEPTH_BIAS | WINED3D_LEGACY_SHADER_CONSTANTS;
- | WINED3D_NORMALIZED_DEPTH_BIAS | WINED3D_NO_DRAW_INDIRECT;
+ | WINED3D_NORMALIZED_DEPTH_BIAS | WINED3D_NO_DRAW_INDIRECT | WINED3D_LEGACY_SHADER_CONSTANTS;
unsigned int adapter_idx, output_idx, adapter_count, output_count = 0;
struct wined3d_adapter *wined3d_adapter;
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index 9328ae3d587..01a9cf990f9 100644
index 60a168b5cef..02643b7b3fe 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -3113,6 +3113,9 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
@@ -3095,6 +3095,9 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
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);
@@ -56,10 +56,10 @@ index 9328ae3d587..01a9cf990f9 100644
}
if (gl_info->supported[ARB_TESSELLATION_SHADER])
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index adfbf60e726..c68a3ad3d55 100644
index 40b5442ed04..3e3f9f79da0 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -135,6 +135,10 @@ struct shader_glsl_priv
@@ -132,6 +132,10 @@ struct shader_glsl_priv
unsigned char *stack;
UINT next_constant_version;
@@ -70,7 +70,7 @@ index adfbf60e726..c68a3ad3d55 100644
const struct wined3d_vertex_pipe_ops *vertex_pipe;
const struct wined3d_fragment_pipe_ops *fragment_pipe;
struct wine_rb_tree ffp_vertex_shaders;
@@ -186,6 +190,7 @@ struct glsl_vs_program
@@ -183,6 +187,7 @@ struct glsl_vs_program
GLint pointsize_l_att_location;
GLint pointsize_q_att_location;
GLint clip_planes_location;
@@ -78,7 +78,7 @@ index adfbf60e726..c68a3ad3d55 100644
};
struct glsl_hs_program
@@ -283,6 +288,7 @@ struct glsl_context_data
@@ -280,6 +285,7 @@ struct glsl_context_data
struct glsl_shader_prog_link *glsl_program;
GLenum vertex_color_clamp;
BOOL rasterization_disabled;
@@ -86,7 +86,7 @@ index adfbf60e726..c68a3ad3d55 100644
};
struct glsl_ps_compiled_shader
@@ -1182,12 +1188,54 @@ static void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_info,
@@ -1179,12 +1185,54 @@ static void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_info,
checkGLcall("walk_constant_heap_clamped()");
}
@@ -142,7 +142,7 @@ index adfbf60e726..c68a3ad3d55 100644
/* 1.X pshaders have the constants clamped to [-1;1] implicitly. */
if (shader->reg_maps.shader_version.major == 1
@@ -1522,7 +1570,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
@@ -1517,7 +1565,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
{
const struct wined3d_shader *vshader = state->shader[WINED3D_SHADER_TYPE_VERTEX];
const struct wined3d_shader *pshader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
@@ -151,7 +151,7 @@ index adfbf60e726..c68a3ad3d55 100644
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
struct glsl_shader_prog_link *prog = ctx_data->glsl_program;
const struct wined3d_gl_info *gl_info = context_gl->gl_info;
@@ -1539,9 +1587,32 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
@@ -1534,9 +1582,32 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
constant_version = prog->constant_version;
update_mask = context->constant_update_mask & prog->constant_update_mask;
@@ -185,7 +185,7 @@ index adfbf60e726..c68a3ad3d55 100644
if (update_mask & WINED3D_SHADER_CONST_VS_I)
shader_glsl_load_constants_i(vshader, gl_info, state->vs_consts_i,
@@ -1694,7 +1765,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
@@ -1689,7 +1760,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
if (update_mask & WINED3D_SHADER_CONST_PS_F)
shader_glsl_load_constants_f(pshader, gl_info, state->ps_consts_f,
@@ -194,7 +194,7 @@ index adfbf60e726..c68a3ad3d55 100644
if (update_mask & WINED3D_SHADER_CONST_PS_I)
shader_glsl_load_constants_i(pshader, gl_info, state->ps_consts_i,
@@ -1833,6 +1904,12 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
@@ -1828,6 +1899,12 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
struct constant_heap *heap = &priv->vconst_heap;
UINT i;
@@ -207,7 +207,7 @@ index adfbf60e726..c68a3ad3d55 100644
for (i = start; i < count + start; ++i)
{
update_heap_entry(heap, i, priv->next_constant_version);
@@ -1845,6 +1922,9 @@ static void shader_glsl_update_float_pixel_constants(struct wined3d_device *devi
@@ -1840,6 +1917,9 @@ static void shader_glsl_update_float_pixel_constants(struct wined3d_device *devi
struct constant_heap *heap = &priv->pconst_heap;
UINT i;
@@ -217,7 +217,7 @@ index adfbf60e726..c68a3ad3d55 100644
for (i = start; i < count + start; ++i)
{
update_heap_entry(heap, i, priv->next_constant_version);
@@ -2162,6 +2242,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
@@ -2157,6 +2237,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
const struct wined3d_shader_reg_maps *reg_maps, const struct shader_glsl_ctx_priv *ctx_priv)
{
const struct wined3d_shader_version *version = &reg_maps->shader_version;
@@ -225,7 +225,7 @@ index adfbf60e726..c68a3ad3d55 100644
const struct vs_compile_args *vs_args = ctx_priv->cur_vs_args;
const struct ps_compile_args *ps_args = ctx_priv->cur_ps_args;
const struct wined3d_gl_info *gl_info = context_gl->gl_info;
@@ -2185,7 +2266,15 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
@@ -2190,7 +2271,15 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
}
/* Declare the constants (aka uniforms) */
@@ -242,7 +242,7 @@ index adfbf60e726..c68a3ad3d55 100644
{
unsigned max_constantsF;
@@ -2250,11 +2339,12 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
@@ -2255,11 +2344,12 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
}
else
{
@@ -257,7 +257,7 @@ index adfbf60e726..c68a3ad3d55 100644
}
/* Always declare the full set of constants, the compiler can remove the
@@ -9933,17 +10023,36 @@ static struct glsl_ffp_fragment_shader *shader_glsl_find_ffp_fragment_shader(str
@@ -9942,17 +10032,36 @@ 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,
@@ -299,7 +299,7 @@ index adfbf60e726..c68a3ad3d55 100644
for (i = 0; i < WINED3D_MAX_CONSTS_I; ++i)
{
@@ -11021,6 +11130,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
@@ -11024,6 +11133,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
const struct wined3d_fragment_pipe_ops *fragment_pipe)
{
SIZE_T stack_size = wined3d_log2i(max(WINED3D_MAX_VS_CONSTS_F, WINED3D_MAX_PS_CONSTS_F)) + 1;
@@ -307,7 +307,7 @@ index adfbf60e726..c68a3ad3d55 100644
struct fragment_caps fragment_caps;
void *vertex_priv, *fragment_priv;
struct shader_glsl_priv *priv;
@@ -11028,6 +11138,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
@@ -11031,6 +11141,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
if (!(priv = heap_alloc_zero(sizeof(*priv))))
return E_OUTOFMEMORY;
@@ -316,7 +316,7 @@ index adfbf60e726..c68a3ad3d55 100644
string_buffer_list_init(&priv->string_buffers);
if (!(vertex_priv = vertex_pipe->vp_alloc(&glsl_shader_backend, priv)))
@@ -11082,6 +11194,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
@@ -11085,6 +11197,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
device->fragment_priv = fragment_priv;
device->shader_priv = priv;
@@ -325,7 +325,7 @@ index adfbf60e726..c68a3ad3d55 100644
return WINED3D_OK;
fail:
@@ -11109,6 +11223,13 @@ static void shader_glsl_free(struct wined3d_device *device, struct wined3d_conte
@@ -11112,6 +11226,13 @@ static void shader_glsl_free(struct wined3d_device *device, struct wined3d_conte
priv->fragment_pipe->free_private(device, context);
priv->vertex_pipe->vp_free(device, context);
@@ -340,10 +340,10 @@ index adfbf60e726..c68a3ad3d55 100644
device->shader_priv = NULL;
}
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 957710dbd43..896e8d37690 100644
index c2e77021bb3..3c22e01094e 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -767,6 +767,8 @@ static BOOL shader_record_register_usage(struct wined3d_shader *shader, struct w
@@ -765,6 +765,8 @@ static BOOL shader_record_register_usage(struct wined3d_shader *shader, struct w
}
else
{
@@ -353,10 +353,10 @@ index 957710dbd43..896e8d37690 100644
}
}
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index a39eefa4387..566404d7887 100644
index ee3e083e812..0569eafd48f 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -4569,6 +4569,11 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state
@@ -4594,6 +4594,11 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state
struct wined3d_bo_gl *bo_gl;
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
@@ -369,10 +369,10 @@ index a39eefa4387..566404d7887 100644
if (STATE_IS_GRAPHICS_CONSTANT_BUFFER(state_id))
shader_type = state_id - STATE_GRAPHICS_CONSTANT_BUFFER(0);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 08f5dc6b862..6503c6cd38a 100644
index b7d3b579ed2..8b1ac25321f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1138,6 +1138,7 @@ struct wined3d_shader_reg_maps
@@ -1217,6 +1217,7 @@ struct wined3d_shader_reg_maps
struct wined3d_shader_tgsm *tgsm;
SIZE_T tgsm_capacity;
unsigned int tgsm_count;
@@ -380,7 +380,7 @@ index 08f5dc6b862..6503c6cd38a 100644
};
/* Keeps track of details for TEX_M#x# instructions which need to maintain
@@ -3259,6 +3260,7 @@ struct wined3d_gl_limits
@@ -3355,6 +3356,7 @@ struct wined3d_gl_limits
UINT glsl_varyings;
UINT glsl_vs_float_constants;
UINT glsl_ps_float_constants;
@@ -389,17 +389,17 @@ index 08f5dc6b862..6503c6cd38a 100644
UINT arb_vs_float_constants;
UINT arb_vs_native_constants;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 9c17135570c..6c865929836 100644
index a18dcda45be..14c89680771 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -1343,6 +1343,7 @@ enum wined3d_pipeline
#define WINED3D_NO_PRIMITIVE_RESTART 0x00000800
@@ -1323,6 +1323,7 @@ enum wined3d_memory_segment_group
#define WINED3D_LEGACY_CUBEMAP_FILTERING 0x00001000
#define WINED3D_NORMALIZED_DEPTH_BIAS 0x00002000
+#define WINED3D_LEGACY_SHADER_CONSTANTS 0x00004000
#define WINED3D_NO_DRAW_INDIRECT 0x00004000
+#define WINED3D_LEGACY_SHADER_CONSTANTS 0x00008000
#define WINED3D_RESZ_CODE 0x7fa05000
--
2.33.0
2.35.1