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
75ee0aa9
Commit
75ee0aa9
authored
Aug 16, 2019
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce wined3d_texture_ops.texture_prepare_location().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6462ba52
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
50 deletions
+99
-50
texture.c
dlls/wined3d/texture.c
+96
-49
wined3d_private.h
dlls/wined3d/wined3d_private.h
+3
-1
No files found.
dlls/wined3d/texture.c
View file @
75ee0aa9
...
...
@@ -1795,53 +1795,10 @@ static void wined3d_texture_gl_prepare_rb(struct wined3d_texture_gl *texture_gl,
}
}
/* Context activation is done by the caller. Context may be NULL in
* WINED3D_NO3D mode. */
BOOL
wined3d_texture_prepare_location
(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
struct
wined3d_context
*
context
,
DWORD
location
)
BOOL
wined3d_texture_prepare_location
(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
struct
wined3d_context
*
context
,
unsigned
int
location
)
{
struct
wined3d_texture_gl
*
texture_gl
=
wined3d_texture_gl
(
texture
);
struct
wined3d_context_gl
*
context_gl
=
wined3d_context_gl
(
context
);
switch
(
location
)
{
case
WINED3D_LOCATION_SYSMEM
:
return
wined3d_resource_prepare_sysmem
(
&
texture
->
resource
);
case
WINED3D_LOCATION_USER_MEMORY
:
if
(
!
texture
->
user_memory
)
ERR
(
"Map binding is set to WINED3D_LOCATION_USER_MEMORY but surface->user_memory is NULL.
\n
"
);
return
TRUE
;
case
WINED3D_LOCATION_BUFFER
:
wined3d_texture_prepare_buffer_object
(
texture
,
sub_resource_idx
,
context_gl
->
gl_info
);
return
TRUE
;
case
WINED3D_LOCATION_TEXTURE_RGB
:
wined3d_texture_gl_prepare_texture
(
texture_gl
,
context_gl
,
FALSE
);
return
TRUE
;
case
WINED3D_LOCATION_TEXTURE_SRGB
:
wined3d_texture_gl_prepare_texture
(
texture_gl
,
context_gl
,
TRUE
);
return
TRUE
;
case
WINED3D_LOCATION_DRAWABLE
:
if
(
!
texture
->
swapchain
&&
wined3d_settings
.
offscreen_rendering_mode
!=
ORM_BACKBUFFER
)
ERR
(
"Texture %p does not have a drawable.
\n
"
,
texture
);
return
TRUE
;
case
WINED3D_LOCATION_RB_MULTISAMPLE
:
wined3d_texture_gl_prepare_rb
(
texture_gl
,
context_gl
->
gl_info
,
TRUE
);
return
TRUE
;
case
WINED3D_LOCATION_RB_RESOLVED
:
wined3d_texture_gl_prepare_rb
(
texture_gl
,
context_gl
->
gl_info
,
FALSE
);
return
TRUE
;
default:
ERR
(
"Invalid location %s.
\n
"
,
wined3d_debug_location
(
location
));
return
FALSE
;
}
return
texture
->
texture_ops
->
texture_prepare_location
(
texture
,
sub_resource_idx
,
context
,
location
);
}
static
struct
wined3d_texture_sub_resource
*
wined3d_texture_get_sub_resource
(
struct
wined3d_texture
*
texture
,
...
...
@@ -2468,7 +2425,6 @@ static BOOL wined3d_texture_gl_load_sysmem(struct wined3d_texture_gl *texture_gl
struct
wined3d_texture_sub_resource
*
sub_resource
;
sub_resource
=
&
texture_gl
->
t
.
sub_resources
[
sub_resource_idx
];
wined3d_texture_prepare_location
(
&
texture_gl
->
t
,
sub_resource_idx
,
&
context_gl
->
c
,
dst_location
);
/* We cannot download data from multisample textures directly. */
if
(
wined3d_texture_gl_is_multisample_location
(
texture_gl
,
WINED3D_LOCATION_TEXTURE_RGB
))
...
...
@@ -2687,7 +2643,6 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
wined3d_texture_load_location
(
&
texture_gl
->
t
,
sub_resource_idx
,
&
context_gl
->
c
,
WINED3D_LOCATION_SYSMEM
);
}
wined3d_texture_gl_prepare_texture
(
texture_gl
,
context_gl
,
srgb
);
wined3d_texture_gl_bind_and_dirtify
(
texture_gl
,
context_gl
,
srgb
);
wined3d_texture_get_pitch
(
&
texture_gl
->
t
,
level
,
&
src_row_pitch
,
&
src_slice_pitch
);
...
...
@@ -2739,6 +2694,53 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
return
TRUE
;
}
static
BOOL
wined3d_texture_gl_prepare_location
(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
struct
wined3d_context
*
context
,
unsigned
int
location
)
{
struct
wined3d_texture_gl
*
texture_gl
=
wined3d_texture_gl
(
texture
);
struct
wined3d_context_gl
*
context_gl
=
wined3d_context_gl
(
context
);
switch
(
location
)
{
case
WINED3D_LOCATION_SYSMEM
:
return
wined3d_resource_prepare_sysmem
(
&
texture
->
resource
);
case
WINED3D_LOCATION_USER_MEMORY
:
if
(
!
texture
->
user_memory
)
ERR
(
"Preparing WINED3D_LOCATION_USER_MEMORY, but texture->user_memory is NULL.
\n
"
);
return
TRUE
;
case
WINED3D_LOCATION_BUFFER
:
wined3d_texture_prepare_buffer_object
(
texture
,
sub_resource_idx
,
context_gl
->
gl_info
);
return
TRUE
;
case
WINED3D_LOCATION_TEXTURE_RGB
:
wined3d_texture_gl_prepare_texture
(
texture_gl
,
context_gl
,
FALSE
);
return
TRUE
;
case
WINED3D_LOCATION_TEXTURE_SRGB
:
wined3d_texture_gl_prepare_texture
(
texture_gl
,
context_gl
,
TRUE
);
return
TRUE
;
case
WINED3D_LOCATION_DRAWABLE
:
if
(
!
texture
->
swapchain
&&
wined3d_settings
.
offscreen_rendering_mode
!=
ORM_BACKBUFFER
)
ERR
(
"Texture %p does not have a drawable.
\n
"
,
texture
);
return
TRUE
;
case
WINED3D_LOCATION_RB_MULTISAMPLE
:
wined3d_texture_gl_prepare_rb
(
texture_gl
,
context_gl
->
gl_info
,
TRUE
);
return
TRUE
;
case
WINED3D_LOCATION_RB_RESOLVED
:
wined3d_texture_gl_prepare_rb
(
texture_gl
,
context_gl
->
gl_info
,
FALSE
);
return
TRUE
;
default:
ERR
(
"Invalid location %s.
\n
"
,
wined3d_debug_location
(
location
));
return
FALSE
;
}
}
/* Context activation is done by the caller. */
static
BOOL
wined3d_texture_gl_load_location
(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
struct
wined3d_context
*
context
,
DWORD
location
)
...
...
@@ -2749,7 +2751,7 @@ static BOOL wined3d_texture_gl_load_location(struct wined3d_texture *texture,
TRACE
(
"texture %p, sub_resource_idx %u, context %p, location %s.
\n
"
,
texture
,
sub_resource_idx
,
context
,
wined3d_debug_location
(
location
));
if
(
!
wined3d_texture_prepare_location
(
texture
,
sub_resource_idx
,
context
,
location
))
if
(
!
wined3d_texture_
gl_
prepare_location
(
texture
,
sub_resource_idx
,
context
,
location
))
return
FALSE
;
switch
(
location
)
...
...
@@ -2809,6 +2811,7 @@ static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
static
const
struct
wined3d_texture_ops
texture_gl_ops
=
{
wined3d_texture_gl_prepare_location
,
wined3d_texture_gl_load_location
,
wined3d_texture_gl_upload_data
,
wined3d_texture_gl_download_data
,
...
...
@@ -3959,6 +3962,25 @@ static void wined3d_texture_no3d_download_data(struct wined3d_context *context,
FIXME
(
"Not implemented.
\n
"
);
}
static
BOOL
wined3d_texture_no3d_prepare_location
(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
struct
wined3d_context
*
context
,
unsigned
int
location
)
{
switch
(
location
)
{
case
WINED3D_LOCATION_SYSMEM
:
return
wined3d_resource_prepare_sysmem
(
&
texture
->
resource
);
case
WINED3D_LOCATION_USER_MEMORY
:
if
(
!
texture
->
user_memory
)
ERR
(
"Preparing WINED3D_LOCATION_USER_MEMORY, but texture->user_memory is NULL.
\n
"
);
return
TRUE
;
default:
FIXME
(
"Unhandled location %s.
\n
"
,
wined3d_debug_location
(
location
));
return
FALSE
;
}
}
static
BOOL
wined3d_texture_no3d_load_location
(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
struct
wined3d_context
*
context
,
DWORD
location
)
{
...
...
@@ -3975,6 +3997,7 @@ static BOOL wined3d_texture_no3d_load_location(struct wined3d_texture *texture,
static
const
struct
wined3d_texture_ops
wined3d_texture_no3d_ops
=
{
wined3d_texture_no3d_prepare_location
,
wined3d_texture_no3d_load_location
,
wined3d_texture_no3d_upload_data
,
wined3d_texture_no3d_download_data
,
...
...
@@ -4011,6 +4034,29 @@ static void wined3d_texture_vk_download_data(struct wined3d_context *context,
FIXME
(
"Not implemented.
\n
"
);
}
static
BOOL
wined3d_texture_vk_prepare_location
(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
struct
wined3d_context
*
context
,
unsigned
int
location
)
{
switch
(
location
)
{
case
WINED3D_LOCATION_SYSMEM
:
return
wined3d_resource_prepare_sysmem
(
&
texture
->
resource
);
case
WINED3D_LOCATION_USER_MEMORY
:
if
(
!
texture
->
user_memory
)
ERR
(
"Preparing WINED3D_LOCATION_USER_MEMORY, but texture->user_memory is NULL.
\n
"
);
return
TRUE
;
case
WINED3D_LOCATION_TEXTURE_RGB
:
/* The Vulkan image is created during resource creation. */
return
TRUE
;
default:
FIXME
(
"Unhandled location %s.
\n
"
,
wined3d_debug_location
(
location
));
return
FALSE
;
}
}
static
BOOL
wined3d_texture_vk_load_location
(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
struct
wined3d_context
*
context
,
DWORD
location
)
{
...
...
@@ -4021,6 +4067,7 @@ static BOOL wined3d_texture_vk_load_location(struct wined3d_texture *texture,
static
const
struct
wined3d_texture_ops
wined3d_texture_vk_ops
=
{
wined3d_texture_vk_prepare_location
,
wined3d_texture_vk_load_location
,
wined3d_texture_vk_upload_data
,
wined3d_texture_vk_download_data
,
...
...
dlls/wined3d/wined3d_private.h
View file @
75ee0aa9
...
...
@@ -3471,8 +3471,10 @@ struct wined3d_blt_info
struct
wined3d_texture_ops
{
BOOL
(
*
texture_prepare_location
)(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
struct
wined3d_context
*
context
,
unsigned
int
location
);
BOOL
(
*
texture_load_location
)(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
struct
wined3d_context
*
context
,
DWORD
location
);
struct
wined3d_context
*
context
,
unsigned
int
location
);
void
(
*
texture_upload_data
)(
struct
wined3d_context
*
context
,
const
struct
wined3d_const_bo_address
*
src_bo_addr
,
const
struct
wined3d_format
*
src_format
,
const
struct
wined3d_box
*
src_box
,
unsigned
int
src_row_pitch
,
unsigned
int
src_slice_pitch
,
struct
wined3d_texture
*
dst_texture
,
unsigned
int
dst_sub_resource_idx
,
...
...
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