Updated wined3d-bindless-texture patchset

Warning fixes.
This commit is contained in:
Alistair Leslie-Hughes 2022-03-17 11:46:33 +11:00
parent e853aaffe3
commit cd68f05ab3

View File

@ -1,4 +1,4 @@
From d8873b3ae77d5a6697a3eb0e3c8a3763cfa74282 Mon Sep 17 00:00:00 2001
From 53a8ae5e78c5548a81bfafa20aa2551a786b120a 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.
@ -6,21 +6,23 @@ Subject: [PATCH] wined3d: Use bindless textures for GLSL shaders.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44514
Signed-off-by: Andrew Wesie <awesie@gmail.com>
---
dlls/wined3d/adapter_gl.c | 6 ++
dlls/wined3d/context_gl.c | 6 ++
dlls/wined3d/device.c | 54 ++++++++++++++++
dlls/wined3d/glsl_shader.c | 114 ++++++++++++++++++++++++++++++++-
dlls/wined3d/texture.c | 18 ++++--
dlls/wined3d/view.c | 30 +++++++++
dlls/wined3d/wined3d_gl.h | 1 +
dlls/wined3d/wined3d_private.h | 25 ++++++++
8 files changed, 247 insertions(+), 7 deletions(-)
dlls/wined3d/adapter_gl.c | 6 ++
dlls/wined3d/arb_program_shader.c | 7 ++
dlls/wined3d/context_gl.c | 6 ++
dlls/wined3d/device.c | 54 ++++++++++++++
dlls/wined3d/glsl_shader.c | 114 +++++++++++++++++++++++++++++-
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 +++++++
10 files changed, 261 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index 6d542713d2a..189955aa05c 100644
index 4464bf3ecc2..90492d16238 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -58,6 +58,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
@@ -56,6 +56,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
/* ARB */
{"GL_ARB_base_instance", ARB_BASE_INSTANCE },
@ -28,7 +30,7 @@ index 6d542713d2a..189955aa05c 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 },
@@ -2120,6 +2121,11 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
@@ -2106,6 +2107,11 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
/* GL_ARB_base_instance */
USE_GL_FUNC(glDrawArraysInstancedBaseInstance)
USE_GL_FUNC(glDrawElementsInstancedBaseVertexBaseInstance)
@ -40,11 +42,36 @@ index 6d542713d2a..189955aa05c 100644
/* GL_ARB_blend_func_extended */
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 b4c395ec355..b0b8cb3dd6e 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -5638,6 +5638,12 @@ static BOOL shader_arb_has_ffp_proj_control(void *shader_priv)
return priv->ffp_proj_control;
}
+void shader_arb_resource_view_handle(void *shader_priv, struct wined3d_context_gl *context_gl,
+ const struct wined3d_state *state, const struct wined3d_shader *shader)
+{
+ ERR("Not implemented.\n");
+}
+
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,
@@ -5666,6 +5672,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,
+ shader_arb_resource_view_handle,
shader_arb_shader_compile,
};
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
index b82849f8470..e77afe96ace 100644
index 8ac5c28c892..21a29ba157b 100644
--- a/dlls/wined3d/context_gl.c
+++ b/dlls/wined3d/context_gl.c
@@ -3930,6 +3930,12 @@ static void wined3d_context_gl_bind_shader_resources(struct wined3d_context_gl *
@@ -3940,6 +3940,12 @@ static void wined3d_context_gl_bind_shader_resources(struct wined3d_context_gl *
if (!(shader = state->shader[shader_type]))
return;
@ -58,10 +85,10 @@ index b82849f8470..e77afe96ace 100644
&shader->reg_maps.shader_version, &base, &count);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d0f0f7407bd..beca9108000 100644
index d14b40d8e3e..995410e984d 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -580,6 +580,59 @@ void wined3d_device_destroy_default_samplers(struct wined3d_device *device)
@@ -578,6 +578,59 @@ void wined3d_device_destroy_default_samplers(struct wined3d_device *device)
device->null_sampler = NULL;
}
@ -121,7 +148,7 @@ index d0f0f7407bd..beca9108000 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)
{
@@ -1274,6 +1327,7 @@ void wined3d_device_gl_create_primary_opengl_context_cs(void *object)
@@ -1273,6 +1326,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);
@ -130,10 +157,10 @@ index d0f0f7407bd..beca9108000 100644
}
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 1945c35f996..94b966e03ea 100644
index f79fa1571e6..85ef1c8ecd7 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -746,6 +746,113 @@ static void shader_glsl_append_sampler_binding_qualifier(struct wined3d_string_b
@@ -732,6 +732,113 @@ static void shader_glsl_append_sampler_binding_qualifier(struct wined3d_string_b
ERR("Unmapped sampler %u.\n", sampler_idx);
}
@ -146,7 +173,7 @@ index 1945c35f996..94b966e03ea 100644
+ && resource_info->type != WINED3D_SHADER_RESOURCE_BUFFER;
+}
+
+static GLuint64 shader_glsl_dummy_sampler_handle(struct wined3d_context *context,
+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;
@ -247,7 +274,7 @@ index 1945c35f996..94b966e03ea 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)
@@ -2553,7 +2660,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
@@ -2413,7 +2520,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
break;
}
@ -258,7 +285,7 @@ index 1945c35f996..94b966e03ea 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);
@@ -7654,6 +7763,8 @@ static void shader_glsl_generate_colour_key_test(struct wined3d_string_buffer *b
@@ -7514,6 +7623,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)
{
@ -267,7 +294,7 @@ index 1945c35f996..94b966e03ea 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])
@@ -11793,6 +11904,7 @@ const struct wined3d_shader_backend_ops glsl_shader_backend =
@@ -11519,6 +11630,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,
@ -275,11 +302,36 @@ index 1945c35f996..94b966e03ea 100644
shader_glsl_shader_compile,
};
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 6282883ed04..51c95b73e9e 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -3276,6 +3276,12 @@ static BOOL shader_none_has_ffp_proj_control(void *shader_priv)
return priv->ffp_proj_control;
}
+void shader_none_resource_view_handle(void *shader_priv, struct wined3d_context_gl *context_gl,
+ const struct wined3d_state *state, const struct wined3d_shader *shader)
+{
+ ERR("Not implemented.\n");
+}
+
static uint64_t shader_none_shader_compile(struct wined3d_context *context, const struct wined3d_shader_desc *shader_desc,
enum wined3d_shader_type shader_type)
{
@@ -3301,6 +3307,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,
+ shader_none_resource_view_handle,
shader_none_shader_compile,
};
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 003aca3aecb..75ca4ffcef5 100644
index fdd2c70c667..5ebc012a20e 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1240,7 +1240,7 @@ void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle[4], struct color_
@@ -1239,7 +1239,7 @@ void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle[4], struct color_
}
/* Context activation is done by the caller. */
@ -288,7 +340,7 @@ index 003aca3aecb..75ca4ffcef5 100644
struct wined3d_context_gl *context_gl, BOOL srgb)
{
const struct wined3d_format *format = texture_gl->t.resource.format;
@@ -1264,10 +1264,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
@@ -1263,10 +1263,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
target = texture_gl->target;
if (gl_tex->name)
@ -300,7 +352,7 @@ index 003aca3aecb..75ca4ffcef5 100644
gl_info->gl_ops.gl.p_glGenTextures(1, &gl_tex->name);
checkGLcall("glGenTextures");
@@ -1276,7 +1273,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
@@ -1275,7 +1272,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
if (!gl_tex->name)
{
ERR("Failed to generate a texture name.\n");
@ -309,7 +361,7 @@ index 003aca3aecb..75ca4ffcef5 100644
}
/* Initialise the state of the texture object to the OpenGL defaults, not
@@ -1360,6 +1357,15 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
@@ -1359,6 +1356,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");
}
@ -326,10 +378,10 @@ index 003aca3aecb..75ca4ffcef5 100644
/* Context activation is done by the caller. */
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index a345626cf5e..f4c24f2d2a6 100644
index 087aa21b75d..62a27535baa 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -1203,6 +1203,36 @@ void wined3d_shader_resource_view_gl_bind(struct wined3d_shader_resource_view_gl
@@ -1201,6 +1201,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);
}
@ -367,7 +419,7 @@ index a345626cf5e..f4c24f2d2a6 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 7b6fa50c5f0..a8186c169e0 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -42,6 +42,7 @@ enum wined3d_gl_extension
@ -379,10 +431,10 @@ index 75c4cd732ab..ccc1ce2f0ff 100644
ARB_BUFFER_STORAGE,
ARB_CLEAR_BUFFER_OBJECT,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7d5bb0391bc..89751c56748 100644
index 5b3eb0136b0..c28d3608ba5 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -94,6 +94,7 @@ struct wined3d_adapter;
@@ -95,6 +95,7 @@ struct wined3d_adapter;
struct wined3d_buffer_vk;
struct wined3d_context;
struct wined3d_context_vk;
@ -390,7 +442,7 @@ index 7d5bb0391bc..89751c56748 100644
struct wined3d_gl_info;
struct wined3d_state;
struct wined3d_swapchain_gl;
@@ -1543,6 +1544,8 @@ struct wined3d_shader_backend_ops
@@ -1506,6 +1507,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);
@ -399,7 +451,7 @@ index 7d5bb0391bc..89751c56748 100644
uint64_t (*shader_compile)(struct wined3d_context *context, const struct wined3d_shader_desc *shader_desc,
enum wined3d_shader_type shader_type);
};
@@ -3888,6 +3891,21 @@ struct wined3d_dummy_textures
@@ -3825,6 +3828,21 @@ struct wined3d_dummy_textures
GLuint tex_2d_ms_array;
};
@ -421,7 +473,7 @@ index 7d5bb0391bc..89751c56748 100644
#define WINED3D_UNMAPPED_STAGE ~0u
/* Multithreaded flag. Removed from the public header to signal that
@@ -3963,6 +3981,9 @@ struct wined3d_device
@@ -3900,6 +3918,9 @@ struct wined3d_device
struct wined3d_sampler *default_sampler;
struct wined3d_sampler *null_sampler;
@ -431,7 +483,7 @@ index 7d5bb0391bc..89751c56748 100644
/* Command stream */
struct wined3d_cs *cs;
@@ -4658,6 +4679,8 @@ void wined3d_texture_download_from_texture(struct wined3d_texture *dst_texture,
@@ -4569,6 +4590,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, DWORD location) DECLSPEC_HIDDEN;
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN;
@ -440,7 +492,7 @@ index 7d5bb0391bc..89751c56748 100644
void wined3d_texture_invalidate_location(struct wined3d_texture *texture,
unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN;
void wined3d_texture_load(struct wined3d_texture *texture,
@@ -5415,6 +5438,8 @@ HRESULT wined3d_shader_resource_view_gl_init(struct wined3d_shader_resource_view
@@ -5372,6 +5395,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;
@ -450,5 +502,5 @@ index 7d5bb0391bc..89751c56748 100644
struct wined3d_view_vk
{
--
2.34.1
2.35.1