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
f193979a
Commit
f193979a
authored
Aug 19, 2019
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce wined3d_colour_srgb_from_linear().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
af8401ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
21 deletions
+27
-21
device.c
dlls/wined3d/device.c
+4
-18
wined3d_private.h
dlls/wined3d/wined3d_private.h
+23
-3
No files found.
dlls/wined3d/device.c
View file @
f193979a
...
...
@@ -291,7 +291,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
struct
wined3d_context_gl
*
context_gl
;
struct
wined3d_texture
*
target
=
NULL
;
UINT
drawable_width
,
drawable_height
;
struct
wined3d_color
co
rrected_color
;
struct
wined3d_color
co
lour_srgb
;
struct
wined3d_context
*
context
;
GLbitfield
clear_mask
=
0
;
BOOL
render_offscreen
;
...
...
@@ -430,25 +430,11 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
if
(
!
gl_info
->
supported
[
ARB_FRAMEBUFFER_SRGB
]
&&
needs_srgb_write
(
context
,
state
,
fb
))
{
if
(
rt_count
>
1
)
WARN
(
"Clearing multiple sRGB render targets with
no
GL_ARB_framebuffer_sRGB "
WARN
(
"Clearing multiple sRGB render targets with
out
GL_ARB_framebuffer_sRGB "
"support, this might cause graphical issues.
\n
"
);
corrected_color
.
r
=
color
->
r
<
wined3d_srgb_const1
[
0
]
?
color
->
r
*
wined3d_srgb_const0
[
3
]
:
pow
(
color
->
r
,
wined3d_srgb_const0
[
0
])
*
wined3d_srgb_const0
[
1
]
-
wined3d_srgb_const0
[
2
];
corrected_color
.
r
=
min
(
max
(
corrected_color
.
r
,
0
.
0
f
),
1
.
0
f
);
corrected_color
.
g
=
color
->
g
<
wined3d_srgb_const1
[
0
]
?
color
->
g
*
wined3d_srgb_const0
[
3
]
:
pow
(
color
->
g
,
wined3d_srgb_const0
[
0
])
*
wined3d_srgb_const0
[
1
]
-
wined3d_srgb_const0
[
2
];
corrected_color
.
g
=
min
(
max
(
corrected_color
.
g
,
0
.
0
f
),
1
.
0
f
);
corrected_color
.
b
=
color
->
b
<
wined3d_srgb_const1
[
0
]
?
color
->
b
*
wined3d_srgb_const0
[
3
]
:
pow
(
color
->
b
,
wined3d_srgb_const0
[
0
])
*
wined3d_srgb_const0
[
1
]
-
wined3d_srgb_const0
[
2
];
corrected_color
.
b
=
min
(
max
(
corrected_color
.
b
,
0
.
0
f
),
1
.
0
f
);
color
=
&
corrected_color
;
wined3d_colour_srgb_from_linear
(
&
colour_srgb
,
color
);
color
=
&
colour_srgb
;
}
gl_info
->
gl_ops
.
gl
.
p_glColorMask
(
GL_TRUE
,
GL_TRUE
,
GL_TRUE
,
GL_TRUE
);
...
...
dlls/wined3d/wined3d_private.h
View file @
f193979a
...
...
@@ -1482,6 +1482,29 @@ static inline void wined3d_color_from_d3dcolor(struct wined3d_color *wined3d_col
wined3d_color
->
a
=
D3DCOLOR_B_A
(
d3d_color
)
/
255
.
0
f
;
}
extern
const
float
wined3d_srgb_const0
[]
DECLSPEC_HIDDEN
;
extern
const
float
wined3d_srgb_const1
[]
DECLSPEC_HIDDEN
;
static
inline
float
wined3d_srgb_from_linear
(
float
colour
)
{
if
(
colour
<
0
.
0
f
)
return
0
.
0
f
;
if
(
colour
<
wined3d_srgb_const1
[
0
])
return
colour
*
wined3d_srgb_const0
[
3
];
if
(
colour
<
1
.
0
f
)
return
wined3d_srgb_const0
[
1
]
*
powf
(
colour
,
wined3d_srgb_const0
[
0
])
-
wined3d_srgb_const0
[
2
];
return
1
.
0
f
;
}
static
inline
void
wined3d_colour_srgb_from_linear
(
struct
wined3d_color
*
colour_srgb
,
const
struct
wined3d_color
*
colour
)
{
colour_srgb
->
r
=
wined3d_srgb_from_linear
(
colour
->
r
);
colour_srgb
->
g
=
wined3d_srgb_from_linear
(
colour
->
g
);
colour_srgb
->
b
=
wined3d_srgb_from_linear
(
colour
->
b
);
colour_srgb
->
a
=
colour
->
a
;
}
#define WINED3D_HIGHEST_TRANSFORM_STATE WINED3D_TS_WORLD_MATRIX(255)
/* Highest value in wined3d_transform_state. */
void
wined3d_check_gl_call
(
const
struct
wined3d_gl_info
*
gl_info
,
...
...
@@ -2978,9 +3001,6 @@ const struct ffp_frag_desc *find_ffp_frag_shader(const struct wine_rb_tree *frag
void
add_ffp_frag_shader
(
struct
wine_rb_tree
*
shaders
,
struct
ffp_frag_desc
*
desc
)
DECLSPEC_HIDDEN
;
void
wined3d_ftoa
(
float
value
,
char
*
s
)
DECLSPEC_HIDDEN
;
extern
const
float
wined3d_srgb_const0
[]
DECLSPEC_HIDDEN
;
extern
const
float
wined3d_srgb_const1
[]
DECLSPEC_HIDDEN
;
enum
wined3d_ffp_vs_fog_mode
{
WINED3D_FFP_VS_FOG_OFF
=
0
,
...
...
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