You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-12-15 08:03:15 -08:00
Rebase against 5cd11ade210ce4a7b5b7b500be664b3661d3e710.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 978c4aaa20278ef16009351e1f65ec543df4aefa Mon Sep 17 00:00:00 2001
|
||||
From 83f5eda40173f8d4d782179449814f6eeb153f7b Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Wesie <awesie@gmail.com>
|
||||
Date: Tue, 2 Oct 2018 23:28:01 -0500
|
||||
Subject: [PATCH] wined3d: Use bindless textures for GLSL shaders.
|
||||
@@ -14,12 +14,12 @@ Signed-off-by: Andrew Wesie <awesie@gmail.com>
|
||||
dlls/wined3d/shader.c | 7 ++
|
||||
dlls/wined3d/texture.c | 18 +++--
|
||||
dlls/wined3d/view.c | 30 ++++++++
|
||||
dlls/wined3d/wined3d_gl.h | 1 +
|
||||
dlls/wined3d/wined3d_private.h | 25 +++++++
|
||||
dlls/wined3d/wined3d_gl.h | 19 +++++
|
||||
dlls/wined3d/wined3d_private.h | 7 ++
|
||||
10 files changed, 261 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
|
||||
index 4d55655e7bf..938fd4b4f02 100644
|
||||
index 8adfabaa590..af543ee1219 100644
|
||||
--- a/dlls/wined3d/adapter_gl.c
|
||||
+++ b/dlls/wined3d/adapter_gl.c
|
||||
@@ -56,6 +56,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
|
||||
@@ -30,7 +30,7 @@ index 4d55655e7bf..938fd4b4f02 100644
|
||||
{"GL_ARB_blend_func_extended", ARB_BLEND_FUNC_EXTENDED },
|
||||
{"GL_ARB_buffer_storage", ARB_BUFFER_STORAGE },
|
||||
{"GL_ARB_clear_buffer_object", ARB_CLEAR_BUFFER_OBJECT },
|
||||
@@ -2121,6 +2122,11 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
|
||||
@@ -2122,6 +2123,11 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
|
||||
/* GL_ARB_base_instance */
|
||||
USE_GL_FUNC(glDrawArraysInstancedBaseInstance)
|
||||
USE_GL_FUNC(glDrawElementsInstancedBaseVertexBaseInstance)
|
||||
@@ -43,10 +43,10 @@ index 4d55655e7bf..938fd4b4f02 100644
|
||||
USE_GL_FUNC(glBindFragDataLocationIndexed)
|
||||
USE_GL_FUNC(glGetFragDataIndex)
|
||||
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
|
||||
index 592216051c2..64782f7c286 100644
|
||||
index 14703e9c66c..391c4cb570a 100644
|
||||
--- a/dlls/wined3d/arb_program_shader.c
|
||||
+++ b/dlls/wined3d/arb_program_shader.c
|
||||
@@ -5631,6 +5631,12 @@ static BOOL shader_arb_has_ffp_proj_control(void *shader_priv)
|
||||
@@ -5654,6 +5654,12 @@ static BOOL shader_arb_has_ffp_proj_control(void *shader_priv)
|
||||
return priv->ffp_proj_control;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ index 592216051c2..64782f7c286 100644
|
||||
static void shader_arb_precompile(void *shader_priv, struct wined3d_shader *shader) {}
|
||||
|
||||
static uint64_t shader_arb_shader_compile(struct wined3d_context *context, const struct wined3d_shader_desc *shader_desc,
|
||||
@@ -5659,6 +5665,7 @@ const struct wined3d_shader_backend_ops arb_program_shader_backend =
|
||||
@@ -5682,6 +5688,7 @@ const struct wined3d_shader_backend_ops arb_program_shader_backend =
|
||||
shader_arb_get_caps,
|
||||
shader_arb_color_fixup_supported,
|
||||
shader_arb_has_ffp_proj_control,
|
||||
@@ -68,10 +68,10 @@ index 592216051c2..64782f7c286 100644
|
||||
};
|
||||
|
||||
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
|
||||
index a8c5160a5b3..3cf56c321d1 100644
|
||||
index 36786cc5a29..ed13bee01f5 100644
|
||||
--- a/dlls/wined3d/context_gl.c
|
||||
+++ b/dlls/wined3d/context_gl.c
|
||||
@@ -4006,6 +4006,12 @@ static void wined3d_context_gl_bind_shader_resources(struct wined3d_context_gl *
|
||||
@@ -4002,6 +4002,12 @@ static void wined3d_context_gl_bind_shader_resources(struct wined3d_context_gl *
|
||||
if (!(shader = state->shader[shader_type]))
|
||||
return;
|
||||
|
||||
@@ -85,7 +85,7 @@ index a8c5160a5b3..3cf56c321d1 100644
|
||||
&shader->reg_maps.shader_version, &base, &count);
|
||||
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 496d1038f55..d6e91c47229 100644
|
||||
index 8501fcbbaf5..330338f8597 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -579,6 +579,59 @@ void wined3d_device_destroy_default_samplers(struct wined3d_device *device)
|
||||
@@ -109,7 +109,7 @@ index 496d1038f55..d6e91c47229 100644
|
||||
+{
|
||||
+ const struct wined3d_gl_info *gl_info = context_gl->gl_info;
|
||||
+ const struct wined3d_dummy_textures *textures = &wined3d_device_gl(device)->dummy_textures;
|
||||
+ struct wined3d_dummy_sampler_handles *handles = &device->dummy_sampler_handles;
|
||||
+ struct wined3d_dummy_sampler_handles *handles = &wined3d_device_gl(device)->dummy_sampler_handles;
|
||||
+
|
||||
+ if (!gl_info->supported[ARB_BINDLESS_TEXTURE])
|
||||
+ return;
|
||||
@@ -148,7 +148,7 @@ index 496d1038f55..d6e91c47229 100644
|
||||
static bool wined3d_null_image_vk_init(struct wined3d_image_vk *image, struct wined3d_context_vk *context_vk,
|
||||
VkCommandBuffer vk_command_buffer, VkImageType type, unsigned int layer_count, unsigned int sample_count)
|
||||
{
|
||||
@@ -1289,6 +1342,7 @@ void wined3d_device_gl_create_primary_opengl_context_cs(void *object)
|
||||
@@ -1290,6 +1343,7 @@ void wined3d_device_gl_create_primary_opengl_context_cs(void *object)
|
||||
|
||||
wined3d_device_gl_create_dummy_textures(device_gl, context_gl);
|
||||
wined3d_device_create_default_samplers(device, context);
|
||||
@@ -157,10 +157,10 @@ index 496d1038f55..d6e91c47229 100644
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index 5d878857ae8..dc50dc1858c 100644
|
||||
index a1a9c5d387c..52ea047d762 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -742,6 +742,113 @@ static void shader_glsl_append_sampler_binding_qualifier(struct wined3d_string_b
|
||||
@@ -730,6 +730,113 @@ static void shader_glsl_append_sampler_binding_qualifier(struct wined3d_string_b
|
||||
ERR("Unmapped sampler %u.\n", sampler_idx);
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ index 5d878857ae8..dc50dc1858c 100644
|
||||
+static GLuint64 shader_glsl_dummy_sampler_handle(const struct wined3d_context *context,
|
||||
+ enum wined3d_shader_resource_type type)
|
||||
+{
|
||||
+ const struct wined3d_device *device = context->device;
|
||||
+ const struct wined3d_device_gl *device = wined3d_device_gl(context->device);
|
||||
+
|
||||
+ switch (type)
|
||||
+ {
|
||||
@@ -274,7 +274,7 @@ index 5d878857ae8..dc50dc1858c 100644
|
||||
/* Context activation is done by the caller. */
|
||||
static void shader_glsl_load_samplers(const struct wined3d_context *context,
|
||||
struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader_reg_maps *reg_maps)
|
||||
@@ -2549,7 +2656,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
|
||||
@@ -2443,7 +2550,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ index 5d878857ae8..dc50dc1858c 100644
|
||||
shader_glsl_append_sampler_binding_qualifier(buffer, &context_gl->c, version, entry->bind_idx);
|
||||
shader_addline(buffer, "uniform %s%s %s_sampler%u;\n",
|
||||
sampler_type_prefix, sampler_type, prefix, entry->bind_idx);
|
||||
@@ -7631,6 +7740,8 @@ static void shader_glsl_generate_colour_key_test(struct wined3d_string_buffer *b
|
||||
@@ -7620,6 +7729,8 @@ static void shader_glsl_generate_colour_key_test(struct wined3d_string_buffer *b
|
||||
static void shader_glsl_enable_extensions(struct wined3d_string_buffer *buffer,
|
||||
const struct wined3d_gl_info *gl_info)
|
||||
{
|
||||
@@ -294,7 +294,7 @@ index 5d878857ae8..dc50dc1858c 100644
|
||||
if (gl_info->supported[ARB_CULL_DISTANCE])
|
||||
shader_addline(buffer, "#extension GL_ARB_cull_distance : enable\n");
|
||||
if (gl_info->supported[ARB_GPU_SHADER5])
|
||||
@@ -11771,6 +11882,7 @@ const struct wined3d_shader_backend_ops glsl_shader_backend =
|
||||
@@ -11631,6 +11742,7 @@ const struct wined3d_shader_backend_ops glsl_shader_backend =
|
||||
shader_glsl_get_caps,
|
||||
shader_glsl_color_fixup_supported,
|
||||
shader_glsl_has_ffp_proj_control,
|
||||
@@ -303,10 +303,10 @@ index 5d878857ae8..dc50dc1858c 100644
|
||||
};
|
||||
|
||||
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
|
||||
index 3d60af16359..2d3614f67d5 100644
|
||||
index 96b47db9ed6..3cb7feeddda 100644
|
||||
--- a/dlls/wined3d/shader.c
|
||||
+++ b/dlls/wined3d/shader.c
|
||||
@@ -2047,6 +2047,12 @@ static BOOL shader_none_has_ffp_proj_control(void *shader_priv)
|
||||
@@ -2032,6 +2032,12 @@ static BOOL shader_none_has_ffp_proj_control(void *shader_priv)
|
||||
return priv->ffp_proj_control;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ index 3d60af16359..2d3614f67d5 100644
|
||||
static uint64_t shader_none_shader_compile(struct wined3d_context *context, const struct wined3d_shader_desc *shader_desc,
|
||||
enum wined3d_shader_type shader_type)
|
||||
{
|
||||
@@ -2072,6 +2078,7 @@ const struct wined3d_shader_backend_ops none_shader_backend =
|
||||
@@ -2057,6 +2063,7 @@ const struct wined3d_shader_backend_ops none_shader_backend =
|
||||
shader_none_get_caps,
|
||||
shader_none_color_fixup_supported,
|
||||
shader_none_has_ffp_proj_control,
|
||||
@@ -328,10 +328,10 @@ index 3d60af16359..2d3614f67d5 100644
|
||||
};
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 78b1f52221c..8a0d9031d67 100644
|
||||
index 664e012cfe5..9e81e4085b1 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -1259,7 +1259,7 @@ void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle[4], struct color_
|
||||
@@ -1260,7 +1260,7 @@ void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle[4], struct color_
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
@@ -340,7 +340,7 @@ index 78b1f52221c..8a0d9031d67 100644
|
||||
struct wined3d_context_gl *context_gl, BOOL srgb)
|
||||
{
|
||||
const struct wined3d_format *format = texture_gl->t.resource.format;
|
||||
@@ -1283,10 +1283,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
|
||||
@@ -1284,10 +1284,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
|
||||
target = texture_gl->target;
|
||||
|
||||
if (gl_tex->name)
|
||||
@@ -352,7 +352,7 @@ index 78b1f52221c..8a0d9031d67 100644
|
||||
|
||||
gl_info->gl_ops.gl.p_glGenTextures(1, &gl_tex->name);
|
||||
checkGLcall("glGenTextures");
|
||||
@@ -1295,7 +1292,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
|
||||
@@ -1296,7 +1293,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
|
||||
if (!gl_tex->name)
|
||||
{
|
||||
ERR("Failed to generate a texture name.\n");
|
||||
@@ -361,7 +361,7 @@ index 78b1f52221c..8a0d9031d67 100644
|
||||
}
|
||||
|
||||
/* Initialise the state of the texture object to the OpenGL defaults, not
|
||||
@@ -1379,6 +1376,15 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
|
||||
@@ -1380,6 +1377,15 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
|
||||
gl_info->gl_ops.gl.p_glTexParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, swizzle);
|
||||
checkGLcall("set format swizzle");
|
||||
}
|
||||
@@ -378,10 +378,10 @@ index 78b1f52221c..8a0d9031d67 100644
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
|
||||
index d318318d2b3..5f4c7684a7e 100644
|
||||
index 675cc186b36..4632b136c28 100644
|
||||
--- a/dlls/wined3d/view.c
|
||||
+++ b/dlls/wined3d/view.c
|
||||
@@ -1260,6 +1260,36 @@ void wined3d_shader_resource_view_gl_bind(struct wined3d_shader_resource_view_gl
|
||||
@@ -1267,6 +1267,36 @@ void wined3d_shader_resource_view_gl_bind(struct wined3d_shader_resource_view_gl
|
||||
wined3d_sampler_gl_bind(sampler_gl, unit, texture_gl, context_gl);
|
||||
}
|
||||
|
||||
@@ -419,10 +419,10 @@ index d318318d2b3..5f4c7684a7e 100644
|
||||
static void shader_resource_view_gl_bind_and_dirtify(struct wined3d_shader_resource_view_gl *view_gl,
|
||||
struct wined3d_context_gl *context_gl)
|
||||
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
|
||||
index 75c4cd732ab..ccc1ce2f0ff 100644
|
||||
index 4e62a456526..39af467d677 100644
|
||||
--- a/dlls/wined3d/wined3d_gl.h
|
||||
+++ b/dlls/wined3d/wined3d_gl.h
|
||||
@@ -42,6 +42,7 @@ enum wined3d_gl_extension
|
||||
@@ -48,6 +48,7 @@ enum wined3d_gl_extension
|
||||
APPLE_YCBCR_422,
|
||||
/* ARB */
|
||||
ARB_BASE_INSTANCE,
|
||||
@@ -430,28 +430,7 @@ index 75c4cd732ab..ccc1ce2f0ff 100644
|
||||
ARB_BLEND_FUNC_EXTENDED,
|
||||
ARB_BUFFER_STORAGE,
|
||||
ARB_CLEAR_BUFFER_OBJECT,
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index d5e4081d37f..af016db240a 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -113,6 +113,7 @@ static inline const char *wined3d_get_line(const char **ptr, const char *end)
|
||||
struct wined3d_fragment_pipe_ops;
|
||||
struct wined3d_adapter;
|
||||
struct wined3d_context;
|
||||
+struct wined3d_context_gl;
|
||||
struct wined3d_gl_info;
|
||||
struct wined3d_state;
|
||||
struct wined3d_swapchain_gl;
|
||||
@@ -1609,6 +1610,8 @@ struct wined3d_shader_backend_ops
|
||||
void (*shader_get_caps)(const struct wined3d_adapter *adapter, struct shader_caps *caps);
|
||||
BOOL (*shader_color_fixup_supported)(struct color_fixup_desc fixup);
|
||||
BOOL (*shader_has_ffp_proj_control)(void *shader_priv);
|
||||
+ void (*shader_load_sampler_handles)(void *shader_priv, struct wined3d_context_gl *context_gl,
|
||||
+ const struct wined3d_state *state, const struct wined3d_shader *shader);
|
||||
uint64_t (*shader_compile)(struct wined3d_context *context, const struct wined3d_shader_desc *shader_desc,
|
||||
enum wined3d_shader_type shader_type);
|
||||
};
|
||||
@@ -3524,6 +3527,21 @@ struct wined3d_dummy_textures
|
||||
@@ -828,6 +829,21 @@ struct wined3d_dummy_textures
|
||||
GLuint tex_2d_ms_array;
|
||||
};
|
||||
|
||||
@@ -470,20 +449,41 @@ index d5e4081d37f..af016db240a 100644
|
||||
+ GLuint64 tex_2d_ms_array;
|
||||
+};
|
||||
+
|
||||
#define WINED3D_UNMAPPED_STAGE ~0u
|
||||
|
||||
/* Multithreaded flag. Removed from the public header to signal that
|
||||
@@ -3599,6 +3617,9 @@ struct wined3d_device
|
||||
struct wined3d_sampler *default_sampler;
|
||||
struct wined3d_sampler *null_sampler;
|
||||
struct wined3d_device_gl
|
||||
{
|
||||
struct wined3d_device d;
|
||||
@@ -835,6 +851,9 @@ struct wined3d_device_gl
|
||||
/* Textures for when no other textures are bound. */
|
||||
struct wined3d_dummy_textures dummy_textures;
|
||||
|
||||
+ /* Texture sampler handles for when no texture is mapped */
|
||||
+ struct wined3d_dummy_sampler_handles dummy_sampler_handles;
|
||||
+
|
||||
/* Command stream */
|
||||
struct wined3d_cs *cs;
|
||||
|
||||
@@ -4177,6 +4198,8 @@ void wined3d_texture_download_from_texture(struct wined3d_texture *dst_texture,
|
||||
CRITICAL_SECTION allocator_cs;
|
||||
struct wined3d_allocator allocator;
|
||||
uint64_t completed_fence_id;
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index e52754f6625..fefd8753af3 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -95,6 +95,7 @@ static inline const char *wined3d_get_line(const char **ptr, const char *end)
|
||||
struct wined3d_fragment_pipe_ops;
|
||||
struct wined3d_adapter;
|
||||
struct wined3d_context;
|
||||
+struct wined3d_context_gl;
|
||||
struct wined3d_gl_info;
|
||||
struct wined3d_state;
|
||||
struct wined3d_swapchain_gl;
|
||||
@@ -1553,6 +1554,8 @@ struct wined3d_shader_backend_ops
|
||||
void (*shader_get_caps)(const struct wined3d_adapter *adapter, struct shader_caps *caps);
|
||||
BOOL (*shader_color_fixup_supported)(struct color_fixup_desc fixup);
|
||||
BOOL (*shader_has_ffp_proj_control)(void *shader_priv);
|
||||
+ void (*shader_load_sampler_handles)(void *shader_priv, struct wined3d_context_gl *context_gl,
|
||||
+ const struct wined3d_state *state, const struct wined3d_shader *shader);
|
||||
uint64_t (*shader_compile)(struct wined3d_context *context, const struct wined3d_shader_desc *shader_desc,
|
||||
enum wined3d_shader_type shader_type);
|
||||
};
|
||||
@@ -3504,6 +3507,8 @@ void wined3d_texture_download_from_texture(struct wined3d_texture *dst_texture,
|
||||
void wined3d_texture_get_bo_address(const struct wined3d_texture *texture,
|
||||
unsigned int sub_resource_idx, struct wined3d_bo_address *data, uint32_t location) DECLSPEC_HIDDEN;
|
||||
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN;
|
||||
@@ -492,7 +492,7 @@ index d5e4081d37f..af016db240a 100644
|
||||
void wined3d_texture_invalidate_location(struct wined3d_texture *texture,
|
||||
unsigned int sub_resource_idx, uint32_t location) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_load(struct wined3d_texture *texture,
|
||||
@@ -4889,6 +4912,8 @@ HRESULT wined3d_shader_resource_view_gl_init(struct wined3d_shader_resource_view
|
||||
@@ -4210,6 +4215,8 @@ HRESULT wined3d_shader_resource_view_gl_init(struct wined3d_shader_resource_view
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
|
||||
void wined3d_shader_resource_view_gl_update(struct wined3d_shader_resource_view_gl *srv_gl,
|
||||
struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
|
||||
|
||||
Reference in New Issue
Block a user