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
5b3f89ae
Commit
5b3f89ae
authored
Aug 11, 2019
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Make the adapter responsible for buffer creation and destruction.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
dccbd6a9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
274 additions
and
42 deletions
+274
-42
adapter_gl.c
dlls/wined3d/adapter_gl.c
+63
-0
adapter_vk.c
dlls/wined3d/adapter_vk.c
+48
-0
buffer.c
dlls/wined3d/buffer.c
+87
-42
directx.c
dlls/wined3d/directx.c
+47
-0
wined3d_private.h
dlls/wined3d/wined3d_private.h
+29
-0
No files found.
dlls/wined3d/adapter_gl.c
View file @
5b3f89ae
...
@@ -4680,6 +4680,67 @@ static void adapter_gl_destroy_swapchain(struct wined3d_swapchain *swapchain)
...
@@ -4680,6 +4680,67 @@ static void adapter_gl_destroy_swapchain(struct wined3d_swapchain *swapchain)
heap_free
(
swapchain
);
heap_free
(
swapchain
);
}
}
static
HRESULT
adapter_gl_create_buffer
(
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_buffer
**
buffer
)
{
struct
wined3d_buffer_gl
*
buffer_gl
;
HRESULT
hr
;
TRACE
(
"device %p, desc %p, data %p, parent %p, parent_ops %p, buffer %p.
\n
"
,
device
,
desc
,
data
,
parent
,
parent_ops
,
buffer
);
if
(
!
(
buffer_gl
=
heap_alloc_zero
(
sizeof
(
*
buffer_gl
))))
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
wined3d_buffer_gl_init
(
buffer_gl
,
device
,
desc
,
data
,
parent
,
parent_ops
)))
{
WARN
(
"Failed to initialise buffer, hr %#x.
\n
"
,
hr
);
heap_free
(
buffer_gl
);
return
hr
;
}
TRACE
(
"Created buffer %p.
\n
"
,
buffer_gl
);
*
buffer
=
&
buffer_gl
->
b
;
return
hr
;
}
static
void
wined3d_buffer_gl_destroy_object
(
void
*
object
)
{
struct
wined3d_buffer_gl
*
buffer_gl
=
object
;
struct
wined3d_context
*
context
;
if
(
buffer_gl
->
buffer_object
)
{
context
=
context_acquire
(
buffer_gl
->
b
.
resource
.
device
,
NULL
,
0
);
wined3d_buffer_gl_destroy_buffer_object
(
buffer_gl
,
wined3d_context_gl
(
context
));
context_release
(
context
);
}
heap_free
(
buffer_gl
);
}
static
void
adapter_gl_destroy_buffer
(
struct
wined3d_buffer
*
buffer
)
{
struct
wined3d_buffer_gl
*
buffer_gl
=
wined3d_buffer_gl
(
buffer
);
struct
wined3d_device
*
device
=
buffer_gl
->
b
.
resource
.
device
;
unsigned
int
swapchain_count
=
device
->
swapchain_count
;
TRACE
(
"buffer_gl %p.
\n
"
,
buffer_gl
);
/* Take a reference to the device, in case releasing the buffer would
* cause the device to be destroyed. However, swapchain resources don't
* take a reference to the device, and we wouldn't want to increment the
* refcount on a device that's in the process of being destroyed. */
if
(
swapchain_count
)
wined3d_device_incref
(
device
);
wined3d_buffer_cleanup
(
&
buffer_gl
->
b
);
wined3d_cs_destroy_object
(
device
->
cs
,
wined3d_buffer_gl_destroy_object
,
buffer_gl
);
if
(
swapchain_count
)
wined3d_device_decref
(
device
);
}
static
const
struct
wined3d_adapter_ops
wined3d_adapter_gl_ops
=
static
const
struct
wined3d_adapter_ops
wined3d_adapter_gl_ops
=
{
{
adapter_gl_destroy
,
adapter_gl_destroy
,
...
@@ -4693,6 +4754,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_gl_ops =
...
@@ -4693,6 +4754,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_gl_ops =
adapter_gl_uninit_3d
,
adapter_gl_uninit_3d
,
adapter_gl_create_swapchain
,
adapter_gl_create_swapchain
,
adapter_gl_destroy_swapchain
,
adapter_gl_destroy_swapchain
,
adapter_gl_create_buffer
,
adapter_gl_destroy_buffer
,
};
};
static
BOOL
wined3d_adapter_gl_init
(
struct
wined3d_adapter_gl
*
adapter_gl
,
static
BOOL
wined3d_adapter_gl_init
(
struct
wined3d_adapter_gl
*
adapter_gl
,
...
...
dlls/wined3d/adapter_vk.c
View file @
5b3f89ae
...
@@ -494,6 +494,52 @@ static void adapter_vk_destroy_swapchain(struct wined3d_swapchain *swapchain)
...
@@ -494,6 +494,52 @@ static void adapter_vk_destroy_swapchain(struct wined3d_swapchain *swapchain)
heap_free
(
swapchain
);
heap_free
(
swapchain
);
}
}
static
HRESULT
adapter_vk_create_buffer
(
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_buffer
**
buffer
)
{
struct
wined3d_buffer_vk
*
buffer_vk
;
HRESULT
hr
;
TRACE
(
"device %p, desc %p, data %p, parent %p, parent_ops %p, buffer %p.
\n
"
,
device
,
desc
,
data
,
parent
,
parent_ops
,
buffer
);
if
(
!
(
buffer_vk
=
heap_alloc_zero
(
sizeof
(
*
buffer_vk
))))
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
wined3d_buffer_vk_init
(
buffer_vk
,
device
,
desc
,
data
,
parent
,
parent_ops
)))
{
WARN
(
"Failed to initialise buffer, hr %#x.
\n
"
,
hr
);
heap_free
(
buffer_vk
);
return
hr
;
}
TRACE
(
"Created buffer %p.
\n
"
,
buffer_vk
);
*
buffer
=
&
buffer_vk
->
b
;
return
hr
;
}
static
void
adapter_vk_destroy_buffer
(
struct
wined3d_buffer
*
buffer
)
{
struct
wined3d_buffer_vk
*
buffer_vk
=
wined3d_buffer_vk
(
buffer
);
struct
wined3d_device
*
device
=
buffer_vk
->
b
.
resource
.
device
;
unsigned
int
swapchain_count
=
device
->
swapchain_count
;
TRACE
(
"buffer_vk %p.
\n
"
,
buffer_vk
);
/* Take a reference to the device, in case releasing the buffer would
* cause the device to be destroyed. However, swapchain resources don't
* take a reference to the device, and we wouldn't want to increment the
* refcount on a device that's in the process of being destroyed. */
if
(
swapchain_count
)
wined3d_device_incref
(
device
);
wined3d_buffer_cleanup
(
&
buffer_vk
->
b
);
wined3d_cs_destroy_object
(
device
->
cs
,
heap_free
,
buffer_vk
);
if
(
swapchain_count
)
wined3d_device_decref
(
device
);
}
static
const
struct
wined3d_adapter_ops
wined3d_adapter_vk_ops
=
static
const
struct
wined3d_adapter_ops
wined3d_adapter_vk_ops
=
{
{
adapter_vk_destroy
,
adapter_vk_destroy
,
...
@@ -507,6 +553,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
...
@@ -507,6 +553,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
adapter_vk_uninit_3d
,
adapter_vk_uninit_3d
,
adapter_vk_create_swapchain
,
adapter_vk_create_swapchain
,
adapter_vk_destroy_swapchain
,
adapter_vk_destroy_swapchain
,
adapter_vk_create_buffer
,
adapter_vk_destroy_buffer
,
};
};
static
unsigned
int
wined3d_get_wine_vk_version
(
void
)
static
unsigned
int
wined3d_get_wine_vk_version
(
void
)
...
...
dlls/wined3d/buffer.c
View file @
5b3f89ae
...
@@ -139,7 +139,7 @@ static void wined3d_buffer_gl_bind(struct wined3d_buffer_gl *buffer_gl, struct w
...
@@ -139,7 +139,7 @@ static void wined3d_buffer_gl_bind(struct wined3d_buffer_gl *buffer_gl, struct w
}
}
/* Context activation is done by the caller. */
/* Context activation is done by the caller. */
static
void
wined3d_buffer_gl_destroy_buffer_object
(
struct
wined3d_buffer_gl
*
buffer_gl
,
void
wined3d_buffer_gl_destroy_buffer_object
(
struct
wined3d_buffer_gl
*
buffer_gl
,
struct
wined3d_context_gl
*
context_gl
)
struct
wined3d_context_gl
*
context_gl
)
{
{
const
struct
wined3d_gl_info
*
gl_info
=
context_gl
->
gl_info
;
const
struct
wined3d_gl_info
*
gl_info
=
context_gl
->
gl_info
;
...
@@ -757,22 +757,18 @@ static void wined3d_buffer_drop_bo(struct wined3d_buffer *buffer)
...
@@ -757,22 +757,18 @@ static void wined3d_buffer_drop_bo(struct wined3d_buffer *buffer)
buffer_unload
(
&
buffer
->
resource
);
buffer_unload
(
&
buffer
->
resource
);
}
}
static
void
wined3d_buffer_
gl_
destroy_object
(
void
*
object
)
static
void
wined3d_buffer_destroy_object
(
void
*
object
)
{
{
struct
wined3d_buffer_gl
*
buffer_gl
=
object
;
struct
wined3d_buffer
*
buffer
=
object
;
struct
wined3d_context
*
context
;
if
(
buffer_gl
->
buffer_object
)
heap_free
(
buffer
->
conversion_map
);
{
heap_free
(
buffer
->
maps
);
context
=
context_acquire
(
buffer_gl
->
b
.
resource
.
device
,
NULL
,
0
);
}
wined3d_buffer_gl_destroy_buffer_object
(
buffer_gl
,
wined3d_context_gl
(
context
));
context_release
(
context
);
heap_free
(
buffer_gl
->
b
.
conversion_map
);
}
heap_free
(
buffer_gl
->
b
.
maps
);
void
wined3d_buffer_cleanup
(
struct
wined3d_buffer
*
buffer
)
heap_free
(
buffer_gl
);
{
resource_cleanup
(
&
buffer
->
resource
);
wined3d_cs_destroy_object
(
buffer
->
resource
.
device
->
cs
,
wined3d_buffer_destroy_object
,
buffer
);
}
}
ULONG
CDECL
wined3d_buffer_decref
(
struct
wined3d_buffer
*
buffer
)
ULONG
CDECL
wined3d_buffer_decref
(
struct
wined3d_buffer
*
buffer
)
...
@@ -784,9 +780,7 @@ ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
...
@@ -784,9 +780,7 @@ ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
if
(
!
refcount
)
if
(
!
refcount
)
{
{
buffer
->
resource
.
parent_ops
->
wined3d_object_destroyed
(
buffer
->
resource
.
parent
);
buffer
->
resource
.
parent_ops
->
wined3d_object_destroyed
(
buffer
->
resource
.
parent
);
resource_cleanup
(
&
buffer
->
resource
);
buffer
->
resource
.
device
->
adapter
->
adapter_ops
->
adapter_destroy_buffer
(
buffer
);
wined3d_cs_destroy_object
(
buffer
->
resource
.
device
->
cs
,
wined3d_buffer_gl_destroy_object
,
wined3d_buffer_gl
(
buffer
));
}
}
return
refcount
;
return
refcount
;
...
@@ -1353,6 +1347,11 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d
...
@@ -1353,6 +1347,11 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d
BOOL
dynamic_buffer_ok
;
BOOL
dynamic_buffer_ok
;
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"buffer %p, device %p, desc byte_width %u, usage %s, bind_flags %s, "
"access %s, data %p, parent %p, parent_ops %p.
\n
"
,
buffer
,
device
,
desc
->
byte_width
,
debug_d3dusage
(
desc
->
usage
),
wined3d_debug_bind_flags
(
desc
->
bind_flags
),
wined3d_debug_resource_access
(
desc
->
access
),
data
,
parent
,
parent_ops
);
if
(
!
desc
->
byte_width
)
if
(
!
desc
->
byte_width
)
{
{
WARN
(
"Size 0 requested, returning E_INVALIDARG.
\n
"
);
WARN
(
"Size 0 requested, returning E_INVALIDARG.
\n
"
);
...
@@ -1382,9 +1381,8 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d
...
@@ -1382,9 +1381,8 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d
buffer
->
structure_byte_stride
=
desc
->
structure_byte_stride
;
buffer
->
structure_byte_stride
=
desc
->
structure_byte_stride
;
buffer
->
locations
=
data
?
WINED3D_LOCATION_DISCARDED
:
WINED3D_LOCATION_SYSMEM
;
buffer
->
locations
=
data
?
WINED3D_LOCATION_DISCARDED
:
WINED3D_LOCATION_SYSMEM
;
TRACE
(
"buffer %p, size %#x, usage %#x, format %s, memory @ %p.
\n
"
,
TRACE
(
"buffer %p, size %#x, usage %#x, memory @ %p.
\n
"
,
buffer
,
buffer
->
resource
.
size
,
buffer
->
resource
.
usage
,
buffer
,
buffer
->
resource
.
size
,
buffer
->
resource
.
usage
,
buffer
->
resource
.
heap_memory
);
debug_d3dformat
(
buffer
->
resource
.
format
->
id
),
buffer
->
resource
.
heap_memory
);
if
(
device
->
create_parms
.
flags
&
WINED3DCREATE_SOFTWARE_VERTEXPROCESSING
if
(
device
->
create_parms
.
flags
&
WINED3DCREATE_SOFTWARE_VERTEXPROCESSING
||
wined3d_resource_access_is_managed
(
desc
->
access
))
||
wined3d_resource_access_is_managed
(
desc
->
access
))
...
@@ -1441,6 +1439,34 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d
...
@@ -1441,6 +1439,34 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d
return
WINED3D_OK
;
return
WINED3D_OK
;
}
}
static
void
wined3d_buffer_no3d_upload_ranges
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
const
void
*
data
,
unsigned
int
data_offset
,
unsigned
int
range_count
,
const
struct
wined3d_map_range
*
ranges
)
{
FIXME
(
"Not implemented.
\n
"
);
}
static
void
wined3d_buffer_no3d_download_ranges
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
void
*
data
,
unsigned
int
data_offset
,
unsigned
int
range_count
,
const
struct
wined3d_map_range
*
ranges
)
{
FIXME
(
"Not implemented.
\n
"
);
}
static
const
struct
wined3d_buffer_ops
wined3d_buffer_no3d_ops
=
{
wined3d_buffer_no3d_upload_ranges
,
wined3d_buffer_no3d_download_ranges
,
};
HRESULT
wined3d_buffer_no3d_init
(
struct
wined3d_buffer
*
buffer_no3d
,
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
TRACE
(
"buffer_no3d %p, device %p, desc %p, data %p, parent %p, parent_ops %p.
\n
"
,
buffer_no3d
,
device
,
desc
,
data
,
parent
,
parent_ops
);
return
wined3d_buffer_init
(
buffer_no3d
,
device
,
desc
,
data
,
parent
,
parent_ops
,
&
wined3d_buffer_no3d_ops
);
}
/* Context activation is done by the caller. */
/* Context activation is done by the caller. */
static
void
wined3d_buffer_gl_upload_ranges
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
static
void
wined3d_buffer_gl_upload_ranges
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
const
void
*
data
,
unsigned
int
data_offset
,
unsigned
int
range_count
,
const
struct
wined3d_map_range
*
ranges
)
const
void
*
data
,
unsigned
int
data_offset
,
unsigned
int
range_count
,
const
struct
wined3d_map_range
*
ranges
)
...
@@ -1487,35 +1513,54 @@ static const struct wined3d_buffer_ops wined3d_buffer_gl_ops =
...
@@ -1487,35 +1513,54 @@ static const struct wined3d_buffer_ops wined3d_buffer_gl_ops =
wined3d_buffer_gl_download_ranges
,
wined3d_buffer_gl_download_ranges
,
};
};
HRESULT
CDECL
wined3d_buffer_create
(
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
HRESULT
wined3d_buffer_gl_init
(
struct
wined3d_buffer_gl
*
buffer_gl
,
struct
wined3d_device
*
device
,
const
struct
wined3d_
sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
const
struct
wined3d_
buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
struct
wined3d_buffer
**
buffer
)
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
{
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
struct
wined3d_buffer_gl
*
object
;
HRESULT
hr
;
TRACE
(
"device %p, desc byte_width %u, usage %s, bind_flags %s, access %s, data %p, parent %p, "
TRACE
(
"buffer_gl %p, device %p, desc %p, data %p, parent %p, parent_ops %p.
\n
"
,
"parent_ops %p, buffer %p.
\n
"
,
buffer_gl
,
device
,
desc
,
data
,
parent
,
parent_ops
);
device
,
desc
->
byte_width
,
debug_d3dusage
(
desc
->
usage
),
wined3d_debug_bind_flags
(
desc
->
bind_flags
),
wined3d_debug_resource_access
(
desc
->
access
),
data
,
parent
,
parent_ops
,
buffer
);
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
buffer_gl
->
buffer_type_hint
=
buffer_type_hint_from_bind_flags
(
gl_info
,
desc
->
bind_flags
);
return
E_OUTOFMEMORY
;
object
->
buffer_type_hint
=
buffer_type_hint_from_bind_flags
(
gl_info
,
desc
->
bind_flags
);
return
wined3d_buffer_init
(
&
buffer_gl
->
b
,
device
,
desc
,
data
,
parent
,
parent_ops
,
&
wined3d_buffer_gl_ops
);
}
if
(
FAILED
(
hr
=
wined3d_buffer_init
(
&
object
->
b
,
device
,
desc
,
data
,
parent
,
parent_ops
,
&
wined3d_buffer_gl_ops
)))
static
void
wined3d_buffer_vk_upload_ranges
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
{
const
void
*
data
,
unsigned
int
data_offset
,
unsigned
int
range_count
,
const
struct
wined3d_map_range
*
ranges
)
WARN
(
"Failed to initialize buffer, hr %#x.
\n
"
,
hr
);
{
heap_free
(
object
);
FIXME
(
"Not implemented.
\n
"
);
return
hr
;
}
}
TRACE
(
"Created buffer %p.
\n
"
,
object
);
static
void
wined3d_buffer_vk_download_ranges
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
void
*
data
,
unsigned
int
data_offset
,
unsigned
int
range_count
,
const
struct
wined3d_map_range
*
ranges
)
{
FIXME
(
"Not implemented.
\n
"
);
}
*
buffer
=
&
object
->
b
;
static
const
struct
wined3d_buffer_ops
wined3d_buffer_vk_ops
=
{
wined3d_buffer_vk_upload_ranges
,
wined3d_buffer_vk_download_ranges
,
};
return
WINED3D_OK
;
HRESULT
wined3d_buffer_vk_init
(
struct
wined3d_buffer_vk
*
buffer_vk
,
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
TRACE
(
"buffer_vk %p, device %p, desc %p, data %p, parent %p, parent_ops %p.
\n
"
,
buffer_vk
,
device
,
desc
,
data
,
parent
,
parent_ops
);
return
wined3d_buffer_init
(
&
buffer_vk
->
b
,
device
,
desc
,
data
,
parent
,
parent_ops
,
&
wined3d_buffer_vk_ops
);
}
HRESULT
CDECL
wined3d_buffer_create
(
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_buffer
**
buffer
)
{
TRACE
(
"device %p, desc %p, data %p, parent %p, parent_ops %p, buffer %p.
\n
"
,
device
,
desc
,
data
,
parent
,
parent_ops
,
buffer
);
return
device
->
adapter
->
adapter_ops
->
adapter_create_buffer
(
device
,
desc
,
data
,
parent
,
parent_ops
,
buffer
);
}
}
dlls/wined3d/directx.c
View file @
5b3f89ae
...
@@ -2385,6 +2385,51 @@ static void adapter_no3d_destroy_swapchain(struct wined3d_swapchain *swapchain)
...
@@ -2385,6 +2385,51 @@ static void adapter_no3d_destroy_swapchain(struct wined3d_swapchain *swapchain)
heap_free
(
swapchain
);
heap_free
(
swapchain
);
}
}
static
HRESULT
adapter_no3d_create_buffer
(
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_buffer
**
buffer
)
{
struct
wined3d_buffer
*
buffer_no3d
;
HRESULT
hr
;
TRACE
(
"device %p, desc %p, data %p, parent %p, parent_ops %p, buffer %p.
\n
"
,
device
,
desc
,
data
,
parent
,
parent_ops
,
buffer
);
if
(
!
(
buffer_no3d
=
heap_alloc_zero
(
sizeof
(
*
buffer_no3d
))))
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
wined3d_buffer_no3d_init
(
buffer_no3d
,
device
,
desc
,
data
,
parent
,
parent_ops
)))
{
WARN
(
"Failed to initialise buffer, hr %#x.
\n
"
,
hr
);
heap_free
(
buffer_no3d
);
return
hr
;
}
TRACE
(
"Created buffer %p.
\n
"
,
buffer_no3d
);
*
buffer
=
buffer_no3d
;
return
hr
;
}
static
void
adapter_no3d_destroy_buffer
(
struct
wined3d_buffer
*
buffer
)
{
struct
wined3d_device
*
device
=
buffer
->
resource
.
device
;
unsigned
int
swapchain_count
=
device
->
swapchain_count
;
TRACE
(
"buffer %p.
\n
"
,
buffer
);
/* Take a reference to the device, in case releasing the buffer would
* cause the device to be destroyed. However, swapchain resources don't
* take a reference to the device, and we wouldn't want to increment the
* refcount on a device that's in the process of being destroyed. */
if
(
swapchain_count
)
wined3d_device_incref
(
device
);
wined3d_buffer_cleanup
(
buffer
);
wined3d_cs_destroy_object
(
device
->
cs
,
heap_free
,
buffer
);
if
(
swapchain_count
)
wined3d_device_decref
(
device
);
}
static
const
struct
wined3d_adapter_ops
wined3d_adapter_no3d_ops
=
static
const
struct
wined3d_adapter_ops
wined3d_adapter_no3d_ops
=
{
{
adapter_no3d_destroy
,
adapter_no3d_destroy
,
...
@@ -2398,6 +2443,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops =
...
@@ -2398,6 +2443,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops =
adapter_no3d_uninit_3d
,
adapter_no3d_uninit_3d
,
adapter_no3d_create_swapchain
,
adapter_no3d_create_swapchain
,
adapter_no3d_destroy_swapchain
,
adapter_no3d_destroy_swapchain
,
adapter_no3d_create_buffer
,
adapter_no3d_destroy_buffer
,
};
};
static
void
wined3d_adapter_no3d_init_d3d_info
(
struct
wined3d_adapter
*
adapter
,
unsigned
int
wined3d_creation_flags
)
static
void
wined3d_adapter_no3d_init_d3d_info
(
struct
wined3d_adapter
*
adapter
,
unsigned
int
wined3d_creation_flags
)
...
...
dlls/wined3d/wined3d_private.h
View file @
5b3f89ae
...
@@ -2784,6 +2784,10 @@ struct wined3d_adapter_ops
...
@@ -2784,6 +2784,10 @@ struct wined3d_adapter_ops
HRESULT
(
*
adapter_create_swapchain
)(
struct
wined3d_device
*
device
,
struct
wined3d_swapchain_desc
*
desc
,
HRESULT
(
*
adapter_create_swapchain
)(
struct
wined3d_device
*
device
,
struct
wined3d_swapchain_desc
*
desc
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_swapchain
**
swapchain
);
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_swapchain
**
swapchain
);
void
(
*
adapter_destroy_swapchain
)(
struct
wined3d_swapchain
*
swapchain
);
void
(
*
adapter_destroy_swapchain
)(
struct
wined3d_swapchain
*
swapchain
);
HRESULT
(
*
adapter_create_buffer
)(
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_buffer
**
buffer
);
void
(
*
adapter_destroy_buffer
)(
struct
wined3d_buffer
*
buffer
);
};
};
/* The adapter structure */
/* The adapter structure */
...
@@ -4078,6 +4082,7 @@ static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resourc
...
@@ -4078,6 +4082,7 @@ static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resourc
return
CONTAINING_RECORD
(
resource
,
struct
wined3d_buffer
,
resource
);
return
CONTAINING_RECORD
(
resource
,
struct
wined3d_buffer
,
resource
);
}
}
void
wined3d_buffer_cleanup
(
struct
wined3d_buffer
*
buffer
)
DECLSPEC_HIDDEN
;
DWORD
wined3d_buffer_get_memory
(
struct
wined3d_buffer
*
buffer
,
DWORD
wined3d_buffer_get_memory
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_bo_address
*
data
,
DWORD
locations
)
DECLSPEC_HIDDEN
;
struct
wined3d_bo_address
*
data
,
DWORD
locations
)
DECLSPEC_HIDDEN
;
void
wined3d_buffer_invalidate_location
(
struct
wined3d_buffer
*
buffer
,
DWORD
location
)
DECLSPEC_HIDDEN
;
void
wined3d_buffer_invalidate_location
(
struct
wined3d_buffer
*
buffer
,
DWORD
location
)
DECLSPEC_HIDDEN
;
...
@@ -4091,6 +4096,10 @@ void wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_off
...
@@ -4091,6 +4096,10 @@ void wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_off
void
wined3d_buffer_upload_data
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
void
wined3d_buffer_upload_data
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
const
struct
wined3d_box
*
box
,
const
void
*
data
)
DECLSPEC_HIDDEN
;
const
struct
wined3d_box
*
box
,
const
void
*
data
)
DECLSPEC_HIDDEN
;
HRESULT
wined3d_buffer_no3d_init
(
struct
wined3d_buffer
*
buffer_no3d
,
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
DECLSPEC_HIDDEN
;
struct
wined3d_buffer_gl
struct
wined3d_buffer_gl
{
{
struct
wined3d_buffer
b
;
struct
wined3d_buffer
b
;
...
@@ -4105,6 +4114,26 @@ static inline struct wined3d_buffer_gl *wined3d_buffer_gl(struct wined3d_buffer
...
@@ -4105,6 +4114,26 @@ static inline struct wined3d_buffer_gl *wined3d_buffer_gl(struct wined3d_buffer
return
CONTAINING_RECORD
(
buffer
,
struct
wined3d_buffer_gl
,
b
);
return
CONTAINING_RECORD
(
buffer
,
struct
wined3d_buffer_gl
,
b
);
}
}
void
wined3d_buffer_gl_destroy_buffer_object
(
struct
wined3d_buffer_gl
*
buffer_gl
,
struct
wined3d_context_gl
*
context_gl
)
DECLSPEC_HIDDEN
;
HRESULT
wined3d_buffer_gl_init
(
struct
wined3d_buffer_gl
*
buffer_gl
,
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
DECLSPEC_HIDDEN
;
struct
wined3d_buffer_vk
{
struct
wined3d_buffer
b
;
};
static
inline
struct
wined3d_buffer_vk
*
wined3d_buffer_vk
(
struct
wined3d_buffer
*
buffer
)
{
return
CONTAINING_RECORD
(
buffer
,
struct
wined3d_buffer_vk
,
b
);
}
HRESULT
wined3d_buffer_vk_init
(
struct
wined3d_buffer_vk
*
buffer_vk
,
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
DECLSPEC_HIDDEN
;
struct
wined3d_rendertarget_view
struct
wined3d_rendertarget_view
{
{
LONG
refcount
;
LONG
refcount
;
...
...
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