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
87143e60
Commit
87143e60
authored
Mar 02, 2016
by
Stefan Dösinger
Committed by
Alexandre Julliard
Mar 03, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Merge surface_prepare_buffer() and wined3d_volume_prepare_pbo().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
45fa5b64
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
55 deletions
+32
-55
surface.c
dlls/wined3d/surface.c
+8
-36
texture.c
dlls/wined3d/texture.c
+21
-0
volume.c
dlls/wined3d/volume.c
+1
-19
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-0
No files found.
dlls/wined3d/surface.c
View file @
87143e60
...
...
@@ -489,40 +489,6 @@ static void surface_get_memory(const struct wined3d_surface *surface, struct win
data
->
buffer_object
=
0
;
}
static
void
surface_prepare_buffer
(
struct
wined3d_surface
*
surface
)
{
struct
wined3d_context
*
context
;
GLuint
*
buffer_object
;
GLenum
error
;
const
struct
wined3d_gl_info
*
gl_info
;
buffer_object
=
&
surface
->
container
->
sub_resources
[
surface_get_sub_resource_idx
(
surface
)].
buffer_object
;
if
(
*
buffer_object
)
return
;
context
=
context_acquire
(
surface
->
resource
.
device
,
NULL
);
gl_info
=
context
->
gl_info
;
GL_EXTCALL
(
glGenBuffers
(
1
,
buffer_object
));
error
=
gl_info
->
gl_ops
.
gl
.
p_glGetError
();
if
(
!*
buffer_object
||
error
!=
GL_NO_ERROR
)
ERR
(
"Failed to create a PBO with error %s (%#x).
\n
"
,
debug_glerror
(
error
),
error
);
TRACE
(
"Binding PBO %u.
\n
"
,
*
buffer_object
);
GL_EXTCALL
(
glBindBuffer
(
GL_PIXEL_UNPACK_BUFFER
,
*
buffer_object
));
checkGLcall
(
"glBindBuffer"
);
GL_EXTCALL
(
glBufferData
(
GL_PIXEL_UNPACK_BUFFER
,
surface
->
resource
.
size
+
4
,
NULL
,
GL_STREAM_DRAW
));
checkGLcall
(
"glBufferData"
);
GL_EXTCALL
(
glBindBuffer
(
GL_PIXEL_UNPACK_BUFFER
,
0
));
checkGLcall
(
"glBindBuffer"
);
context_release
(
context
);
}
static
void
surface_prepare_system_memory
(
struct
wined3d_surface
*
surface
)
{
TRACE
(
"surface %p.
\n
"
,
surface
);
...
...
@@ -541,6 +507,9 @@ static void surface_prepare_system_memory(struct wined3d_surface *surface)
void
surface_prepare_map_memory
(
struct
wined3d_surface
*
surface
)
{
struct
wined3d_texture
*
texture
=
surface
->
container
;
struct
wined3d_context
*
context
;
switch
(
surface
->
resource
.
map_binding
)
{
case
WINED3D_LOCATION_SYSMEM
:
...
...
@@ -548,7 +517,7 @@ void surface_prepare_map_memory(struct wined3d_surface *surface)
break
;
case
WINED3D_LOCATION_USER_MEMORY
:
if
(
!
surface
->
container
->
user_memory
)
if
(
!
texture
->
user_memory
)
ERR
(
"Map binding is set to WINED3D_LOCATION_USER_MEMORY but surface->user_memory is NULL.
\n
"
);
break
;
...
...
@@ -558,7 +527,10 @@ void surface_prepare_map_memory(struct wined3d_surface *surface)
break
;
case
WINED3D_LOCATION_BUFFER
:
surface_prepare_buffer
(
surface
);
context
=
context_acquire
(
texture
->
resource
.
device
,
NULL
);
wined3d_texture_prepare_buffer_object
(
texture
,
surface_get_sub_resource_idx
(
surface
),
context
->
gl_info
);
context_release
(
context
);
break
;
default:
...
...
dlls/wined3d/texture.c
View file @
87143e60
...
...
@@ -690,6 +690,27 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
return
wined3d_surface_update_desc
(
surface
,
gl_info
);
}
/* Context activation is done by the caller. */
void
wined3d_texture_prepare_buffer_object
(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
const
struct
wined3d_gl_info
*
gl_info
)
{
GLuint
*
buffer_object
;
buffer_object
=
&
texture
->
sub_resources
[
sub_resource_idx
].
buffer_object
;
if
(
*
buffer_object
)
return
;
GL_EXTCALL
(
glGenBuffers
(
1
,
buffer_object
));
GL_EXTCALL
(
glBindBuffer
(
GL_PIXEL_UNPACK_BUFFER
,
*
buffer_object
));
GL_EXTCALL
(
glBufferData
(
GL_PIXEL_UNPACK_BUFFER
,
texture
->
sub_resources
[
sub_resource_idx
].
resource
->
size
,
NULL
,
GL_STREAM_DRAW
));
GL_EXTCALL
(
glBindBuffer
(
GL_PIXEL_UNPACK_BUFFER
,
0
));
checkGLcall
(
"Create buffer object"
);
TRACE
(
"Created buffer object %u for texture %p, sub-resource %u.
\n
"
,
*
buffer_object
,
texture
,
sub_resource_idx
);
}
void
wined3d_texture_prepare_texture
(
struct
wined3d_texture
*
texture
,
struct
wined3d_context
*
context
,
BOOL
srgb
)
{
DWORD
alloc_flag
=
srgb
?
WINED3D_TEXTURE_SRGB_ALLOCATED
:
WINED3D_TEXTURE_RGB_ALLOCATED
;
...
...
dlls/wined3d/volume.c
View file @
87143e60
...
...
@@ -362,24 +362,6 @@ void wined3d_volume_load(struct wined3d_volume *volume, struct wined3d_context *
srgb_mode
?
WINED3D_LOCATION_TEXTURE_SRGB
:
WINED3D_LOCATION_TEXTURE_RGB
);
}
/* Context activation is done by the caller. */
static
void
wined3d_volume_prepare_pbo
(
struct
wined3d_volume
*
volume
,
struct
wined3d_context
*
context
)
{
GLuint
*
buffer_object
=
&
volume
->
container
->
sub_resources
[
volume
->
texture_level
].
buffer_object
;
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
if
(
*
buffer_object
)
return
;
GL_EXTCALL
(
glGenBuffers
(
1
,
buffer_object
));
GL_EXTCALL
(
glBindBuffer
(
GL_PIXEL_UNPACK_BUFFER
,
*
buffer_object
));
GL_EXTCALL
(
glBufferData
(
GL_PIXEL_UNPACK_BUFFER
,
volume
->
resource
.
size
,
NULL
,
GL_STREAM_DRAW
));
GL_EXTCALL
(
glBindBuffer
(
GL_PIXEL_UNPACK_BUFFER
,
0
));
checkGLcall
(
"Create PBO"
);
TRACE
(
"Created PBO %u for volume %p.
\n
"
,
*
buffer_object
,
volume
);
}
static
void
wined3d_volume_free_pbo
(
struct
wined3d_volume
*
volume
)
{
GLuint
*
buffer_object
=
&
volume
->
container
->
sub_resources
[
volume
->
texture_level
].
buffer_object
;
...
...
@@ -506,7 +488,7 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume,
context
=
context_acquire
(
device
,
NULL
);
gl_info
=
context
->
gl_info
;
wined3d_
volume_prepare_pbo
(
volume
,
context
);
wined3d_
texture_prepare_buffer_object
(
texture
,
volume
->
texture_level
,
gl_info
);
if
(
flags
&
WINED3D_MAP_DISCARD
)
wined3d_volume_validate_location
(
volume
,
WINED3D_LOCATION_BUFFER
);
else
...
...
dlls/wined3d/wined3d_private.h
View file @
87143e60
...
...
@@ -2420,6 +2420,8 @@ struct wined3d_resource *wined3d_texture_get_sub_resource(const struct wined3d_t
UINT
sub_resource_idx
)
DECLSPEC_HIDDEN
;
void
wined3d_texture_load
(
struct
wined3d_texture
*
texture
,
struct
wined3d_context
*
context
,
BOOL
srgb
)
DECLSPEC_HIDDEN
;
void
wined3d_texture_prepare_buffer_object
(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
const
struct
wined3d_gl_info
*
gl_info
)
DECLSPEC_HIDDEN
;
void
wined3d_texture_prepare_texture
(
struct
wined3d_texture
*
texture
,
struct
wined3d_context
*
context
,
BOOL
srgb
)
DECLSPEC_HIDDEN
;
void
wined3d_texture_set_dirty
(
struct
wined3d_texture
*
texture
)
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