Rebase against 2e9a72759cc8508d1ddb7be5d813fdd7bc64e6a5.

This commit is contained in:
Zebediah Figura 2022-04-27 16:34:32 -05:00
parent b54ac2f2b2
commit 7de1ccb1fa
3 changed files with 44 additions and 44 deletions

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "4ec67b7a6447dfc4af8c03c141c600b41b90ef53"
echo "2e9a72759cc8508d1ddb7be5d813fdd7bc64e6a5"
}
# Show version information

View File

@ -1,4 +1,4 @@
From d7ef3801994419f2101bf659e90e8dba7712f5ee Mon Sep 17 00:00:00 2001
From 1c404c1655a49693245eb76db42c147b84949a40 Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Mon, 25 Feb 2019 20:28:35 +0300
Subject: [PATCH] wined3d: Support indexed vertex blending.
@ -12,10 +12,10 @@ Subject: [PATCH] wined3d: Support indexed vertex blending.
5 files changed, 169 insertions(+), 30 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index cfe74a11f5e..0618b2507e8 100644
index b90910d8947..e711eef9b51 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -21861,7 +21861,7 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
@@ -21937,7 +21937,7 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
if (caps.MaxVertexBlendMatrixIndex < 7 || caps.MaxVertexBlendMatrices < 4)
{
@ -24,7 +24,7 @@ index cfe74a11f5e..0618b2507e8 100644
test_id_str, caps.MaxVertexBlendMatrices, caps.MaxVertexBlendMatrixIndex);
return;
}
@@ -22030,7 +22030,7 @@ static void test_indexed_vertex_blending(void)
@@ -22106,7 +22106,7 @@ static void test_indexed_vertex_blending(void)
memset(&caps, 0, sizeof(caps));
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
@ -33,7 +33,7 @@ index cfe74a11f5e..0618b2507e8 100644
caps.MaxVertexBlendMatrixIndex);
do_test_indexed_vertex_blending(device,"IVB software");
@@ -22056,7 +22056,7 @@ static void test_indexed_vertex_blending(void)
@@ -22132,7 +22132,7 @@ static void test_indexed_vertex_blending(void)
memset(&caps, 0, sizeof(caps));
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
@ -43,10 +43,10 @@ index cfe74a11f5e..0618b2507e8 100644
hr = IDirect3DDevice9_SetSoftwareVertexProcessing(device, FALSE);
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 3741a881da0..af0c8fa6c52 100644
index a781d08f396..b6d67c75c9e 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -147,6 +147,9 @@ struct shader_glsl_priv
@@ -144,6 +144,9 @@ struct shader_glsl_priv
struct wine_rb_tree ffp_fragment_shaders;
BOOL ffp_proj_control;
BOOL legacy_lighting;
@ -56,7 +56,7 @@ index 3741a881da0..af0c8fa6c52 100644
};
struct glsl_vs_program
@@ -161,6 +164,7 @@ struct glsl_vs_program
@@ -158,6 +161,7 @@ struct glsl_vs_program
GLint base_vertex_id_location;
GLint modelview_matrix_location[MAX_VERTEX_BLENDS];
@ -64,7 +64,7 @@ index 3741a881da0..af0c8fa6c52 100644
GLint projection_matrix_location;
GLint normal_matrix_location;
GLint texture_matrix_location[WINED3D_MAX_TEXTURES];
@@ -1605,10 +1609,10 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
@@ -1600,10 +1604,10 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
{
unsigned int base, count;
@ -77,7 +77,7 @@ index 3741a881da0..af0c8fa6c52 100644
if (priv->ubo_vs_c == -1)
{
GL_EXTCALL(glGenBuffers(1, &priv->ubo_vs_c));
@@ -1621,6 +1625,21 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
@@ -1616,6 +1620,21 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
GL_EXTCALL(glBindBufferBase(GL_UNIFORM_BUFFER, base, priv->ubo_vs_c));
checkGLcall("glBindBufferBase");
}
@ -99,7 +99,7 @@ index 3741a881da0..af0c8fa6c52 100644
ctx_data->ubo_bound = TRUE;
}
@@ -1667,28 +1686,41 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
@@ -1662,28 +1681,41 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
}
if (update_mask & WINED3D_SHADER_CONST_FFP_MODELVIEW)
@ -124,16 +124,16 @@ index 3741a881da0..af0c8fa6c52 100644
- break;
+ if (priv->ubo_modelview == -1)
+ FIXME("UBO buffer with vertex blend matrices is not initialized.\n");
+
- get_modelview_matrix(context, state, i, &mat);
- GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location[i], 1, FALSE, &mat._11));
- checkGLcall("glUniformMatrix4fv");
+ GL_EXTCALL(glBindBuffer(GL_UNIFORM_BUFFER, priv->ubo_modelview));
+ checkGLcall("glBindBuffer (UBO)");
+ GL_EXTCALL(glBufferData(GL_UNIFORM_BUFFER, sizeof(*priv->modelview_buffer) * MAX_VERTEX_BLEND_UBO,
+ NULL, GL_STREAM_DRAW));
+ checkGLcall("glBufferData");
- get_modelview_matrix(context, state, i, &mat);
- GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location[i], 1, FALSE, &mat._11));
- checkGLcall("glUniformMatrix4fv");
+
+ for (i = 0; i < MAX_VERTEX_BLEND_UBO; ++i)
+ get_modelview_matrix(context, state, i, &priv->modelview_buffer[i]);
+
@ -155,7 +155,7 @@ index 3741a881da0..af0c8fa6c52 100644
}
}
@@ -9079,8 +9111,7 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
@@ -9086,8 +9118,7 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
{
{"vec4", "ffp_attrib_position"}, /* WINED3D_FFP_POSITION */
{"vec4", "ffp_attrib_blendweight"}, /* WINED3D_FFP_BLENDWEIGHT */
@ -165,7 +165,7 @@ index 3741a881da0..af0c8fa6c52 100644
{"vec3", "ffp_attrib_normal"}, /* WINED3D_FFP_NORMAL */
{"float", "ffp_attrib_psize"}, /* WINED3D_FFP_PSIZE */
{"vec4", "ffp_attrib_diffuse"}, /* WINED3D_FFP_DIFFUSE */
@@ -9096,6 +9127,9 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
@@ -9103,6 +9134,9 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
string_buffer_clear(buffer);
shader_glsl_add_version_declaration(buffer, gl_info);
@ -175,7 +175,7 @@ index 3741a881da0..af0c8fa6c52 100644
if (shader_glsl_use_explicit_attrib_location(gl_info))
shader_addline(buffer, "#extension GL_ARB_explicit_attrib_location : enable\n");
@@ -9110,7 +9144,18 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
@@ -9119,7 +9153,18 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
}
shader_addline(buffer, "\n");
@ -195,7 +195,7 @@ index 3741a881da0..af0c8fa6c52 100644
shader_addline(buffer, "uniform mat4 ffp_projection_matrix;\n");
shader_addline(buffer, "uniform mat3 ffp_normal_matrix;\n");
shader_addline(buffer, "uniform mat4 ffp_texture_matrix[%u];\n", WINED3D_MAX_TEXTURES);
@@ -9172,6 +9217,8 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
@@ -9181,6 +9226,8 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
shader_addline(buffer, "\nvoid main()\n{\n");
shader_addline(buffer, "float m;\n");
shader_addline(buffer, "vec3 r;\n");
@ -204,7 +204,7 @@ index 3741a881da0..af0c8fa6c52 100644
for (i = 0; i < ARRAY_SIZE(attrib_info); ++i)
{
@@ -9201,8 +9248,21 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
@@ -9210,8 +9257,21 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
shader_addline(buffer, "ffp_attrib_blendweight[%u] -= ffp_attrib_blendweight[%u];\n", settings->vertexblends, i);
shader_addline(buffer, "vec4 ec_pos = vec4(0.0);\n");
@ -228,7 +228,7 @@ index 3741a881da0..af0c8fa6c52 100644
shader_addline(buffer, "gl_Position = ffp_projection_matrix * ec_pos;\n");
if (settings->clipping)
@@ -9226,7 +9286,19 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
@@ -9235,7 +9295,19 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
else
{
for (i = 0; i < settings->vertexblends + 1; ++i)
@ -249,7 +249,7 @@ index 3741a881da0..af0c8fa6c52 100644
}
if (settings->normalize)
@@ -10091,6 +10163,28 @@ static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *
@@ -10100,6 +10172,28 @@ static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *
string_buffer_sprintf(name, "ffp_modelview_matrix[%u]", i);
vs->modelview_matrix_location[i] = GL_EXTCALL(glGetUniformLocation(program_id, name->buffer));
}
@ -278,7 +278,7 @@ index 3741a881da0..af0c8fa6c52 100644
vs->projection_matrix_location = GL_EXTCALL(glGetUniformLocation(program_id, "ffp_projection_matrix"));
vs->normal_matrix_location = GL_EXTCALL(glGetUniformLocation(program_id, "ffp_normal_matrix"));
for (i = 0; i < WINED3D_MAX_TEXTURES; ++i)
@@ -10673,7 +10767,7 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl,
@@ -10680,7 +10774,7 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl,
entry->constant_update_mask |= WINED3D_SHADER_CONST_FFP_MODELVIEW
| WINED3D_SHADER_CONST_FFP_PROJ;
@ -287,7 +287,7 @@ index 3741a881da0..af0c8fa6c52 100644
{
if (entry->vs.modelview_matrix_location[i] != -1)
{
@@ -10682,6 +10776,9 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl,
@@ -10689,6 +10783,9 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl,
}
}
@ -297,7 +297,7 @@ index 3741a881da0..af0c8fa6c52 100644
for (i = 0; i < WINED3D_MAX_TEXTURES; ++i)
{
if (entry->vs.texture_matrix_location[i] != -1)
@@ -11222,7 +11319,17 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
@@ -11225,7 +11322,17 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
fragment_pipe->get_caps(device->adapter, &fragment_caps);
priv->ffp_proj_control = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_PROJ_CONTROL;
priv->legacy_lighting = device->wined3d->flags & WINED3D_LEGACY_FFP_LIGHTING;
@ -316,7 +316,7 @@ index 3741a881da0..af0c8fa6c52 100644
device->vertex_priv = vertex_priv;
device->fragment_priv = fragment_priv;
device->shader_priv = priv;
@@ -11255,6 +11362,14 @@ static void shader_glsl_free(struct wined3d_device *device, struct wined3d_conte
@@ -11258,6 +11365,14 @@ static void shader_glsl_free(struct wined3d_device *device, struct wined3d_conte
string_buffer_free(&priv->shader_buffer);
priv->fragment_pipe->free_private(device, context);
priv->vertex_pipe->vp_free(device, context);
@ -331,7 +331,7 @@ index 3741a881da0..af0c8fa6c52 100644
if (priv->ubo_vs_c != -1)
{
@@ -11679,7 +11794,11 @@ static void glsl_vertex_pipe_vp_get_caps(const struct wined3d_adapter *adapter,
@@ -11690,7 +11805,11 @@ static void glsl_vertex_pipe_vp_get_caps(const struct wined3d_adapter *adapter,
caps->ffp_generic_attributes = TRUE;
caps->max_active_lights = WINED3D_MAX_ACTIVE_LIGHTS;
caps->max_vertex_blend_matrices = MAX_VERTEX_BLENDS;
@ -344,7 +344,7 @@ index 3741a881da0..af0c8fa6c52 100644
caps->vertex_processing_caps = WINED3DVTXPCAPS_TEXGEN
| WINED3DVTXPCAPS_MATERIALSOURCE7
| WINED3DVTXPCAPS_VERTEXFOG
@@ -11881,7 +12000,8 @@ static void glsl_vertex_pipe_pixel_shader(struct wined3d_context *context,
@@ -11892,7 +12011,8 @@ static void glsl_vertex_pipe_pixel_shader(struct wined3d_context *context,
static void glsl_vertex_pipe_world(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id)
{
@ -355,10 +355,10 @@ index 3741a881da0..af0c8fa6c52 100644
static void glsl_vertex_pipe_vertexblend(struct wined3d_context *context,
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index c4016c686c6..0f5521535d3 100644
index dcbc0720b22..4b6bb29aa85 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -6728,6 +6728,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
@@ -6832,6 +6832,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
settings->flatshading = FALSE;
settings->swizzle_map = si->swizzle_map;
@ -367,7 +367,7 @@ index c4016c686c6..0f5521535d3 100644
int wined3d_ffp_vertex_program_key_compare(const void *key, const struct wine_rb_entry *entry)
diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c
index 45a01f4bdd4..46788da8e69 100644
index dbb78806c3e..ca12679246a 100644
--- a/dlls/wined3d/vertexdeclaration.c
+++ b/dlls/wined3d/vertexdeclaration.c
@@ -121,6 +121,15 @@ static BOOL declaration_element_valid_ffp(const struct wined3d_vertex_element *e
@ -387,10 +387,10 @@ index 45a01f4bdd4..46788da8e69 100644
switch(element->format)
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7245354bd96..cdca5f01c93 100644
index a7062fe546a..b3b544b0064 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -295,6 +295,7 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
@@ -301,6 +301,7 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
}
/* Device caps */
@ -398,17 +398,17 @@ index 7245354bd96..cdca5f01c93 100644
#define WINED3D_MAX_ACTIVE_LIGHTS 8
#define WINED3D_MAX_SOFTWARE_ACTIVE_LIGHTS 32
#define MAX_CONSTANT_BUFFERS 15
@@ -3592,7 +3593,8 @@ struct wined3d_ffp_vs_settings
@@ -3663,7 +3664,8 @@ struct wined3d_ffp_vs_settings
DWORD texcoords : 8; /* WINED3D_MAX_TEXTURES */
DWORD ortho_fog : 1;
DWORD flatshading : 1;
DWORD swizzle_map : 16; /* MAX_ATTRIBS, 16 */
- DWORD padding : 2;
- DWORD padding : 18;
+ DWORD vb_indices : 1;
+ DWORD padding : 1;
+ DWORD padding : 17;
DWORD texgen[WINED3D_MAX_TEXTURES];
};
@@ -6082,6 +6084,13 @@ static inline void wined3d_not_from_cs(const struct wined3d_cs *cs)
DWORD swizzle_map; /* MAX_ATTRIBS, 32 */
@@ -6373,6 +6375,13 @@ static inline void wined3d_not_from_cs(const struct wined3d_cs *cs)
assert(cs->thread_id != GetCurrentThreadId());
}
@ -423,5 +423,5 @@ index 7245354bd96..cdca5f01c93 100644
enum wined3d_material_color_source source)
{
--
2.30.2
2.34.1

View File

@ -1 +1 @@
4ec67b7a6447dfc4af8c03c141c600b41b90ef53
2e9a72759cc8508d1ddb7be5d813fdd7bc64e6a5