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
35187471
Commit
35187471
authored
Jun 21, 2006
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jun 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Pixel format cleanup.
parent
d23b83a0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
74 deletions
+78
-74
device.c
dlls/wined3d/device.c
+15
-17
surface.c
dlls/wined3d/surface.c
+16
-22
surface_gdi.c
dlls/wined3d/surface_gdi.c
+28
-18
utils.c
dlls/wined3d/utils.c
+0
-0
volume.c
dlls/wined3d/volume.c
+7
-7
wined3d_private.h
dlls/wined3d/wined3d_private.h
+12
-10
No files found.
dlls/wined3d/device.c
View file @
35187471
...
...
@@ -798,6 +798,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
IWineD3DSurfaceImpl
*
object
;
/*NOTE: impl ref allowed since this is a create function */
unsigned
int
pow2Width
,
pow2Height
;
unsigned
int
Size
=
1
;
const
PixelFormatDesc
*
tableEntry
=
getFormatDescEntry
(
Format
);
TRACE
(
"(%p) Create surface
\n
"
,
This
);
/** FIXME: Check ranges on the inputs are valid
...
...
@@ -861,13 +862,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
Size
=
0
;
}
else
if
(
Format
==
WINED3DFMT_DXT1
)
{
/* DXT1 is half byte per pixel */
Size
=
((
max
(
pow2Width
,
4
)
*
D3DFmtGetBpp
(
This
,
Format
)
)
*
max
(
pow2Height
,
4
))
>>
1
;
Size
=
((
max
(
pow2Width
,
4
)
*
tableEntry
->
bpp
)
*
max
(
pow2Height
,
4
))
>>
1
;
}
else
if
(
Format
==
WINED3DFMT_DXT2
||
Format
==
WINED3DFMT_DXT3
||
Format
==
WINED3DFMT_DXT4
||
Format
==
WINED3DFMT_DXT5
)
{
Size
=
((
max
(
pow2Width
,
4
)
*
D3DFmtGetBpp
(
This
,
Format
)
)
*
max
(
pow2Height
,
4
));
Size
=
((
max
(
pow2Width
,
4
)
*
tableEntry
->
bpp
)
*
max
(
pow2Height
,
4
));
}
else
{
Size
=
(
pow2Width
*
D3DFmtGetBpp
(
This
,
Format
)
)
*
pow2Height
;
Size
=
(
pow2Width
*
tableEntry
->
bpp
)
*
pow2Height
;
}
/** Create and initialise the surface resource **/
...
...
@@ -881,15 +882,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
object
->
currentDesc
.
MultiSampleQuality
=
MultisampleQuality
;
/* Setup some glformat defaults */
if
(
WINED3DFMT_UNKNOWN
!=
Format
)
{
object
->
glDescription
.
glFormat
=
D3DFmt2GLFmt
(
This
,
object
->
resource
.
format
);
object
->
glDescription
.
glFormatInternal
=
D3DFmt2GLIntFmt
(
This
,
object
->
resource
.
format
);
object
->
glDescription
.
glType
=
D3DFmt2GLType
(
This
,
object
->
resource
.
format
);
}
else
{
object
->
glDescription
.
glFormat
=
0
;
object
->
glDescription
.
glFormatInternal
=
0
;
object
->
glDescription
.
glType
=
0
;
}
object
->
glDescription
.
glFormat
=
tableEntry
->
glFormat
;
object
->
glDescription
.
glFormatInternal
=
tableEntry
->
glInternal
;
object
->
glDescription
.
glType
=
tableEntry
->
glType
;
object
->
glDescription
.
textureName
=
0
;
object
->
glDescription
.
level
=
Level
;
...
...
@@ -908,7 +903,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
if
(
WINED3DFMT_UNKNOWN
!=
Format
)
{
object
->
bytesPerPixel
=
D3DFmtGetBpp
(
This
,
Format
)
;
object
->
bytesPerPixel
=
tableEntry
->
bpp
;
object
->
pow2Size
=
(
pow2Width
*
object
->
bytesPerPixel
)
*
pow2Height
;
}
else
{
object
->
bytesPerPixel
=
0
;
...
...
@@ -1148,8 +1143,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface,
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DVolumeImpl
*
object
;
/** NOTE: impl ref allowed since this is a create function **/
const
PixelFormatDesc
*
formatDesc
=
getFormatDescEntry
(
Format
);
D3DCREATERESOURCEOBJECTINSTANCE
(
object
,
Volume
,
WINED3DRTYPE_VOLUME
,
((
Width
*
D3DFmtGetBpp
(
This
,
Format
)
)
*
Height
*
Depth
))
D3DCREATERESOURCEOBJECTINSTANCE
(
object
,
Volume
,
WINED3DRTYPE_VOLUME
,
((
Width
*
formatDesc
->
bpp
)
*
Height
*
Depth
))
TRACE
(
"(%p) : W(%d) H(%d) D(%d), Usage(%ld), Fmt(%u,%s), Pool(%s)
\n
"
,
This
,
Width
,
Height
,
Depth
,
Usage
,
Format
,
debug_d3dformat
(
Format
),
debug_d3dpool
(
Pool
));
...
...
@@ -1157,7 +1153,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface,
object
->
currentDesc
.
Width
=
Width
;
object
->
currentDesc
.
Height
=
Height
;
object
->
currentDesc
.
Depth
=
Depth
;
object
->
bytesPerPixel
=
D3DFmtGetBpp
(
This
,
Format
)
;
object
->
bytesPerPixel
=
formatDesc
->
bpp
;
/** Note: Volume textures cannot be dxtn, hence no need to check here **/
object
->
lockable
=
TRUE
;
...
...
@@ -2043,6 +2039,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EnumDisplayModes(IWineD3DDevice *iface,
DEVMODEW
DevModeW
;
int
i
;
const
PixelFormatDesc
*
formatDesc
=
getFormatDescEntry
(
pixelformat
);
TRACE
(
"(%p)->(%lx,%d,%d,%d,%p,%p)
\n
"
,
This
,
Flags
,
Width
,
Height
,
pixelformat
,
context
,
callback
);
...
...
@@ -2050,7 +2047,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EnumDisplayModes(IWineD3DDevice *iface,
/* Ignore some modes if a description was passed */
if
(
(
Width
>
0
)
&&
(
Width
!=
DevModeW
.
dmPelsWidth
))
continue
;
if
(
(
Height
>
0
)
&&
(
Height
!=
DevModeW
.
dmPelsHeight
))
continue
;
if
(
(
pixelformat
!=
WINED3DFMT_UNKNOWN
)
&&
(
D3DFmtGetBpp
(
NULL
,
pixelformat
)
!=
DevModeW
.
dmBitsPerPel
)
)
continue
;
if
(
(
pixelformat
!=
WINED3DFMT_UNKNOWN
)
&&
(
formatDesc
->
bpp
!=
DevModeW
.
dmBitsPerPel
)
)
continue
;
TRACE
(
"Enumerating %ldx%ld@%s
\n
"
,
DevModeW
.
dmPelsWidth
,
DevModeW
.
dmPelsHeight
,
debug_d3dformat
(
pixelformat_for_depth
(
DevModeW
.
dmBitsPerPel
)));
...
...
@@ -2065,6 +2062,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, U
DEVMODEW
devmode
;
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
LONG
ret
;
const
PixelFormatDesc
*
formatDesc
=
getFormatDescEntry
(
pMode
->
Format
);
TRACE
(
"(%p)->(%d,%p) Mode=%dx%dx@%d, %s
\n
"
,
This
,
iSwapChain
,
pMode
,
pMode
->
Width
,
pMode
->
Height
,
pMode
->
RefreshRate
,
debug_d3dformat
(
pMode
->
Format
));
...
...
@@ -2075,7 +2073,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, U
*/
devmode
.
dmFields
=
DM_BITSPERPEL
|
DM_PELSWIDTH
|
DM_PELSHEIGHT
;
devmode
.
dmBitsPerPel
=
D3DFmtGetBpp
(
This
,
pMode
->
Format
)
*
8
;
devmode
.
dmBitsPerPel
=
formatDesc
->
bpp
*
8
;
if
(
devmode
.
dmBitsPerPel
==
24
)
devmode
.
dmBitsPerPel
=
32
;
devmode
.
dmPelsWidth
=
pMode
->
Width
;
devmode
.
dmPelsHeight
=
pMode
->
Height
;
...
...
dlls/wined3d/surface.c
View file @
35187471
...
...
@@ -967,6 +967,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
DWORD
*
masks
;
HRESULT
hr
;
RGBQUAD
col
[
256
];
const
PixelFormatDesc
*
formatEntry
=
getFormatDescEntry
(
This
->
resource
.
format
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pHDC
);
...
...
@@ -1049,9 +1050,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
case
WINED3DFMT_A16B16G16R16
:
usage
=
0
;
b_info
->
bmiHeader
.
biCompression
=
BI_BITFIELDS
;
masks
[
0
]
=
get_bitmask_red
(
This
->
resource
.
format
)
;
masks
[
1
]
=
get_bitmask_green
(
This
->
resource
.
format
)
;
masks
[
2
]
=
get_bitmask_blue
(
This
->
resource
.
format
)
;
masks
[
0
]
=
formatEntry
->
redMask
;
masks
[
1
]
=
formatEntry
->
greenMask
;
masks
[
2
]
=
formatEntry
->
blueMask
;
break
;
default:
...
...
@@ -1186,14 +1187,12 @@ typedef enum {
HRESULT
d3dfmt_get_conv
(
IWineD3DSurfaceImpl
*
This
,
BOOL
need_alpha_ck
,
GLenum
*
format
,
GLenum
*
internal
,
GLenum
*
type
,
CONVERT_TYPES
*
convert
,
int
*
target_bpp
)
{
BOOL
colorkey_active
=
need_alpha_ck
&&
(
This
->
CKeyFlags
&
DDSD_CKSRCBLT
);
const
PixelFormatDesc
*
formatEntry
=
getFormatDescEntry
(
This
->
resource
.
format
);
/* Default values: From the surface */
*
format
=
D3DFmt2GLFmt
(
This
->
resource
.
wineD3DDevice
,
This
->
resource
.
format
);
*
internal
=
D3DFmt2GLIntFmt
(
This
->
resource
.
wineD3DDevice
,
This
->
resource
.
format
);
*
type
=
D3DFmt2GLType
(
This
->
resource
.
wineD3DDevice
,
This
->
resource
.
format
);
*
format
=
formatEntry
->
glFormat
;
*
internal
=
formatEntry
->
glInternal
;
*
type
=
formatEntry
->
glType
;
*
convert
=
NO_CONVERSION
;
*
target_bpp
=
This
->
bytesPerPixel
;
...
...
@@ -1873,6 +1872,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetContainer(IWineD3DSurface *iface, IWineD3D
HRESULT
WINAPI
IWineD3DSurfaceImpl_SetFormat
(
IWineD3DSurface
*
iface
,
WINED3DFORMAT
format
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
const
PixelFormatDesc
*
formatEntry
=
getFormatDescEntry
(
format
);
if
(
This
->
resource
.
format
!=
WINED3DFMT_UNKNOWN
)
{
FIXME
(
"(%p) : The foramt of the surface must be WINED3DFORMAT_UNKNOWN
\n
"
,
This
);
...
...
@@ -1884,29 +1884,23 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3DFORM
This
->
resource
.
size
=
0
;
}
else
if
(
format
==
WINED3DFMT_DXT1
)
{
/* DXT1 is half byte per pixel */
This
->
resource
.
size
=
((
max
(
This
->
pow2Width
,
4
)
*
D3DFmtGetBpp
(
This
->
resource
.
wineD3DDevice
,
format
)
)
*
max
(
This
->
pow2Height
,
4
))
>>
1
;
This
->
resource
.
size
=
((
max
(
This
->
pow2Width
,
4
)
*
formatEntry
->
bpp
)
*
max
(
This
->
pow2Height
,
4
))
>>
1
;
}
else
if
(
format
==
WINED3DFMT_DXT2
||
format
==
WINED3DFMT_DXT3
||
format
==
WINED3DFMT_DXT4
||
format
==
WINED3DFMT_DXT5
)
{
This
->
resource
.
size
=
((
max
(
This
->
pow2Width
,
4
)
*
D3DFmtGetBpp
(
This
->
resource
.
wineD3DDevice
,
format
)
)
*
max
(
This
->
pow2Height
,
4
));
This
->
resource
.
size
=
((
max
(
This
->
pow2Width
,
4
)
*
formatEntry
->
bpp
)
*
max
(
This
->
pow2Height
,
4
));
}
else
{
This
->
resource
.
size
=
(
This
->
pow2Width
*
D3DFmtGetBpp
(
This
->
resource
.
wineD3DDevice
,
format
)
)
*
This
->
pow2Height
;
This
->
resource
.
size
=
(
This
->
pow2Width
*
formatEntry
->
bpp
)
*
This
->
pow2Height
;
}
/* Setup some glformat defaults */
if
(
format
!=
WINED3DFMT_UNKNOWN
)
{
This
->
glDescription
.
glFormat
=
D3DFmt2GLFmt
(
This
->
resource
.
wineD3DDevice
,
format
);
This
->
glDescription
.
glFormatInternal
=
D3DFmt2GLIntFmt
(
This
->
resource
.
wineD3DDevice
,
format
);
This
->
glDescription
.
glType
=
D3DFmt2GLType
(
This
->
resource
.
wineD3DDevice
,
format
);
}
else
{
This
->
glDescription
.
glFormat
=
0
;
This
->
glDescription
.
glFormatInternal
=
0
;
This
->
glDescription
.
glType
=
0
;
}
This
->
glDescription
.
glFormat
=
formatEntry
->
glFormat
;
This
->
glDescription
.
glFormatInternal
=
formatEntry
->
glInternal
;
This
->
glDescription
.
glType
=
formatEntry
->
glType
;
if
(
format
!=
WINED3DFMT_UNKNOWN
)
{
This
->
bytesPerPixel
=
D3DFmtGetBpp
(
This
->
resource
.
wineD3DDevice
,
format
)
;
This
->
bytesPerPixel
=
formatEntry
->
bpp
;
This
->
pow2Size
=
(
This
->
pow2Width
*
This
->
bytesPerPixel
)
*
This
->
pow2Height
;
}
else
{
This
->
bytesPerPixel
=
0
;
...
...
dlls/wined3d/surface_gdi.c
View file @
35187471
...
...
@@ -462,6 +462,7 @@ IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface,
WINED3DFORMAT
dfmt
=
WINED3DFMT_UNKNOWN
,
sfmt
=
WINED3DFMT_UNKNOWN
;
int
bpp
,
srcheight
,
srcwidth
,
dstheight
,
dstwidth
,
width
;
int
x
,
y
;
const
PixelFormatDesc
*
sEntry
,
*
dEntry
;
LPBYTE
dbuf
,
sbuf
;
TRACE
(
"(%p)->(%p,%p,%p,%lx,%p)
\n
"
,
This
,
DestRect
,
Src
,
SrcRect
,
Flags
,
DDBltFx
);
...
...
@@ -494,6 +495,8 @@ IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface,
dfmt
=
This
->
resource
.
format
;
slock
=
dlock
;
sfmt
=
dfmt
;
sEntry
=
getFormatDescEntry
(
sfmt
);
dEntry
=
sEntry
;
}
else
{
...
...
@@ -502,13 +505,15 @@ IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface,
IWineD3DSurface_LockRect
(
SrcSurface
,
&
slock
,
NULL
,
D3DLOCK_READONLY
);
sfmt
=
Src
->
resource
.
format
;
}
sEntry
=
getFormatDescEntry
(
sfmt
);
dfmt
=
This
->
resource
.
format
;
dEntry
=
getFormatDescEntry
(
dfmt
);
IWineD3DSurface_LockRect
(
iface
,
&
dlock
,
NULL
,
0
);
}
if
(
!
DDBltFx
||
!
(
DDBltFx
->
dwDDFX
))
Flags
&=
~
DDBLT_DDFX
;
if
(
isFourcc
(
sfmt
)
&&
isFourcc
(
dfmt
)
)
if
(
sEntry
->
isFourcc
&&
dEntry
->
isFourcc
)
{
if
(
sfmt
!=
dfmt
)
{
...
...
@@ -521,8 +526,7 @@ IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface,
goto
release
;
}
if
(
isFourcc
(
sfmt
)
&&
(
!
isFourcc
(
dfmt
)))
if
(
sEntry
->
isFourcc
&&
!
dEntry
->
isFourcc
)
{
FIXME
(
"DXTC decompression not supported right now
\n
"
);
goto
release
;
...
...
@@ -897,9 +901,9 @@ IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface,
}
else
{
keymask
=
get_bitmask_red
(
Src
->
resource
.
format
)
|
get_bitmask_green
(
Src
->
resource
.
format
)
|
get_bitmask_blue
(
Src
->
resource
.
format
)
;
keymask
=
sEntry
->
redMask
|
sEntry
->
greenMask
|
sEntry
->
blueMask
;
}
Flags
&=
~
(
DDBLT_KEYSRC
|
DDBLT_KEYDEST
|
DDBLT_KEYSRCOVERRIDE
|
DDBLT_KEYDESTOVERRIDE
);
}
...
...
@@ -1086,6 +1090,7 @@ IWineGDISurfaceImpl_BltFast(IWineD3DSurface *iface,
RECT
rsrc2
;
RECT
lock_src
,
lock_dst
,
lock_union
;
BYTE
*
sbuf
,
*
dbuf
;
const
PixelFormatDesc
*
sEntry
,
*
dEntry
;
if
(
TRACE_ON
(
d3d_surface
))
{
...
...
@@ -1169,8 +1174,10 @@ IWineGDISurfaceImpl_BltFast(IWineD3DSurface *iface,
/* Since slock was originally copied from this surface's description, we can just reuse it */
assert
(
This
->
resource
.
allocatedMemory
!=
NULL
);
sbuf
=
(
BYTE
*
)
This
->
resource
.
allocatedMemory
+
lock_src
.
top
*
pitch
+
lock_src
.
left
*
bpp
;
dbuf
=
(
BYTE
*
)
This
->
resource
.
allocatedMemory
+
lock_dst
.
top
*
pitch
+
lock_dst
.
left
*
bpp
;
sbuf
=
(
BYTE
*
)
This
->
resource
.
allocatedMemory
+
lock_src
.
top
*
pitch
+
lock_src
.
left
*
bpp
;
dbuf
=
(
BYTE
*
)
This
->
resource
.
allocatedMemory
+
lock_dst
.
top
*
pitch
+
lock_dst
.
left
*
bpp
;
sEntry
=
getFormatDescEntry
(
Src
->
resource
.
format
);
dEntry
=
sEntry
;
}
else
{
...
...
@@ -1182,10 +1189,13 @@ IWineGDISurfaceImpl_BltFast(IWineD3DSurface *iface,
sbuf
=
slock
.
pBits
;
dbuf
=
dlock
.
pBits
;
TRACE
(
"Dst is at %p, Src is at %p
\n
"
,
dbuf
,
sbuf
);
sEntry
=
getFormatDescEntry
(
Src
->
resource
.
format
);
dEntry
=
getFormatDescEntry
(
This
->
resource
.
format
);
}
/* Handle first the FOURCC surfaces... */
if
(
isFourcc
(
Src
->
resource
.
format
)
&&
isFourcc
(
This
->
resource
.
format
)
)
if
(
sEntry
->
isFourcc
&&
dEntry
->
isFourcc
)
{
TRACE
(
"Fourcc -> Fourcc copy
\n
"
);
if
(
trans
)
...
...
@@ -1202,8 +1212,7 @@ IWineGDISurfaceImpl_BltFast(IWineD3DSurface *iface,
memcpy
(
dbuf
,
sbuf
,
This
->
resource
.
size
);
goto
error
;
}
if
((
isFourcc
(
Src
->
resource
.
format
))
&&
(
!
isFourcc
(
This
->
resource
.
format
)))
if
(
sEntry
->
isFourcc
&&
!
dEntry
->
isFourcc
)
{
/* TODO: Use the libtxc_dxtn.so shared library to do
* software decompression
...
...
@@ -1360,6 +1369,7 @@ const char* filename)
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
static
char
*
output
=
NULL
;
static
int
size
=
0
;
const
PixelFormatDesc
*
formatEntry
=
getFormatDescEntry
(
This
->
resource
.
format
);
if
(
This
->
pow2Width
>
size
)
{
output
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
This
->
pow2Width
*
3
);
...
...
@@ -1404,9 +1414,9 @@ const char* filename)
pix_width
=
This
->
bytesPerPixel
;
red_shift
=
get_shift
(
get_bitmask_red
(
This
->
resource
.
format
)
);
green_shift
=
get_shift
(
get_bitmask_green
(
This
->
resource
.
format
)
);
blue_shift
=
get_shift
(
get_bitmask_blue
(
This
->
resource
.
format
)
);
red_shift
=
get_shift
(
formatEntry
->
redMask
);
green_shift
=
get_shift
(
formatEntry
->
greenMask
);
blue_shift
=
get_shift
(
formatEntry
->
blueMask
);
for
(
y
=
0
;
y
<
This
->
pow2Height
;
y
++
)
{
unsigned
char
*
src
=
(
unsigned
char
*
)
This
->
resource
.
allocatedMemory
+
(
y
*
1
*
IWineD3DSurface_GetPitch
(
iface
));
...
...
@@ -1421,11 +1431,11 @@ const char* filename)
}
src
+=
1
*
pix_width
;
comp
=
color
&
get_bitmask_red
(
This
->
resource
.
format
)
;
comp
=
color
&
formatEntry
->
redMask
;
output
[
3
*
x
+
0
]
=
red_shift
>
0
?
comp
>>
red_shift
:
comp
<<
-
red_shift
;
comp
=
color
&
get_bitmask_green
(
This
->
resource
.
format
)
;
comp
=
color
&
formatEntry
->
greenMask
;
output
[
3
*
x
+
1
]
=
green_shift
>
0
?
comp
>>
green_shift
:
comp
<<
-
green_shift
;
comp
=
color
&
get_bitmask_blue
(
This
->
resource
.
format
)
;
comp
=
color
&
formatEntry
->
blueMask
;
output
[
3
*
x
+
2
]
=
blue_shift
>
0
?
comp
>>
blue_shift
:
comp
<<
-
blue_shift
;
}
fwrite
(
output
,
3
*
This
->
pow2Width
,
1
,
f
);
...
...
@@ -1467,7 +1477,7 @@ IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface)
This
->
resource
.
allocatedMemory
=
NULL
;
/* We don't mind the nonpow2 stuff in GDI */
This
->
resource
.
size
=
This
->
currentDesc
.
Width
*
D3DFmtGetBpp
(
This
->
resource
.
wineD3DDevice
,
This
->
resource
.
format
)
*
This
->
currentDesc
.
Width
;
This
->
resource
.
size
=
This
->
currentDesc
.
Width
*
getFormatDescEntry
(
This
->
resource
.
format
)
->
bpp
*
This
->
currentDesc
.
Width
;
This
->
pow2Size
=
This
->
resource
.
size
;
This
->
pow2Width
=
This
->
currentDesc
.
Width
;
This
->
pow2Height
=
This
->
currentDesc
.
Height
;
...
...
dlls/wined3d/utils.c
View file @
35187471
This diff is collapsed.
Click to expand it.
dlls/wined3d/volume.c
View file @
35187471
...
...
@@ -283,28 +283,28 @@ static HRESULT WINAPI IWineD3DVolumeImpl_SetContainer(IWineD3DVolume *iface, IWi
static
HRESULT
WINAPI
IWineD3DVolumeImpl_LoadTexture
(
IWineD3DVolume
*
iface
,
GLenum
gl_level
)
{
IWineD3DVolumeImpl
*
This
=
(
IWineD3DVolumeImpl
*
)
iface
;
IWineD3DDeviceImpl
*
myDevice
=
This
->
resource
.
wineD3DDevice
;
const
PixelFormatDesc
*
formatEntry
=
getFormatDescEntry
(
This
->
resource
.
format
)
;
TRACE
(
"Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p
\n
"
,
GL_TEXTURE_3D
,
gl_level
,
D3DFmt2GLIntFmt
(
myDevice
,
This
->
resource
.
format
)
,
formatEntry
->
glInternal
,
This
->
currentDesc
.
Width
,
This
->
currentDesc
.
Height
,
This
->
currentDesc
.
Depth
,
0
,
D3DFmt2GLFmt
(
myDevice
,
This
->
resource
.
format
)
,
D3DFmt2GLType
(
myDevice
,
This
->
resource
.
format
)
,
formatEntry
->
glFormat
,
formatEntry
->
glType
,
This
->
resource
.
allocatedMemory
);
glTexImage3D
(
GL_TEXTURE_3D
,
gl_level
,
D3DFmt2GLIntFmt
(
myDevice
,
This
->
resource
.
format
)
,
formatEntry
->
glInternal
,
This
->
currentDesc
.
Width
,
This
->
currentDesc
.
Height
,
This
->
currentDesc
.
Depth
,
0
,
D3DFmt2GLFmt
(
myDevice
,
This
->
resource
.
format
)
,
D3DFmt2GLType
(
myDevice
,
This
->
resource
.
format
)
,
formatEntry
->
glFormat
,
formatEntry
->
glType
,
This
->
resource
.
allocatedMemory
);
checkGLcall
(
"glTexImage3D"
);
return
WINED3D_OK
;
...
...
dlls/wined3d/wined3d_private.h
View file @
35187471
...
...
@@ -1169,11 +1169,6 @@ GLenum StencilFunc(DWORD func);
void
set_tex_op
(
IWineD3DDevice
*
iface
,
BOOL
isAlpha
,
int
Stage
,
D3DTEXTUREOP
op
,
DWORD
arg1
,
DWORD
arg2
,
DWORD
arg3
);
void
set_texture_matrix
(
const
float
*
smat
,
DWORD
flags
,
BOOL
calculatedCoords
);
SHORT
D3DFmtGetBpp
(
IWineD3DDeviceImpl
*
This
,
D3DFORMAT
fmt
);
GLenum
D3DFmt2GLFmt
(
IWineD3DDeviceImpl
*
This
,
D3DFORMAT
fmt
);
GLenum
D3DFmt2GLType
(
IWineD3DDeviceImpl
*
This
,
D3DFORMAT
fmt
);
GLint
D3DFmt2GLIntFmt
(
IWineD3DDeviceImpl
*
This
,
D3DFORMAT
fmt
);
int
D3DFmtMakeGlCfg
(
D3DFORMAT
BackBufferFormat
,
D3DFORMAT
StencilBufferFormat
,
int
*
attribs
,
int
*
nAttribs
,
BOOL
alternate
);
/* Math utils */
...
...
@@ -1574,10 +1569,17 @@ DWORD IWineD3DPaletteImpl_Size(DWORD dwFlags);
/* DirectDraw utility functions */
extern
WINED3DFORMAT
pixelformat_for_depth
(
DWORD
depth
);
LONG
get_bitmask_red
(
WINED3DFORMAT
fmt
);
LONG
get_bitmask_green
(
WINED3DFORMAT
fmt
);
LONG
get_bitmask_blue
(
WINED3DFORMAT
fmt
);
LONG
get_bitmask_alpha
(
WINED3DFORMAT
fmt
);
BOOL
isFourcc
(
WINED3DFORMAT
fmt
);
/*****************************************************************************
* Pixel format management
*/
typedef
struct
{
WINED3DFORMAT
format
;
DWORD
alphaMask
,
redMask
,
greenMask
,
blueMask
;
UINT
bpp
;
BOOL
isFourcc
;
GLint
glInternal
,
glFormat
,
glType
;
}
PixelFormatDesc
;
const
PixelFormatDesc
*
getFormatDescEntry
(
WINED3DFORMAT
fmt
);
#endif
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