Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
573f37ab
Commit
573f37ab
authored
Apr 30, 2020
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Create Vulkan buffer views for shader resource views.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fcbdddfb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
125 additions
and
18 deletions
+125
-18
adapter_vk.c
dlls/wined3d/adapter_vk.c
+33
-10
buffer.c
dlls/wined3d/buffer.c
+1
-1
context_vk.c
dlls/wined3d/context_vk.c
+30
-0
view.c
dlls/wined3d/view.c
+48
-4
wined3d_private.h
dlls/wined3d/wined3d_private.h
+13
-3
No files found.
dlls/wined3d/adapter_vk.c
View file @
573f37ab
...
...
@@ -1216,6 +1216,7 @@ static HRESULT adapter_vk_create_rendertarget_view(const struct wined3d_view_des
struct
wined3d_view_vk_destroy_ctx
{
struct
wined3d_device_vk
*
device_vk
;
VkBufferView
*
vk_buffer_view
;
VkImageView
*
vk_image_view
;
uint64_t
*
command_buffer_id
;
void
*
object
;
...
...
@@ -1227,32 +1228,47 @@ static void wined3d_view_vk_destroy_object(void *object)
struct
wined3d_view_vk_destroy_ctx
*
ctx
=
object
;
const
struct
wined3d_vk_info
*
vk_info
;
struct
wined3d_device_vk
*
device_vk
;
struct
wined3d_context
*
context
;
device_vk
=
ctx
->
device_vk
;
vk_info
=
&
wined3d_adapter_vk
(
device_vk
->
d
.
adapter
)
->
vk_info
;
context
=
context_acquire
(
&
device_vk
->
d
,
NULL
,
0
);
if
(
ctx
->
vk_
image
_view
)
if
(
ctx
->
vk_
buffer
_view
)
{
struct
wined3d_context
*
context
;
if
(
!
(
context
=
context_acquire
(
&
device_vk
->
d
,
NULL
,
0
)))
if
(
context
)
{
VK_CALL
(
vkDestroyImageView
(
device_vk
->
vk_device
,
*
ctx
->
vk_image_view
,
NULL
));
TRACE
(
"Destroyed image view 0x%s.
\n
"
,
wine_dbgstr_longlong
(
*
ctx
->
vk_image_view
)
);
wined3d_context_vk_destroy_buffer_view
(
wined3d_context_vk
(
context
),
*
ctx
->
vk_buffer_view
,
*
ctx
->
command_buffer_id
);
}
else
{
VK_CALL
(
vkDestroyBufferView
(
device_vk
->
vk_device
,
*
ctx
->
vk_buffer_view
,
NULL
));
TRACE
(
"Destroyed buffer view 0x%s.
\n
"
,
wine_dbgstr_longlong
(
*
ctx
->
vk_buffer_view
));
}
}
if
(
ctx
->
vk_image_view
)
{
if
(
context
)
{
wined3d_context_vk_destroy_image_view
(
wined3d_context_vk
(
context
),
*
ctx
->
vk_image_view
,
*
ctx
->
command_buffer_id
);
context_release
(
context
);
}
else
{
VK_CALL
(
vkDestroyImageView
(
device_vk
->
vk_device
,
*
ctx
->
vk_image_view
,
NULL
));
TRACE
(
"Destroyed image view 0x%s.
\n
"
,
wine_dbgstr_longlong
(
*
ctx
->
vk_image_view
));
}
}
if
(
context
)
context_release
(
context
);
heap_free
(
ctx
->
object
);
heap_free
(
ctx
->
free
);
}
static
void
wined3d_view_vk_destroy
(
struct
wined3d_device
*
device
,
static
void
wined3d_view_vk_destroy
(
struct
wined3d_device
*
device
,
VkBufferView
*
vk_buffer_view
,
VkImageView
*
vk_image_view
,
uint64_t
*
command_buffer_id
,
void
*
view_vk
)
{
struct
wined3d_view_vk_destroy_ctx
*
ctx
,
c
;
...
...
@@ -1260,6 +1276,7 @@ static void wined3d_view_vk_destroy(struct wined3d_device *device,
if
(
!
(
ctx
=
heap_alloc
(
sizeof
(
*
ctx
))))
ctx
=
&
c
;
ctx
->
device_vk
=
wined3d_device_vk
(
device
);
ctx
->
vk_buffer_view
=
vk_buffer_view
;
ctx
->
vk_image_view
=
vk_image_view
;
ctx
->
command_buffer_id
=
command_buffer_id
;
ctx
->
object
=
view_vk
;
...
...
@@ -1285,7 +1302,7 @@ static void adapter_vk_destroy_rendertarget_view(struct wined3d_rendertarget_vie
if
(
swapchain_count
)
wined3d_device_incref
(
device
);
wined3d_rendertarget_view_cleanup
(
&
view_vk
->
v
);
wined3d_view_vk_destroy
(
device
,
&
view_vk
->
vk_image_view
,
&
view_vk
->
command_buffer_id
,
view_vk
);
wined3d_view_vk_destroy
(
device
,
NULL
,
&
view_vk
->
vk_image_view
,
&
view_vk
->
command_buffer_id
,
view_vk
);
if
(
swapchain_count
)
wined3d_device_decref
(
device
);
}
...
...
@@ -1322,6 +1339,8 @@ static void adapter_vk_destroy_shader_resource_view(struct wined3d_shader_resour
struct
wined3d_device
*
device
=
srv_vk
->
v
.
resource
->
device
;
unsigned
int
swapchain_count
=
device
->
swapchain_count
;
struct
wined3d_view_vk
*
view_vk
=
&
srv_vk
->
view_vk
;
VkBufferView
*
vk_buffer_view
=
NULL
;
VkImageView
*
vk_image_view
=
NULL
;
TRACE
(
"srv_vk %p.
\n
"
,
srv_vk
);
...
...
@@ -1331,8 +1350,12 @@ static void adapter_vk_destroy_shader_resource_view(struct wined3d_shader_resour
* the refcount on a device that's in the process of being destroyed. */
if
(
swapchain_count
)
wined3d_device_incref
(
device
);
if
(
srv_vk
->
v
.
resource
->
type
==
WINED3D_RTYPE_BUFFER
)
vk_buffer_view
=
&
view_vk
->
u
.
vk_buffer_view
;
else
vk_image_view
=
&
view_vk
->
u
.
vk_image_info
.
imageView
;
wined3d_shader_resource_view_cleanup
(
&
srv_vk
->
v
);
wined3d_view_vk_destroy
(
device
,
&
view_vk
->
vk_image_info
.
imageV
iew
,
&
view_vk
->
command_buffer_id
,
srv_vk
);
wined3d_view_vk_destroy
(
device
,
vk_buffer_view
,
vk_image_v
iew
,
&
view_vk
->
command_buffer_id
,
srv_vk
);
if
(
swapchain_count
)
wined3d_device_decref
(
device
);
}
...
...
dlls/wined3d/buffer.c
View file @
573f37ab
...
...
@@ -598,7 +598,7 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined
heap_free
(
data
);
}
static
BOOL
wined3d_buffer_prepare_location
(
struct
wined3d_buffer
*
buffer
,
BOOL
wined3d_buffer_prepare_location
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
unsigned
int
location
)
{
return
buffer
->
buffer_ops
->
buffer_prepare_location
(
buffer
,
context
,
location
);
...
...
dlls/wined3d/context_vk.c
View file @
573f37ab
...
...
@@ -469,6 +469,31 @@ void wined3d_context_vk_destroy_image(struct wined3d_context_vk *context_vk,
o
->
command_buffer_id
=
command_buffer_id
;
}
void
wined3d_context_vk_destroy_buffer_view
(
struct
wined3d_context_vk
*
context_vk
,
VkBufferView
vk_view
,
uint64_t
command_buffer_id
)
{
struct
wined3d_device_vk
*
device_vk
=
wined3d_device_vk
(
context_vk
->
c
.
device
);
const
struct
wined3d_vk_info
*
vk_info
=
context_vk
->
vk_info
;
struct
wined3d_retired_object_vk
*
o
;
if
(
context_vk
->
completed_command_buffer_id
>
command_buffer_id
)
{
VK_CALL
(
vkDestroyBufferView
(
device_vk
->
vk_device
,
vk_view
,
NULL
));
TRACE
(
"Destroyed buffer view 0x%s.
\n
"
,
wine_dbgstr_longlong
(
vk_view
));
return
;
}
if
(
!
(
o
=
wined3d_context_vk_get_retired_object_vk
(
context_vk
)))
{
ERR
(
"Leaking buffer view 0x%s.
\n
"
,
wine_dbgstr_longlong
(
vk_view
));
return
;
}
o
->
type
=
WINED3D_RETIRED_BUFFER_VIEW_VK
;
o
->
u
.
vk_buffer_view
=
vk_view
;
o
->
command_buffer_id
=
command_buffer_id
;
}
void
wined3d_context_vk_destroy_image_view
(
struct
wined3d_context_vk
*
context_vk
,
VkImageView
vk_view
,
uint64_t
command_buffer_id
)
{
...
...
@@ -592,6 +617,11 @@ static void wined3d_context_vk_cleanup_resources(struct wined3d_context_vk *cont
TRACE
(
"Destroyed image 0x%s.
\n
"
,
wine_dbgstr_longlong
(
o
->
u
.
vk_image
));
break
;
case
WINED3D_RETIRED_BUFFER_VIEW_VK
:
VK_CALL
(
vkDestroyBufferView
(
device_vk
->
vk_device
,
o
->
u
.
vk_buffer_view
,
NULL
));
TRACE
(
"Destroyed buffer view 0x%s.
\n
"
,
wine_dbgstr_longlong
(
o
->
u
.
vk_buffer_view
));
break
;
case
WINED3D_RETIRED_IMAGE_VIEW_VK
:
VK_CALL
(
vkDestroyImageView
(
device_vk
->
vk_device
,
o
->
u
.
vk_image_view
,
NULL
));
TRACE
(
"Destroyed image view 0x%s.
\n
"
,
wine_dbgstr_longlong
(
o
->
u
.
vk_image_view
));
...
...
dlls/wined3d/view.c
View file @
573f37ab
...
...
@@ -653,6 +653,38 @@ VkImageViewType vk_image_view_type_from_wined3d(enum wined3d_resource_type type,
}
}
static
VkBufferView
wined3d_view_vk_create_buffer_view
(
struct
wined3d_context_vk
*
context_vk
,
const
struct
wined3d_view_desc
*
desc
,
struct
wined3d_buffer_vk
*
buffer_vk
,
const
struct
wined3d_format_vk
*
view_format_vk
)
{
const
struct
wined3d_vk_info
*
vk_info
=
context_vk
->
vk_info
;
VkBufferViewCreateInfo
create_info
;
struct
wined3d_device_vk
*
device_vk
;
VkBufferView
vk_buffer_view
;
unsigned
int
offset
,
size
;
VkResult
vr
;
get_buffer_view_range
(
&
buffer_vk
->
b
,
desc
,
&
view_format_vk
->
f
,
&
offset
,
&
size
);
wined3d_buffer_prepare_location
(
&
buffer_vk
->
b
,
&
context_vk
->
c
,
WINED3D_LOCATION_BUFFER
);
create_info
.
sType
=
VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
;
create_info
.
pNext
=
NULL
;
create_info
.
flags
=
0
;
create_info
.
buffer
=
buffer_vk
->
bo
.
vk_buffer
;
create_info
.
format
=
view_format_vk
->
vk_format
;
create_info
.
offset
=
buffer_vk
->
bo
.
buffer_offset
+
offset
;
create_info
.
range
=
size
;
device_vk
=
wined3d_device_vk
(
buffer_vk
->
b
.
resource
.
device
);
if
((
vr
=
VK_CALL
(
vkCreateBufferView
(
device_vk
->
vk_device
,
&
create_info
,
NULL
,
&
vk_buffer_view
)))
<
0
)
{
ERR
(
"Failed to create buffer view, vr %s.
\n
"
,
wined3d_debug_vkresult
(
vr
));
return
VK_NULL_HANDLE
;
}
return
vk_buffer_view
;
}
static
VkImageView
wined3d_view_vk_create_texture_view
(
struct
wined3d_context_vk
*
context_vk
,
const
struct
wined3d_view_desc
*
desc
,
struct
wined3d_texture_vk
*
texture_vk
,
const
struct
wined3d_format_vk
*
view_format_vk
,
struct
color_fixup_desc
fixup
,
bool
srv
)
...
...
@@ -987,6 +1019,7 @@ static void wined3d_shader_resource_view_vk_cs_init(void *object)
const
struct
wined3d_format
*
format
;
struct
wined3d_resource
*
resource
;
struct
wined3d_context
*
context
;
VkBufferView
vk_buffer_view
;
uint32_t
default_flags
=
0
;
VkImageView
vk_image_view
;
...
...
@@ -995,7 +1028,18 @@ static void wined3d_shader_resource_view_vk_cs_init(void *object)
if
(
resource
->
type
==
WINED3D_RTYPE_BUFFER
)
{
FIXME
(
"Buffer views not implemented.
\n
"
);
context
=
context_acquire
(
resource
->
device
,
NULL
,
0
);
vk_buffer_view
=
wined3d_view_vk_create_buffer_view
(
wined3d_context_vk
(
context
),
desc
,
wined3d_buffer_vk
(
buffer_from_resource
(
resource
)),
wined3d_format_vk
(
format
));
context_release
(
context
);
if
(
!
vk_buffer_view
)
return
;
TRACE
(
"Created buffer view 0x%s.
\n
"
,
wine_dbgstr_longlong
(
vk_buffer_view
));
srv_vk
->
view_vk
.
u
.
vk_buffer_view
=
vk_buffer_view
;
return
;
}
...
...
@@ -1026,9 +1070,9 @@ static void wined3d_shader_resource_view_vk_cs_init(void *object)
TRACE
(
"Created image view 0x%s.
\n
"
,
wine_dbgstr_longlong
(
vk_image_view
));
srv_vk
->
view_vk
.
vk_image_info
.
imageView
=
vk_image_view
;
srv_vk
->
view_vk
.
vk_image_info
.
sampler
=
VK_NULL_HANDLE
;
srv_vk
->
view_vk
.
vk_image_info
.
imageLayout
=
texture_vk
->
layout
;
srv_vk
->
view_vk
.
u
.
vk_image_info
.
imageView
=
vk_image_view
;
srv_vk
->
view_vk
.
u
.
vk_image_info
.
sampler
=
VK_NULL_HANDLE
;
srv_vk
->
view_vk
.
u
.
vk_image_info
.
imageLayout
=
texture_vk
->
layout
;
}
HRESULT
wined3d_shader_resource_view_vk_init
(
struct
wined3d_shader_resource_view_vk
*
view_vk
,
...
...
dlls/wined3d/wined3d_private.h
View file @
573f37ab
...
...
@@ -2230,6 +2230,7 @@ enum wined3d_retired_object_type_vk
WINED3D_RETIRED_BO_SLAB_SLICE_VK
,
WINED3D_RETIRED_BUFFER_VK
,
WINED3D_RETIRED_IMAGE_VK
,
WINED3D_RETIRED_BUFFER_VIEW_VK
,
WINED3D_RETIRED_IMAGE_VIEW_VK
,
};
...
...
@@ -2249,6 +2250,7 @@ struct wined3d_retired_object_vk
}
slice
;
VkBuffer
vk_buffer
;
VkImage
vk_image
;
VkBufferView
vk_buffer_view
;
VkImageView
vk_image_view
;
}
u
;
uint64_t
command_buffer_id
;
...
...
@@ -2322,6 +2324,8 @@ void wined3d_context_vk_destroy_allocator_block(struct wined3d_context_vk *conte
struct
wined3d_allocator_block
*
block
,
uint64_t
command_buffer_id
)
DECLSPEC_HIDDEN
;
void
wined3d_context_vk_destroy_bo
(
struct
wined3d_context_vk
*
context_vk
,
const
struct
wined3d_bo_vk
*
bo
)
DECLSPEC_HIDDEN
;
void
wined3d_context_vk_destroy_buffer_view
(
struct
wined3d_context_vk
*
context_vk
,
VkBufferView
vk_view
,
uint64_t
command_buffer_id
)
DECLSPEC_HIDDEN
;
void
wined3d_context_vk_destroy_framebuffer
(
struct
wined3d_context_vk
*
context_vk
,
VkFramebuffer
vk_framebuffer
,
uint64_t
command_buffer_id
)
DECLSPEC_HIDDEN
;
void
wined3d_context_vk_destroy_image
(
struct
wined3d_context_vk
*
context_vk
,
...
...
@@ -4434,6 +4438,8 @@ static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resourc
}
void
wined3d_buffer_cleanup
(
struct
wined3d_buffer
*
buffer
)
DECLSPEC_HIDDEN
;
void
wined3d_buffer_copy
(
struct
wined3d_buffer
*
dst_buffer
,
unsigned
int
dst_offset
,
struct
wined3d_buffer
*
src_buffer
,
unsigned
int
src_offset
,
unsigned
int
size
)
DECLSPEC_HIDDEN
;
DWORD
wined3d_buffer_get_memory
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_bo_address
*
data
,
DWORD
locations
)
DECLSPEC_HIDDEN
;
void
wined3d_buffer_invalidate_location
(
struct
wined3d_buffer
*
buffer
,
DWORD
location
)
DECLSPEC_HIDDEN
;
...
...
@@ -4442,8 +4448,8 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
BOOL
wined3d_buffer_load_location
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
DWORD
location
)
DECLSPEC_HIDDEN
;
BYTE
*
wined3d_buffer_load_sysmem
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
)
DECLSPEC_HIDDEN
;
void
wined3d_buffer_copy
(
struct
wined3d_buffer
*
dst_buffer
,
unsigned
int
dst_offset
,
struct
wined3d_
buffer
*
src_buffer
,
unsigned
int
src_offset
,
unsigned
int
size
)
DECLSPEC_HIDDEN
;
BOOL
wined3d_buffer_prepare_location
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_
context
*
context
,
unsigned
int
location
)
DECLSPEC_HIDDEN
;
void
wined3d_buffer_upload_data
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
const
struct
wined3d_box
*
box
,
const
void
*
data
)
DECLSPEC_HIDDEN
;
...
...
@@ -4596,7 +4602,11 @@ HRESULT wined3d_shader_resource_view_gl_init(struct wined3d_shader_resource_view
struct
wined3d_view_vk
{
VkDescriptorImageInfo
vk_image_info
;
union
{
VkBufferView
vk_buffer_view
;
VkDescriptorImageInfo
vk_image_info
;
}
u
;
uint64_t
command_buffer_id
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment