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
2dc7fc29
Commit
2dc7fc29
authored
Mar 13, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 13, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Remove the format field from IWineD3DResourceClass.
parent
a56e3a10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
76 additions
and
57 deletions
+76
-57
buffer.c
dlls/wined3d/buffer.c
+2
-2
context.c
dlls/wined3d/context.c
+15
-8
cubetexture.c
dlls/wined3d/cubetexture.c
+2
-1
device.c
dlls/wined3d/device.c
+21
-13
resource.c
dlls/wined3d/resource.c
+3
-3
surface.c
dlls/wined3d/surface.c
+0
-0
surface_base.c
dlls/wined3d/surface_base.c
+20
-20
surface_gdi.c
dlls/wined3d/surface_gdi.c
+5
-3
swapchain.c
dlls/wined3d/swapchain.c
+1
-1
texture.c
dlls/wined3d/texture.c
+3
-1
volume.c
dlls/wined3d/volume.c
+2
-3
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-2
No files found.
dlls/wined3d/buffer.c
View file @
2dc7fc29
...
...
@@ -915,7 +915,7 @@ static HRESULT STDMETHODCALLTYPE buffer_GetDesc(IWineD3DBuffer *iface, WINED3DVE
TRACE
(
"(%p)
\n
"
,
This
);
desc
->
Format
=
This
->
resource
.
format
;
desc
->
Format
=
This
->
resource
.
format
_desc
->
format
;
desc
->
Type
=
This
->
resource
.
resourceType
;
desc
->
Usage
=
This
->
resource
.
usage
;
desc
->
Pool
=
This
->
resource
.
pool
;
...
...
@@ -1166,7 +1166,7 @@ static HRESULT STDMETHODCALLTYPE IWineD3DIndexBufferImpl_GetDesc(IWineD3DIndexBu
TRACE
(
"(%p)
\n
"
,
This
);
pDesc
->
Format
=
This
->
resource
.
format
;
pDesc
->
Format
=
This
->
resource
.
format
_desc
->
format
;
pDesc
->
Type
=
This
->
resource
.
resourceType
;
pDesc
->
Usage
=
This
->
resource
.
usage
;
pDesc
->
Pool
=
This
->
resource
.
pool
;
...
...
dlls/wined3d/context.c
View file @
2dc7fc29
...
...
@@ -200,14 +200,16 @@ static void context_check_fbo_status(IWineD3DDevice *iface)
attachment
=
(
IWineD3DSurfaceImpl
*
)
This
->
activeContext
->
current_fbo
->
render_targets
[
i
];
if
(
attachment
)
{
FIXME
(
"
\t
Color attachment %d: (%p) %s %ux%u
\n
"
,
i
,
attachment
,
debug_d3dformat
(
attachment
->
resource
.
format
),
FIXME
(
"
\t
Color attachment %d: (%p) %s %ux%u
\n
"
,
i
,
attachment
,
debug_d3dformat
(
attachment
->
resource
.
format_desc
->
format
),
attachment
->
pow2Width
,
attachment
->
pow2Height
);
}
}
attachment
=
(
IWineD3DSurfaceImpl
*
)
This
->
activeContext
->
current_fbo
->
depth_stencil
;
if
(
attachment
)
{
FIXME
(
"
\t
Depth attachment: (%p) %s %ux%u
\n
"
,
attachment
,
debug_d3dformat
(
attachment
->
resource
.
format
),
FIXME
(
"
\t
Depth attachment: (%p) %s %ux%u
\n
"
,
attachment
,
debug_d3dformat
(
attachment
->
resource
.
format_desc
->
format
),
attachment
->
pow2Width
,
attachment
->
pow2Height
);
}
}
...
...
@@ -644,16 +646,21 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
int
iPixelFormat
=
0
;
IWineD3DSurface
*
StencilSurface
=
This
->
stencilBufferTarget
;
WINED3DFORMAT
StencilBufferFormat
=
(
NULL
!=
StencilSurface
)
?
((
IWineD3DSurfaceImpl
*
)
StencilSurface
)
->
resource
.
format
:
0
;
WINED3DFORMAT
StencilBufferFormat
=
StencilSurface
?
((
IWineD3DSurfaceImpl
*
)
StencilSurface
)
->
resource
.
format_desc
->
format
:
0
;
/* Try to find a pixel format with pbuffer support. */
iPixelFormat
=
WineD3D_ChoosePixelFormat
(
This
,
hdc_parent
,
target
->
resource
.
format
,
StencilBufferFormat
,
FALSE
/* auxBuffers */
,
0
/* numSamples */
,
TRUE
/* PBUFFER */
,
FALSE
/* findCompatible */
);
iPixelFormat
=
WineD3D_ChoosePixelFormat
(
This
,
hdc_parent
,
target
->
resource
.
format_desc
->
format
,
StencilBufferFormat
,
FALSE
/* auxBuffers */
,
0
/* numSamples */
,
TRUE
/* PBUFFER */
,
FALSE
/* findCompatible */
);
if
(
!
iPixelFormat
)
{
TRACE
(
"Trying to locate a compatible pixel format because an exact match failed.
\n
"
);
/* For some reason we weren't able to find a format, try to find something instead of crashing.
* A reason for failure could have been wglChoosePixelFormatARB strictness. */
iPixelFormat
=
WineD3D_ChoosePixelFormat
(
This
,
hdc_parent
,
target
->
resource
.
format
,
StencilBufferFormat
,
FALSE
/* auxBuffer */
,
0
/* numSamples */
,
TRUE
/* PBUFFER */
,
TRUE
/* findCompatible */
);
iPixelFormat
=
WineD3D_ChoosePixelFormat
(
This
,
hdc_parent
,
target
->
resource
.
format_desc
->
format
,
StencilBufferFormat
,
FALSE
/* auxBuffer */
,
0
/* numSamples */
,
TRUE
/* PBUFFER */
,
TRUE
/* findCompatible */
);
}
/* This shouldn't happen as ChoosePixelFormat always returns something */
...
...
@@ -684,7 +691,7 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
PIXELFORMATDESCRIPTOR
pfd
;
int
iPixelFormat
;
int
res
;
WINED3DFORMAT
ColorFormat
=
target
->
resource
.
format
;
WINED3DFORMAT
ColorFormat
=
target
->
resource
.
format
_desc
->
format
;
WINED3DFORMAT
DepthStencilFormat
=
0
;
BOOL
auxBuffers
=
FALSE
;
int
numSamples
=
0
;
...
...
@@ -699,9 +706,9 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_BACKBUFFER
)
{
auxBuffers
=
TRUE
;
if
(
target
->
resource
.
format
==
WINED3DFMT_X4R4G4B4
)
if
(
target
->
resource
.
format_desc
->
format
==
WINED3DFMT_X4R4G4B4
)
ColorFormat
=
WINED3DFMT_A4R4G4B4
;
else
if
(
target
->
resource
.
format
==
WINED3DFMT_X8R8G8B8
)
else
if
(
target
->
resource
.
format
_desc
->
format
==
WINED3DFMT_X8R8G8B8
)
ColorFormat
=
WINED3DFMT_A8R8G8B8
;
}
...
...
dlls/wined3d/cubetexture.c
View file @
2dc7fc29
...
...
@@ -120,7 +120,8 @@ void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB s
ActivateContext
(
device
,
device
->
lastActiveRenderTarget
,
CTXUSAGE_RESOURCELOAD
);
}
if
(
This
->
resource
.
format
==
WINED3DFMT_P8
||
This
->
resource
.
format
==
WINED3DFMT_A8P8
)
{
if
(
This
->
resource
.
format_desc
->
format
==
WINED3DFMT_P8
||
This
->
resource
.
format_desc
->
format
==
WINED3DFMT_A8P8
)
{
for
(
i
=
0
;
i
<
This
->
baseTexture
.
levels
;
i
++
)
{
for
(
j
=
WINED3DCUBEMAP_FACE_POSITIVE_X
;
j
<=
WINED3DCUBEMAP_FACE_NEGATIVE_Z
;
j
++
)
{
if
(
palette9_changed
((
IWineD3DSurfaceImpl
*
)
This
->
surfaces
[
j
][
i
]))
{
...
...
dlls/wined3d/device.c
View file @
2dc7fc29
...
...
@@ -251,7 +251,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface,
IWineD3DDeviceImpl_AddResource
(
iface
,
(
IWineD3DResource
*
)
object
);
TRACE
(
"size %#x, usage=%#x, format %s, memory @ %p, iface @ %p
\n
"
,
object
->
resource
.
size
,
object
->
resource
.
usage
,
debug_d3dformat
(
object
->
resource
.
format
),
object
->
resource
.
allocatedMemory
,
object
);
debug_d3dformat
(
object
->
resource
.
format
_desc
->
format
),
object
->
resource
.
allocatedMemory
,
object
);
*
buffer
=
(
IWineD3DBuffer
*
)
object
;
...
...
@@ -262,8 +262,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
DWORD
FVF
,
WINED3DPOOL
Pool
,
IWineD3DBuffer
**
ppVertexBuffer
,
HANDLE
*
sharedHandle
,
IUnknown
*
parent
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
/* Dummy format for now */
const
struct
GlPixelFormatDesc
*
format_desc
=
getFormatDescEntry
(
WINED3DFMT_VERTEXDATA
,
&
This
->
adapter
->
gl_info
);
struct
wined3d_buffer
*
object
;
WINED3DFORMAT
Format
=
WINED3DFMT_VERTEXDATA
;
/* Dummy format for now */
int
dxVersion
=
(
(
IWineD3DImpl
*
)
This
->
wineD3D
)
->
dxVersion
;
HRESULT
hr
;
BOOL
conv
;
...
...
@@ -290,7 +291,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
}
object
->
vtbl
=
&
wined3d_buffer_vtbl
;
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_VERTEXBUFFER
,
This
,
Size
,
Usage
,
Format
,
Pool
,
parent
);
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_VERTEXBUFFER
,
This
,
Size
,
Usage
,
format_desc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -392,6 +393,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface
WINED3DFORMAT
Format
,
WINED3DPOOL
Pool
,
IWineD3DIndexBuffer
**
ppIndexBuffer
,
HANDLE
*
sharedHandle
,
IUnknown
*
parent
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
const
struct
GlPixelFormatDesc
*
format_desc
=
getFormatDescEntry
(
Format
,
&
This
->
adapter
->
gl_info
);
IWineD3DIndexBufferImpl
*
object
;
HRESULT
hr
;
...
...
@@ -407,7 +409,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface
}
object
->
lpVtbl
=
&
IWineD3DIndexBuffer_Vtbl
;
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_INDEXBUFFER
,
This
,
Length
,
Usage
,
Format
,
Pool
,
parent
);
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_INDEXBUFFER
,
This
,
Length
,
Usage
,
format_desc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -778,7 +780,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
return
WINED3DERR_INVALIDCALL
;
}
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_SURFACE
,
This
,
Size
,
Usage
,
Format
,
Pool
,
parent
);
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_SURFACE
,
This
,
Size
,
Usage
,
glDesc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -902,6 +904,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface,
IWineD3DTexture
**
ppTexture
,
HANDLE
*
pSharedHandle
,
IUnknown
*
parent
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
const
struct
GlPixelFormatDesc
*
format_desc
=
getFormatDescEntry
(
Format
,
&
This
->
adapter
->
gl_info
);
IWineD3DTextureImpl
*
object
;
unsigned
int
i
;
UINT
tmpW
;
...
...
@@ -977,7 +980,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface,
}
object
->
lpVtbl
=
&
IWineD3DTexture_Vtbl
;
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_TEXTURE
,
This
,
0
,
Usage
,
Format
,
Pool
,
parent
);
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_TEXTURE
,
This
,
0
,
Usage
,
format_desc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -1074,6 +1077,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
IWineD3DVolumeTexture
**
ppVolumeTexture
,
HANDLE
*
pSharedHandle
,
IUnknown
*
parent
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
const
struct
GlPixelFormatDesc
*
format_desc
=
getFormatDescEntry
(
Format
,
&
This
->
adapter
->
gl_info
);
IWineD3DVolumeTextureImpl
*
object
;
unsigned
int
i
;
UINT
tmpW
;
...
...
@@ -1124,7 +1128,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
}
object
->
lpVtbl
=
&
IWineD3DVolumeTexture_Vtbl
;
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_VOLUMETEXTURE
,
This
,
0
,
Usage
,
Format
,
Pool
,
parent
);
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_VOLUMETEXTURE
,
This
,
0
,
Usage
,
format_desc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -1217,7 +1221,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface,
object
->
lpVtbl
=
&
IWineD3DVolume_Vtbl
;
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_VOLUME
,
This
,
Width
*
Height
*
Depth
*
format_desc
->
byte_count
,
Usage
,
Format
,
Pool
,
parent
);
Width
*
Height
*
Depth
*
format_desc
->
byte_count
,
Usage
,
format_desc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -1256,6 +1260,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
IWineD3DCubeTexture
**
ppCubeTexture
,
HANDLE
*
pSharedHandle
,
IUnknown
*
parent
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
const
struct
GlPixelFormatDesc
*
format_desc
=
getFormatDescEntry
(
Format
,
&
This
->
adapter
->
gl_info
);
IWineD3DCubeTextureImpl
*
object
;
/** NOTE: impl ref allowed since this is a create function **/
unsigned
int
i
,
j
;
UINT
tmpW
;
...
...
@@ -1306,7 +1311,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
}
object
->
lpVtbl
=
&
IWineD3DCubeTexture_Vtbl
;
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_CUBETEXTURE
,
This
,
0
,
Usage
,
Format
,
Pool
,
parent
);
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_CUBETEXTURE
,
This
,
0
,
Usage
,
format_desc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -5840,7 +5845,9 @@ static void dirtify_p8_texture_samplers(IWineD3DDeviceImpl *device)
for
(
i
=
0
;
i
<
MAX_COMBINED_SAMPLERS
;
i
++
)
{
IWineD3DBaseTextureImpl
*
texture
=
(
IWineD3DBaseTextureImpl
*
)
device
->
stateBlock
->
textures
[
i
];
if
(
texture
&&
(
texture
->
resource
.
format
==
WINED3DFMT_P8
||
texture
->
resource
.
format
==
WINED3DFMT_A8P8
))
{
if
(
texture
&&
(
texture
->
resource
.
format_desc
->
format
==
WINED3DFMT_P8
||
texture
->
resource
.
format_desc
->
format
==
WINED3DFMT_A8P8
))
{
IWineD3DDeviceImpl_MarkStateDirty
(
device
,
STATE_SAMPLER
(
i
));
}
}
...
...
@@ -6507,7 +6514,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface, IWineD
/* Just forward this to the DirectDraw blitting engine */
memset
(
&
BltFx
,
0
,
sizeof
(
BltFx
));
BltFx
.
dwSize
=
sizeof
(
BltFx
);
BltFx
.
u5
.
dwFillColor
=
argb_to_fmt
(
color
,
surface
->
resource
.
format
);
BltFx
.
u5
.
dwFillColor
=
argb_to_fmt
(
color
,
surface
->
resource
.
format
_desc
->
format
);
return
IWineD3DSurface_Blt
(
pSurface
,
(
const
RECT
*
)
pRect
,
NULL
,
NULL
,
WINEDDBLT_COLORFILL
,
&
BltFx
,
WINED3DTEXF_NONE
);
}
...
...
@@ -6555,7 +6562,7 @@ static void WINAPI IWineD3DDeviceImpl_ClearRendertargetView(IWineD3DDevice *ifac
/* Just forward this to the DirectDraw blitting engine */
memset
(
&
BltFx
,
0
,
sizeof
(
BltFx
));
BltFx
.
dwSize
=
sizeof
(
BltFx
);
BltFx
.
u5
.
dwFillColor
=
argb_to_fmt
(
c
,
((
IWineD3DSurfaceImpl
*
)
surface
)
->
resource
.
format
);
BltFx
.
u5
.
dwFillColor
=
argb_to_fmt
(
c
,
((
IWineD3DSurfaceImpl
*
)
surface
)
->
resource
.
format
_desc
->
format
);
hr
=
IWineD3DSurface_Blt
(
surface
,
NULL
,
NULL
,
NULL
,
WINEDDBLT_COLORFILL
,
&
BltFx
,
WINED3DTEXF_NONE
);
if
(
FAILED
(
hr
))
{
...
...
@@ -6955,7 +6962,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i
WINED3DLOCKED_RECT
rect
;
/* MSDN: Cursor must be A8R8G8B8 */
if
(
WINED3DFMT_A8R8G8B8
!=
pSur
->
resource
.
format
)
{
if
(
WINED3DFMT_A8R8G8B8
!=
pSur
->
resource
.
format_desc
->
format
)
{
ERR
(
"(%p) : surface(%p) has an invalid format
\n
"
,
This
,
pCursorBitmap
);
return
WINED3DERR_INVALIDCALL
;
}
...
...
dlls/wined3d/resource.c
View file @
2dc7fc29
...
...
@@ -27,15 +27,15 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d
);
HRESULT
resource_init
(
struct
IWineD3DResourceClass
*
resource
,
WINED3DRESOURCETYPE
resource_type
,
IWineD3DDeviceImpl
*
device
,
UINT
size
,
DWORD
usage
,
WINED3DFORMAT
format
,
WINED3DPOOL
pool
,
IUnknown
*
parent
)
IWineD3DDeviceImpl
*
device
,
UINT
size
,
DWORD
usage
,
const
struct
GlPixelFormatDesc
*
format_desc
,
WINED3DPOOL
pool
,
IUnknown
*
parent
)
{
resource
->
wineD3DDevice
=
device
;
resource
->
parent
=
parent
;
resource
->
resourceType
=
resource_type
;
resource
->
ref
=
1
;
resource
->
pool
=
pool
;
resource
->
format
=
format
;
resource
->
format_desc
=
getFormatDescEntry
(
format
,
&
device
->
adapter
->
gl_info
);
resource
->
format_desc
=
format_desc
;
resource
->
usage
=
usage
;
resource
->
size
=
size
;
resource
->
priority
=
0
;
...
...
dlls/wined3d/surface.c
View file @
2dc7fc29
This diff is collapsed.
Click to expand it.
dlls/wined3d/surface_base.c
View file @
2dc7fc29
...
...
@@ -181,7 +181,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSU
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
TRACE
(
"(%p) : copying into %p
\n
"
,
This
,
pDesc
);
if
(
pDesc
->
Format
!=
NULL
)
*
(
pDesc
->
Format
)
=
This
->
resource
.
format
;
if
(
pDesc
->
Format
!=
NULL
)
*
(
pDesc
->
Format
)
=
This
->
resource
.
format
_desc
->
format
;
if
(
pDesc
->
Type
!=
NULL
)
*
(
pDesc
->
Type
)
=
This
->
resource
.
resourceType
;
if
(
pDesc
->
Usage
!=
NULL
)
*
(
pDesc
->
Usage
)
=
This
->
resource
.
usage
;
if
(
pDesc
->
Pool
!=
NULL
)
*
(
pDesc
->
Pool
)
=
This
->
resource
.
pool
;
...
...
@@ -332,16 +332,17 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPalette(IWineD3DSurface *iface, IWineD
DWORD
WINAPI
IWineD3DBaseSurfaceImpl_GetPitch
(
IWineD3DSurface
*
iface
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
WINED3DFORMAT
format
=
This
->
resource
.
format_desc
->
format
;
DWORD
ret
;
TRACE
(
"(%p)
\n
"
,
This
);
/* DXTn formats don't have exact pitches as they are to the new row of blocks,
where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt2/3/4/5)
ie pitch = (width/4) * bytes per block */
if
(
This
->
resource
.
format
==
WINED3DFMT_DXT1
)
/* DXT1 is 8 bytes per block */
if
(
format
==
WINED3DFMT_DXT1
)
/* DXT1 is 8 bytes per block */
ret
=
((
This
->
currentDesc
.
Width
+
3
)
>>
2
)
<<
3
;
else
if
(
This
->
resource
.
format
==
WINED3DFMT_DXT2
||
This
->
resource
.
format
==
WINED3DFMT_DXT3
||
This
->
resource
.
format
==
WINED3DFMT_DXT4
||
This
->
resource
.
format
==
WINED3DFMT_DXT5
)
/* DXT2/3/4/5 is 16 bytes per block */
else
if
(
format
==
WINED3DFMT_DXT2
||
format
==
WINED3DFMT_DXT3
||
format
==
WINED3DFMT_DXT4
||
format
==
WINED3DFMT_DXT5
)
/* DXT2/3/4/5 is 16 bytes per block */
ret
=
((
This
->
currentDesc
.
Width
+
3
)
>>
2
)
<<
4
;
else
{
unsigned
char
alignment
=
This
->
resource
.
wineD3DDevice
->
surface_alignment
;
...
...
@@ -511,7 +512,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3D
const
struct
GlPixelFormatDesc
*
format_desc
=
getFormatDescEntry
(
format
,
&
This
->
resource
.
wineD3DDevice
->
adapter
->
gl_info
);
if
(
This
->
resource
.
format
!=
WINED3DFMT_UNKNOWN
)
{
if
(
This
->
resource
.
format_desc
->
format
!=
WINED3DFMT_UNKNOWN
)
{
FIXME
(
"(%p) : The format of the surface must be WINED3DFORMAT_UNKNOWN
\n
"
,
This
);
return
WINED3DERR_INVALIDCALL
;
}
...
...
@@ -540,7 +542,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3D
This
->
Flags
|=
(
WINED3DFMT_D16_LOCKABLE
==
format
)
?
SFLAG_LOCKABLE
:
0
;
This
->
resource
.
format
=
format
;
This
->
resource
.
format_desc
=
format_desc
;
TRACE
(
"(%p) : Size %d, bytesPerPixel %d
\n
"
,
This
,
This
->
resource
.
size
,
This
->
bytesPerPixel
);
...
...
@@ -607,7 +608,8 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
/* Get the bit masks */
masks
=
(
DWORD
*
)
b_info
->
bmiColors
;
switch
(
This
->
resource
.
format
)
{
switch
(
This
->
resource
.
format_desc
->
format
)
{
case
WINED3DFMT_R8G8B8
:
usage
=
DIB_RGB_COLORS
;
b_info
->
bmiHeader
.
biCompression
=
BI_RGB
;
...
...
@@ -779,10 +781,10 @@ static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source,
WINED3DLOCKED_RECT
lock_src
,
lock_dst
;
HRESULT
hr
;
conv
=
find_convertor
(
source
->
resource
.
format
,
to_fmt
);
conv
=
find_convertor
(
source
->
resource
.
format
_desc
->
format
,
to_fmt
);
if
(
!
conv
)
{
FIXME
(
"Cannot find a conversion function from format %s to %s
\n
"
,
debug_d3dformat
(
source
->
resource
.
format
),
debug_d3dformat
(
to_fmt
));
debug_d3dformat
(
source
->
resource
.
format
_desc
->
format
),
debug_d3dformat
(
to_fmt
));
return
NULL
;
}
...
...
@@ -916,7 +918,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
RECT
xdst
,
xsrc
;
HRESULT
ret
=
WINED3D_OK
;
WINED3DLOCKED_RECT
dlock
,
slock
;
WINED3DFORMAT
dfmt
=
WINED3DFMT_UNKNOWN
,
sfmt
=
WINED3DFMT_UNKNOWN
;
int
bpp
,
srcheight
,
srcwidth
,
dstheight
,
dstwidth
,
width
;
const
struct
GlPixelFormatDesc
*
sEntry
,
*
dEntry
;
int
x
,
y
;
...
...
@@ -1095,20 +1096,18 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
if
(
Src
==
This
)
{
IWineD3DSurface_LockRect
(
iface
,
&
dlock
,
NULL
,
0
);
dfmt
=
This
->
resource
.
format
;
slock
=
dlock
;
sfmt
=
dfmt
;
sEntry
=
This
->
resource
.
format_desc
;
dEntry
=
sEntry
;
}
else
{
dfmt
=
This
->
resource
.
format
;
dEntry
=
This
->
resource
.
format_desc
;
if
(
Src
)
{
if
(
This
->
resource
.
format
!=
Src
->
resource
.
format
)
{
Src
=
surface_convert_format
(
Src
,
dfmt
);
if
(
This
->
resource
.
format_desc
!=
Src
->
resource
.
format_desc
)
{
Src
=
surface_convert_format
(
Src
,
dEntry
->
format
);
if
(
!
Src
)
{
/* The conv function writes a FIXME */
WARN
(
"Cannot convert source surface format to dest format
\n
"
);
...
...
@@ -1116,7 +1115,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
}
}
IWineD3DSurface_LockRect
((
IWineD3DSurface
*
)
Src
,
&
slock
,
NULL
,
WINED3DLOCK_READONLY
);
sfmt
=
Src
->
resource
.
format
;
sEntry
=
Src
->
resource
.
format_desc
;
}
else
...
...
@@ -1678,7 +1676,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
FIXME
(
"trans arg not supported when a FOURCC surface is involved
\n
"
);
if
(
dstx
||
dsty
)
FIXME
(
"offset for destination surface is not supported
\n
"
);
if
(
Src
->
resource
.
format
!=
This
->
resource
.
format
)
if
(
Src
->
resource
.
format
_desc
!=
This
->
resource
.
format_desc
)
{
FIXME
(
"FOURCC->FOURCC copy only supported for the same type of surface
\n
"
);
ret
=
WINED3DERR_WRONGTEXTUREFORMAT
;
...
...
@@ -1841,12 +1839,14 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DL
* long. The x offset is calculated differently as well, since moving 4
* pixels to the right actually moves an entire 4x4 block to right, ie
* 16 bytes (8 in case of DXT1). */
if
(
This
->
resource
.
format
==
WINED3DFMT_DXT1
)
if
(
This
->
resource
.
format
_desc
->
format
==
WINED3DFMT_DXT1
)
{
pLockedRect
->
pBits
=
This
->
resource
.
allocatedMemory
+
(
pLockedRect
->
Pitch
*
pRect
->
top
/
4
)
+
(
pRect
->
left
*
2
);
}
else
if
(
This
->
resource
.
format
==
WINED3DFMT_DXT2
||
This
->
resource
.
format
==
WINED3DFMT_DXT3
||
This
->
resource
.
format
==
WINED3DFMT_DXT4
||
This
->
resource
.
format
==
WINED3DFMT_DXT5
)
else
if
(
This
->
resource
.
format_desc
->
format
==
WINED3DFMT_DXT2
||
This
->
resource
.
format_desc
->
format
==
WINED3DFMT_DXT3
||
This
->
resource
.
format_desc
->
format
==
WINED3DFMT_DXT4
||
This
->
resource
.
format_desc
->
format
==
WINED3DFMT_DXT5
)
{
pLockedRect
->
pBits
=
This
->
resource
.
allocatedMemory
+
(
pLockedRect
->
Pitch
*
pRect
->
top
/
4
)
+
(
pRect
->
left
*
4
);
}
...
...
dlls/wined3d/surface_gdi.c
View file @
2dc7fc29
...
...
@@ -304,7 +304,8 @@ const char* filename)
}
fprintf
(
f
,
"P6
\n
%d %d
\n
255
\n
"
,
This
->
pow2Width
,
This
->
pow2Height
);
if
(
This
->
resource
.
format
==
WINED3DFMT_P8
)
{
if
(
This
->
resource
.
format_desc
->
format
==
WINED3DFMT_P8
)
{
unsigned
char
table
[
256
][
3
];
int
i
;
...
...
@@ -402,8 +403,9 @@ static HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD
return
hr
;
}
if
(
This
->
resource
.
format
==
WINED3DFMT_P8
||
This
->
resource
.
format
==
WINED3DFMT_A8P8
)
{
if
(
This
->
resource
.
format_desc
->
format
==
WINED3DFMT_P8
||
This
->
resource
.
format_desc
->
format
==
WINED3DFMT_A8P8
)
{
unsigned
int
n
;
const
PALETTEENTRY
*
pal
=
NULL
;
...
...
dlls/wined3d/swapchain.c
View file @
2dc7fc29
...
...
@@ -109,7 +109,7 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
cursor
.
resource
.
ref
=
1
;
cursor
.
resource
.
wineD3DDevice
=
This
->
wineD3DDevice
;
cursor
.
resource
.
pool
=
WINED3DPOOL_SCRATCH
;
cursor
.
resource
.
format
=
WINED3DFMT_A8R8G8B8
;
cursor
.
resource
.
format
_desc
=
getFormatDescEntry
(
WINED3DFMT_A8R8G8B8
,
&
This
->
wineD3DDevice
->
adapter
->
gl_info
)
;
cursor
.
resource
.
resourceType
=
WINED3DRTYPE_SURFACE
;
cursor
.
glDescription
.
textureName
=
This
->
wineD3DDevice
->
cursorTexture
;
cursor
.
glDescription
.
target
=
GL_TEXTURE_2D
;
...
...
dlls/wined3d/texture.c
View file @
2dc7fc29
...
...
@@ -119,7 +119,9 @@ void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb)
ActivateContext
(
device
,
device
->
lastActiveRenderTarget
,
CTXUSAGE_RESOURCELOAD
);
}
if
(
This
->
resource
.
format
==
WINED3DFMT_P8
||
This
->
resource
.
format
==
WINED3DFMT_A8P8
)
{
if
(
This
->
resource
.
format_desc
->
format
==
WINED3DFMT_P8
||
This
->
resource
.
format_desc
->
format
==
WINED3DFMT_A8P8
)
{
for
(
i
=
0
;
i
<
This
->
baseTexture
.
levels
;
i
++
)
{
if
(
palette9_changed
((
IWineD3DSurfaceImpl
*
)
This
->
surfaces
[
i
]))
{
TRACE
(
"Reloading surface because the d3d8/9 palette was changed
\n
"
);
...
...
dlls/wined3d/volume.c
View file @
2dc7fc29
...
...
@@ -196,7 +196,7 @@ static HRESULT WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, WINED3DV
IWineD3DVolumeImpl
*
This
=
(
IWineD3DVolumeImpl
*
)
iface
;
TRACE
(
"(%p) : copying into %p
\n
"
,
This
,
pDesc
);
*
(
pDesc
->
Format
)
=
This
->
resource
.
format
;
*
(
pDesc
->
Format
)
=
This
->
resource
.
format
_desc
->
format
;
*
(
pDesc
->
Type
)
=
This
->
resource
.
resourceType
;
*
(
pDesc
->
Usage
)
=
This
->
resource
.
usage
;
*
(
pDesc
->
Pool
)
=
This
->
resource
.
pool
;
...
...
@@ -302,9 +302,8 @@ static HRESULT WINAPI IWineD3DVolumeImpl_SetContainer(IWineD3DVolume *iface, IWi
static
HRESULT
WINAPI
IWineD3DVolumeImpl_LoadTexture
(
IWineD3DVolume
*
iface
,
int
gl_level
,
BOOL
srgb_mode
)
{
IWineD3DVolumeImpl
*
This
=
(
IWineD3DVolumeImpl
*
)
iface
;
const
struct
GlPixelFormatDesc
*
glDesc
=
This
->
resource
.
format_desc
;
WINED3DFORMAT
format
=
This
->
resource
.
format
;
TRACE
(
"(%p) : level %u, format %s (0x%08x)
\n
"
,
This
,
gl_level
,
debug_d3dformat
(
format
),
format
);
TRACE
(
"(%p) : level %u, format %s (0x%08x)
\n
"
,
This
,
gl_level
,
debug_d3dformat
(
glDesc
->
format
),
glDesc
->
format
);
volume_bind_and_dirtify
(
iface
);
...
...
dlls/wined3d/wined3d_private.h
View file @
2dc7fc29
...
...
@@ -1236,7 +1236,6 @@ typedef struct IWineD3DResourceClass
WINED3DPOOL
pool
;
UINT
size
;
DWORD
usage
;
WINED3DFORMAT
format
;
const
struct
GlPixelFormatDesc
*
format_desc
;
DWORD
priority
;
BYTE
*
allocatedMemory
;
/* Pointer to the real data location */
...
...
@@ -1261,7 +1260,8 @@ DWORD resource_get_priority(IWineD3DResource *iface);
HRESULT
resource_get_private_data
(
IWineD3DResource
*
iface
,
REFGUID
guid
,
void
*
data
,
DWORD
*
data_size
);
HRESULT
resource_init
(
struct
IWineD3DResourceClass
*
resource
,
WINED3DRESOURCETYPE
resource_type
,
IWineD3DDeviceImpl
*
device
,
UINT
size
,
DWORD
usage
,
WINED3DFORMAT
format
,
WINED3DPOOL
pool
,
IUnknown
*
parent
);
IWineD3DDeviceImpl
*
device
,
UINT
size
,
DWORD
usage
,
const
struct
GlPixelFormatDesc
*
format_desc
,
WINED3DPOOL
pool
,
IUnknown
*
parent
);
WINED3DRESOURCETYPE
resource_get_type
(
IWineD3DResource
*
iface
);
DWORD
resource_set_priority
(
IWineD3DResource
*
iface
,
DWORD
new_priority
);
HRESULT
resource_set_private_data
(
IWineD3DResource
*
iface
,
REFGUID
guid
,
...
...
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