Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
75386a99
Commit
75386a99
authored
Feb 01, 2011
by
Matteo Bruni
Committed by
Alexandre Julliard
Feb 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Make clip planes independent from offscreen/onscreen drawing.
parent
b9704628
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
40 deletions
+33
-40
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+24
-22
glsl_shader.c
dlls/wined3d/glsl_shader.c
+6
-8
state.c
dlls/wined3d/state.c
+3
-10
No files found.
dlls/wined3d/arb_program_shader.c
View file @
75386a99
...
...
@@ -3111,35 +3111,24 @@ static void vshader_add_footer(struct shader_arb_ctx_priv *priv_ctx,
* the fog frag coord is thrown away. If the fog frag coord is used, but not written by
* the shader, it is set to 0.0(fully fogged, since start = 1.0, end = 0.0)
*/
if
(
args
->
super
.
fog_src
==
VS_FOG_Z
)
{
if
(
args
->
super
.
fog_src
==
VS_FOG_Z
)
shader_addline
(
buffer
,
"MOV result.fogcoord, TMP_OUT.z;
\n
"
);
}
else
if
(
!
reg_maps
->
fog
)
{
/* posFixup.x is always 1.0, so we can sa
v
ely use it */
else
if
(
!
reg_maps
->
fog
)
/* posFixup.x is always 1.0, so we can sa
f
ely use it */
shader_addline
(
buffer
,
"ADD result.fogcoord, posFixup.x, -posFixup.x;
\n
"
);
}
/* Write the final position.
*
* OpenGL coordinates specify the center of the pixel while d3d coords specify
* the corner. The offsets are stored in z and w in posFixup. posFixup.y contains
* 1.0 or -1.0 to turn the rendering upside down for offscreen rendering. PosFixup.x
* contains 1.0 to allow a mad, but arb vs swizzles are too restricted for that.
*/
shader_addline
(
buffer
,
"MUL TA, posFixup, TMP_OUT.w;
\n
"
);
shader_addline
(
buffer
,
"ADD TMP_OUT.x, TMP_OUT.x, TA.z;
\n
"
);
shader_addline
(
buffer
,
"MAD TMP_OUT.y, TMP_OUT.y, posFixup.y, TA.w;
\n
"
);
if
(
use_nv_clip
(
gl_info
)
&&
priv_ctx
->
target_version
>=
NV2
)
/* Clipplanes are always stored without y inversion */
if
(
use_nv_clip
(
gl_info
)
&&
priv_ctx
->
target_version
>=
NV2
)
{
if
(
args
->
super
.
clip_enabled
)
if
(
args
->
super
.
clip_enabled
)
{
for
(
i
=
0
;
i
<
priv_ctx
->
vs_clipplanes
;
i
++
)
for
(
i
=
0
;
i
<
priv_ctx
->
vs_clipplanes
;
i
++
)
{
shader_addline
(
buffer
,
"DP4 result.clip[%u].x, TMP_OUT, state.clip[%u].plane;
\n
"
,
i
,
i
);
}
}
}
else
if
(
args
->
clip
.
boolclip
.
clip_texcoord
)
else
if
(
args
->
clip
.
boolclip
.
clip_texcoord
)
{
unsigned
int
cur_clip
=
0
;
char
component
[
4
]
=
{
'x'
,
'y'
,
'z'
,
'w'
};
...
...
@@ -3147,13 +3136,13 @@ static void vshader_add_footer(struct shader_arb_ctx_priv *priv_ctx,
for
(
i
=
0
;
i
<
gl_info
->
limits
.
clipplanes
;
++
i
)
{
if
(
args
->
clip
.
boolclip
.
clipplane_mask
&
(
1
<<
i
))
if
(
args
->
clip
.
boolclip
.
clipplane_mask
&
(
1
<<
i
))
{
shader_addline
(
buffer
,
"DP4 TA.%c, TMP_OUT, state.clip[%u].plane;
\n
"
,
component
[
cur_clip
++
],
i
);
}
}
switch
(
cur_clip
)
switch
(
cur_clip
)
{
case
0
:
shader_addline
(
buffer
,
"MOV TA, %s;
\n
"
,
zero
);
...
...
@@ -3172,6 +3161,17 @@ static void vshader_add_footer(struct shader_arb_ctx_priv *priv_ctx,
args
->
clip
.
boolclip
.
clip_texcoord
-
1
);
}
/* Write the final position.
*
* OpenGL coordinates specify the center of the pixel while d3d coords specify
* the corner. The offsets are stored in z and w in posFixup. posFixup.y contains
* 1.0 or -1.0 to turn the rendering upside down for offscreen rendering. PosFixup.x
* contains 1.0 to allow a mad, but arb vs swizzles are too restricted for that.
*/
shader_addline
(
buffer
,
"MUL TA, posFixup, TMP_OUT.w;
\n
"
);
shader_addline
(
buffer
,
"ADD TMP_OUT.x, TMP_OUT.x, TA.z;
\n
"
);
shader_addline
(
buffer
,
"MAD TMP_OUT.y, TMP_OUT.y, posFixup.y, TA.w;
\n
"
);
/* Z coord [0;1]->[-1;1] mapping, see comment in transform_projection in state.c
* and the glsl equivalent
*/
...
...
@@ -3179,7 +3179,9 @@ static void vshader_add_footer(struct shader_arb_ctx_priv *priv_ctx,
{
const
char
*
two
=
arb_get_helper_value
(
WINED3D_SHADER_TYPE_VERTEX
,
ARB_TWO
);
shader_addline
(
buffer
,
"MAD TMP_OUT.z, TMP_OUT.z, %s, -TMP_OUT.w;
\n
"
,
two
);
}
else
{
}
else
{
shader_addline
(
buffer
,
"ADD TMP_OUT.z, TMP_OUT.z, TMP_OUT.z;
\n
"
);
shader_addline
(
buffer
,
"ADD TMP_OUT.z, TMP_OUT.z, -TMP_OUT.w;
\n
"
);
}
...
...
dlls/wined3d/glsl_shader.c
View file @
75386a99
...
...
@@ -4079,9 +4079,7 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context
shader_addline
(
buffer
,
"#version 120
\n
"
);
if
(
gl_info
->
supported
[
EXT_GPU_SHADER4
])
{
shader_addline
(
buffer
,
"#extension GL_EXT_gpu_shader4 : enable
\n
"
);
}
memset
(
&
priv_ctx
,
0
,
sizeof
(
priv_ctx
));
priv_ctx
.
cur_vs_args
=
args
;
...
...
@@ -4100,11 +4098,14 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context
* the fog frag coord is thrown away. If the fog frag coord is used, but not written by
* the shader, it is set to 0.0(fully fogged, since start = 1.0, end = 0.0)
*/
if
(
args
->
fog_src
==
VS_FOG_Z
)
{
if
(
args
->
fog_src
==
VS_FOG_Z
)
shader_addline
(
buffer
,
"gl_FogFragCoord = gl_Position.z;
\n
"
);
}
else
if
(
!
reg_maps
->
fog
)
{
else
if
(
!
reg_maps
->
fog
)
shader_addline
(
buffer
,
"gl_FogFragCoord = 0.0;
\n
"
);
}
/* We always store the clipplanes without y inversion */
if
(
args
->
clip_enabled
)
shader_addline
(
buffer
,
"gl_ClipVertex = gl_Position;
\n
"
);
/* Write the final position.
*
...
...
@@ -4115,9 +4116,6 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context
*/
shader_addline
(
buffer
,
"gl_Position.y = gl_Position.y * posFixup.y;
\n
"
);
shader_addline
(
buffer
,
"gl_Position.xy += posFixup.zw * gl_Position.ww;
\n
"
);
if
(
args
->
clip_enabled
)
{
shader_addline
(
buffer
,
"gl_ClipVertex = gl_Position;
\n
"
);
}
/* Z coord [0;1]->[-1;1] mapping, see comment in transform_projection in state.c
*
...
...
dlls/wined3d/state.c
View file @
75386a99
...
...
@@ -3798,24 +3798,17 @@ static void clipplane(DWORD state_id, struct wined3d_stateblock *stateblock, str
return
;
}
glMatrixMode
(
GL_MODELVIEW
);
glPushMatrix
();
/* Clip Plane settings are affected by the model view in OpenGL, the View transform in direct3d */
if
(
!
use_vs
(
state
))
{
glMatrixMode
(
GL_MODELVIEW
);
glPushMatrix
();
glLoadMatrixf
(
&
state
->
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
}
else
{
/* with vertex shaders, clip planes are not transformed in direct3d,
* in OpenGL they are still transformed by the model view.
* Use this to swap the y coordinate if necessary
*/
glMatrixMode
(
GL_MODELVIEW
);
glPushMatrix
();
glLoadIdentity
();
if
(
context
->
render_offscreen
)
glScalef
(
1
.
0
f
,
-
1
.
0
f
,
1
.
0
f
);
}
TRACE
(
"Clipplane [%.8e, %.8e, %.8e, %.8e]
\n
"
,
state
->
clip_planes
[
index
][
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