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
93db4433
Commit
93db4433
authored
May 24, 2006
by
Stefan Dösinger
Committed by
Alexandre Julliard
May 25, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Color keying emulation.
parent
5eeead1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
34 deletions
+58
-34
device.c
dlls/wined3d/device.c
+58
-34
No files found.
dlls/wined3d/device.c
View file @
93db4433
...
...
@@ -3212,46 +3212,55 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
break
;
case
WINED3DRS_ALPHATESTENABLE
:
if
(
Value
)
{
glEnable
(
GL_ALPHA_TEST
);
checkGLcall
(
"glEnable GL_ALPHA_TEST"
);
}
else
{
glDisable
(
GL_ALPHA_TEST
);
checkGLcall
(
"glDisable GL_ALPHA_TEST"
);
}
break
;
case
WINED3DRS_ALPHAFUNC
:
case
WINED3DRS_ALPHAREF
:
case
WINED3DRS_COLORKEYENABLE
:
{
int
glParm
=
GL_LESS
;
float
ref
=
((
float
)
This
->
stateBlock
->
renderState
[
WINED3DRS_ALPHAREF
])
/
255
.
0
f
;
int
glParm
=
0
.
0
;
float
ref
=
GL_LESS
;
BOOL
enable_ckey
=
FALSE
;
switch
((
D3DCMPFUNC
)
Value
)
{
case
D3DCMP_NEVER
:
glParm
=
GL_NEVER
;
break
;
case
D3DCMP_LESS
:
glParm
=
GL_LESS
;
break
;
case
D3DCMP_EQUAL
:
glParm
=
GL_EQUAL
;
break
;
case
D3DCMP_LESSEQUAL
:
glParm
=
GL_LEQUAL
;
break
;
case
D3DCMP_GREATER
:
glParm
=
GL_GREATER
;
break
;
case
D3DCMP_NOTEQUAL
:
glParm
=
GL_NOTEQUAL
;
break
;
case
D3DCMP_GREATEREQUAL
:
glParm
=
GL_GEQUAL
;
break
;
case
D3DCMP_ALWAYS
:
glParm
=
GL_ALWAYS
;
break
;
default:
FIXME
(
"Unrecognized/Unhandled D3DCMPFUNC value %ld
\n
"
,
Value
);
IWineD3DSurfaceImpl
*
surf
;
/* Find out if the texture on the first stage has a ckey set */
if
(
This
->
stateBlock
->
textures
[
0
])
{
surf
=
(
IWineD3DSurfaceImpl
*
)
((
IWineD3DTextureImpl
*
)
This
->
stateBlock
->
textures
[
0
])
->
surfaces
[
0
];
if
(
surf
->
CKeyFlags
&
DDSD_CKSRCBLT
)
enable_ckey
=
TRUE
;
}
TRACE
(
"glAlphaFunc with Parm=%x, ref=%f
\n
"
,
glParm
,
ref
);
glAlphaFunc
(
glParm
,
ref
);
This
->
alphafunc
=
glParm
;
checkGLcall
(
"glAlphaFunc"
);
}
break
;
case
WINED3DRS_ALPHAREF
:
{
int
glParm
=
This
->
alphafunc
;
float
ref
=
1
.
0
f
;
if
(
This
->
stateBlock
->
renderState
[
WINED3DRS_ALPHATESTENABLE
]
||
(
This
->
stateBlock
->
renderState
[
WINED3DRS_COLORKEYENABLE
]
&&
enable_ckey
))
{
glEnable
(
GL_ALPHA_TEST
);
checkGLcall
(
"glEnable GL_ALPHA_TEST"
);
}
else
{
glDisable
(
GL_ALPHA_TEST
);
checkGLcall
(
"glDisable GL_ALPHA_TEST"
);
/* Alpha test is disabled, don't bother setting the params - it will happen on the next
* enable call
*/
break
;
}
ref
=
((
float
)
Value
)
/
255
.
0
f
;
TRACE
(
"glAlphaFunc with Parm=%x, ref=%f
\n
"
,
glParm
,
ref
);
if
(
This
->
stateBlock
->
renderState
[
WINED3DRS_COLORKEYENABLE
]
&&
enable_ckey
)
{
glParm
=
GL_NOTEQUAL
;
ref
=
0
.
0
;
}
else
{
ref
=
((
float
)
This
->
stateBlock
->
renderState
[
WINED3DRS_ALPHAREF
])
/
255
.
0
f
;
switch
((
D3DCMPFUNC
)
This
->
stateBlock
->
renderState
[
WINED3DRS_ALPHAFUNC
])
{
case
D3DCMP_NEVER
:
glParm
=
GL_NEVER
;
break
;
case
D3DCMP_LESS
:
glParm
=
GL_LESS
;
break
;
case
D3DCMP_EQUAL
:
glParm
=
GL_EQUAL
;
break
;
case
D3DCMP_LESSEQUAL
:
glParm
=
GL_LEQUAL
;
break
;
case
D3DCMP_GREATER
:
glParm
=
GL_GREATER
;
break
;
case
D3DCMP_NOTEQUAL
:
glParm
=
GL_NOTEQUAL
;
break
;
case
D3DCMP_GREATEREQUAL
:
glParm
=
GL_GEQUAL
;
break
;
case
D3DCMP_ALWAYS
:
glParm
=
GL_ALWAYS
;
break
;
default:
FIXME
(
"Unrecognized/Unhandled D3DCMPFUNC value %ld
\n
"
,
Value
);
}
}
This
->
alphafunc
=
glParm
;
glAlphaFunc
(
glParm
,
ref
);
checkGLcall
(
"glAlphaFunc"
);
}
...
...
@@ -5231,6 +5240,21 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD Stage,
IWineD3DBaseTexture_Release
(
oldTexture
);
}
/* Reset color keying */
if
(
Stage
==
0
&&
This
->
stateBlock
->
renderState
[
WINED3DRS_COLORKEYENABLE
])
{
BOOL
enable_ckey
=
FALSE
;
if
(
pTexture
)
{
IWineD3DSurfaceImpl
*
surf
=
(
IWineD3DSurfaceImpl
*
)
((
IWineD3DTextureImpl
*
)
pTexture
)
->
surfaces
[
0
];
if
(
surf
->
CKeyFlags
&
DDSD_CKSRCBLT
)
enable_ckey
=
TRUE
;
}
if
(
enable_ckey
)
{
glAlphaFunc
(
GL_NOTEQUAL
,
0
.
0
);
checkGLcall
(
"glAlphaFunc"
);
}
}
return
WINED3D_OK
;
}
...
...
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