You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Rebase against 887a57fadd00b39b266b421fe1a04ab09e0d917d
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
From 940ff566fa1192c46622e3a107b087993b02063e Mon Sep 17 00:00:00 2001
|
||||
From 54e5b6327bac8709f264ef8effe6b629aa264a8a 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
|
||||
Subject: [PATCH] wined3d: Use UBO for vertex shader float constants if
|
||||
supported.
|
||||
|
||||
Signed-off-by: Paul Gofman <gofmanp@gmail.com>
|
||||
@@ -9,12 +9,12 @@ 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 | 145 ++++++++++++++++++++++++++++++---
|
||||
dlls/wined3d/glsl_shader.c | 146 ++++++++++++++++++++++++++++++---
|
||||
dlls/wined3d/shader.c | 2 +
|
||||
dlls/wined3d/state.c | 5 ++
|
||||
dlls/wined3d/wined3d_private.h | 2 +
|
||||
include/wine/wined3d.h | 1 +
|
||||
8 files changed, 148 insertions(+), 14 deletions(-)
|
||||
8 files changed, 149 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c
|
||||
index f78ff3e5af..847cfd17bf 100644
|
||||
@@ -57,7 +57,7 @@ index c8ebe34643..4071ed0f82 100644
|
||||
}
|
||||
if (gl_info->supported[ARB_TESSELLATION_SHADER])
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index ab62c1ca59..fc3093f4d1 100644
|
||||
index 80e58ccb72..0bc81d07fe 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -138,6 +138,10 @@ struct shader_glsl_priv
|
||||
@@ -143,16 +143,18 @@ index ab62c1ca59..fc3093f4d1 100644
|
||||
|
||||
/* 1.X pshaders have the constants clamped to [-1;1] implicitly. */
|
||||
if (shader->reg_maps.shader_version.major == 1
|
||||
@@ -1515,7 +1563,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
@@ -1515,8 +1563,9 @@ 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 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_info;
|
||||
float position_fixup[4 * WINED3D_MAX_VIEWPORTS];
|
||||
@@ -1531,9 +1579,32 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
@@ -1532,9 +1581,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;
|
||||
|
||||
@@ -186,7 +188,7 @@ index ab62c1ca59..fc3093f4d1 100644
|
||||
|
||||
if (update_mask & WINED3D_SHADER_CONST_VS_I)
|
||||
shader_glsl_load_constants_i(vshader, gl_info, state->vs_consts_i,
|
||||
@@ -1686,7 +1757,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
@@ -1687,7 +1759,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,
|
||||
@@ -195,7 +197,7 @@ index ab62c1ca59..fc3093f4d1 100644
|
||||
|
||||
if (update_mask & WINED3D_SHADER_CONST_PS_I)
|
||||
shader_glsl_load_constants_i(pshader, gl_info, state->ps_consts_i,
|
||||
@@ -1825,6 +1896,12 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
|
||||
@@ -1826,6 +1898,12 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
|
||||
struct constant_heap *heap = &priv->vconst_heap;
|
||||
UINT i;
|
||||
|
||||
@@ -208,7 +210,7 @@ index ab62c1ca59..fc3093f4d1 100644
|
||||
for (i = start; i < count + start; ++i)
|
||||
{
|
||||
update_heap_entry(heap, i, priv->next_constant_version);
|
||||
@@ -1837,6 +1914,9 @@ static void shader_glsl_update_float_pixel_constants(struct wined3d_device *devi
|
||||
@@ -1838,6 +1916,9 @@ static void shader_glsl_update_float_pixel_constants(struct wined3d_device *devi
|
||||
struct constant_heap *heap = &priv->pconst_heap;
|
||||
UINT i;
|
||||
|
||||
@@ -218,7 +220,7 @@ index ab62c1ca59..fc3093f4d1 100644
|
||||
for (i = start; i < count + start; ++i)
|
||||
{
|
||||
update_heap_entry(heap, i, priv->next_constant_version);
|
||||
@@ -2140,6 +2220,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
@@ -2141,6 +2222,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;
|
||||
@@ -226,7 +228,7 @@ index ab62c1ca59..fc3093f4d1 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;
|
||||
@@ -2160,7 +2241,15 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
@@ -2161,7 +2243,15 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
}
|
||||
|
||||
/* Declare the constants (aka uniforms) */
|
||||
@@ -243,7 +245,7 @@ index ab62c1ca59..fc3093f4d1 100644
|
||||
{
|
||||
unsigned max_constantsF;
|
||||
|
||||
@@ -2225,11 +2314,12 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
@@ -2226,11 +2316,12 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -258,7 +260,7 @@ index ab62c1ca59..fc3093f4d1 100644
|
||||
}
|
||||
|
||||
/* Always declare the full set of constants, the compiler can remove the
|
||||
@@ -9818,17 +9908,36 @@ static struct glsl_ffp_fragment_shader *shader_glsl_find_ffp_fragment_shader(str
|
||||
@@ -9815,17 +9906,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,
|
||||
@@ -300,7 +302,7 @@ index ab62c1ca59..fc3093f4d1 100644
|
||||
|
||||
for (i = 0; i < WINED3D_MAX_CONSTS_I; ++i)
|
||||
{
|
||||
@@ -10900,6 +11009,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
@@ -10900,6 +11010,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
const struct fragment_pipeline *fragment_pipe)
|
||||
{
|
||||
SIZE_T stack_size = wined3d_log2i(max(WINED3D_MAX_VS_CONSTS_F, WINED3D_MAX_PS_CONSTS_F)) + 1;
|
||||
@@ -308,7 +310,7 @@ index ab62c1ca59..fc3093f4d1 100644
|
||||
struct fragment_caps fragment_caps;
|
||||
void *vertex_priv, *fragment_priv;
|
||||
struct shader_glsl_priv *priv;
|
||||
@@ -10907,6 +11017,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
@@ -10907,6 +11018,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
if (!(priv = heap_alloc_zero(sizeof(*priv))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
@@ -317,7 +319,7 @@ index ab62c1ca59..fc3093f4d1 100644
|
||||
string_buffer_list_init(&priv->string_buffers);
|
||||
|
||||
if (!(vertex_priv = vertex_pipe->vp_alloc(&glsl_shader_backend, priv)))
|
||||
@@ -10961,6 +11073,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
@@ -10961,6 +11074,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
device->fragment_priv = fragment_priv;
|
||||
device->shader_priv = priv;
|
||||
|
||||
@@ -326,7 +328,7 @@ index ab62c1ca59..fc3093f4d1 100644
|
||||
return WINED3D_OK;
|
||||
|
||||
fail:
|
||||
@@ -10988,6 +11102,13 @@ static void shader_glsl_free(struct wined3d_device *device, struct wined3d_conte
|
||||
@@ -10988,6 +11103,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);
|
||||
|
||||
@@ -354,10 +356,10 @@ index a8fee07c6c..d7fdc9cfdb 100644
|
||||
}
|
||||
}
|
||||
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
|
||||
index c52e25d6ce..435aaa598b 100644
|
||||
index 06b30ba5e1..4d5b8be65a 100644
|
||||
--- a/dlls/wined3d/state.c
|
||||
+++ b/dlls/wined3d/state.c
|
||||
@@ -4387,6 +4387,11 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state
|
||||
@@ -4389,6 +4389,11 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state
|
||||
unsigned int i, base, count;
|
||||
|
||||
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
|
||||
@@ -370,7 +372,7 @@ index c52e25d6ce..435aaa598b 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 8272a56203..444ffdba1e 100644
|
||||
index b6f4b67018..0f82fc8e49 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -1065,6 +1065,7 @@ struct wined3d_shader_reg_maps
|
||||
@@ -381,7 +383,7 @@ index 8272a56203..444ffdba1e 100644
|
||||
};
|
||||
|
||||
/* Keeps track of details for TEX_M#x# instructions which need to maintain
|
||||
@@ -2638,6 +2639,7 @@ struct wined3d_gl_limits
|
||||
@@ -2643,6 +2644,7 @@ struct wined3d_gl_limits
|
||||
UINT glsl_varyings;
|
||||
UINT glsl_vs_float_constants;
|
||||
UINT glsl_ps_float_constants;
|
||||
@@ -390,10 +392,10 @@ index 8272a56203..444ffdba1e 100644
|
||||
UINT arb_vs_float_constants;
|
||||
UINT arb_vs_native_constants;
|
||||
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
|
||||
index ada5636550..302c5b4fa4 100644
|
||||
index abef3f0ad0..86e324a0df 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -1334,6 +1334,7 @@ enum wined3d_shader_type
|
||||
@@ -1335,6 +1335,7 @@ enum wined3d_shader_type
|
||||
#define WINED3D_NO_PRIMITIVE_RESTART 0x00000800
|
||||
#define WINED3D_LEGACY_CUBEMAP_FILTERING 0x00001000
|
||||
#define WINED3D_NORMALIZED_DEPTH_BIAS 0x00002000
|
||||
@@ -402,5 +404,5 @@ index ada5636550..302c5b4fa4 100644
|
||||
#define WINED3D_RESZ_CODE 0x7fa05000
|
||||
|
||||
--
|
||||
2.21.0
|
||||
2.20.1
|
||||
|
||||
|
Reference in New Issue
Block a user