mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Added wined3d-bindless-texture patchset
This commit is contained in:
parent
2239795e43
commit
d5e8d145c8
@ -237,6 +237,7 @@ patch_enable_all ()
|
||||
enable_wined3d_SWVP_shaders="$1"
|
||||
enable_wined3d_Silence_FIXMEs="$1"
|
||||
enable_wined3d_WINED3DFMT_B8G8R8X8_UNORM="$1"
|
||||
enable_wined3d_bindless_texture="$1"
|
||||
enable_wined3d_mesa_texture_download="$1"
|
||||
enable_wined3d_unset_flip_gdi="$1"
|
||||
enable_wined3d_wined3d_guess_gl_vendor="$1"
|
||||
@ -741,6 +742,9 @@ patch_enable ()
|
||||
wined3d-WINED3DFMT_B8G8R8X8_UNORM)
|
||||
enable_wined3d_WINED3DFMT_B8G8R8X8_UNORM="$2"
|
||||
;;
|
||||
wined3d-bindless-texture)
|
||||
enable_wined3d_bindless_texture="$2"
|
||||
;;
|
||||
wined3d-mesa_texture_download)
|
||||
enable_wined3d_mesa_texture_download="$2"
|
||||
;;
|
||||
@ -3637,6 +3641,19 @@ if test "$enable_wined3d_WINED3DFMT_B8G8R8X8_UNORM" -eq 1; then
|
||||
patch_apply wined3d-WINED3DFMT_B8G8R8X8_UNORM/0001-wined3d-Implement-WINED3DFMT_B8G8R8X8_UNORM-to-WINED.patch
|
||||
fi
|
||||
|
||||
# Patchset wined3d-bindless-texture
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#44514] - wined3d: Use bindless textures for GLSL shaders.
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wined3d/adapter_gl.c, dlls/wined3d/context_gl.c, dlls/wined3d/device.c, dlls/wined3d/glsl_shader.c,
|
||||
# | dlls/wined3d/texture.c, dlls/wined3d/view.c, dlls/wined3d/wined3d_gl.h, dlls/wined3d/wined3d_private.h
|
||||
# |
|
||||
if test "$enable_wined3d_bindless_texture" -eq 1; then
|
||||
patch_apply wined3d-bindless-texture/0001-wined3d-Use-bindless-textures-for-GLSL-shaders.patch
|
||||
fi
|
||||
|
||||
# Patchset wined3d-mesa_texture_download
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
@ -0,0 +1,454 @@
|
||||
From 0690735af120711ffa1e759bd3af1281de627dc1 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.
|
||||
|
||||
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(-)
|
||||
|
||||
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
|
||||
index 0a98720a5ae..8b45be19f49 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[] =
|
||||
|
||||
/* ARB */
|
||||
{"GL_ARB_base_instance", ARB_BASE_INSTANCE },
|
||||
+ {"GL_ARB_bindless_texture", ARB_BINDLESS_TEXTURE },
|
||||
{"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)
|
||||
/* GL_ARB_base_instance */
|
||||
USE_GL_FUNC(glDrawArraysInstancedBaseInstance)
|
||||
USE_GL_FUNC(glDrawElementsInstancedBaseVertexBaseInstance)
|
||||
+ /* GL_ARB_bindless_texture */
|
||||
+ USE_GL_FUNC(glGetTextureSamplerHandleARB)
|
||||
+ USE_GL_FUNC(glMakeTextureHandleNonResidentARB)
|
||||
+ USE_GL_FUNC(glMakeTextureHandleResidentARB)
|
||||
+ USE_GL_FUNC(glUniformHandleui64ARB)
|
||||
/* GL_ARB_blend_func_extended */
|
||||
USE_GL_FUNC(glBindFragDataLocationIndexed)
|
||||
USE_GL_FUNC(glGetFragDataIndex)
|
||||
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
|
||||
index 9fd2ed67dcc..e569cab599d 100644
|
||||
--- a/dlls/wined3d/context_gl.c
|
||||
+++ b/dlls/wined3d/context_gl.c
|
||||
@@ -3757,6 +3757,12 @@ static void wined3d_context_gl_bind_shader_resources(struct wined3d_context_gl *
|
||||
if (!(shader = state->shader[shader_type]))
|
||||
return;
|
||||
|
||||
+ if (device->shader_backend->shader_load_sampler_handles)
|
||||
+ {
|
||||
+ device->shader_backend->shader_load_sampler_handles(device->shader_priv, context_gl, state, shader);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
tex_unit_map = wined3d_context_gl_get_tex_unit_mapping(context_gl,
|
||||
&shader->reg_maps.shader_version, &base, &count);
|
||||
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index a6e361021ea..9d5eb0af5e9 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -577,6 +577,59 @@ void wined3d_device_destroy_default_samplers(struct wined3d_device *device)
|
||||
device->null_sampler = NULL;
|
||||
}
|
||||
|
||||
+static GLuint64 create_dummy_sampler_handle(struct wined3d_device *device, struct wined3d_context_gl *context_gl,
|
||||
+ GLuint texture)
|
||||
+{
|
||||
+ const struct wined3d_gl_info *gl_info = context_gl->gl_info;
|
||||
+ GLuint64 handle;
|
||||
+
|
||||
+ handle = GL_EXTCALL(glGetTextureSamplerHandleARB(texture, wined3d_sampler_gl(device->default_sampler)->name));
|
||||
+ GL_EXTCALL(glMakeTextureHandleResidentARB(handle));
|
||||
+ checkGLcall("glMakeTextureHandleResidentARB");
|
||||
+ return handle;
|
||||
+}
|
||||
+
|
||||
+/* Context activation is done by the caller. */
|
||||
+static void create_dummy_sampler_handles(struct wined3d_device *device, struct wined3d_context_gl *context_gl)
|
||||
+{
|
||||
+ 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;
|
||||
+
|
||||
+ if (!gl_info->supported[ARB_BINDLESS_TEXTURE])
|
||||
+ return;
|
||||
+
|
||||
+ if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE])
|
||||
+ {
|
||||
+ handles->tex_2d_ms = create_dummy_sampler_handle(device, context_gl, textures->tex_2d_ms);
|
||||
+ handles->tex_2d_ms_array = create_dummy_sampler_handle(device, context_gl, textures->tex_2d_ms_array);
|
||||
+ }
|
||||
+
|
||||
+ if (gl_info->supported[ARB_TEXTURE_BUFFER_OBJECT])
|
||||
+ handles->tex_buffer = create_dummy_sampler_handle(device, context_gl, textures->tex_buffer);
|
||||
+
|
||||
+ if (gl_info->supported[EXT_TEXTURE_ARRAY])
|
||||
+ {
|
||||
+ handles->tex_2d_array = create_dummy_sampler_handle(device, context_gl, textures->tex_2d_array);
|
||||
+ handles->tex_1d_array = create_dummy_sampler_handle(device, context_gl, textures->tex_1d_array);
|
||||
+ }
|
||||
+
|
||||
+ if (gl_info->supported[ARB_TEXTURE_CUBE_MAP_ARRAY])
|
||||
+ handles->tex_cube_array = create_dummy_sampler_handle(device, context_gl, textures->tex_cube_array);
|
||||
+
|
||||
+ if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
|
||||
+ handles->tex_cube = create_dummy_sampler_handle(device, context_gl, textures->tex_cube);
|
||||
+
|
||||
+ if (gl_info->supported[EXT_TEXTURE3D])
|
||||
+ handles->tex_3d = create_dummy_sampler_handle(device, context_gl, textures->tex_3d);
|
||||
+
|
||||
+ if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
|
||||
+ handles->tex_rect = create_dummy_sampler_handle(device, context_gl, textures->tex_rect);
|
||||
+
|
||||
+ handles->tex_2d = create_dummy_sampler_handle(device, context_gl, textures->tex_2d);
|
||||
+ handles->tex_1d = create_dummy_sampler_handle(device, context_gl, textures->tex_1d);
|
||||
+}
|
||||
+
|
||||
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)
|
||||
{
|
||||
@@ -1036,6 +1089,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);
|
||||
+ create_dummy_sampler_handles(device, context_gl);
|
||||
context_release(context);
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index c8709344ada..70dc9fe4f3c 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
|
||||
ERR("Unmapped sampler %u.\n", sampler_idx);
|
||||
}
|
||||
|
||||
+static BOOL shader_glsl_use_bindless_texture(const struct wined3d_gl_info *gl_info,
|
||||
+ unsigned int sampler_idx, const struct wined3d_shader_resource_info *resource_info)
|
||||
+{
|
||||
+ return gl_info->supported[ARB_BINDLESS_TEXTURE]
|
||||
+ && shader_glsl_use_layout_binding_qualifier(gl_info)
|
||||
+ && sampler_idx >= 16
|
||||
+ && resource_info->type != WINED3D_SHADER_RESOURCE_BUFFER;
|
||||
+}
|
||||
+
|
||||
+static GLuint64 shader_glsl_dummy_sampler_handle(struct wined3d_context *context,
|
||||
+ enum wined3d_shader_resource_type type)
|
||||
+{
|
||||
+ const struct wined3d_device *device = context->device;
|
||||
+
|
||||
+ switch (type)
|
||||
+ {
|
||||
+ case WINED3D_SHADER_RESOURCE_BUFFER:
|
||||
+ return device->dummy_sampler_handles.tex_buffer;
|
||||
+ case WINED3D_SHADER_RESOURCE_TEXTURE_1D:
|
||||
+ return device->dummy_sampler_handles.tex_1d;
|
||||
+ case WINED3D_SHADER_RESOURCE_TEXTURE_2D:
|
||||
+ return device->dummy_sampler_handles.tex_2d;
|
||||
+ case WINED3D_SHADER_RESOURCE_TEXTURE_3D:
|
||||
+ return device->dummy_sampler_handles.tex_3d;
|
||||
+ case WINED3D_SHADER_RESOURCE_TEXTURE_CUBE:
|
||||
+ return device->dummy_sampler_handles.tex_cube;
|
||||
+ case WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY:
|
||||
+ return device->dummy_sampler_handles.tex_1d_array;
|
||||
+ case WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY:
|
||||
+ return device->dummy_sampler_handles.tex_2d_array;
|
||||
+ case WINED3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY:
|
||||
+ return device->dummy_sampler_handles.tex_cube_array;
|
||||
+ case WINED3D_SHADER_RESOURCE_TEXTURE_2DMS:
|
||||
+ return device->dummy_sampler_handles.tex_2d_ms;
|
||||
+ case WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY:
|
||||
+ return device->dummy_sampler_handles.tex_2d_array;
|
||||
+ default:
|
||||
+ FIXME("Unhandled resource type %#x.\n", type);
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void shader_glsl_load_sampler_handles(void *shader_priv, struct wined3d_context_gl *context_gl,
|
||||
+ const struct wined3d_state *state, const struct wined3d_shader *shader)
|
||||
+{
|
||||
+ const struct wined3d_context *context = &context_gl->c;
|
||||
+ const struct glsl_context_data *ctx_data = context->shader_backend_data;
|
||||
+ const struct wined3d_device *device = context->device;
|
||||
+ const struct wined3d_gl_info *gl_info = context_gl->gl_info;
|
||||
+ struct shader_glsl_priv *priv = shader_priv;
|
||||
+ struct wined3d_string_buffer *sampler_name = string_buffer_get(&priv->string_buffers);
|
||||
+ enum wined3d_shader_type shader_type = shader->reg_maps.shader_version.type;
|
||||
+ const char *prefix = shader_glsl_get_prefix(shader_type);
|
||||
+
|
||||
+ struct wined3d_shader_sampler_map_entry *entry;
|
||||
+ struct wined3d_shader_resource_view *view;
|
||||
+ struct wined3d_sampler *sampler;
|
||||
+ unsigned int bind_idx, i;
|
||||
+ GLint name_loc;
|
||||
+
|
||||
+ for (i = 0; i < shader->reg_maps.sampler_map.count; ++i)
|
||||
+ {
|
||||
+ entry = &shader->reg_maps.sampler_map.entries[i];
|
||||
+ bind_idx = shader_glsl_map_tex_unit(context, &shader->reg_maps.shader_version, entry->bind_idx);
|
||||
+ if (entry->sampler_idx == WINED3D_SAMPLER_DEFAULT)
|
||||
+ sampler = device->default_sampler;
|
||||
+ else if (!(sampler = state->sampler[shader_type][entry->sampler_idx]))
|
||||
+ sampler = device->null_sampler;
|
||||
+
|
||||
+ string_buffer_sprintf(sampler_name, "%s_sampler%u", prefix, entry->bind_idx);
|
||||
+ name_loc = GL_EXTCALL(glGetUniformLocation(ctx_data->glsl_program->id, sampler_name->buffer));
|
||||
+ if (name_loc == -1)
|
||||
+ {
|
||||
+ ERR("No uniform location at %u, %s\n", i, sampler_name->buffer);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (!(view = state->shader_resource_view[shader_type][entry->resource_idx]))
|
||||
+ WARN("No resource view bound at index %u, %u.\n", shader_type, entry->resource_idx);
|
||||
+
|
||||
+ if (shader_glsl_use_bindless_texture(gl_info, i, &shader->reg_maps.resource_info[entry->resource_idx]))
|
||||
+ {
|
||||
+ GLuint64 handle;
|
||||
+ if (view)
|
||||
+ {
|
||||
+ handle = wined3d_shader_resource_view_handle(view, sampler, context_gl);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ handle = shader_glsl_dummy_sampler_handle(context,
|
||||
+ shader->reg_maps.resource_info[entry->resource_idx].type);
|
||||
+ }
|
||||
+ GL_EXTCALL(glUniformHandleui64ARB(name_loc, handle));
|
||||
+ checkGLcall("glUniformHandleui64ARB");
|
||||
+ }
|
||||
+ else if (bind_idx == WINED3D_UNMAPPED_STAGE || bind_idx >= gl_info->limits.combined_samplers)
|
||||
+ {
|
||||
+ ERR("Trying to load sampler %s on unsupported unit %u.\n", sampler_name->buffer, bind_idx);
|
||||
+ }
|
||||
+ else if (view)
|
||||
+ {
|
||||
+ wined3d_shader_resource_view_gl_bind(wined3d_shader_resource_view_gl(view), bind_idx, sampler, context_gl);
|
||||
+ }
|
||||
+ }
|
||||
+ string_buffer_release(&priv->string_buffers, sampler_name);
|
||||
+}
|
||||
+
|
||||
/* 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)
|
||||
@@ -2566,7 +2673,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
|
||||
break;
|
||||
}
|
||||
|
||||
- if (shader_glsl_use_layout_binding_qualifier(gl_info))
|
||||
+ if (shader_glsl_use_bindless_texture(gl_info, i, ®_maps->resource_info[entry->resource_idx]))
|
||||
+ shader_addline(buffer, "layout(bindless_sampler)\n");
|
||||
+ else if (shader_glsl_use_layout_binding_qualifier(gl_info))
|
||||
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);
|
||||
@@ -7759,6 +7868,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)
|
||||
{
|
||||
+ if (gl_info->supported[ARB_BINDLESS_TEXTURE])
|
||||
+ shader_addline(buffer, "#extension GL_ARB_bindless_texture : enable\n");
|
||||
if (gl_info->supported[ARB_CULL_DISTANCE])
|
||||
shader_addline(buffer, "#extension GL_ARB_cull_distance : enable\n");
|
||||
if (gl_info->supported[ARB_GPU_SHADER5])
|
||||
@@ -11907,6 +12018,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,
|
||||
+ shader_glsl_load_sampler_handles,
|
||||
shader_glsl_shader_compile,
|
||||
};
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 99aa6a5598a..8a10abf07d9 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -1191,7 +1191,7 @@ void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle[4], struct color_
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
-void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
|
||||
+GLuint wined3d_texture_get_name(struct wined3d_texture_gl *texture_gl,
|
||||
struct wined3d_context_gl *context_gl, BOOL srgb)
|
||||
{
|
||||
const struct wined3d_format *format = texture_gl->t.resource.format;
|
||||
@@ -1215,10 +1215,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
|
||||
target = texture_gl->target;
|
||||
|
||||
if (gl_tex->name)
|
||||
- {
|
||||
- wined3d_context_gl_bind_texture(context_gl, target, gl_tex->name);
|
||||
- return;
|
||||
- }
|
||||
+ return gl_tex->name;
|
||||
|
||||
gl_info->gl_ops.gl.p_glGenTextures(1, &gl_tex->name);
|
||||
checkGLcall("glGenTextures");
|
||||
@@ -1227,7 +1224,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
|
||||
if (!gl_tex->name)
|
||||
{
|
||||
ERR("Failed to generate a texture name.\n");
|
||||
- return;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/* Initialise the state of the texture object to the OpenGL defaults, not
|
||||
@@ -1311,6 +1308,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");
|
||||
}
|
||||
+
|
||||
+ return gl_tex->name;
|
||||
+}
|
||||
+
|
||||
+/* Context activation is done by the caller. */
|
||||
+void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
|
||||
+ struct wined3d_context_gl *context_gl, BOOL srgb)
|
||||
+{
|
||||
+ wined3d_context_gl_bind_texture(context_gl, texture_gl->target, wined3d_texture_get_name(texture_gl, context_gl, srgb));
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
|
||||
index efa98ea13eb..4a2678b3952 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
|
||||
wined3d_sampler_gl_bind(sampler_gl, unit, texture_gl, context_gl);
|
||||
}
|
||||
|
||||
+GLuint64 wined3d_shader_resource_view_handle(struct wined3d_shader_resource_view *view,
|
||||
+ struct wined3d_sampler *sampler, struct wined3d_context_gl *context_gl)
|
||||
+{
|
||||
+ struct wined3d_shader_resource_view_gl *view_gl = wined3d_shader_resource_view_gl(view);
|
||||
+ const struct wined3d_gl_info *gl_info = context_gl->gl_info;
|
||||
+ GLuint name;
|
||||
+ GLuint64 handle;
|
||||
+
|
||||
+ if (view_gl->gl_view.name)
|
||||
+ {
|
||||
+ name = view_gl->gl_view.name;
|
||||
+ }
|
||||
+ else if (view->resource->type == WINED3D_RTYPE_BUFFER)
|
||||
+ {
|
||||
+ FIXME("Buffer shader resources not supported.\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ struct wined3d_texture_gl *texture_gl = wined3d_texture_gl(wined3d_texture_from_resource(view->resource));
|
||||
+ name = wined3d_texture_get_name(texture_gl, context_gl, FALSE);
|
||||
+ }
|
||||
+
|
||||
+ handle = GL_EXTCALL(glGetTextureSamplerHandleARB(name, wined3d_sampler_gl(sampler)->name));
|
||||
+ checkGLcall("glGetTextureSamplerHandleARB");
|
||||
+ GL_EXTCALL(glMakeTextureHandleResidentARB(handle));
|
||||
+ checkGLcall("glMakeTextureHandleResidentARB");
|
||||
+ return handle;
|
||||
+}
|
||||
+
|
||||
/* Context activation is done by the caller. */
|
||||
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
|
||||
--- a/dlls/wined3d/wined3d_gl.h
|
||||
+++ b/dlls/wined3d/wined3d_gl.h
|
||||
@@ -42,6 +42,7 @@ enum wined3d_gl_extension
|
||||
APPLE_YCBCR_422,
|
||||
/* ARB */
|
||||
ARB_BASE_INSTANCE,
|
||||
+ ARB_BINDLESS_TEXTURE,
|
||||
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 ed3b8f63fbd..d8d1d22270d 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -94,6 +94,7 @@ struct wined3d_adapter;
|
||||
struct wined3d_buffer_vk;
|
||||
struct wined3d_context;
|
||||
struct wined3d_context_vk;
|
||||
+struct wined3d_context_gl;
|
||||
struct wined3d_gl_info;
|
||||
struct wined3d_state;
|
||||
struct wined3d_swapchain_gl;
|
||||
@@ -1534,6 +1535,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);
|
||||
};
|
||||
@@ -3852,6 +3855,21 @@ struct wined3d_dummy_textures
|
||||
GLuint tex_2d_ms_array;
|
||||
};
|
||||
|
||||
+struct wined3d_dummy_sampler_handles
|
||||
+{
|
||||
+ GLuint64 tex_1d;
|
||||
+ GLuint64 tex_2d;
|
||||
+ GLuint64 tex_rect;
|
||||
+ GLuint64 tex_3d;
|
||||
+ GLuint64 tex_cube;
|
||||
+ GLuint64 tex_cube_array;
|
||||
+ GLuint64 tex_1d_array;
|
||||
+ GLuint64 tex_2d_array;
|
||||
+ GLuint64 tex_buffer;
|
||||
+ GLuint64 tex_2d_ms;
|
||||
+ GLuint64 tex_2d_ms_array;
|
||||
+};
|
||||
+
|
||||
#define WINED3D_UNMAPPED_STAGE ~0u
|
||||
|
||||
/* Multithreaded flag. Removed from the public header to signal that
|
||||
@@ -3927,6 +3945,9 @@ struct wined3d_device
|
||||
struct wined3d_sampler *default_sampler;
|
||||
struct wined3d_sampler *null_sampler;
|
||||
|
||||
+ /* Texture sampler handles for when no texture is mapped */
|
||||
+ struct wined3d_dummy_sampler_handles dummy_sampler_handles;
|
||||
+
|
||||
/* Command stream */
|
||||
struct wined3d_cs *cs;
|
||||
|
||||
@@ -4560,6 +4581,8 @@ void wined3d_texture_download_from_texture(struct wined3d_texture *dst_texture,
|
||||
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
struct wined3d_bo_address *data, DWORD locations) DECLSPEC_HIDDEN;
|
||||
+GLuint wined3d_texture_get_name(struct wined3d_texture_gl *texture_gl,
|
||||
+ struct wined3d_context_gl *context_gl, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
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,
|
||||
@@ -5327,6 +5350,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;
|
||||
+GLuint64 wined3d_shader_resource_view_handle(struct wined3d_shader_resource_view *view,
|
||||
+ struct wined3d_sampler *sampler, struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
|
||||
|
||||
struct wined3d_view_vk
|
||||
{
|
||||
--
|
||||
2.34.1
|
||||
|
1
patches/wined3d-bindless-texture/definition
Normal file
1
patches/wined3d-bindless-texture/definition
Normal file
@ -0,0 +1 @@
|
||||
Fixes: [44514] - wined3d: Use bindless textures for GLSL shaders.
|
Loading…
Reference in New Issue
Block a user