mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Updated wined3d-Indexed_Vertex_Blending and wined3d-SWVP-shaders patchset
Thanks Paul Gofman.
This commit is contained in:
parent
5ffc00de0a
commit
055e049821
@ -1,4 +1,4 @@
|
||||
From 38fb8092fba8c27ab0d89c6253b1b3d00c6e3544 Mon Sep 17 00:00:00 2001
|
||||
From 789b15cc3fcc71567cf103c42333af09a099afe8 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <gofmanp@gmail.com>
|
||||
Date: Thu, 17 Aug 2017 17:46:50 +0300
|
||||
Subject: [PATCH 1/5] d3d9/tests: Add test for indexed vertex blending.
|
||||
@ -9,10 +9,10 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
|
||||
1 file changed, 252 insertions(+)
|
||||
|
||||
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
|
||||
index 09cd09db94..8653462cea 100644
|
||||
index 1cc8642f9b..bd2cd0eee3 100644
|
||||
--- a/dlls/d3d9/tests/visual.c
|
||||
+++ b/dlls/d3d9/tests/visual.c
|
||||
@@ -20765,6 +20765,257 @@ done:
|
||||
@@ -21456,6 +21456,257 @@ done:
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ index 09cd09db94..8653462cea 100644
|
||||
static void test_updatetexture(void)
|
||||
{
|
||||
BOOL r32f_supported, ati2n_supported, do_visual_test;
|
||||
@@ -24918,6 +25169,7 @@ START_TEST(visual)
|
||||
@@ -25610,6 +25861,7 @@ START_TEST(visual)
|
||||
test_multisample_mismatch();
|
||||
test_texcoordindex();
|
||||
test_vertex_blending();
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 4627f3540a189d8a109b71f8a91e25153bfd2b48 Mon Sep 17 00:00:00 2001
|
||||
From c088befb046095f20f615a44c5864b4af9da4938 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Thu, 31 Aug 2017 00:23:43 +0200
|
||||
Subject: [PATCH 2/5] d3d9/tests: Test normal calculation when indexed vertex
|
||||
@ -10,10 +10,10 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
|
||||
1 file changed, 95 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
|
||||
index 8653462cea..8e7d17d5b4 100644
|
||||
index bd2cd0eee3..54051a2010 100644
|
||||
--- a/dlls/d3d9/tests/visual.c
|
||||
+++ b/dlls/d3d9/tests/visual.c
|
||||
@@ -20767,47 +20767,68 @@ done:
|
||||
@@ -21458,47 +21458,68 @@ done:
|
||||
|
||||
static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char *test_id_str)
|
||||
{
|
||||
@ -86,7 +86,7 @@ index 8653462cea..8e7d17d5b4 100644
|
||||
static const POINT quad_upper_right_points[] =
|
||||
{
|
||||
{576, 48}, {-1, -1},
|
||||
@@ -20848,6 +20869,7 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
|
||||
@@ -21539,6 +21560,7 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
|
||||
struct vec3 position;
|
||||
struct vec3 blendweights;
|
||||
DWORD matrixIndices;
|
||||
@ -94,7 +94,7 @@ index 8653462cea..8e7d17d5b4 100644
|
||||
}
|
||||
vertex_data[4];
|
||||
const POINT *quad_points;
|
||||
@@ -20857,34 +20879,34 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
|
||||
@@ -21548,34 +21570,34 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
|
||||
{
|
||||
/* upper right */
|
||||
{
|
||||
@ -145,7 +145,7 @@ index 8653462cea..8e7d17d5b4 100644
|
||||
quad_fullscreen_points, quad_fullscreen_empty_points
|
||||
}
|
||||
};
|
||||
@@ -20919,21 +20941,32 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
|
||||
@@ -21610,21 +21632,32 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
|
||||
ok(hr == D3D_OK, "(%s) IDirect3DDevice9_SetRenderState D3DRS_INDEXEDVERTEXBLENDENABLE failed %08x.\n",
|
||||
test_id_str, hr);
|
||||
|
||||
@ -180,7 +180,7 @@ index 8653462cea..8e7d17d5b4 100644
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_EndScene(device);
|
||||
@@ -20957,7 +20990,47 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
|
||||
@@ -21648,7 +21681,47 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
|
||||
|
||||
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 019c92ba7506c7e6464a9c9dc7a15185c2553d61 Mon Sep 17 00:00:00 2001
|
||||
From d2a46ac5531e0820aa60248478cfc0b203ae999b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Thu, 31 Aug 2017 01:47:49 +0200
|
||||
Subject: [PATCH 3/5] d3d9/tests: Check MaxVertexBlendMatrixIndex capability.
|
||||
@ -9,10 +9,10 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
|
||||
1 file changed, 28 insertions(+)
|
||||
|
||||
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
|
||||
index 8e7d17d5b4..a1d663f43a 100644
|
||||
index 54051a2010..bd9f349746 100644
|
||||
--- a/dlls/d3d9/tests/visual.c
|
||||
+++ b/dlls/d3d9/tests/visual.c
|
||||
@@ -21039,7 +21039,9 @@ static void test_indexed_vertex_blending(void)
|
||||
@@ -21730,7 +21730,9 @@ static void test_indexed_vertex_blending(void)
|
||||
IDirect3DDevice9 *device;
|
||||
IDirect3D9 *d3d;
|
||||
ULONG refcount;
|
||||
@ -22,7 +22,7 @@ index 8e7d17d5b4..a1d663f43a 100644
|
||||
|
||||
window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
0, 0, 640, 480, NULL, NULL, NULL, NULL);
|
||||
@@ -21068,7 +21070,14 @@ static void test_indexed_vertex_blending(void)
|
||||
@@ -21759,7 +21761,14 @@ static void test_indexed_vertex_blending(void)
|
||||
if (SUCCEEDED(IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
|
||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device)))
|
||||
{
|
||||
@ -37,7 +37,7 @@ index 8e7d17d5b4..a1d663f43a 100644
|
||||
refcount = IDirect3DDevice9_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
@@ -21078,7 +21087,26 @@ static void test_indexed_vertex_blending(void)
|
||||
@@ -21769,7 +21778,26 @@ static void test_indexed_vertex_blending(void)
|
||||
if (SUCCEEDED(IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
|
||||
D3DCREATE_MIXED_VERTEXPROCESSING, &present_parameters, &device)))
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 7b61c945927e3744132a25831d707be324c0e77f Mon Sep 17 00:00:00 2001
|
||||
From 74e911fda30ef2ab782ef18168b2acd36e23a8a2 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <gofmanp@gmail.com>
|
||||
Date: Mon, 25 Feb 2019 20:15:07 +0300
|
||||
Subject: [PATCH 4/5] wined3d: Allow higher world matrix states.
|
||||
@ -16,10 +16,10 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
|
||||
8 files changed, 268 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
|
||||
index 89d887e0fc..71ebf0a2d6 100644
|
||||
index 47fff09b8a..63c3a37511 100644
|
||||
--- a/dlls/wined3d/adapter_gl.c
|
||||
+++ b/dlls/wined3d/adapter_gl.c
|
||||
@@ -3750,6 +3750,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
|
||||
@@ -3754,6 +3754,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
|
||||
d3d_info->ffp_generic_attributes = vertex_caps.ffp_generic_attributes;
|
||||
d3d_info->limits.ffp_vertex_blend_matrices = vertex_caps.max_vertex_blend_matrices;
|
||||
d3d_info->limits.active_light_count = vertex_caps.max_active_lights;
|
||||
@ -28,10 +28,10 @@ index 89d887e0fc..71ebf0a2d6 100644
|
||||
|
||||
adapter->fragment_pipe->get_caps(gl_info, &fragment_caps);
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index b5ad1f8875..2dc509749a 100644
|
||||
index 022d790fff..af979a4c1e 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -1672,7 +1672,8 @@ static void wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *dat
|
||||
@@ -1670,7 +1670,8 @@ static void wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *dat
|
||||
const struct wined3d_cs_set_transform *op = data;
|
||||
|
||||
cs->state.transforms[op->state] = op->matrix;
|
||||
@ -42,7 +42,7 @@ index b5ad1f8875..2dc509749a 100644
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 8d7f03ecc3..7f4fe4ba96 100644
|
||||
index 4b98987f63..7f146787bf 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -3645,6 +3645,11 @@ HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device
|
||||
@ -58,10 +58,10 @@ index 8d7f03ecc3..7f4fe4ba96 100644
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
|
||||
index a05f6cccdc..ae061bb82a 100644
|
||||
index debc4e5dc6..84b252582f 100644
|
||||
--- a/dlls/wined3d/directx.c
|
||||
+++ b/dlls/wined3d/directx.c
|
||||
@@ -2251,6 +2251,8 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
|
||||
@@ -2113,6 +2113,8 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, unsigned in
|
||||
caps->MaxActiveLights = vertex_caps.max_active_lights;
|
||||
caps->MaxVertexBlendMatrices = vertex_caps.max_vertex_blend_matrices;
|
||||
caps->MaxVertexBlendMatrixIndex = vertex_caps.max_vertex_blend_matrix_index;
|
||||
@ -71,10 +71,10 @@ index a05f6cccdc..ae061bb82a 100644
|
||||
caps->FVFCaps = vertex_caps.fvf_caps;
|
||||
caps->RasterCaps |= vertex_caps.raster_caps;
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index 8bdb952f38..e2d04702ad 100644
|
||||
index 0df81ed669..df4dfa0659 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -12195,6 +12195,258 @@ static const struct StateEntryTemplate glsl_vertex_pipe_vp_states[] =
|
||||
@@ -12240,6 +12240,258 @@ static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] =
|
||||
{STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(1)), {STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(1)), glsl_vertex_pipe_vertexblend }, WINED3D_GL_EXT_NONE },
|
||||
{STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(2)), {STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(2)), glsl_vertex_pipe_vertexblend }, WINED3D_GL_EXT_NONE },
|
||||
{STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(3)), {STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(3)), glsl_vertex_pipe_vertexblend }, WINED3D_GL_EXT_NONE },
|
||||
@ -334,10 +334,10 @@ index 8bdb952f38..e2d04702ad 100644
|
||||
{STATE_TEXTURESTAGE(1, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(1, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), glsl_vertex_pipe_texmatrix}, WINED3D_GL_EXT_NONE },
|
||||
{STATE_TEXTURESTAGE(2, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(2, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), glsl_vertex_pipe_texmatrix}, WINED3D_GL_EXT_NONE },
|
||||
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
|
||||
index 25205c9aca..d68933802d 100644
|
||||
index d84b42d2ea..8110d530e7 100644
|
||||
--- a/dlls/wined3d/state.c
|
||||
+++ b/dlls/wined3d/state.c
|
||||
@@ -5412,7 +5412,8 @@ static void prune_invalid_states(struct StateEntry *state_table, const struct wi
|
||||
@@ -5416,7 +5416,8 @@ static void prune_invalid_states(struct wined3d_state_entry *state_table, const
|
||||
state_table[i].apply = state_undefined;
|
||||
}
|
||||
|
||||
@ -348,10 +348,10 @@ index 25205c9aca..d68933802d 100644
|
||||
for (i = start; i <= last; ++i)
|
||||
{
|
||||
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
|
||||
index 104e276585..3785ae104b 100644
|
||||
index 1a07366822..fd8e944e3b 100644
|
||||
--- a/dlls/wined3d/utils.c
|
||||
+++ b/dlls/wined3d/utils.c
|
||||
@@ -4933,11 +4933,9 @@ const char *debug_d3dtstype(enum wined3d_transform_state tstype)
|
||||
@@ -4934,11 +4934,9 @@ const char *debug_d3dtstype(enum wined3d_transform_state tstype)
|
||||
TSTYPE_TO_STR(WINED3D_TS_WORLD_MATRIX(3));
|
||||
#undef TSTYPE_TO_STR
|
||||
default:
|
||||
@ -367,10 +367,10 @@ index 104e276585..3785ae104b 100644
|
||||
return "unrecognized";
|
||||
}
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index e48c2a730d..cfad5aba07 100644
|
||||
index 766449d711..5cbadfc2ed 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -170,6 +170,7 @@ struct wined3d_d3d_limits
|
||||
@@ -171,6 +171,7 @@ struct wined3d_d3d_limits
|
||||
unsigned int ffp_blend_stages;
|
||||
unsigned int ffp_vertex_blend_matrices;
|
||||
unsigned int active_light_count;
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 205894feb8deb4c552b9df91636ad76d69847e13 Mon Sep 17 00:00:00 2001
|
||||
From ec2efdf0470dac6a513b0e4a01cc48745b8fa04f Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <gofmanp@gmail.com>
|
||||
Date: Mon, 25 Feb 2019 20:28:35 +0300
|
||||
Subject: [PATCH 5/5] wined3d: Support indexed vertex blending.
|
||||
@ -6,17 +6,17 @@ Subject: [PATCH 5/5] wined3d: Support indexed vertex blending.
|
||||
Signed-off-by: Paul Gofman <gofmanp@gmail.com>
|
||||
---
|
||||
dlls/d3d9/tests/visual.c | 6 +-
|
||||
dlls/wined3d/glsl_shader.c | 164 ++++++++++++++++++++++++++-----
|
||||
dlls/wined3d/glsl_shader.c | 172 ++++++++++++++++++++++++++-----
|
||||
dlls/wined3d/utils.c | 1 +
|
||||
dlls/wined3d/vertexdeclaration.c | 9 ++
|
||||
dlls/wined3d/wined3d_private.h | 11 ++-
|
||||
5 files changed, 163 insertions(+), 28 deletions(-)
|
||||
dlls/wined3d/wined3d_private.h | 11 +-
|
||||
5 files changed, 169 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
|
||||
index a1d663f43a..a452f37944 100644
|
||||
index bd9f349746..beed647b6c 100644
|
||||
--- a/dlls/d3d9/tests/visual.c
|
||||
+++ b/dlls/d3d9/tests/visual.c
|
||||
@@ -20916,7 +20916,7 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
|
||||
@@ -21607,7 +21607,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)
|
||||
{
|
||||
@ -25,7 +25,7 @@ index a1d663f43a..a452f37944 100644
|
||||
test_id_str, caps.MaxVertexBlendMatrices, caps.MaxVertexBlendMatrixIndex);
|
||||
return;
|
||||
}
|
||||
@@ -21073,7 +21073,7 @@ static void test_indexed_vertex_blending(void)
|
||||
@@ -21764,7 +21764,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);
|
||||
@ -34,7 +34,7 @@ index a1d663f43a..a452f37944 100644
|
||||
caps.MaxVertexBlendMatrixIndex);
|
||||
|
||||
do_test_indexed_vertex_blending(device,"IVB software");
|
||||
@@ -21099,7 +21099,7 @@ static void test_indexed_vertex_blending(void)
|
||||
@@ -21790,7 +21790,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);
|
||||
@ -44,7 +44,7 @@ index a1d663f43a..a452f37944 100644
|
||||
|
||||
hr = IDirect3DDevice9_SetSoftwareVertexProcessing(device, FALSE);
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index 4ff5a0622c..48a30856f8 100644
|
||||
index df4dfa0659..8791a714cc 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -150,6 +150,9 @@ struct shader_glsl_priv
|
||||
@ -65,7 +65,42 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
GLint projection_matrix_location;
|
||||
GLint normal_matrix_location;
|
||||
GLint texture_matrix_location[WINED3D_MAX_TEXTURES];
|
||||
@@ -1903,28 +1907,41 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
@@ -1865,10 +1869,10 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
{
|
||||
unsigned int base, count;
|
||||
|
||||
+ wined3d_gl_limits_get_uniform_block_range(&gl_info->limits, WINED3D_SHADER_TYPE_VERTEX,
|
||||
+ &base, &count);
|
||||
if (priv->consts_ubo)
|
||||
{
|
||||
- wined3d_gl_limits_get_uniform_block_range(&gl_info->limits, WINED3D_SHADER_TYPE_VERTEX,
|
||||
- &base, &count);
|
||||
if (priv->ubo_vs_c == -1)
|
||||
{
|
||||
GL_EXTCALL(glGenBuffers(1, &priv->ubo_vs_c));
|
||||
@@ -1881,6 +1885,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");
|
||||
}
|
||||
+ if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT]
|
||||
+ && (context->device->adapter->d3d_info.wined3d_creation_flags & WINED3D_LEGACY_SHADER_CONSTANTS))
|
||||
+ {
|
||||
+ if (priv->ubo_modelview == -1)
|
||||
+ {
|
||||
+ GL_EXTCALL(glGenBuffers(1, &priv->ubo_modelview));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_UNIFORM_BUFFER, priv->ubo_modelview));
|
||||
+ checkGLcall("glBindBuffer (UBO)");
|
||||
+ GL_EXTCALL(glBufferData(GL_UNIFORM_BUFFER,
|
||||
+ sizeof(struct wined3d_matrix) * MAX_VERTEX_BLEND_UBO, NULL, GL_DYNAMIC_DRAW));
|
||||
+ checkGLcall("glBufferData (UBO)");
|
||||
+ }
|
||||
+ GL_EXTCALL(glBindBufferBase(GL_UNIFORM_BUFFER, base + 1, priv->ubo_modelview));
|
||||
+ checkGLcall("glBindBufferBase");
|
||||
+ }
|
||||
ctx_data->ubo_bound = TRUE;
|
||||
}
|
||||
|
||||
@@ -1927,28 +1946,41 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
}
|
||||
|
||||
if (update_mask & WINED3D_SHADER_CONST_FFP_MODELVIEW)
|
||||
@ -96,13 +131,13 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
+ GL_EXTCALL(glBufferData(GL_UNIFORM_BUFFER, sizeof(*priv->modelview_buffer) * MAX_VERTEX_BLEND_UBO,
|
||||
+ NULL, GL_STREAM_DRAW));
|
||||
+ checkGLcall("glBufferData");
|
||||
+
|
||||
+ for (i = 0; i < MAX_VERTEX_BLEND_UBO; ++i)
|
||||
+ get_modelview_matrix(context, state, i, &priv->modelview_buffer[i]);
|
||||
|
||||
- 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]);
|
||||
+
|
||||
+ GL_EXTCALL(glBufferSubData(GL_UNIFORM_BUFFER, 0,
|
||||
+ sizeof(*priv->modelview_buffer) * MAX_VERTEX_BLEND_UBO, priv->modelview_buffer));
|
||||
+ checkGLcall("glBufferSubData");
|
||||
@ -121,7 +156,7 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9242,8 +9259,7 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
@@ -9266,8 +9298,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 */
|
||||
@ -131,7 +166,7 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
{"vec3", "ffp_attrib_normal"}, /* WINED3D_FFP_NORMAL */
|
||||
{"float", "ffp_attrib_psize"}, /* WINED3D_FFP_PSIZE */
|
||||
{"vec4", "ffp_attrib_diffuse"}, /* WINED3D_FFP_DIFFUSE */
|
||||
@@ -9259,6 +9275,9 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
@@ -9283,6 +9314,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);
|
||||
@ -141,7 +176,7 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
|
||||
if (shader_glsl_use_explicit_attrib_location(gl_info))
|
||||
shader_addline(buffer, "#extension GL_ARB_explicit_attrib_location : enable\n");
|
||||
@@ -9273,7 +9292,18 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
@@ -9297,7 +9331,18 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
}
|
||||
shader_addline(buffer, "\n");
|
||||
|
||||
@ -161,7 +196,7 @@ index 4ff5a0622c..48a30856f8 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);
|
||||
@@ -9335,6 +9365,8 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
@@ -9359,6 +9404,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");
|
||||
@ -170,7 +205,7 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(attrib_info); ++i)
|
||||
{
|
||||
@@ -9364,8 +9396,21 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
@@ -9388,8 +9435,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");
|
||||
@ -194,7 +229,7 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
|
||||
shader_addline(buffer, "gl_Position = ffp_projection_matrix * ec_pos;\n");
|
||||
if (settings->clipping)
|
||||
@@ -9389,7 +9434,19 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
@@ -9413,7 +9473,19 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
else
|
||||
{
|
||||
for (i = 0; i < settings->vertexblends + 1; ++i)
|
||||
@ -215,7 +250,7 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
}
|
||||
|
||||
if (settings->normalize)
|
||||
@@ -10262,6 +10319,39 @@ static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *
|
||||
@@ -10278,6 +10350,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));
|
||||
}
|
||||
@ -234,17 +269,6 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
+
|
||||
+ GL_EXTCALL(glUniformBlockBinding(program_id, vs->modelview_block_index, base + 1));
|
||||
+ checkGLcall("glUniformBlockBinding");
|
||||
+ if (priv->ubo_modelview == -1)
|
||||
+ {
|
||||
+ GL_EXTCALL(glGenBuffers(1, &priv->ubo_modelview));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_UNIFORM_BUFFER, priv->ubo_modelview));
|
||||
+ checkGLcall("glBindBuffer (UBO)");
|
||||
+ GL_EXTCALL(glBufferData(GL_UNIFORM_BUFFER,
|
||||
+ sizeof(struct wined3d_matrix) * MAX_VERTEX_BLEND_UBO, NULL, GL_DYNAMIC_DRAW));
|
||||
+ checkGLcall("glBufferData (UBO)");
|
||||
+ GL_EXTCALL(glBindBufferBase(GL_UNIFORM_BUFFER, base + 1, priv->ubo_modelview));
|
||||
+ checkGLcall("glBindBufferBase");
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
@ -255,7 +279,7 @@ index 4ff5a0622c..48a30856f8 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)
|
||||
@@ -10841,7 +10931,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
|
||||
@@ -10857,7 +10951,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
|
||||
entry->constant_update_mask |= WINED3D_SHADER_CONST_FFP_MODELVIEW
|
||||
| WINED3D_SHADER_CONST_FFP_PROJ;
|
||||
|
||||
@ -264,7 +288,7 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
{
|
||||
if (entry->vs.modelview_matrix_location[i] != -1)
|
||||
{
|
||||
@@ -10850,6 +10940,9 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
|
||||
@@ -10866,6 +10960,9 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,7 +298,7 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
for (i = 0; i < WINED3D_MAX_TEXTURES; ++i)
|
||||
{
|
||||
if (entry->vs.texture_matrix_location[i] != -1)
|
||||
@@ -11387,7 +11480,17 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
@@ -11403,7 +11500,17 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
fragment_pipe->get_caps(gl_info, &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;
|
||||
@ -293,7 +317,7 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
device->vertex_priv = vertex_priv;
|
||||
device->fragment_priv = fragment_priv;
|
||||
device->shader_priv = priv;
|
||||
@@ -11420,6 +11523,14 @@ static void shader_glsl_free(struct wined3d_device *device)
|
||||
@@ -11436,6 +11543,14 @@ static void shader_glsl_free(struct wined3d_device *device)
|
||||
string_buffer_free(&priv->shader_buffer);
|
||||
priv->fragment_pipe->free_private(device);
|
||||
priv->vertex_pipe->vp_free(device);
|
||||
@ -308,7 +332,7 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
|
||||
if (priv->ubo_vs_c != -1)
|
||||
{
|
||||
@@ -11836,7 +11947,11 @@ static void glsl_vertex_pipe_vp_get_caps(const struct wined3d_gl_info *gl_info,
|
||||
@@ -11852,7 +11967,11 @@ static void glsl_vertex_pipe_vp_get_caps(const struct wined3d_gl_info *gl_info,
|
||||
caps->ffp_generic_attributes = TRUE;
|
||||
caps->max_active_lights = WINED3D_MAX_ACTIVE_LIGHTS;
|
||||
caps->max_vertex_blend_matrices = MAX_VERTEX_BLENDS;
|
||||
@ -321,7 +345,7 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
caps->vertex_processing_caps = WINED3DVTXPCAPS_TEXGEN
|
||||
| WINED3DVTXPCAPS_MATERIALSOURCE7
|
||||
| WINED3DVTXPCAPS_VERTEXFOG
|
||||
@@ -12035,7 +12150,8 @@ static void glsl_vertex_pipe_pixel_shader(struct wined3d_context *context,
|
||||
@@ -12051,7 +12170,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)
|
||||
{
|
||||
@ -332,10 +356,10 @@ index 4ff5a0622c..48a30856f8 100644
|
||||
|
||||
static void glsl_vertex_pipe_vertexblend(struct wined3d_context *context,
|
||||
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
|
||||
index f0ffe6a62d..4f44ff7a11 100644
|
||||
index fd8e944e3b..fbc44b78b9 100644
|
||||
--- a/dlls/wined3d/utils.c
|
||||
+++ b/dlls/wined3d/utils.c
|
||||
@@ -6332,6 +6332,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
|
||||
@@ -6331,6 +6331,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
|
||||
settings->flatshading = FALSE;
|
||||
|
||||
settings->swizzle_map = si->swizzle_map;
|
||||
@ -364,10 +388,10 @@ index cd8bb5e423..d37f3ce860 100644
|
||||
switch(element->format)
|
||||
{
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index ed719e0919..4eb8498873 100644
|
||||
index 5cbadfc2ed..7265c2d606 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -277,6 +277,7 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
|
||||
@@ -279,6 +279,7 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
|
||||
#define MAX_UNORDERED_ACCESS_VIEWS 8
|
||||
#define MAX_TGSM_REGISTERS 8192
|
||||
#define MAX_VERTEX_BLENDS 4
|
||||
@ -375,7 +399,7 @@ index ed719e0919..4eb8498873 100644
|
||||
#define MAX_RENDER_TARGETS 8
|
||||
|
||||
struct min_lookup
|
||||
@@ -2848,7 +2849,8 @@ struct wined3d_ffp_vs_settings
|
||||
@@ -2852,7 +2853,8 @@ struct wined3d_ffp_vs_settings
|
||||
DWORD ortho_fog : 1;
|
||||
DWORD flatshading : 1;
|
||||
DWORD swizzle_map : 16; /* MAX_ATTRIBS, 16 */
|
||||
@ -385,7 +409,7 @@ index ed719e0919..4eb8498873 100644
|
||||
|
||||
DWORD texgen[WINED3D_MAX_TEXTURES];
|
||||
};
|
||||
@@ -4746,6 +4748,13 @@ static inline void wined3d_not_from_cs(struct wined3d_cs *cs)
|
||||
@@ -4748,6 +4750,13 @@ static inline void wined3d_not_from_cs(struct wined3d_cs *cs)
|
||||
assert(cs->thread_id != GetCurrentThreadId());
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 22aa526b9442ac184b928d16fd354d97b92a7a39 Mon Sep 17 00:00:00 2001
|
||||
From 8c0527ec9d3d1635b74d892aa21d45b86a1e5a18 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
|
||||
@ -9,18 +9,18 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
|
||||
dlls/d3d8/directx.c | 2 +-
|
||||
dlls/d3d9/directx.c | 2 +-
|
||||
dlls/wined3d/adapter_gl.c | 3 +
|
||||
dlls/wined3d/glsl_shader.c | 126 ++++++++++++++++++++++++++++++---
|
||||
dlls/wined3d/glsl_shader.c | 144 ++++++++++++++++++++++++++++++---
|
||||
dlls/wined3d/shader.c | 2 +
|
||||
dlls/wined3d/state.c | 5 ++
|
||||
dlls/wined3d/wined3d_private.h | 2 +
|
||||
include/wine/wined3d.h | 1 +
|
||||
8 files changed, 130 insertions(+), 13 deletions(-)
|
||||
8 files changed, 147 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c
|
||||
index 09188cc2ae..657227357c 100644
|
||||
index f78ff3e5af..847cfd17bf 100644
|
||||
--- a/dlls/d3d8/directx.c
|
||||
+++ b/dlls/d3d8/directx.c
|
||||
@@ -419,7 +419,7 @@ BOOL d3d8_init(struct d3d8 *d3d8)
|
||||
@@ -420,7 +420,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
|
||||
@ -43,10 +43,10 @@ index c507991aaa..7cdf5ddbb9 100644
|
||||
if (!extended)
|
||||
flags |= WINED3D_VIDMEM_ACCOUNTING;
|
||||
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
|
||||
index a61e87344b..abd7114ff2 100644
|
||||
index 5a5a1612a5..fe85fab216 100644
|
||||
--- a/dlls/wined3d/adapter_gl.c
|
||||
+++ b/dlls/wined3d/adapter_gl.c
|
||||
@@ -3087,6 +3087,9 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info, struct
|
||||
@@ -3091,6 +3091,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);
|
||||
@ -57,7 +57,7 @@ index a61e87344b..abd7114ff2 100644
|
||||
}
|
||||
if (gl_info->supported[ARB_TESSELLATION_SHADER])
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index 84899be004..710abbe2a0 100644
|
||||
index 84899be004..5dc5c98982 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -138,6 +138,10 @@ struct shader_glsl_priv
|
||||
@ -79,7 +79,15 @@ index 84899be004..710abbe2a0 100644
|
||||
};
|
||||
|
||||
struct glsl_hs_program
|
||||
@@ -1145,12 +1150,54 @@ static inline void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_i
|
||||
@@ -284,6 +289,7 @@ struct glsl_context_data
|
||||
struct glsl_shader_prog_link *glsl_program;
|
||||
GLenum vertex_color_clamp;
|
||||
BOOL rasterization_disabled;
|
||||
+ BOOL ubo_bound;
|
||||
};
|
||||
|
||||
struct glsl_ps_compiled_shader
|
||||
@@ -1145,12 +1151,54 @@ static inline void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_i
|
||||
checkGLcall("walk_constant_heap_clamped()");
|
||||
}
|
||||
|
||||
@ -135,8 +143,42 @@ index 84899be004..710abbe2a0 100644
|
||||
|
||||
/* 1.X pshaders have the constants clamped to [-1;1] implicitly. */
|
||||
if (shader->reg_maps.shader_version.major == 1
|
||||
@@ -1801,7 +1848,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
@@ -1783,7 +1831,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];
|
||||
- const struct glsl_context_data *ctx_data = context->shader_backend_data;
|
||||
+ struct glsl_context_data *ctx_data = context->shader_backend_data;
|
||||
struct glsl_shader_prog_link *prog = ctx_data->glsl_program;
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
float position_fixup[4 * WINED3D_MAX_VIEWPORTS];
|
||||
@@ -1799,9 +1847,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;
|
||||
|
||||
+ if (!ctx_data->ubo_bound)
|
||||
+ {
|
||||
+ unsigned int base, count;
|
||||
+
|
||||
+ if (priv->consts_ubo)
|
||||
+ {
|
||||
+ wined3d_gl_limits_get_uniform_block_range(&gl_info->limits, WINED3D_SHADER_TYPE_VERTEX,
|
||||
+ &base, &count);
|
||||
+ if (priv->ubo_vs_c == -1)
|
||||
+ {
|
||||
+ GL_EXTCALL(glGenBuffers(1, &priv->ubo_vs_c));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_UNIFORM_BUFFER, priv->ubo_vs_c));
|
||||
+ checkGLcall("glBindBuffer (UBO)");
|
||||
+ GL_EXTCALL(glBufferData(GL_UNIFORM_BUFFER, WINED3D_MAX_VS_CONSTS_F * sizeof(struct wined3d_vec4),
|
||||
+ NULL, GL_STREAM_DRAW));
|
||||
+ checkGLcall("glBufferData");
|
||||
+ }
|
||||
+ GL_EXTCALL(glBindBufferBase(GL_UNIFORM_BUFFER, base, priv->ubo_vs_c));
|
||||
+ checkGLcall("glBindBufferBase");
|
||||
+ }
|
||||
+ ctx_data->ubo_bound = TRUE;
|
||||
+ }
|
||||
+
|
||||
if (update_mask & WINED3D_SHADER_CONST_VS_F)
|
||||
shader_glsl_load_constants_f(vshader, gl_info, state->vs_consts_f,
|
||||
- prog->vs.uniform_f_locations, &priv->vconst_heap, priv->stack, constant_version);
|
||||
@ -144,7 +186,7 @@ index 84899be004..710abbe2a0 100644
|
||||
|
||||
if (update_mask & WINED3D_SHADER_CONST_VS_I)
|
||||
shader_glsl_load_constants_i(vshader, gl_info, state->vs_consts_i,
|
||||
@@ -1954,7 +2001,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
@@ -1954,7 +2025,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,
|
||||
@ -153,7 +195,7 @@ index 84899be004..710abbe2a0 100644
|
||||
|
||||
if (update_mask & WINED3D_SHADER_CONST_PS_I)
|
||||
shader_glsl_load_constants_i(pshader, gl_info, state->ps_consts_i,
|
||||
@@ -2093,6 +2140,12 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
|
||||
@@ -2093,6 +2164,12 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
|
||||
struct constant_heap *heap = &priv->vconst_heap;
|
||||
UINT i;
|
||||
|
||||
@ -166,7 +208,7 @@ index 84899be004..710abbe2a0 100644
|
||||
for (i = start; i < count + start; ++i)
|
||||
{
|
||||
update_heap_entry(heap, i, priv->next_constant_version);
|
||||
@@ -2105,6 +2158,9 @@ static void shader_glsl_update_float_pixel_constants(struct wined3d_device *devi
|
||||
@@ -2105,6 +2182,9 @@ static void shader_glsl_update_float_pixel_constants(struct wined3d_device *devi
|
||||
struct constant_heap *heap = &priv->pconst_heap;
|
||||
UINT i;
|
||||
|
||||
@ -176,7 +218,7 @@ index 84899be004..710abbe2a0 100644
|
||||
for (i = start; i < count + start; ++i)
|
||||
{
|
||||
update_heap_entry(heap, i, priv->next_constant_version);
|
||||
@@ -2408,6 +2464,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
@@ -2408,6 +2488,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
const struct wined3d_shader_version *version = ®_maps->shader_version;
|
||||
const struct vs_compile_args *vs_args = ctx_priv->cur_vs_args;
|
||||
const struct ps_compile_args *ps_args = ctx_priv->cur_ps_args;
|
||||
@ -184,7 +226,7 @@ index 84899be004..710abbe2a0 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;
|
||||
@@ -2428,7 +2485,15 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
@@ -2428,7 +2509,15 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
}
|
||||
|
||||
/* Declare the constants (aka uniforms) */
|
||||
@ -201,7 +243,7 @@ index 84899be004..710abbe2a0 100644
|
||||
{
|
||||
unsigned max_constantsF;
|
||||
|
||||
@@ -2493,11 +2558,12 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
@@ -2493,11 +2582,12 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -216,7 +258,7 @@ index 84899be004..710abbe2a0 100644
|
||||
}
|
||||
|
||||
/* Always declare the full set of constants, the compiler can remove the
|
||||
@@ -10120,17 +10186,44 @@ static struct glsl_ffp_fragment_shader *shader_glsl_find_ffp_fragment_shader(str
|
||||
@@ -10120,17 +10210,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,
|
||||
@ -229,7 +271,9 @@ index 84899be004..710abbe2a0 100644
|
||||
|
||||
- for (i = 0; i < vs_c_count; ++i)
|
||||
+ if (priv->consts_ubo && vs_c_count)
|
||||
+ {
|
||||
{
|
||||
- string_buffer_sprintf(name, "vs_c[%u]", i);
|
||||
- vs->uniform_f_locations[i] = GL_EXTCALL(glGetUniformLocation(program_id, name->buffer));
|
||||
+ unsigned int base, count;
|
||||
+
|
||||
+ vs->vs_c_block_index = GL_EXTCALL(glGetUniformBlockIndex(program_id, "vs_c_ubo"));
|
||||
@ -242,19 +286,9 @@ index 84899be004..710abbe2a0 100644
|
||||
+ assert(count >= 1);
|
||||
+ GL_EXTCALL(glUniformBlockBinding(program_id, vs->vs_c_block_index, base));
|
||||
+ checkGLcall("glUniformBlockBinding");
|
||||
+ if (priv->ubo_vs_c == -1)
|
||||
+ {
|
||||
+ GL_EXTCALL(glGenBuffers(1, &priv->ubo_vs_c));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_UNIFORM_BUFFER, priv->ubo_vs_c));
|
||||
+ checkGLcall("glBindBuffer (UBO)");
|
||||
+ GL_EXTCALL(glBindBufferBase(GL_UNIFORM_BUFFER, base, priv->ubo_vs_c));
|
||||
+ checkGLcall("glBindBufferBase");
|
||||
+ }
|
||||
+ }
|
||||
+ else if (!priv->consts_ubo)
|
||||
{
|
||||
- string_buffer_sprintf(name, "vs_c[%u]", i);
|
||||
- vs->uniform_f_locations[i] = GL_EXTCALL(glGetUniformLocation(program_id, name->buffer));
|
||||
+ {
|
||||
+ for (i = 0; i < vs_c_count; ++i)
|
||||
+ {
|
||||
+ string_buffer_sprintf(name, "vs_c[%u]", i);
|
||||
@ -266,7 +300,7 @@ index 84899be004..710abbe2a0 100644
|
||||
|
||||
for (i = 0; i < WINED3D_MAX_CONSTS_I; ++i)
|
||||
{
|
||||
@@ -11210,6 +11303,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
@@ -11210,6 +11319,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
if (!(priv = heap_alloc_zero(sizeof(*priv))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
@ -275,7 +309,7 @@ index 84899be004..710abbe2a0 100644
|
||||
string_buffer_list_init(&priv->string_buffers);
|
||||
|
||||
if (!(vertex_priv = vertex_pipe->vp_alloc(&glsl_shader_backend, priv)))
|
||||
@@ -11264,6 +11359,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
@@ -11264,6 +11375,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
device->fragment_priv = fragment_priv;
|
||||
device->shader_priv = priv;
|
||||
|
||||
@ -284,7 +318,7 @@ index 84899be004..710abbe2a0 100644
|
||||
return WINED3D_OK;
|
||||
|
||||
fail:
|
||||
@@ -11291,6 +11388,13 @@ static void shader_glsl_free(struct wined3d_device *device)
|
||||
@@ -11291,6 +11404,13 @@ static void shader_glsl_free(struct wined3d_device *device)
|
||||
priv->fragment_pipe->free_private(device);
|
||||
priv->vertex_pipe->vp_free(device);
|
||||
|
||||
@ -328,10 +362,10 @@ index 3af60e1351..d84b42d2ea 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 a5a3f34737..81507db891 100644
|
||||
index 152a78cbf9..faf4be0ab1 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -1053,6 +1053,7 @@ struct wined3d_shader_reg_maps
|
||||
@@ -1055,6 +1055,7 @@ struct wined3d_shader_reg_maps
|
||||
struct wined3d_shader_tgsm *tgsm;
|
||||
SIZE_T tgsm_capacity;
|
||||
unsigned int tgsm_count;
|
||||
@ -339,7 +373,7 @@ index a5a3f34737..81507db891 100644
|
||||
};
|
||||
|
||||
/* Keeps track of details for TEX_M#x# instructions which need to maintain
|
||||
@@ -2592,6 +2593,7 @@ struct wined3d_gl_limits
|
||||
@@ -2593,6 +2594,7 @@ struct wined3d_gl_limits
|
||||
UINT glsl_varyings;
|
||||
UINT glsl_vs_float_constants;
|
||||
UINT glsl_ps_float_constants;
|
||||
@ -348,7 +382,7 @@ index a5a3f34737..81507db891 100644
|
||||
UINT arb_vs_float_constants;
|
||||
UINT arb_vs_native_constants;
|
||||
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
|
||||
index 86fde6a1f2..c597897f43 100644
|
||||
index 6d977a6179..1a541bed46 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -1348,6 +1348,7 @@ enum wined3d_shader_type
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 93e394cd34fa63e16adeee0bf87537256c071fe7 Mon Sep 17 00:00:00 2001
|
||||
From 624a1744fb48b75afb79169b7fab8c8a9d3000d6 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.
|
||||
@ -11,7 +11,7 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
|
||||
3 files changed, 28 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
|
||||
index 3fe0376e5c..300bee73c7 100644
|
||||
index b07d72a066..a9b332ff92 100644
|
||||
--- a/dlls/d3d9/d3d9_private.h
|
||||
+++ b/dlls/d3d9/d3d9_private.h
|
||||
@@ -41,6 +41,7 @@
|
||||
@ -32,7 +32,7 @@ index 3fe0376e5c..300bee73c7 100644
|
||||
struct d3d9
|
||||
{
|
||||
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
|
||||
index 6cc3f180b0..03d2faf61a 100644
|
||||
index 5844d2cdac..00734021b0 100644
|
||||
--- a/dlls/d3d9/device.c
|
||||
+++ b/dlls/d3d9/device.c
|
||||
@@ -362,7 +362,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
|
||||
@ -81,7 +81,7 @@ index 6cc3f180b0..03d2faf61a 100644
|
||||
|
||||
return hr;
|
||||
}
|
||||
@@ -3418,14 +3424,20 @@ static HRESULT WINAPI d3d9_device_SetVertexShaderConstantF(IDirect3DDevice9Ex *i
|
||||
@@ -3434,14 +3440,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);
|
||||
@ -104,7 +104,7 @@ index 6cc3f180b0..03d2faf61a 100644
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
@@ -3441,14 +3453,20 @@ static HRESULT WINAPI d3d9_device_GetVertexShaderConstantF(IDirect3DDevice9Ex *i
|
||||
@@ -3457,14 +3469,20 @@ static HRESULT WINAPI d3d9_device_GetVertexShaderConstantF(IDirect3DDevice9Ex *i
|
||||
UINT reg_idx, float *data, UINT count)
|
||||
{
|
||||
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
|
||||
@ -128,10 +128,10 @@ index 6cc3f180b0..03d2faf61a 100644
|
||||
}
|
||||
|
||||
diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c
|
||||
index eab114d19c..7c4defa169 100644
|
||||
index 7cdf5ddbb9..1d37e900c2 100644
|
||||
--- a/dlls/d3d9/directx.c
|
||||
+++ b/dlls/d3d9/directx.c
|
||||
@@ -371,7 +371,7 @@ static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DD
|
||||
@@ -372,7 +372,7 @@ static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DD
|
||||
hr = wined3d_get_device_caps(d3d9->wined3d, adapter, device_type, &wined3d_caps);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 37d7d2673047b10e356541e113c8d35d893a0ebb Mon Sep 17 00:00:00 2001
|
||||
From fdfe81a0579648faaff6d4cfd59908b62f2c1d3c 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 86df4003db..89d887e0fc 100644
|
||||
index fe85fab216..47fff09b8a 100644
|
||||
--- a/dlls/wined3d/adapter_gl.c
|
||||
+++ b/dlls/wined3d/adapter_gl.c
|
||||
@@ -3737,7 +3737,8 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
|
||||
@@ -3741,7 +3741,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;
|
||||
@ -27,7 +27,7 @@ index 86df4003db..89d887e0fc 100644
|
||||
d3d_info->limits.varying_count = shader_caps.varying_count;
|
||||
d3d_info->shader_double_precision = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION);
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index af73751dbf..0be43d4551 100644
|
||||
index 30d52bc610..4d8396888c 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -3623,10 +3623,21 @@ struct wined3d_texture * CDECL wined3d_device_get_texture(const struct wined3d_d
|
||||
@ -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 ecc1d7fbf8..ac77a6a178 100644
|
||||
index 5dc5c98982..d9d807abdb 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -11441,7 +11441,10 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
|
||||
@@ -11486,7 +11486,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,10 +70,10 @@ index ecc1d7fbf8..ac77a6a178 100644
|
||||
caps->varying_count = gl_info->limits.glsl_varyings;
|
||||
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 5edff2ecee..9e5665165f 100644
|
||||
index faf4be0ab1..fa195c3b15 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -163,6 +163,7 @@ struct wined3d_d3d_limits
|
||||
@@ -164,6 +164,7 @@ struct wined3d_d3d_limits
|
||||
{
|
||||
unsigned int vs_version, hs_version, ds_version, gs_version, ps_version, cs_version;
|
||||
DWORD vs_uniform_count;
|
||||
@ -81,7 +81,7 @@ index 5edff2ecee..9e5665165f 100644
|
||||
DWORD ps_uniform_count;
|
||||
unsigned int varying_count;
|
||||
unsigned int ffp_textures;
|
||||
@@ -681,6 +682,7 @@ enum wined3d_shader_conditional_op
|
||||
@@ -685,6 +686,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
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 220fe2d54e6a022f263ccfc014e31ef239f9c6a6 Mon Sep 17 00:00:00 2001
|
||||
From 83e16d7e0af178dd8e7183446893083c5a69869d 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
|
||||
@ -15,10 +15,10 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
|
||||
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
|
||||
index 8e996d3fb3..0dddcceeeb 100644
|
||||
--- a/dlls/d3d9/tests/device.c
|
||||
+++ b/dlls/d3d9/tests/device.c
|
||||
@@ -6425,13 +6425,10 @@ static void test_vertex_shader_constant(void)
|
||||
@@ -6437,13 +6437,10 @@ static void test_vertex_shader_constant(void)
|
||||
ok(consts_swvp == 8192, "Unexpected consts_swvp %u.\n", consts_swvp);
|
||||
|
||||
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, consts + 0, c, 1);
|
||||
@ -32,7 +32,7 @@ index 030b34c4e4..5f7944b93a 100644
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, consts_swvp - 1, c, 1);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
@@ -6456,7 +6453,6 @@ static void test_vertex_shader_constant(void)
|
||||
@@ -6468,7 +6465,6 @@ static void test_vertex_shader_constant(void)
|
||||
|
||||
IDirect3DDevice9_SetSoftwareVertexProcessing(device, 0);
|
||||
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, consts + 0, c, 1);
|
||||
@ -40,7 +40,7 @@ index 030b34c4e4..5f7944b93a 100644
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, consts_swvp - 1, c, 1);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
@@ -6464,7 +6460,6 @@ static void test_vertex_shader_constant(void)
|
||||
@@ -6476,7 +6472,6 @@ static void test_vertex_shader_constant(void)
|
||||
IDirect3DDevice9_SetSoftwareVertexProcessing(device, 1);
|
||||
|
||||
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, consts + 0, c, 1);
|
||||
@ -49,10 +49,10 @@ 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 659d074149..a0d7b9caaf 100644
|
||||
index 80b9ecd4ab..768ec8f39e 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)
|
||||
@@ -24639,7 +24639,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, c_index, 1);
|
||||
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, (unsigned int)c_index[0], c_color, 1);
|
||||
@ -61,7 +61,7 @@ index 659d074149..a0d7b9caaf 100644
|
||||
|
||||
hr = IDirect3DDevice9_BeginScene(device);
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 0be43d4551..6649e5078d 100644
|
||||
index 4d8396888c..b9cfbf9e68 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,
|
||||
@ -104,10 +104,10 @@ index 0be43d4551..6649e5078d 100644
|
||||
|
||||
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 ac77a6a178..6acb730fe4 100644
|
||||
index d9d807abdb..ddd2cfa633 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
|
||||
@@ -2170,7 +2170,7 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
|
||||
if (priv->consts_ubo)
|
||||
return;
|
||||
|
||||
@ -148,10 +148,10 @@ index 820089d0b8..cd5c8bd5dc 100644
|
||||
|
||||
default:
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 9e5665165f..9655660a5b 100644
|
||||
index fa195c3b15..42396a1b6e 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -2947,7 +2947,7 @@ struct wined3d_state
|
||||
@@ -2953,7 +2953,7 @@ struct wined3d_state
|
||||
|
||||
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
|
||||
struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I];
|
||||
@ -160,7 +160,7 @@ index 9e5665165f..9655660a5b 100644
|
||||
|
||||
BOOL ps_consts_b[WINED3D_MAX_CONSTS_B];
|
||||
struct wined3d_ivec4 ps_consts_i[WINED3D_MAX_CONSTS_I];
|
||||
@@ -3019,7 +3019,7 @@ struct wined3d_stateblock_state
|
||||
@@ -3025,7 +3025,7 @@ struct wined3d_stateblock_state
|
||||
int base_vertex_index;
|
||||
|
||||
struct wined3d_shader *vs;
|
||||
@ -169,7 +169,7 @@ index 9e5665165f..9655660a5b 100644
|
||||
struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I];
|
||||
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
|
||||
|
||||
@@ -3614,7 +3614,7 @@ struct wined3d_saved_states
|
||||
@@ -3621,7 +3621,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 */
|
||||
@ -178,7 +178,7 @@ index 9e5665165f..9655660a5b 100644
|
||||
DWORD textures : 20; /* WINED3D_MAX_COMBINED_SAMPLERS, 20 */
|
||||
DWORD indices : 1;
|
||||
DWORD material : 1;
|
||||
@@ -3650,7 +3650,7 @@ struct wined3d_stateblock
|
||||
@@ -3657,7 +3657,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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 7fd5eef6fefa01881ac93471672b391b5e8346e7 Mon Sep 17 00:00:00 2001
|
||||
From 8a25d864ab5a2b9bb157a9fe9ddd46620a188d40 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.
|
||||
@ -8,17 +8,17 @@ Signed-off-by: Paul Gofman <gofmanp@gmail.com>
|
||||
dlls/d3d9/tests/device.c | 16 ++------
|
||||
dlls/d3d9/tests/visual.c | 5 +--
|
||||
dlls/wined3d/device.c | 8 ++++
|
||||
dlls/wined3d/glsl_shader.c | 69 +++++++++++++++++++++++++---------
|
||||
dlls/wined3d/shader.c | 44 +++++++++++++++-------
|
||||
dlls/wined3d/glsl_shader.c | 71 +++++++++++++++++++++++++---------
|
||||
dlls/wined3d/shader.c | 44 ++++++++++++++-------
|
||||
dlls/wined3d/shader_sm1.c | 2 +-
|
||||
dlls/wined3d/wined3d_private.h | 7 ++++
|
||||
7 files changed, 103 insertions(+), 48 deletions(-)
|
||||
7 files changed, 104 insertions(+), 49 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
|
||||
index 23c2a7d47f..265285730f 100644
|
||||
index 0dddcceeeb..e1d968e19e 100644
|
||||
--- a/dlls/d3d9/tests/device.c
|
||||
+++ b/dlls/d3d9/tests/device.c
|
||||
@@ -6913,15 +6913,11 @@ float4 main(const float4 color : COLOR) : SV_TARGET
|
||||
@@ -6925,15 +6925,11 @@ float4 main(const float4 color : COLOR) : SV_TARGET
|
||||
|
||||
vs = NULL;
|
||||
hr = IDirect3DDevice9_CreateVertexShader(device, vs_1_256, &vs);
|
||||
@ -36,7 +36,7 @@ index 23c2a7d47f..265285730f 100644
|
||||
|
||||
refcount = IDirect3DDevice9_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
@@ -6938,20 +6934,16 @@ float4 main(const float4 color : COLOR) : SV_TARGET
|
||||
@@ -6950,20 +6946,16 @@ float4 main(const float4 color : COLOR) : SV_TARGET
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_CreateVertexShader(device, vs_1_256, &vs);
|
||||
@ -60,10 +60,10 @@ index 23c2a7d47f..265285730f 100644
|
||||
cleanup:
|
||||
refcount = IDirect3DDevice9_Release(device);
|
||||
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
|
||||
index a0d7b9caaf..09cd09db94 100644
|
||||
index 768ec8f39e..1cc8642f9b 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)
|
||||
@@ -24565,7 +24565,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
hr = IDirect3DDevice9_CreateVertexShader(device, reladdr_shader_code, &reladdr_shader);
|
||||
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_CreateVertexShader(device, pure_sw_shader_code, &pure_sw_shader);
|
||||
@ -71,7 +71,7 @@ index a0d7b9caaf..09cd09db94 100644
|
||||
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vertex_declaration);
|
||||
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
|
||||
@@ -23912,7 +23911,7 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
@@ -24603,7 +24602,7 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
|
||||
expected_color = 0x00ff0000; /* Color from vertex data and not from the shader. */
|
||||
color = getPixelColor(device, 5, 5);
|
||||
@ -80,7 +80,7 @@ index a0d7b9caaf..09cd09db94 100644
|
||||
expected_color, color);
|
||||
|
||||
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
||||
@@ -23931,7 +23930,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
@@ -24622,7 +24621,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
|
||||
expected_color = 0x00ffffff;
|
||||
color = getPixelColor(device, 5, 5);
|
||||
@ -88,7 +88,7 @@ index a0d7b9caaf..09cd09db94 100644
|
||||
ok(color == expected_color, "Expected color 0x%08x, got 0x%08x (sw shader in sw mode).\n",
|
||||
expected_color, color);
|
||||
|
||||
@@ -23981,7 +23979,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
@@ -24672,7 +24670,6 @@ static void test_mvp_software_vertex_shaders(void)
|
||||
|
||||
expected_color = 0x0000ffff; /* c[256] is c_color for SW shader. */
|
||||
color = getPixelColor(device, 5, 5);
|
||||
@ -97,7 +97,7 @@ index a0d7b9caaf..09cd09db94 100644
|
||||
expected_color, color);
|
||||
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 956333afe6..b67d534cfe 100644
|
||||
index b9cfbf9e68..4b98987f63 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -4080,6 +4080,14 @@ void CDECL wined3d_device_set_software_vertex_processing(struct wined3d_device *
|
||||
@ -116,7 +116,7 @@ index 956333afe6..b67d534cfe 100644
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index 01e79a7ecc..3d9280dc70 100644
|
||||
index ddd2cfa633..0df81ed669 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -140,7 +140,9 @@ struct shader_glsl_priv
|
||||
@ -139,7 +139,7 @@ index 01e79a7ecc..3d9280dc70 100644
|
||||
GLint uniform_i_locations[WINED3D_MAX_CONSTS_I];
|
||||
GLint uniform_b_locations[WINED3D_MAX_CONSTS_B];
|
||||
GLint pos_fixup_location;
|
||||
@@ -1154,7 +1156,7 @@ static void bind_and_orphan_consts_ubo(const struct wined3d_gl_info *gl_info, st
|
||||
@@ -1155,7 +1157,7 @@ static void bind_and_orphan_consts_ubo(const struct wined3d_gl_info *gl_info, st
|
||||
{
|
||||
GL_EXTCALL(glBindBuffer(GL_UNIFORM_BUFFER, priv->ubo_vs_c));
|
||||
checkGLcall("glBindBuffer");
|
||||
@ -148,7 +148,7 @@ index 01e79a7ecc..3d9280dc70 100644
|
||||
NULL, GL_STREAM_DRAW));
|
||||
checkGLcall("glBufferData");
|
||||
}
|
||||
@@ -1162,14 +1164,16 @@ static void bind_and_orphan_consts_ubo(const struct wined3d_gl_info *gl_info, st
|
||||
@@ -1163,14 +1165,16 @@ static void bind_and_orphan_consts_ubo(const struct wined3d_gl_info *gl_info, st
|
||||
/* Context activation is done by the caller. */
|
||||
static void shader_glsl_load_constants_f(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info,
|
||||
const struct wined3d_vec4 *constants, const GLint *constant_locations, const struct constant_heap *heap,
|
||||
@ -166,7 +166,7 @@ index 01e79a7ecc..3d9280dc70 100644
|
||||
unsigned max_const_used;
|
||||
|
||||
if (priv->ubo_vs_c == -1)
|
||||
@@ -1179,22 +1183,32 @@ static void shader_glsl_load_constants_f(const struct wined3d_shader *shader, co
|
||||
@@ -1180,22 +1184,32 @@ static void shader_glsl_load_constants_f(const struct wined3d_shader *shader, co
|
||||
}
|
||||
|
||||
bind_and_orphan_consts_ubo(gl_info, priv);
|
||||
@ -205,7 +205,16 @@ index 01e79a7ecc..3d9280dc70 100644
|
||||
checkGLcall("glBufferSubData");
|
||||
return;
|
||||
}
|
||||
@@ -1848,7 +1862,8 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
@@ -1860,7 +1874,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
GL_EXTCALL(glGenBuffers(1, &priv->ubo_vs_c));
|
||||
GL_EXTCALL(glBindBuffer(GL_UNIFORM_BUFFER, priv->ubo_vs_c));
|
||||
checkGLcall("glBindBuffer (UBO)");
|
||||
- GL_EXTCALL(glBufferData(GL_UNIFORM_BUFFER, WINED3D_MAX_VS_CONSTS_F * sizeof(struct wined3d_vec4),
|
||||
+ GL_EXTCALL(glBufferData(GL_UNIFORM_BUFFER, priv->max_vs_consts_f * sizeof(struct wined3d_vec4),
|
||||
NULL, GL_STREAM_DRAW));
|
||||
checkGLcall("glBufferData");
|
||||
}
|
||||
@@ -1872,7 +1886,8 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
|
||||
if (update_mask & WINED3D_SHADER_CONST_VS_F)
|
||||
shader_glsl_load_constants_f(vshader, gl_info, state->vs_consts_f,
|
||||
@ -215,7 +224,7 @@ index 01e79a7ecc..3d9280dc70 100644
|
||||
|
||||
if (update_mask & WINED3D_SHADER_CONST_VS_I)
|
||||
shader_glsl_load_constants_i(vshader, gl_info, state->vs_consts_i,
|
||||
@@ -2001,7 +2016,8 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
@@ -2025,7 +2040,8 @@ 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,
|
||||
@ -225,7 +234,7 @@ index 01e79a7ecc..3d9280dc70 100644
|
||||
|
||||
if (update_mask & WINED3D_SHADER_CONST_PS_I)
|
||||
shader_glsl_load_constants_i(pshader, gl_info, state->ps_consts_i,
|
||||
@@ -2146,7 +2162,7 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
|
||||
@@ -2170,7 +2186,7 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
|
||||
if (priv->consts_ubo)
|
||||
return;
|
||||
|
||||
@ -234,7 +243,7 @@ index 01e79a7ecc..3d9280dc70 100644
|
||||
{
|
||||
update_heap_entry(heap, i, priv->next_constant_version);
|
||||
}
|
||||
@@ -2491,7 +2507,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
@@ -2515,7 +2531,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"
|
||||
@ -243,7 +252,7 @@ index 01e79a7ecc..3d9280dc70 100644
|
||||
}
|
||||
else if (shader->limits->constant_float > 0)
|
||||
{
|
||||
@@ -10217,12 +10233,13 @@ static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *
|
||||
@@ -10233,12 +10249,13 @@ static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *
|
||||
}
|
||||
else if (!priv->consts_ubo)
|
||||
{
|
||||
@ -259,7 +268,7 @@ index 01e79a7ecc..3d9280dc70 100644
|
||||
}
|
||||
|
||||
for (i = 0; i < WINED3D_MAX_CONSTS_I; ++i)
|
||||
@@ -10541,6 +10558,10 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
|
||||
@@ -10557,6 +10574,10 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
|
||||
vs_list = &ffp_shader->linked_programs;
|
||||
}
|
||||
|
||||
@ -270,7 +279,7 @@ index 01e79a7ecc..3d9280dc70 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;
|
||||
@@ -11294,7 +11315,7 @@ static void constant_heap_free(struct constant_heap *heap)
|
||||
@@ -11310,7 +11331,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)
|
||||
{
|
||||
@ -279,7 +288,7 @@ index 01e79a7ecc..3d9280dc70 100644
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
struct fragment_caps fragment_caps;
|
||||
void *vertex_priv, *fragment_priv;
|
||||
@@ -11305,6 +11326,18 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
@@ -11321,6 +11342,18 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
|
||||
priv->consts_ubo = (device->adapter->d3d_info.wined3d_creation_flags & WINED3D_LEGACY_SHADER_CONSTANTS)
|
||||
&& gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT];
|
||||
@ -298,7 +307,7 @@ index 01e79a7ecc..3d9280dc70 100644
|
||||
string_buffer_list_init(&priv->string_buffers);
|
||||
|
||||
if (!(vertex_priv = vertex_pipe->vp_alloc(&glsl_shader_backend, priv)))
|
||||
@@ -11334,7 +11367,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
@@ -11350,7 +11383,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -474,10 +483,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 c01100e0a4..857fc8a06d 100644
|
||||
index 42396a1b6e..766449d711 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -4428,6 +4428,13 @@ static inline BOOL shader_constant_is_local(const struct wined3d_shader *shader,
|
||||
@@ -4430,6 +4430,13 @@ static inline BOOL shader_constant_is_local(const struct wined3d_shader *shader,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user