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
07f12693
Commit
07f12693
authored
Jan 05, 2003
by
Lionel Ulmer
Committed by
Alexandre Julliard
Jan 05, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fix in the GetHandle method
- factorize some code between D3D1/2/3 and D3D7 - fix reference counting for palettes
parent
274e7267
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
64 deletions
+37
-64
mesa.c
dlls/ddraw/d3ddevice/mesa.c
+13
-11
d3dtexture.c
dlls/ddraw/d3dtexture.c
+19
-37
mesa.c
dlls/ddraw/mesa.c
+5
-16
No files found.
dlls/ddraw/d3ddevice/mesa.c
View file @
07f12693
...
...
@@ -312,9 +312,11 @@ GL_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
TRACE
(
"(%p/%p)->() decrementing from %lu.
\n
"
,
This
,
iface
,
This
->
ref
);
if
(
!--
(
This
->
ref
))
{
int
i
;
/* Release texture associated with the device */
if
(
This
->
current_texture
[
0
]
!=
NULL
)
IDirect3DTexture2_Release
(
ICOM_INTERFACE
(
This
->
current_texture
[
0
],
IDirect3DTexture2
));
for
(
i
=
0
;
i
<
MAX_TEXTURES
;
i
++
)
if
(
This
->
current_texture
[
i
]
!=
NULL
)
IDirectDrawSurface7_Release
(
ICOM_INTERFACE
(
This
->
current_texture
[
i
],
IDirectDrawSurface7
));
/* And warn the D3D object that this device is no longer active... */
This
->
d3d
->
removed_device
(
This
->
d3d
,
This
);
...
...
@@ -1402,12 +1404,13 @@ GL_IDirect3DDeviceImpl_7_3T_SetTexture(LPDIRECT3DDEVICE7 iface,
TRACE
(
"(%p/%p)->(%08lx,%p)
\n
"
,
This
,
iface
,
dwStage
,
lpTexture2
);
if
(
This
->
current_texture
[
dwStage
]
!=
NULL
)
{
/* Seems that this is not right... Need to test in real Windows
IDirect3DTexture2_Release(ICOM_INTERFACE(This->current_texture[dwStage], IDirect3DTexture2)); */
IDirectDrawSurface7_Release
(
ICOM_INTERFACE
(
This
->
current_texture
[
dwStage
],
IDirectDrawSurface7
));
}
ENTER_GL
();
if
(
lpTexture2
==
NULL
)
{
This
->
current_texture
[
dwStage
]
=
NULL
;
TRACE
(
" disabling 2D texturing.
\n
"
);
glBindTexture
(
GL_TEXTURE_2D
,
0
);
glDisable
(
GL_TEXTURE_2D
);
...
...
@@ -2102,9 +2105,6 @@ d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfa
surf
->
d3ddevice
=
object
;
}
/* FIXME: Should handle other versions than just 7 */
InitDefaultStateBlock
(
&
object
->
state_block
,
7
);
/* FIXME: These 4 statements are kept for compatibility but should be removed as soon
as they are correctly handled */
gl_object
->
render_state
.
fog_on
=
FALSE
;
...
...
@@ -2137,10 +2137,6 @@ d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfa
ENTER_GL
();
TRACE
(
" current context set
\n
"
);
/* Apply default render state values */
apply_render_state
(
gl_object
,
&
object
->
state_block
);
/* FIXME: do something similar for ligh_state and texture_stage_state */
glClearColor
(
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
|
GL_STENCIL_BUFFER_BIT
);
glDrawBuffer
(
buffer
);
...
...
@@ -2162,5 +2158,11 @@ d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfa
/* And finally warn D3D that this device is now present */
object
->
d3d
->
added_device
(
object
->
d3d
,
object
);
/* FIXME: Should handle other versions than just 7 */
InitDefaultStateBlock
(
&
object
->
state_block
,
7
);
/* Apply default render state values */
apply_render_state
(
gl_object
,
&
object
->
state_block
);
/* FIXME: do something similar for ligh_state and texture_stage_state */
return
DD_OK
;
}
dlls/ddraw/d3dtexture.c
View file @
07f12693
...
...
@@ -496,8 +496,19 @@ Main_IDirect3DTextureImpl_2_1T_GetHandle(LPDIRECT3DTEXTURE2 iface,
LPD3DTEXTUREHANDLE
lpHandle
)
{
ICOM_THIS_FROM
(
IDirectDrawSurfaceImpl
,
IDirect3DTexture2
,
iface
);
FIXME
(
"(%p/%p)->(%p,%p): stub!
\n
"
,
This
,
iface
,
lpDirect3DDevice2
,
lpHandle
);
return
DD_OK
;
IDirect3DDeviceImpl
*
lpDeviceImpl
=
ICOM_OBJECT
(
IDirect3DDeviceImpl
,
IDirect3DDevice2
,
lpDirect3DDevice2
);
TRACE
(
"(%p/%p)->(%p,%p)
\n
"
,
This
,
iface
,
lpDirect3DDevice2
,
lpHandle
);
/* The handle is simply the pointer to the implementation structure */
*
lpHandle
=
(
D3DTEXTUREHANDLE
)
This
;
TRACE
(
" returning handle %08lx.
\n
"
,
*
lpHandle
);
/* Now set the device for this texture */
This
->
d3ddevice
=
lpDeviceImpl
;
return
D3D_OK
;
}
HRESULT
WINAPI
...
...
@@ -525,6 +536,7 @@ gltex_final_release(IDirectDrawSurfaceImpl *This)
{
IDirect3DTextureGLImpl
*
glThis
=
(
IDirect3DTextureGLImpl
*
)
This
->
tex_private
;
DWORD
mem_used
;
int
i
;
TRACE
(
" deleting texture with GL id %d.
\n
"
,
glThis
->
tex_name
);
...
...
@@ -536,8 +548,9 @@ gltex_final_release(IDirectDrawSurfaceImpl *This)
/* And if this texture was the current one, remove it at the device level */
if
(
This
->
d3ddevice
!=
NULL
)
if
(
This
->
d3ddevice
->
current_texture
[
0
]
==
This
)
This
->
d3ddevice
->
current_texture
[
0
]
=
NULL
;
for
(
i
=
0
;
i
<
MAX_TEXTURES
;
i
++
)
if
(
This
->
d3ddevice
->
current_texture
[
i
]
==
This
)
This
->
d3ddevice
->
current_texture
[
i
]
=
NULL
;
/* All this should be part of main surface management not just a hack for texture.. */
if
(
glThis
->
loaded
)
{
...
...
@@ -570,37 +583,6 @@ gltex_unlock_update(IDirectDrawSurfaceImpl* This, LPCRECT pRect)
}
HRESULT
WINAPI
GL_IDirect3DTextureImpl_2_1T_GetHandle
(
LPDIRECT3DTEXTURE2
iface
,
LPDIRECT3DDEVICE2
lpDirect3DDevice2
,
LPD3DTEXTUREHANDLE
lpHandle
)
{
ICOM_THIS_FROM
(
IDirectDrawSurfaceImpl
,
IDirect3DTexture2
,
iface
);
IDirect3DTextureGLImpl
*
glThis
=
(
IDirect3DTextureGLImpl
*
)
This
->
tex_private
;
IDirect3DDeviceImpl
*
lpDeviceImpl
=
ICOM_OBJECT
(
IDirect3DDeviceImpl
,
IDirect3DDevice2
,
lpDirect3DDevice2
);
TRACE
(
"(%p/%p)->(%p,%p)
\n
"
,
This
,
iface
,
lpDirect3DDevice2
,
lpHandle
);
/* The handle is simply the pointer to the implementation structure */
*
lpHandle
=
(
D3DTEXTUREHANDLE
)
This
;
TRACE
(
" returning handle %08lx.
\n
"
,
*
lpHandle
);
/* Now, bind a new texture */
This
->
d3ddevice
=
lpDeviceImpl
;
/* Associate the texture with the device and perform the appropriate AddRef/Release */
/* FIXME: Is there only one or several textures associated with the device ? */
if
(
lpDeviceImpl
->
current_texture
[
0
]
!=
NULL
)
IDirectDrawSurface7_Release
(
ICOM_INTERFACE
(
lpDeviceImpl
->
current_texture
[
0
],
IDirectDrawSurface7
));
IDirectDrawSurface7_AddRef
(
ICOM_INTERFACE
(
This
,
IDirectDrawSurface7
));
lpDeviceImpl
->
current_texture
[
0
]
=
This
;
TRACE
(
"OpenGL texture handle is : %d
\n
"
,
glThis
->
tex_name
);
return
D3D_OK
;
}
HRESULT
WINAPI
GL_IDirect3DTextureImpl_2_1T_Load
(
LPDIRECT3DTEXTURE2
iface
,
LPDIRECT3DTEXTURE2
lpD3DTexture2
)
{
...
...
@@ -646,7 +628,6 @@ GL_IDirect3DTextureImpl_2_1T_Load(LPDIRECT3DTEXTURE2 iface,
if
(
lpD3DTextureImpl
->
palette
!=
NULL
)
{
PALETTEENTRY
palent
[
256
];
IDirectDrawPalette
*
pal_int
=
ICOM_INTERFACE
(
lpD3DTextureImpl
->
palette
,
IDirectDrawPalette
);
IDirectDrawPalette_AddRef
(
pal_int
);
IDirectDrawPalette_GetEntries
(
pal_int
,
0
,
0
,
256
,
palent
);
IDirectDrawPalette_SetEntries
(
ICOM_INTERFACE
(
This
->
palette
,
IDirectDrawPalette
),
0
,
0
,
256
,
palent
);
...
...
@@ -667,6 +648,7 @@ GL_IDirect3DTextureImpl_2_1T_Load(LPDIRECT3DTEXTURE2 iface,
/* Copy also the ColorKeying stuff */
if
(
src_d
->
dwFlags
&
DDSD_CKSRCBLT
)
{
dst_d
->
dwFlags
|=
DDSD_CKSRCBLT
;
dst_d
->
ddckCKSrcBlt
.
dwColorSpaceLowValue
=
src_d
->
ddckCKSrcBlt
.
dwColorSpaceLowValue
;
dst_d
->
ddckCKSrcBlt
.
dwColorSpaceHighValue
=
src_d
->
ddckCKSrcBlt
.
dwColorSpaceHighValue
;
}
...
...
@@ -780,7 +762,7 @@ ICOM_VTABLE(IDirect3DTexture2) VTABLE_IDirect3DTexture2 =
XCAST
(
QueryInterface
)
Thunk_IDirect3DTextureImpl_2_QueryInterface
,
XCAST
(
AddRef
)
Thunk_IDirect3DTextureImpl_2_AddRef
,
XCAST
(
Release
)
Thunk_IDirect3DTextureImpl_2_Release
,
XCAST
(
GetHandle
)
GL
_IDirect3DTextureImpl_2_1T_GetHandle
,
XCAST
(
GetHandle
)
Main
_IDirect3DTextureImpl_2_1T_GetHandle
,
XCAST
(
PaletteChanged
)
Main_IDirect3DTextureImpl_2_1T_PaletteChanged
,
XCAST
(
Load
)
GL_IDirect3DTextureImpl_2_1T_Load
,
};
...
...
dlls/ddraw/mesa.c
View file @
07f12693
...
...
@@ -81,24 +81,13 @@ void set_render_state(IDirect3DDeviceGLImpl* This,
case
D3DRENDERSTATE_TEXTUREHANDLE
:
{
/* 1 */
IDirectDrawSurfaceImpl
*
tex
=
(
IDirectDrawSurfaceImpl
*
)
dwRenderState
;
if
(
tex
==
NULL
)
{
glBindTexture
(
GL_TEXTURE_2D
,
0
);
glDisable
(
GL_TEXTURE_2D
);
TRACE
(
"disabling texturing
\n
"
);
}
else
{
glEnable
(
GL_TEXTURE_2D
);
/* Default parameters */
gltex_upload_texture
(
tex
);
/* To prevent state change, we could test here what are the parameters
stored in the texture */
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MAG_FILTER
,
rs
->
mag
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
rs
->
min
);
}
LEAVE_GL
();
IDirect3DDevice7_SetTexture
(
ICOM_INTERFACE
(
&
(
This
->
parent
),
IDirect3DDevice7
),
0
,
ICOM_INTERFACE
(
tex
,
IDirectDrawSurface7
));
ENTER_GL
();
}
break
;
case
D3DRENDERSTATE_TEXTUREADDRESSU
:
/* 44 */
case
D3DRENDERSTATE_TEXTUREADDRESSV
:
/* 45 */
case
D3DRENDERSTATE_TEXTUREADDRESS
:
{
/* 3 */
...
...
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