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
dbc8702e
Commit
dbc8702e
authored
Apr 20, 2011
by
Stefan Dösinger
Committed by
Alexandre Julliard
Apr 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Scale the depthbias factor by the depth buffer's depth.
parent
96b758f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
device.c
dlls/wined3d/device.c
+5
-0
state.c
dlls/wined3d/state.c
+21
-4
No files found.
dlls/wined3d/device.c
View file @
dbc8702e
...
...
@@ -5941,6 +5941,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_RENDER
(
WINED3DRS_ZENABLE
));
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_RENDER
(
WINED3DRS_STENCILENABLE
));
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_RENDER
(
WINED3DRS_STENCILWRITEMASK
));
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_RENDER
(
WINED3DRS_DEPTHBIAS
));
}
else
if
(
tmp
&&
tmp
->
resource
.
format
->
depth_size
!=
This
->
depth_stencil
->
resource
.
format
->
depth_size
)
{
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_RENDER
(
WINED3DRS_DEPTHBIAS
));
}
return
WINED3D_OK
;
...
...
dlls/wined3d/state.c
View file @
dbc8702e
...
...
@@ -1743,14 +1743,17 @@ static void state_scissor(DWORD state, struct wined3d_stateblock *stateblock, st
* convert from D3D to GL we need to divide the D3D depth bias by that value.
* There's no practical way to retrieve that value from a given GL
* implementation, but the D3D application has essentially the same problem,
* which makes a guess of
1e-6f seem reasonable here. Note that
*
SLOPESCALEDEPTHBIAS is a scaling factor for the depth slope, and doesn't
* need to be scaled. */
* which makes a guess of
the depth buffer format's highest possible value a
*
reasonable guess. Note that SLOPESCALEDEPTHBIAS is a scaling factor for the
*
depth slope, and doesn't
need to be scaled. */
static
void
state_depthbias
(
DWORD
state
,
struct
wined3d_stateblock
*
stateblock
,
struct
wined3d_context
*
context
)
{
if
(
stateblock
->
state
.
render_states
[
WINED3DRS_SLOPESCALEDEPTHBIAS
]
||
stateblock
->
state
.
render_states
[
WINED3DRS_DEPTHBIAS
])
{
IWineD3DSurfaceImpl
*
depth
=
stateblock
->
device
->
depth_stencil
;
float
scale
;
union
{
DWORD
d
;
...
...
@@ -1763,7 +1766,21 @@ static void state_depthbias(DWORD state, struct wined3d_stateblock *stateblock,
glEnable
(
GL_POLYGON_OFFSET_FILL
);
checkGLcall
(
"glEnable(GL_POLYGON_OFFSET_FILL)"
);
glPolygonOffset
(
scale_bias
.
f
,
const_bias
.
f
*
1e6
f
);
if
(
depth
)
{
const
struct
wined3d_format
*
fmt
=
depth
->
resource
.
format
;
scale
=
powf
(
2
,
fmt
->
depth_size
)
-
1
;
TRACE
(
"Depth format %s, using depthbias scale of %f
\n
"
,
debug_d3dformat
(
fmt
->
id
),
scale
);
}
else
{
/* The context manager will reapply this state on a depth stencil change */
TRACE
(
"No depth stencil, using depthbias scale of 0.0
\n
"
);
scale
=
0
;
}
glPolygonOffset
(
scale_bias
.
f
,
const_bias
.
f
*
scale
);
checkGLcall
(
"glPolygonOffset(...)"
);
}
else
{
glDisable
(
GL_POLYGON_OFFSET_FILL
);
...
...
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