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
0d749e8e
Commit
0d749e8e
authored
Aug 21, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Aug 30, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Clear unused channels on R32F and R16F textures on readback.
parent
8c9c0840
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
surface.c
dlls/wined3d/surface.c
+37
-0
No files found.
dlls/wined3d/surface.c
View file @
0d749e8e
...
...
@@ -1963,6 +1963,41 @@ static BOOL palette9_changed(IWineD3DSurfaceImpl *This) {
return
TRUE
;
}
static
inline
void
clear_unused_channels
(
IWineD3DSurfaceImpl
*
This
)
{
GLboolean
oldwrite
[
4
];
/* Some formats have only some color channels, and the others are 1.0.
* since our rendering renders to all channels, and those pixel formats
* are emulated by using a full texture with the other channels set to 1.0
* manually, clear the unused channels.
*
* This could be done with hacking colorwriteenable to mask the colors,
* but before drawing the buffer would have to be cleared too, so there's
* no gain in that
*/
switch
(
This
->
resource
.
format
)
{
case
WINED3DFMT_R16F
:
case
WINED3DFMT_R32F
:
TRACE
(
"R16F or R32F format, clearing green, blue and alpha to 1.0
\n
"
);
/* Do not activate a context, the correct drawable is active already
* though just the read buffer is set, make sure to have the correct draw
* buffer too
*/
glDrawBuffer
(
This
->
resource
.
wineD3DDevice
->
offscreenBuffer
);
glDisable
(
GL_SCISSOR_TEST
);
glGetBooleanv
(
GL_COLOR_WRITEMASK
,
oldwrite
);
glColorMask
(
GL_FALSE
,
GL_TRUE
,
GL_TRUE
,
GL_TRUE
);
glClearColor
(
0
.
0
,
1
.
0
,
1
.
0
,
1
.
0
);
glClear
(
GL_COLOR_BUFFER_BIT
);
glColorMask
(
oldwrite
[
0
],
oldwrite
[
1
],
oldwrite
[
2
],
oldwrite
[
3
]);
if
(
!
This
->
resource
.
wineD3DDevice
->
render_offscreen
)
glDrawBuffer
(
GL_BACK
);
checkGLcall
(
"Unused channel clear
\n
"
);
break
;
default:
break
;
}
}
static
HRESULT
WINAPI
IWineD3DSurfaceImpl_LoadTexture
(
IWineD3DSurface
*
iface
,
BOOL
srgb_mode
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
IWineD3DDeviceImpl
*
device
=
This
->
resource
.
wineD3DDevice
;
...
...
@@ -2027,6 +2062,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BO
This
->
pow2Height
,
format
,
type
);
}
clear_unused_channels
(
This
);
glCopyTexSubImage2D
(
This
->
glDescription
.
target
,
This
->
glDescription
.
level
,
0
,
0
,
0
,
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