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
5356292e
Commit
5356292e
authored
Aug 15, 2019
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce a separate structure for OpenGL sampler information.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e63df7f7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
40 deletions
+55
-40
adapter_gl.c
dlls/wined3d/adapter_gl.c
+8
-6
context.c
dlls/wined3d/context.c
+2
-1
sampler.c
dlls/wined3d/sampler.c
+26
-24
state.c
dlls/wined3d/state.c
+1
-1
view.c
dlls/wined3d/view.c
+3
-3
wined3d_private.h
dlls/wined3d/wined3d_private.h
+15
-5
No files found.
dlls/wined3d/adapter_gl.c
View file @
5356292e
...
...
@@ -5027,7 +5027,7 @@ static void adapter_gl_destroy_unordered_access_view(struct wined3d_unordered_ac
static
HRESULT
adapter_gl_create_sampler
(
struct
wined3d_device
*
device
,
const
struct
wined3d_sampler_desc
*
desc
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_sampler
**
sampler
)
{
struct
wined3d_sampler
*
sampler_gl
;
struct
wined3d_sampler
_gl
*
sampler_gl
;
TRACE
(
"device %p, desc %p, parent %p, parent_ops %p, sampler %p.
\n
"
,
device
,
desc
,
parent
,
parent_ops
,
sampler
);
...
...
@@ -5038,20 +5038,20 @@ static HRESULT adapter_gl_create_sampler(struct wined3d_device *device, const st
wined3d_sampler_gl_init
(
sampler_gl
,
device
,
desc
,
parent
,
parent_ops
);
TRACE
(
"Created sampler %p.
\n
"
,
sampler_gl
);
*
sampler
=
sampler_gl
;
*
sampler
=
&
sampler_gl
->
s
;
return
WINED3D_OK
;
}
static
void
wined3d_sampler_gl_destroy_object
(
void
*
object
)
{
struct
wined3d_sampler
*
sampler_gl
=
object
;
struct
wined3d_sampler
_gl
*
sampler_gl
=
object
;
const
struct
wined3d_gl_info
*
gl_info
;
struct
wined3d_context
*
context
;
if
(
sampler_gl
->
name
)
{
context
=
context_acquire
(
sampler_gl
->
device
,
NULL
,
0
);
context
=
context_acquire
(
sampler_gl
->
s
.
device
,
NULL
,
0
);
gl_info
=
wined3d_context_gl
(
context
)
->
gl_info
;
GL_EXTCALL
(
glDeleteSamplers
(
1
,
&
sampler_gl
->
name
));
context_release
(
context
);
...
...
@@ -5062,9 +5062,11 @@ static void wined3d_sampler_gl_destroy_object(void *object)
static
void
adapter_gl_destroy_sampler
(
struct
wined3d_sampler
*
sampler
)
{
TRACE
(
"sampler %p.
\n
"
,
sampler
);
struct
wined3d_sampler_gl
*
sampler_gl
=
wined3d_sampler_gl
(
sampler
);
wined3d_cs_destroy_object
(
sampler
->
device
->
cs
,
wined3d_sampler_gl_destroy_object
,
sampler
);
TRACE
(
"sampler_gl %p.
\n
"
,
sampler_gl
);
wined3d_cs_destroy_object
(
sampler
->
device
->
cs
,
wined3d_sampler_gl_destroy_object
,
sampler_gl
);
}
static
const
struct
wined3d_adapter_ops
wined3d_adapter_gl_ops
=
...
...
dlls/wined3d/context.c
View file @
5356292e
...
...
@@ -3797,7 +3797,8 @@ static void wined3d_context_gl_bind_shader_resources(struct wined3d_context_gl *
sampler
=
device
->
default_sampler
;
else
if
(
!
(
sampler
=
state
->
sampler
[
shader_type
][
entry
->
sampler_idx
]))
sampler
=
device
->
null_sampler
;
wined3d_shader_resource_view_gl_bind
(
wined3d_shader_resource_view_gl
(
view
),
bind_idx
,
sampler
,
context_gl
);
wined3d_shader_resource_view_gl_bind
(
wined3d_shader_resource_view_gl
(
view
),
bind_idx
,
wined3d_sampler_gl
(
sampler
),
context_gl
);
}
}
...
...
dlls/wined3d/sampler.c
View file @
5356292e
...
...
@@ -70,53 +70,55 @@ static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d
static
void
wined3d_sampler_gl_cs_init
(
void
*
object
)
{
struct
wined3d_sampler
*
sampler
=
object
;
struct
wined3d_sampler
_gl
*
sampler_gl
=
object
;
const
struct
wined3d_sampler_desc
*
desc
;
const
struct
wined3d_gl_info
*
gl_info
;
struct
wined3d_context
*
context
;
GLuint
name
;
context
=
context_acquire
(
sampler
->
device
,
NULL
,
0
);
context
=
context_acquire
(
sampler
_gl
->
s
.
device
,
NULL
,
0
);
gl_info
=
wined3d_context_gl
(
context
)
->
gl_info
;
desc
=
&
sampler
->
desc
;
GL_EXTCALL
(
glGenSamplers
(
1
,
&
sampler
->
name
));
GL_EXTCALL
(
glSamplerParameteri
(
sampler
->
name
,
GL_TEXTURE_WRAP_S
,
desc
=
&
sampler
_gl
->
s
.
desc
;
GL_EXTCALL
(
glGenSamplers
(
1
,
&
name
));
GL_EXTCALL
(
glSamplerParameteri
(
name
,
GL_TEXTURE_WRAP_S
,
gl_info
->
wrap_lookup
[
desc
->
address_u
-
WINED3D_TADDRESS_WRAP
]));
GL_EXTCALL
(
glSamplerParameteri
(
sampler
->
name
,
GL_TEXTURE_WRAP_T
,
GL_EXTCALL
(
glSamplerParameteri
(
name
,
GL_TEXTURE_WRAP_T
,
gl_info
->
wrap_lookup
[
desc
->
address_v
-
WINED3D_TADDRESS_WRAP
]));
GL_EXTCALL
(
glSamplerParameteri
(
sampler
->
name
,
GL_TEXTURE_WRAP_R
,
GL_EXTCALL
(
glSamplerParameteri
(
name
,
GL_TEXTURE_WRAP_R
,
gl_info
->
wrap_lookup
[
desc
->
address_w
-
WINED3D_TADDRESS_WRAP
]));
GL_EXTCALL
(
glSamplerParameterfv
(
sampler
->
name
,
GL_TEXTURE_BORDER_COLOR
,
&
desc
->
border_color
[
0
]));
GL_EXTCALL
(
glSamplerParameteri
(
sampler
->
name
,
GL_TEXTURE_MAG_FILTER
,
GL_EXTCALL
(
glSamplerParameterfv
(
name
,
GL_TEXTURE_BORDER_COLOR
,
&
desc
->
border_color
[
0
]));
GL_EXTCALL
(
glSamplerParameteri
(
name
,
GL_TEXTURE_MAG_FILTER
,
wined3d_gl_mag_filter
(
desc
->
mag_filter
)));
GL_EXTCALL
(
glSamplerParameteri
(
sampler
->
name
,
GL_TEXTURE_MIN_FILTER
,
GL_EXTCALL
(
glSamplerParameteri
(
name
,
GL_TEXTURE_MIN_FILTER
,
wined3d_gl_min_mip_filter
(
desc
->
min_filter
,
desc
->
mip_filter
)));
GL_EXTCALL
(
glSamplerParameterf
(
sampler
->
name
,
GL_TEXTURE_LOD_BIAS
,
desc
->
lod_bias
));
GL_EXTCALL
(
glSamplerParameterf
(
sampler
->
name
,
GL_TEXTURE_MIN_LOD
,
desc
->
min_lod
));
GL_EXTCALL
(
glSamplerParameterf
(
sampler
->
name
,
GL_TEXTURE_MAX_LOD
,
desc
->
max_lod
));
GL_EXTCALL
(
glSamplerParameterf
(
name
,
GL_TEXTURE_LOD_BIAS
,
desc
->
lod_bias
));
GL_EXTCALL
(
glSamplerParameterf
(
name
,
GL_TEXTURE_MIN_LOD
,
desc
->
min_lod
));
GL_EXTCALL
(
glSamplerParameterf
(
name
,
GL_TEXTURE_MAX_LOD
,
desc
->
max_lod
));
if
(
gl_info
->
supported
[
ARB_TEXTURE_FILTER_ANISOTROPIC
])
GL_EXTCALL
(
glSamplerParameteri
(
sampler
->
name
,
GL_TEXTURE_MAX_ANISOTROPY
,
desc
->
max_anisotropy
));
GL_EXTCALL
(
glSamplerParameteri
(
name
,
GL_TEXTURE_MAX_ANISOTROPY
,
desc
->
max_anisotropy
));
if
(
desc
->
compare
)
GL_EXTCALL
(
glSamplerParameteri
(
sampler
->
name
,
GL_TEXTURE_COMPARE_MODE
,
GL_COMPARE_R_TO_TEXTURE
));
GL_EXTCALL
(
glSamplerParameteri
(
sampler
->
name
,
GL_TEXTURE_COMPARE_FUNC
,
GL_EXTCALL
(
glSamplerParameteri
(
name
,
GL_TEXTURE_COMPARE_MODE
,
GL_COMPARE_R_TO_TEXTURE
));
GL_EXTCALL
(
glSamplerParameteri
(
name
,
GL_TEXTURE_COMPARE_FUNC
,
wined3d_gl_compare_func
(
desc
->
comparison_func
)));
if
((
context
->
d3d_info
->
wined3d_creation_flags
&
WINED3D_SRGB_READ_WRITE_CONTROL
)
&&
gl_info
->
supported
[
EXT_TEXTURE_SRGB_DECODE
]
&&
!
desc
->
srgb_decode
)
GL_EXTCALL
(
glSamplerParameteri
(
sampler
->
name
,
GL_TEXTURE_SRGB_DECODE_EXT
,
GL_SKIP_DECODE_EXT
));
GL_EXTCALL
(
glSamplerParameteri
(
name
,
GL_TEXTURE_SRGB_DECODE_EXT
,
GL_SKIP_DECODE_EXT
));
checkGLcall
(
"sampler creation"
);
TRACE
(
"Created sampler %u.
\n
"
,
sampler
->
name
);
TRACE
(
"Created sampler %u.
\n
"
,
name
);
sampler_gl
->
name
=
name
;
context_release
(
context
);
}
void
wined3d_sampler_gl_init
(
struct
wined3d_sampler
*
sampler_gl
,
struct
wined3d_device
*
device
,
void
wined3d_sampler_gl_init
(
struct
wined3d_sampler
_gl
*
sampler_gl
,
struct
wined3d_device
*
device
,
const
struct
wined3d_sampler_desc
*
desc
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
TRACE
(
"sampler_gl %p, device %p, desc %p, parent %p, parent_ops %p.
\n
"
,
sampler_gl
,
device
,
desc
,
parent
,
parent_ops
);
wined3d_sampler_init
(
sampler_gl
,
device
,
desc
,
parent
,
parent_ops
);
wined3d_sampler_init
(
&
sampler_gl
->
s
,
device
,
desc
,
parent
,
parent_ops
);
if
(
device
->
adapter
->
gl_info
.
supported
[
ARB_SAMPLER_OBJECTS
])
wined3d_cs_init_object
(
device
->
cs
,
wined3d_sampler_gl_cs_init
,
sampler_gl
);
...
...
@@ -176,19 +178,19 @@ static void texture_gl_apply_base_level(struct wined3d_texture_gl *texture_gl,
}
/* This function relies on the correct texture being bound and loaded. */
void
wined3d_sampler_
bind
(
struct
wined3d_sampler
*
sampler
,
unsigned
int
unit
,
void
wined3d_sampler_
gl_bind
(
struct
wined3d_sampler_gl
*
sampler_gl
,
unsigned
int
unit
,
struct
wined3d_texture_gl
*
texture_gl
,
const
struct
wined3d_context_gl
*
context_gl
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context_gl
->
gl_info
;
if
(
gl_info
->
supported
[
ARB_SAMPLER_OBJECTS
])
{
GL_EXTCALL
(
glBindSampler
(
unit
,
sampler
->
name
));
GL_EXTCALL
(
glBindSampler
(
unit
,
sampler
_gl
->
name
));
checkGLcall
(
"bind sampler"
);
}
else
if
(
texture_gl
)
{
wined3d_texture_gl_apply_sampler_desc
(
texture_gl
,
&
sampler
->
desc
,
context_gl
);
wined3d_texture_gl_apply_sampler_desc
(
texture_gl
,
&
sampler
_gl
->
s
.
desc
,
context_gl
);
}
else
{
...
...
@@ -196,5 +198,5 @@ void wined3d_sampler_bind(struct wined3d_sampler *sampler, unsigned int unit,
}
if
(
texture_gl
)
texture_gl_apply_base_level
(
texture_gl
,
&
sampler
->
desc
,
gl_info
);
texture_gl_apply_base_level
(
texture_gl
,
&
sampler
_gl
->
s
.
desc
,
gl_info
);
}
dlls/wined3d/state.c
View file @
5356292e
...
...
@@ -3639,7 +3639,7 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state
}
}
wined3d_sampler_
bind
(
sampler
,
mapped_stage
,
texture_gl
,
context_gl
);
wined3d_sampler_
gl_bind
(
wined3d_sampler_gl
(
sampler
)
,
mapped_stage
,
texture_gl
,
context_gl
);
/* Trigger shader constant reloading (for NP2 texcoord fixup) */
if
(
!
(
texture_gl
->
t
.
flags
&
WINED3D_TEXTURE_POW2_MAT_IDENT
))
...
...
dlls/wined3d/view.c
View file @
5356292e
...
...
@@ -818,7 +818,7 @@ HRESULT CDECL wined3d_shader_resource_view_create(const struct wined3d_view_desc
}
void
wined3d_shader_resource_view_gl_bind
(
struct
wined3d_shader_resource_view_gl
*
view_gl
,
unsigned
int
unit
,
struct
wined3d_sampler
*
sampler
,
struct
wined3d_context_gl
*
context_gl
)
unsigned
int
unit
,
struct
wined3d_sampler
_gl
*
sampler_gl
,
struct
wined3d_context_gl
*
context_gl
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context_gl
->
gl_info
;
struct
wined3d_texture_gl
*
texture_gl
;
...
...
@@ -828,7 +828,7 @@ void wined3d_shader_resource_view_gl_bind(struct wined3d_shader_resource_view_gl
if
(
view_gl
->
gl_view
.
name
)
{
wined3d_context_gl_bind_texture
(
context_gl
,
view_gl
->
gl_view
.
target
,
view_gl
->
gl_view
.
name
);
wined3d_sampler_
bind
(
sampler
,
unit
,
NULL
,
context_gl
);
wined3d_sampler_
gl_bind
(
sampler_gl
,
unit
,
NULL
,
context_gl
);
return
;
}
...
...
@@ -840,7 +840,7 @@ void wined3d_shader_resource_view_gl_bind(struct wined3d_shader_resource_view_gl
texture_gl
=
wined3d_texture_gl
(
wined3d_texture_from_resource
(
view_gl
->
v
.
resource
));
wined3d_texture_gl_bind
(
texture_gl
,
context_gl
,
FALSE
);
wined3d_sampler_
bind
(
sampler
,
unit
,
texture_gl
,
context_gl
);
wined3d_sampler_
gl_bind
(
sampler_gl
,
unit
,
texture_gl
,
context_gl
);
}
/* Context activation is done by the caller. */
...
...
dlls/wined3d/wined3d_private.h
View file @
5356292e
...
...
@@ -3793,17 +3793,27 @@ struct wined3d_sampler
{
struct
wine_rb_entry
entry
;
LONG
refcount
;
GLuint
name
;
struct
wined3d_device
*
device
;
void
*
parent
;
const
struct
wined3d_parent_ops
*
parent_ops
;
struct
wined3d_sampler_desc
desc
;
};
void
wined3d_sampler_bind
(
struct
wined3d_sampler
*
sampler
,
unsigned
int
unit
,
struct
wined3d_texture_gl
*
texture_gl
,
const
struct
wined3d_context_gl
*
context_gl
)
DECLSPEC_HIDDEN
;
struct
wined3d_sampler_gl
{
struct
wined3d_sampler
s
;
GLuint
name
;
};
void
wined3d_sampler_gl_init
(
struct
wined3d_sampler
*
sampler_gl
,
static
inline
struct
wined3d_sampler_gl
*
wined3d_sampler_gl
(
struct
wined3d_sampler
*
sampler
)
{
return
CONTAINING_RECORD
(
sampler
,
struct
wined3d_sampler_gl
,
s
);
}
void
wined3d_sampler_gl_bind
(
struct
wined3d_sampler_gl
*
sampler_gl
,
unsigned
int
unit
,
struct
wined3d_texture_gl
*
texture_gl
,
const
struct
wined3d_context_gl
*
context_gl
)
DECLSPEC_HIDDEN
;
void
wined3d_sampler_gl_init
(
struct
wined3d_sampler_gl
*
sampler_gl
,
struct
wined3d_device
*
device
,
const
struct
wined3d_sampler_desc
*
desc
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
DECLSPEC_HIDDEN
;
...
...
@@ -4291,7 +4301,7 @@ static inline struct wined3d_shader_resource_view_gl *wined3d_shader_resource_vi
}
void
wined3d_shader_resource_view_gl_bind
(
struct
wined3d_shader_resource_view_gl
*
view_gl
,
unsigned
int
unit
,
struct
wined3d_sampler
*
sampler
,
struct
wined3d_context_gl
*
context_gl
)
DECLSPEC_HIDDEN
;
struct
wined3d_sampler
_gl
*
sampler_gl
,
struct
wined3d_context_gl
*
context_gl
)
DECLSPEC_HIDDEN
;
HRESULT
wined3d_shader_resource_view_gl_init
(
struct
wined3d_shader_resource_view_gl
*
view_gl
,
const
struct
wined3d_view_desc
*
desc
,
struct
wined3d_resource
*
resource
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
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