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
edb3ea66
Commit
edb3ea66
authored
Mar 08, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Replace D3DCOLORTOGLFLOAT4 with an inline function.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
09aa6acc
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
49 deletions
+51
-49
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+4
-4
ati_fragment_shader.c
dlls/wined3d/ati_fragment_shader.c
+8
-8
drawprim.c
dlls/wined3d/drawprim.c
+3
-3
glsl_shader.c
dlls/wined3d/glsl_shader.c
+11
-11
nvidia_texture_shader.c
dlls/wined3d/nvidia_texture_shader.c
+3
-3
state.c
dlls/wined3d/state.c
+15
-14
wined3d_private.h
dlls/wined3d/wined3d_private.h
+7
-6
No files found.
dlls/wined3d/arb_program_shader.c
View file @
edb3ea66
...
...
@@ -5919,7 +5919,7 @@ static void state_texfactor_arbfp(struct wined3d_context *context,
{
struct
wined3d_device
*
device
=
context
->
swapchain
->
device
;
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
float
col
[
4
]
;
struct
wined3d_color
color
;
/* Don't load the parameter if we're using an arbfp pixel shader,
* otherwise we'll overwrite application provided constants. */
...
...
@@ -5934,9 +5934,9 @@ static void state_texfactor_arbfp(struct wined3d_context *context,
priv
->
highest_dirty_ps_const
=
max
(
priv
->
highest_dirty_ps_const
,
ARB_FFP_CONST_TFACTOR
+
1
);
}
D3DCOLORTOGLFLOAT4
(
state
->
render_states
[
WINED3D_RS_TEXTUREFACTOR
],
col
);
GL_EXTCALL
(
glProgramEnvParameter4fvARB
(
GL_FRAGMENT_PROGRAM_ARB
,
ARB_FFP_CONST_TFACTOR
,
col
));
checkGLcall
(
"glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_TFACTOR,
col
)"
);
wined3d_color_from_d3dcolor
(
&
color
,
state
->
render_states
[
WINED3D_RS_TEXTUREFACTOR
]
);
GL_EXTCALL
(
glProgramEnvParameter4fvARB
(
GL_FRAGMENT_PROGRAM_ARB
,
ARB_FFP_CONST_TFACTOR
,
&
color
.
r
));
checkGLcall
(
"glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_TFACTOR,
&color.r
)"
);
}
static
void
state_arb_specularenable
(
struct
wined3d_context
*
context
,
...
...
dlls/wined3d/ati_fragment_shader.c
View file @
edb3ea66
...
...
@@ -953,16 +953,16 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES],
static
void
atifs_tfactor
(
struct
wined3d_context
*
context
,
const
struct
wined3d_state
*
state
,
DWORD
state_id
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
float
col
[
4
];
struct
atifs_context_private_data
*
ctx_priv
=
context
->
fragment_pipe_data
;
struct
wined3d_color
color
;
if
(
!
ctx_priv
->
last_shader
||
ctx_priv
->
last_shader
->
constants
[
ATIFS_CONST_TFACTOR
-
GL_CON_0_ATI
]
!=
ATIFS_CONSTANT_TFACTOR
)
return
;
D3DCOLORTOGLFLOAT4
(
state
->
render_states
[
WINED3D_RS_TEXTUREFACTOR
],
col
);
GL_EXTCALL
(
glSetFragmentShaderConstantATI
(
ATIFS_CONST_TFACTOR
,
col
));
checkGLcall
(
"glSetFragmentShaderConstantATI(ATIFS_CONST_TFACTOR,
col
)"
);
wined3d_color_from_d3dcolor
(
&
color
,
state
->
render_states
[
WINED3D_RS_TEXTUREFACTOR
]
);
GL_EXTCALL
(
glSetFragmentShaderConstantATI
(
ATIFS_CONST_TFACTOR
,
&
color
.
r
));
checkGLcall
(
"glSetFragmentShaderConstantATI(ATIFS_CONST_TFACTOR,
&color.r
)"
);
}
static
void
set_bumpmat
(
struct
wined3d_context
*
context
,
const
struct
wined3d_state
*
state
,
DWORD
state_id
)
...
...
@@ -998,16 +998,16 @@ static void atifs_stage_constant(struct wined3d_context *context, const struct w
{
DWORD
stage
=
(
state_id
-
STATE_TEXTURESTAGE
(
0
,
0
))
/
(
WINED3D_HIGHEST_TEXTURE_STATE
+
1
);
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
float
col
[
4
];
struct
atifs_context_private_data
*
ctx_priv
=
context
->
fragment_pipe_data
;
struct
wined3d_color
color
;
if
(
!
ctx_priv
->
last_shader
||
ctx_priv
->
last_shader
->
constants
[
stage
]
!=
ATIFS_CONSTANT_STAGE
)
return
;
D3DCOLORTOGLFLOAT4
(
state
->
texture_states
[
stage
][
WINED3D_TSS_CONSTANT
],
col
);
GL_EXTCALL
(
glSetFragmentShaderConstantATI
(
ATIFS_CONST_STAGE
(
stage
),
col
));
checkGLcall
(
"glSetFragmentShaderConstantATI(ATIFS_CONST_STAGE(stage),
col
)"
);
wined3d_color_from_d3dcolor
(
&
color
,
state
->
texture_states
[
stage
][
WINED3D_TSS_CONSTANT
]
);
GL_EXTCALL
(
glSetFragmentShaderConstantATI
(
ATIFS_CONST_STAGE
(
stage
),
&
color
.
r
));
checkGLcall
(
"glSetFragmentShaderConstantATI(ATIFS_CONST_STAGE(stage),
&color.r
)"
);
}
static
void
set_tex_op_atifs
(
struct
wined3d_context
*
context
,
const
struct
wined3d_state
*
state
,
DWORD
state_id
)
...
...
dlls/wined3d/drawprim.c
View file @
edb3ea66
...
...
@@ -291,13 +291,13 @@ static void drawStridedSlow(const struct wined3d_device *device, struct wined3d_
if
(
num_untracked_materials
)
{
struct
wined3d_color
color
;
unsigned
char
i
;
float
color
[
4
];
D3DCOLORTOGLFLOAT4
(
*
(
const
DWORD
*
)
ptrToCoords
,
color
);
wined3d_color_from_d3dcolor
(
&
color
,
*
(
const
DWORD
*
)
ptrToCoords
);
for
(
i
=
0
;
i
<
num_untracked_materials
;
++
i
)
{
gl_info
->
gl_ops
.
gl
.
p_glMaterialfv
(
GL_FRONT_AND_BACK
,
context
->
untracked_materials
[
i
],
colo
r
);
gl_info
->
gl_ops
.
gl
.
p_glMaterialfv
(
GL_FRONT_AND_BACK
,
context
->
untracked_materials
[
i
],
&
color
.
r
);
}
}
}
...
...
dlls/wined3d/glsl_shader.c
View file @
edb3ea66
...
...
@@ -1137,10 +1137,10 @@ static void shader_glsl_ffp_vertex_lightambient_uniform(const struct wined3d_con
const
struct
wined3d_state
*
state
,
struct
glsl_shader_prog_link
*
prog
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
float
col
[
4
]
;
struct
wined3d_color
color
;
D3DCOLORTOGLFLOAT4
(
state
->
render_states
[
WINED3D_RS_AMBIENT
],
col
);
GL_EXTCALL
(
glUniform3fv
(
prog
->
vs
.
light_ambient_location
,
1
,
col
));
wined3d_color_from_d3dcolor
(
&
color
,
state
->
render_states
[
WINED3D_RS_AMBIENT
]
);
GL_EXTCALL
(
glUniform3fv
(
prog
->
vs
.
light_ambient_location
,
1
,
&
color
.
r
));
checkGLcall
(
"glUniform3fv"
);
}
...
...
@@ -1245,16 +1245,16 @@ static void shader_glsl_load_fog_uniform(const struct wined3d_context *context,
const
struct
wined3d_state
*
state
,
struct
glsl_shader_prog_link
*
prog
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
struct
wined3d_color
color
;
float
start
,
end
,
scale
;
union
{
DWORD
d
;
float
f
;
}
tmpvalue
;
float
col
[
4
];
D3DCOLORTOGLFLOAT4
(
state
->
render_states
[
WINED3D_RS_FOGCOLOR
],
col
);
GL_EXTCALL
(
glUniform4fv
(
prog
->
ps
.
fog_color_location
,
1
,
col
));
wined3d_color_from_d3dcolor
(
&
color
,
state
->
render_states
[
WINED3D_RS_FOGCOLOR
]
);
GL_EXTCALL
(
glUniform4fv
(
prog
->
ps
.
fog_color_location
,
1
,
&
color
.
r
));
tmpvalue
.
d
=
state
->
render_states
[
WINED3D_RS_FOGDENSITY
];
GL_EXTCALL
(
glUniform1f
(
prog
->
ps
.
fog_density_location
,
tmpvalue
.
f
));
get_fog_start_end
(
context
,
state
,
&
start
,
&
end
);
...
...
@@ -1426,12 +1426,12 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
if
(
update_mask
&
WINED3D_SHADER_CONST_FFP_PS
)
{
float
col
[
4
]
;
struct
wined3d_color
color
;
if
(
prog
->
ps
.
tex_factor_location
!=
-
1
)
{
D3DCOLORTOGLFLOAT4
(
state
->
render_states
[
WINED3D_RS_TEXTUREFACTOR
],
col
);
GL_EXTCALL
(
glUniform4fv
(
prog
->
ps
.
tex_factor_location
,
1
,
col
));
wined3d_color_from_d3dcolor
(
&
color
,
state
->
render_states
[
WINED3D_RS_TEXTUREFACTOR
]
);
GL_EXTCALL
(
glUniform4fv
(
prog
->
ps
.
tex_factor_location
,
1
,
&
color
.
r
));
}
if
(
state
->
render_states
[
WINED3D_RS_SPECULARENABLE
])
...
...
@@ -1444,8 +1444,8 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
if
(
prog
->
ps
.
tss_constant_location
[
i
]
==
-
1
)
continue
;
D3DCOLORTOGLFLOAT4
(
state
->
texture_states
[
i
][
WINED3D_TSS_CONSTANT
],
col
);
GL_EXTCALL
(
glUniform4fv
(
prog
->
ps
.
tss_constant_location
[
i
],
1
,
col
));
wined3d_color_from_d3dcolor
(
&
color
,
state
->
texture_states
[
i
][
WINED3D_TSS_CONSTANT
]
);
GL_EXTCALL
(
glUniform4fv
(
prog
->
ps
.
tss_constant_location
[
i
],
1
,
&
color
.
r
));
}
checkGLcall
(
"fixed function uniforms"
);
...
...
dlls/wined3d/nvidia_texture_shader.c
View file @
edb3ea66
...
...
@@ -647,10 +647,10 @@ static void nvts_bumpenvmat(struct wined3d_context *context, const struct wined3
static
void
nvrc_texfactor
(
struct
wined3d_context
*
context
,
const
struct
wined3d_state
*
state
,
DWORD
state_id
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
float
col
[
4
]
;
struct
wined3d_color
color
;
D3DCOLORTOGLFLOAT4
(
state
->
render_states
[
WINED3D_RS_TEXTUREFACTOR
],
col
);
GL_EXTCALL
(
glCombinerParameterfvNV
(
GL_CONSTANT_COLOR0_NV
,
&
col
[
0
]
));
wined3d_color_from_d3dcolor
(
&
color
,
state
->
render_states
[
WINED3D_RS_TEXTUREFACTOR
]
);
GL_EXTCALL
(
glCombinerParameterfvNV
(
GL_CONSTANT_COLOR0_NV
,
&
col
or
.
r
));
}
/* Context activation is done by the caller. */
...
...
dlls/wined3d/state.c
View file @
edb3ea66
...
...
@@ -260,11 +260,11 @@ static void state_zfunc(struct wined3d_context *context, const struct wined3d_st
static
void
state_ambient
(
struct
wined3d_context
*
context
,
const
struct
wined3d_state
*
state
,
DWORD
state_id
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
float
col
[
4
]
;
struct
wined3d_color
color
;
D3DCOLORTOGLFLOAT4
(
state
->
render_states
[
WINED3D_RS_AMBIENT
],
col
);
TRACE
(
"Setting ambient to
(%f,%f,%f,%f)
\n
"
,
col
[
0
],
col
[
1
],
col
[
2
],
col
[
3
]
);
gl_info
->
gl_ops
.
gl
.
p_glLightModelfv
(
GL_LIGHT_MODEL_AMBIENT
,
col
);
wined3d_color_from_d3dcolor
(
&
color
,
state
->
render_states
[
WINED3D_RS_AMBIENT
]
);
TRACE
(
"Setting ambient to
{%.8e, %.8e, %.8e, %.8e}.
\n
"
,
color
.
r
,
color
.
g
,
color
.
b
,
color
.
a
);
gl_info
->
gl_ops
.
gl
.
p_glLightModelfv
(
GL_LIGHT_MODEL_AMBIENT
,
&
color
.
r
);
checkGLcall
(
"glLightModel for MODEL_AMBIENT"
);
}
...
...
@@ -497,12 +497,12 @@ static void state_blendfactor_w(struct wined3d_context *context, const struct wi
static
void
state_blendfactor
(
struct
wined3d_context
*
context
,
const
struct
wined3d_state
*
state
,
DWORD
state_id
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
float
col
[
4
]
;
struct
wined3d_color
color
;
TRACE
(
"Setting blend factor to %#x.
\n
"
,
state
->
render_states
[
WINED3D_RS_BLENDFACTOR
]);
D3DCOLORTOGLFLOAT4
(
state
->
render_states
[
WINED3D_RS_BLENDFACTOR
],
col
);
GL_EXTCALL
(
glBlendColor
(
col
[
0
],
col
[
1
],
col
[
2
],
col
[
3
]
));
wined3d_color_from_d3dcolor
(
&
color
,
state
->
render_states
[
WINED3D_RS_BLENDFACTOR
]
);
GL_EXTCALL
(
glBlendColor
(
col
or
.
r
,
color
.
g
,
color
.
b
,
color
.
a
));
checkGLcall
(
"glBlendColor"
);
}
...
...
@@ -736,12 +736,12 @@ static void state_specularenable(struct wined3d_context *context, const struct w
static
void
state_texfactor
(
struct
wined3d_context
*
context
,
const
struct
wined3d_state
*
state
,
DWORD
state_id
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
struct
wined3d_color
color
;
unsigned
int
i
;
/* Note the texture color applies to all textures whereas
* GL_TEXTURE_ENV_COLOR applies to active only. */
float
col
[
4
];
D3DCOLORTOGLFLOAT4
(
state
->
render_states
[
WINED3D_RS_TEXTUREFACTOR
],
col
);
wined3d_color_from_d3dcolor
(
&
color
,
state
->
render_states
[
WINED3D_RS_TEXTUREFACTOR
]);
/* And now the default texture color as well */
for
(
i
=
0
;
i
<
context
->
d3d_info
->
limits
.
ffp_blend_stages
;
++
i
)
...
...
@@ -750,7 +750,7 @@ static void state_texfactor(struct wined3d_context *context, const struct wined3
* per texture, so apply it now ready to be used! */
context_active_texture
(
context
,
gl_info
,
i
);
gl_info
->
gl_ops
.
gl
.
p_glTexEnvfv
(
GL_TEXTURE_ENV
,
GL_TEXTURE_ENV_COLOR
,
&
col
[
0
]
);
gl_info
->
gl_ops
.
gl
.
p_glTexEnvfv
(
GL_TEXTURE_ENV
,
GL_TEXTURE_ENV_COLOR
,
&
col
or
.
r
);
checkGLcall
(
"glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);"
);
}
}
...
...
@@ -1179,10 +1179,10 @@ void state_fog_fragpart(struct wined3d_context *context, const struct wined3d_st
void
state_fogcolor
(
struct
wined3d_context
*
context
,
const
struct
wined3d_state
*
state
,
DWORD
state_id
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
float
col
[
4
]
;
struct
wined3d_color
color
;
D3DCOLORTOGLFLOAT4
(
state
->
render_states
[
WINED3D_RS_FOGCOLOR
],
col
);
gl_info
->
gl_ops
.
gl
.
p_glFogfv
(
GL_FOG_COLOR
,
col
);
wined3d_color_from_d3dcolor
(
&
color
,
state
->
render_states
[
WINED3D_RS_FOGCOLOR
]
);
gl_info
->
gl_ops
.
gl
.
p_glFogfv
(
GL_FOG_COLOR
,
&
color
.
r
);
checkGLcall
(
"glFog GL_FOG_COLOR"
);
}
...
...
@@ -3488,7 +3488,8 @@ static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc
desc
->
address_u
=
wined3d_texture_address_mode
(
texture
,
sampler_states
[
WINED3D_SAMP_ADDRESS_U
]);
desc
->
address_v
=
wined3d_texture_address_mode
(
texture
,
sampler_states
[
WINED3D_SAMP_ADDRESS_V
]);
desc
->
address_w
=
wined3d_texture_address_mode
(
texture
,
sampler_states
[
WINED3D_SAMP_ADDRESS_W
]);
D3DCOLORTOGLFLOAT4
(
sampler_states
[
WINED3D_SAMP_BORDER_COLOR
],
desc
->
border_color
);
wined3d_color_from_d3dcolor
((
struct
wined3d_color
*
)
desc
->
border_color
,
sampler_states
[
WINED3D_SAMP_BORDER_COLOR
]);
if
(
sampler_states
[
WINED3D_SAMP_MAG_FILTER
]
>
WINED3D_TEXF_ANISOTROPIC
)
FIXME
(
"Unrecognized or unsupported WINED3D_SAMP_MAG_FILTER %#x.
\n
"
,
sampler_states
[
WINED3D_SAMP_MAG_FILTER
]);
...
...
dlls/wined3d/wined3d_private.h
View file @
edb3ea66
...
...
@@ -989,12 +989,13 @@ extern const struct wined3d_shader_backend_ops none_shader_backend DECLSPEC_HIDD
#define D3DCOLOR_B_B(dw) (((dw) >> 0) & 0xff)
#define D3DCOLOR_B_A(dw) (((dw) >> 24) & 0xff)
#define D3DCOLORTOGLFLOAT4(dw, vec) do { \
(vec)[0] = D3DCOLOR_B_R(dw) / 255.0f; \
(vec)[1] = D3DCOLOR_B_G(dw) / 255.0f; \
(vec)[2] = D3DCOLOR_B_B(dw) / 255.0f; \
(vec)[3] = D3DCOLOR_B_A(dw) / 255.0f; \
} while(0)
static
inline
void
wined3d_color_from_d3dcolor
(
struct
wined3d_color
*
wined3d_color
,
DWORD
d3d_color
)
{
wined3d_color
->
r
=
D3DCOLOR_B_R
(
d3d_color
)
/
255
.
0
f
;
wined3d_color
->
g
=
D3DCOLOR_B_G
(
d3d_color
)
/
255
.
0
f
;
wined3d_color
->
b
=
D3DCOLOR_B_B
(
d3d_color
)
/
255
.
0
f
;
wined3d_color
->
a
=
D3DCOLOR_B_A
(
d3d_color
)
/
255
.
0
f
;
}
#define HIGHEST_TRANSFORMSTATE WINED3D_TS_WORLD_MATRIX(255)
/* Highest value in wined3d_transform_state. */
...
...
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