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
fd29561e
Commit
fd29561e
authored
Jun 11, 2019
by
Henri Verbeet
Committed by
Alexandre Julliard
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Pass a wined3d_context_gl structure to context_map_bo_address().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6ffc6cd5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
20 deletions
+42
-20
context.c
dlls/wined3d/context.c
+4
-5
surface.c
dlls/wined3d/surface.c
+22
-9
texture.c
dlls/wined3d/texture.c
+14
-4
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-2
No files found.
dlls/wined3d/context.c
View file @
fd29561e
...
...
@@ -2589,17 +2589,16 @@ void wined3d_context_gl_bind_texture(struct wined3d_context_gl *context_gl, GLen
checkGLcall
(
"bind texture"
);
}
void
*
context_map_bo_address
(
struct
wined3d_context
*
context
,
void
*
wined3d_context_gl_map_bo_address
(
struct
wined3d_context_gl
*
context_gl
,
const
struct
wined3d_bo_address
*
data
,
size_t
size
,
GLenum
binding
,
DWORD
flags
)
{
struct
wined3d_context_gl
*
context_gl
=
wined3d_context_gl
(
context
);
const
struct
wined3d_gl_info
*
gl_info
;
BYTE
*
memory
;
if
(
!
data
->
buffer_object
)
return
data
->
addr
;
gl_info
=
context
->
gl_info
;
gl_info
=
context
_gl
->
c
.
gl_info
;
wined3d_context_gl_bind_bo
(
context_gl
,
binding
,
data
->
buffer_object
);
if
(
gl_info
->
supported
[
ARB_MAP_BUFFER_RANGE
])
...
...
@@ -2656,8 +2655,8 @@ void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
}
else
{
src_ptr
=
context_map_bo_address
(
&
context_gl
->
c
,
src
,
size
,
src_binding
,
WINED3D_MAP_READ
);
dst_ptr
=
context_map_bo_address
(
&
context_gl
->
c
,
dst
,
size
,
dst_binding
,
WINED3D_MAP_WRITE
);
src_ptr
=
wined3d_context_gl_map_bo_address
(
context_gl
,
src
,
size
,
src_binding
,
WINED3D_MAP_READ
);
dst_ptr
=
wined3d_context_gl_map_bo_address
(
context_gl
,
dst
,
size
,
dst_binding
,
WINED3D_MAP_WRITE
);
memcpy
(
dst_ptr
,
src_ptr
,
size
);
...
...
dlls/wined3d/surface.c
View file @
fd29561e
...
...
@@ -614,6 +614,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
const
struct
wined3d_format
*
src_format
=
src_texture
->
resource
.
format
;
struct
wined3d_device
*
device
=
src_texture
->
resource
.
device
;
const
struct
d3dfmt_converter_desc
*
conv
=
NULL
;
struct
wined3d_context_gl
*
context_gl
=
NULL
;
unsigned
int
src_row_pitch
,
src_slice_pitch
;
struct
wined3d_context
*
context
=
NULL
;
struct
wined3d_texture
*
dst_texture
;
...
...
@@ -651,7 +652,10 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
}
if
(
device
->
d3d_initialized
)
{
context
=
context_acquire
(
device
,
NULL
,
0
);
context_gl
=
wined3d_context_gl
(
context
);
}
map_binding
=
src_texture
->
resource
.
map_binding
;
if
(
!
wined3d_texture_load_location
(
src_texture
,
sub_resource_idx
,
context
,
map_binding
))
...
...
@@ -672,10 +676,10 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
wined3d_texture_get_pitch
(
dst_texture
,
0
,
&
dst_row_pitch
,
&
dst_slice_pitch
);
wined3d_texture_get_memory
(
dst_texture
,
0
,
&
dst_data
,
map_binding
);
src
=
context_map_bo_address
(
context
,
&
src_data
,
src
=
wined3d_context_gl_map_bo_address
(
context_gl
,
&
src_data
,
src_texture
->
sub_resources
[
sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
);
dst
=
context_map_bo_address
(
context
,
&
dst_data
,
dst_texture
->
sub_resources
[
0
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_WRITE
);
dst
=
wined3d_context_gl_map_bo_address
(
context_gl
,
&
dst_data
,
dst_texture
->
sub_resources
[
0
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_WRITE
);
conv
->
convert
(
src
,
dst
,
src_row_pitch
,
dst_row_pitch
,
desc
.
width
,
desc
.
height
);
...
...
@@ -1525,6 +1529,7 @@ BOOL texture2d_load_texture(struct wined3d_texture *texture, unsigned int sub_re
struct
wined3d_context
*
context
,
BOOL
srgb
)
{
unsigned
int
width
,
height
,
level
,
src_row_pitch
,
src_slice_pitch
,
dst_row_pitch
,
dst_slice_pitch
;
struct
wined3d_context_gl
*
context_gl
=
wined3d_context_gl
(
context
);
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
struct
wined3d_device
*
device
=
texture
->
resource
.
device
;
const
struct
wined3d_color_key_conversion
*
conversion
;
...
...
@@ -1643,8 +1648,8 @@ BOOL texture2d_load_texture(struct wined3d_texture *texture, unsigned int sub_re
wined3d_format_calculate_pitch
(
format
,
device
->
surface_alignment
,
width
,
height
,
&
dst_row_pitch
,
&
dst_slice_pitch
);
src_mem
=
context_map_bo_address
(
context
,
&
data
,
src_slice_pitch
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
);
src_mem
=
wined3d_context_gl_map_bo_address
(
context_gl
,
&
data
,
src_slice_pitch
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
);
if
(
!
(
dst_mem
=
heap_alloc
(
dst_slice_pitch
)))
{
ERR
(
"Out of memory (%u).
\n
"
,
dst_slice_pitch
);
...
...
@@ -2468,6 +2473,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
const
struct
wined3d_format
*
src_format
,
*
dst_format
;
struct
wined3d_texture
*
converted_texture
=
NULL
;
struct
wined3d_bo_address
src_data
,
dst_data
;
struct
wined3d_context_gl
*
context_gl
=
NULL
;
unsigned
int
src_fmt_flags
,
dst_fmt_flags
;
struct
wined3d_map_desc
dst_map
,
src_map
;
struct
wined3d_context
*
context
=
NULL
;
...
...
@@ -2486,7 +2492,10 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
src_sub_resource_idx
,
debug_box
(
src_box
),
flags
,
fx
,
debug_d3dtexturefiltertype
(
filter
));
if
(
device
->
d3d_initialized
)
{
context
=
context_acquire
(
device
,
NULL
,
0
);
context_gl
=
wined3d_context_gl
(
context
);
}
if
(
src_texture
==
dst_texture
&&
src_sub_resource_idx
==
dst_sub_resource_idx
)
{
...
...
@@ -2499,7 +2508,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
wined3d_texture_invalidate_location
(
dst_texture
,
dst_sub_resource_idx
,
~
map_binding
);
wined3d_texture_get_pitch
(
dst_texture
,
texture_level
,
&
dst_map
.
row_pitch
,
&
dst_map
.
slice_pitch
);
wined3d_texture_get_memory
(
dst_texture
,
dst_sub_resource_idx
,
&
dst_data
,
map_binding
);
dst_map
.
data
=
context_map_bo_address
(
context
,
&
dst_data
,
dst_map
.
data
=
wined3d_context_gl_map_bo_address
(
context_gl
,
&
dst_data
,
dst_texture
->
sub_resources
[
dst_sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
);
...
...
@@ -2536,7 +2545,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
ERR
(
"Failed to load the source sub-resource into %s.
\n
"
,
wined3d_debug_location
(
map_binding
));
wined3d_texture_get_pitch
(
src_texture
,
texture_level
,
&
src_map
.
row_pitch
,
&
src_map
.
slice_pitch
);
wined3d_texture_get_memory
(
src_texture
,
src_sub_resource_idx
,
&
src_data
,
map_binding
);
src_map
.
data
=
context_map_bo_address
(
context
,
&
src_data
,
src_map
.
data
=
wined3d_context_gl_map_bo_address
(
context_gl
,
&
src_data
,
src_texture
->
sub_resources
[
src_sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
);
map_binding
=
dst_texture
->
resource
.
map_binding
;
...
...
@@ -2546,7 +2555,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
wined3d_texture_invalidate_location
(
dst_texture
,
dst_sub_resource_idx
,
~
map_binding
);
wined3d_texture_get_pitch
(
dst_texture
,
texture_level
,
&
dst_map
.
row_pitch
,
&
dst_map
.
slice_pitch
);
wined3d_texture_get_memory
(
dst_texture
,
dst_sub_resource_idx
,
&
dst_data
,
map_binding
);
dst_map
.
data
=
context_map_bo_address
(
context
,
&
dst_data
,
dst_map
.
data
=
wined3d_context_gl_map_bo_address
(
context_gl
,
&
dst_data
,
dst_texture
->
sub_resources
[
dst_sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_WRITE
);
}
flags
&=
~
WINED3D_BLT_RAW
;
...
...
@@ -2944,6 +2953,7 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
const
struct
wined3d_box
*
box
,
const
struct
wined3d_color
*
colour
)
{
struct
wined3d_device
*
device
=
view
->
resource
->
device
;
struct
wined3d_context_gl
*
context_gl
=
NULL
;
struct
wined3d_context
*
context
=
NULL
;
struct
wined3d_texture
*
texture
;
struct
wined3d_bo_address
data
;
...
...
@@ -2972,7 +2982,10 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
}
if
(
device
->
d3d_initialized
)
{
context
=
context_acquire
(
device
,
NULL
,
0
);
context_gl
=
wined3d_context_gl
(
context
);
}
c
=
wined3d_format_convert_from_float
(
view
->
format
,
colour
);
bpp
=
view
->
format
->
byte_count
;
...
...
@@ -2987,7 +3000,7 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
wined3d_texture_get_pitch
(
texture
,
view
->
sub_resource_idx
%
texture
->
level_count
,
&
map
.
row_pitch
,
&
map
.
slice_pitch
);
wined3d_texture_get_memory
(
texture
,
view
->
sub_resource_idx
,
&
data
,
map_binding
);
map
.
data
=
context_map_bo_address
(
context
,
&
data
,
map
.
data
=
wined3d_context_gl_map_bo_address
(
context_gl
,
&
data
,
texture
->
sub_resources
[
view
->
sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_WRITE
);
map
.
data
=
(
BYTE
*
)
map
.
data
+
(
box
->
front
*
map
.
slice_pitch
)
...
...
dlls/wined3d/texture.c
View file @
fd29561e
...
...
@@ -695,6 +695,7 @@ static void wined3d_texture_sub_resources_destroyed(struct wined3d_texture *text
static
void
wined3d_texture_create_dc
(
void
*
object
)
{
const
struct
wined3d_texture_idx
*
idx
=
object
;
struct
wined3d_context_gl
*
context_gl
=
NULL
;
struct
wined3d_context
*
context
=
NULL
;
unsigned
int
sub_resource_idx
,
level
;
const
struct
wined3d_format
*
format
;
...
...
@@ -732,13 +733,16 @@ static void wined3d_texture_create_dc(void *object)
}
if
(
device
->
d3d_initialized
)
{
context
=
context_acquire
(
device
,
NULL
,
0
);
context_gl
=
wined3d_context_gl
(
context
);
}
wined3d_texture_load_location
(
texture
,
sub_resource_idx
,
context
,
texture
->
resource
.
map_binding
);
wined3d_texture_invalidate_location
(
texture
,
sub_resource_idx
,
~
texture
->
resource
.
map_binding
);
wined3d_texture_get_pitch
(
texture
,
level
,
&
row_pitch
,
&
slice_pitch
);
wined3d_texture_get_memory
(
texture
,
sub_resource_idx
,
&
data
,
texture
->
resource
.
map_binding
);
desc
.
pMemory
=
context_map_bo_address
(
context
,
&
data
,
desc
.
pMemory
=
wined3d_context_gl_map_bo_address
(
context_gl
,
&
data
,
texture
->
sub_resources
[
sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
);
...
...
@@ -1903,6 +1907,7 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
const
struct
wined3d_const_bo_address
*
data
,
unsigned
int
src_row_pitch
,
unsigned
int
src_slice_pitch
,
unsigned
int
dst_x
,
unsigned
int
dst_y
,
unsigned
int
dst_z
,
BOOL
srgb
)
{
struct
wined3d_context_gl
*
context_gl
=
wined3d_context_gl
(
context
);
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
unsigned
int
update_w
=
src_box
->
right
-
src_box
->
left
;
unsigned
int
update_h
=
src_box
->
bottom
-
src_box
->
top
;
...
...
@@ -1995,8 +2000,8 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
return
;
}
src_mem
=
context_map_bo_address
(
context
,
&
bo
,
src_slice_pitch
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
);
src_mem
=
wined3d_context_gl_map_bo_address
(
context_gl
,
&
bo
,
src_slice_pitch
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
);
if
(
decompress
)
compressed_format
->
decompress
(
src_mem
,
converted_mem
,
src_row_pitch
,
src_slice_pitch
,
dst_row_pitch
,
dst_slice_pitch
,
update_w
,
update_h
,
update_d
);
...
...
@@ -2577,6 +2582,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
struct
wined3d_texture_sub_resource
*
sub_resource
;
struct
wined3d_device
*
device
=
resource
->
device
;
unsigned
int
fmt_flags
=
resource
->
format_flags
;
struct
wined3d_context_gl
*
context_gl
=
NULL
;
struct
wined3d_context
*
context
=
NULL
;
struct
wined3d_texture
*
texture
;
struct
wined3d_bo_address
data
;
...
...
@@ -2613,7 +2619,10 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
}
if
(
device
->
d3d_initialized
)
{
context
=
context_acquire
(
device
,
NULL
,
0
);
context_gl
=
wined3d_context_gl
(
context
);
}
if
(
flags
&
WINED3D_MAP_DISCARD
)
{
...
...
@@ -2641,7 +2650,8 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
wined3d_texture_invalidate_location
(
texture
,
sub_resource_idx
,
~
resource
->
map_binding
);
wined3d_texture_get_memory
(
texture
,
sub_resource_idx
,
&
data
,
resource
->
map_binding
);
base_memory
=
context_map_bo_address
(
context
,
&
data
,
sub_resource
->
size
,
GL_PIXEL_UNPACK_BUFFER
,
flags
);
base_memory
=
wined3d_context_gl_map_bo_address
(
context_gl
,
&
data
,
sub_resource
->
size
,
GL_PIXEL_UNPACK_BUFFER
,
flags
);
TRACE
(
"Base memory pointer %p.
\n
"
,
base_memory
);
if
(
context
)
...
...
dlls/wined3d/wined3d_private.h
View file @
fd29561e
...
...
@@ -2104,6 +2104,8 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl,
struct
wined3d_swapchain
*
swapchain
)
DECLSPEC_HIDDEN
;
void
wined3d_context_gl_load_tex_coords
(
const
struct
wined3d_context_gl
*
context_gl
,
const
struct
wined3d_stream_info
*
si
,
GLuint
*
current_bo
,
const
struct
wined3d_state
*
state
)
DECLSPEC_HIDDEN
;
void
*
wined3d_context_gl_map_bo_address
(
struct
wined3d_context_gl
*
context_gl
,
const
struct
wined3d_bo_address
*
data
,
size_t
size
,
GLenum
binding
,
DWORD
flags
)
DECLSPEC_HIDDEN
;
struct
wined3d_context_gl
*
wined3d_context_gl_reacquire
(
struct
wined3d_context_gl
*
context_gl
)
DECLSPEC_HIDDEN
;
void
wined3d_context_gl_release
(
struct
wined3d_context_gl
*
context_gl
)
DECLSPEC_HIDDEN
;
void
wined3d_context_gl_set_draw_buffer
(
struct
wined3d_context_gl
*
context_gl
,
GLenum
buffer
)
DECLSPEC_HIDDEN
;
...
...
@@ -2257,8 +2259,6 @@ void context_gl_resource_released(struct wined3d_device *device,
GLuint
name
,
BOOL
rb_namespace
)
DECLSPEC_HIDDEN
;
void
context_invalidate_compute_state
(
struct
wined3d_context
*
context
,
DWORD
state_id
)
DECLSPEC_HIDDEN
;
void
context_invalidate_state
(
struct
wined3d_context
*
context
,
DWORD
state_id
)
DECLSPEC_HIDDEN
;
void
*
context_map_bo_address
(
struct
wined3d_context
*
context
,
const
struct
wined3d_bo_address
*
data
,
size_t
size
,
GLenum
binding
,
DWORD
flags
)
DECLSPEC_HIDDEN
;
void
context_resource_released
(
const
struct
wined3d_device
*
device
,
struct
wined3d_resource
*
resource
)
DECLSPEC_HIDDEN
;
void
context_restore
(
struct
wined3d_context
*
context
,
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
)
DECLSPEC_HIDDEN
;
...
...
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