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
231e2c60
Commit
231e2c60
authored
Oct 16, 2008
by
Henri Verbeet
Committed by
Alexandre Julliard
Oct 16, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: The container is always non-NULL if GetContainer() succeeds.
parent
f5fbfe47
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
43 deletions
+38
-43
context.c
dlls/wined3d/context.c
+1
-3
device.c
dlls/wined3d/device.c
+1
-2
surface.c
dlls/wined3d/surface.c
+30
-32
surface_gdi.c
dlls/wined3d/surface_gdi.c
+6
-6
No files found.
dlls/wined3d/context.c
View file @
231e2c60
...
...
@@ -1231,7 +1231,6 @@ static WineD3DContext *findThreadContextForSwapChain(IWineD3DSwapChain *swapchai
*****************************************************************************/
static
inline
WineD3DContext
*
FindContext
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurface
*
target
,
DWORD
tid
)
{
IWineD3DSwapChain
*
swapchain
=
NULL
;
HRESULT
hr
;
BOOL
readTexture
=
wined3d_settings
.
offscreen_rendering_mode
!=
ORM_FBO
&&
This
->
render_offscreen
;
WineD3DContext
*
context
=
This
->
activeContext
;
BOOL
oldRenderOffscreen
=
This
->
render_offscreen
;
...
...
@@ -1253,8 +1252,7 @@ static inline WineD3DContext *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurf
}
}
hr
=
IWineD3DSurface_GetContainer
(
target
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
);
if
(
hr
==
WINED3D_OK
&&
swapchain
)
{
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
(
target
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
)))
{
TRACE
(
"Rendering onscreen
\n
"
);
context
=
findThreadContextForSwapChain
(
swapchain
,
tid
);
...
...
dlls/wined3d/device.c
View file @
231e2c60
...
...
@@ -5179,8 +5179,7 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfa
LEAVE_GL
();
IWineD3DSurface_GetContainer
(
(
IWineD3DSurface
*
)
target
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
);
if
(
swapchain
)
{
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
((
IWineD3DSurface
*
)
target
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
)))
{
if
(
target
==
(
IWineD3DSurfaceImpl
*
)
swapchain
->
frontBuffer
)
{
glFlush
();
}
...
...
dlls/wined3d/surface.c
View file @
231e2c60
...
...
@@ -712,7 +712,6 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, v
return
;
}
IWineD3DSurface_GetContainer
((
IWineD3DSurface
*
)
This
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
);
/* Activate the surface. Set it up for blitting now, although not necessarily needed for LockRect.
* Certain graphics drivers seem to dislike some enabled states when reading from opengl, the blitting usage
* should help here. Furthermore unlockrect will need the context set up for blitting. The context manager will find
...
...
@@ -725,14 +724,8 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, v
* There is no need to keep track of the current read buffer or reset it, every part of the code
* that reads sets the read buffer as desired.
*/
if
(
!
swapchain
)
{
/* Locking the primary render target which is not on a swapchain(=offscreen render target).
* Read from the back buffer
*/
TRACE
(
"Locking offscreen render target
\n
"
);
glReadBuffer
(
myDevice
->
offscreenBuffer
);
srcIsUpsideDown
=
TRUE
;
}
else
{
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
((
IWineD3DSurface
*
)
This
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
)))
{
GLenum
buffer
=
surface_get_gl_buffer
((
IWineD3DSurface
*
)
This
,
(
IWineD3DSwapChain
*
)
swapchain
);
TRACE
(
"Locking %#x buffer
\n
"
,
buffer
);
glReadBuffer
(
buffer
);
...
...
@@ -740,6 +733,13 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, v
IWineD3DSwapChain_Release
((
IWineD3DSwapChain
*
)
swapchain
);
srcIsUpsideDown
=
FALSE
;
}
else
{
/* Locking the primary render target which is not on a swapchain(=offscreen render target).
* Read from the back buffer
*/
TRACE
(
"Locking offscreen render target
\n
"
);
glReadBuffer
(
myDevice
->
offscreenBuffer
);
srcIsUpsideDown
=
TRUE
;
}
/* TODO: Get rid of the extra rectangle comparison and construction of a full surface rectangle */
...
...
@@ -910,7 +910,6 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This)
d3dfmt_get_conv
(
This
,
TRUE
/* We need color keying */
,
TRUE
/* We will use textures */
,
&
format
,
&
internal
,
&
type
,
&
convert
,
&
bpp
,
This
->
srgb
);
IWineD3DSurface_GetContainer
((
IWineD3DSurface
*
)
This
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
);
/* Activate the surface to read from. In some situations it isn't the currently active target(e.g. backbuffer
* locking during offscreen rendering). RESOURCELOAD is ok because glCopyTexSubImage2D isn't affected by any
* states in the stateblock, and no driver was found yet that had bugs in that regard.
...
...
@@ -925,19 +924,20 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This)
* There is no need to keep track of the current read buffer or reset it, every part of the code
* that reads sets the read buffer as desired.
*/
if
(
!
swapchain
)
{
/* Locking the primary render target which is not on a swapchain(=offscreen render target).
* Read from the back buffer
*/
TRACE
(
"Locking offscreen render target
\n
"
);
glReadBuffer
(
device
->
offscreenBuffer
);
}
else
{
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
((
IWineD3DSurface
*
)
This
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
)))
{
GLenum
buffer
=
surface_get_gl_buffer
((
IWineD3DSurface
*
)
This
,
(
IWineD3DSwapChain
*
)
swapchain
);
TRACE
(
"Locking %#x buffer
\n
"
,
buffer
);
glReadBuffer
(
buffer
);
checkGLcall
(
"glReadBuffer"
);
IWineD3DSwapChain_Release
((
IWineD3DSwapChain
*
)
swapchain
);
}
else
{
/* Locking the primary render target which is not on a swapchain(=offscreen render target).
* Read from the back buffer
*/
TRACE
(
"Locking offscreen render target
\n
"
);
glReadBuffer
(
device
->
offscreenBuffer
);
}
if
(
!
(
This
->
Flags
&
SFLAG_ALLOCATED
))
{
...
...
@@ -1170,7 +1170,7 @@ lock_end:
IWineD3DSurface_AddDirtyRect
(
iface
,
pRect
);
/** Dirtify Container if needed */
if
(
WINED3D_OK
==
IWineD3DSurface_GetContainer
(
iface
,
&
IID_IWineD3DBaseTexture
,
(
void
**
)
&
pBaseTexture
)
&&
pBaseTexture
!=
NULL
)
{
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
(
iface
,
&
IID_IWineD3DBaseTexture
,
(
void
**
)
&
pBaseTexture
))
)
{
TRACE
(
"Making container dirty
\n
"
);
IWineD3DBaseTexture_SetDirty
(
pBaseTexture
,
TRUE
);
IWineD3DBaseTexture_Release
(
pBaseTexture
);
...
...
@@ -1194,19 +1194,18 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm
ActivateContext
(
myDevice
,
(
IWineD3DSurface
*
)
This
,
CTXUSAGE_BLIT
);
ENTER_GL
();
IWineD3DSurface_GetContainer
((
IWineD3DSurface
*
)
This
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
);
if
(
!
swapchain
)
{
/* Primary offscreen render target */
TRACE
(
"Offscreen render target
\n
"
);
glDrawBuffer
(
myDevice
->
offscreenBuffer
);
checkGLcall
(
"glDrawBuffer(myDevice->offscreenBuffer)"
);
}
else
{
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
((
IWineD3DSurface
*
)
This
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
)))
{
GLenum
buffer
=
surface_get_gl_buffer
((
IWineD3DSurface
*
)
This
,
(
IWineD3DSwapChain
*
)
swapchain
);
TRACE
(
"Unlocking %#x buffer
\n
"
,
buffer
);
glDrawBuffer
(
buffer
);
checkGLcall
(
"glDrawBuffer"
);
IWineD3DSwapChain_Release
((
IWineD3DSwapChain
*
)
swapchain
);
}
else
{
/* Primary offscreen render target */
TRACE
(
"Offscreen render target
\n
"
);
glDrawBuffer
(
myDevice
->
offscreenBuffer
);
checkGLcall
(
"glDrawBuffer(myDevice->offscreenBuffer)"
);
}
glGetIntegerv
(
GL_PACK_SWAP_BYTES
,
&
prev_store
);
...
...
@@ -4128,9 +4127,8 @@ struct coords {
static
inline
void
surface_blt_to_drawable
(
IWineD3DSurfaceImpl
*
This
,
const
RECT
*
rect_in
)
{
struct
coords
coords
[
4
];
RECT
rect
;
IWineD3DSwapChain
*
swapchain
=
NULL
;
IWineD3DBaseTexture
*
texture
=
NULL
;
HRESULT
hr
;
IWineD3DSwapChain
*
swapchain
;
IWineD3DBaseTexture
*
texture
;
IWineD3DDeviceImpl
*
device
=
This
->
resource
.
wineD3DDevice
;
GLenum
bind_target
;
...
...
@@ -4265,8 +4263,8 @@ static inline void surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT
LEAVE_GL
();
hr
=
IWineD3DSurface_GetContainer
((
IWineD3DSurface
*
)
This
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
);
if
(
hr
==
WINED3D_OK
&&
swapchain
)
{
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
((
IWineD3DSurface
*
)
This
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
)))
{
/* Make sure to flush the buffers. This is needed in apps like Red Alert II and Tiberian SUN that use multiple WGL contexts. */
if
(((
IWineD3DSwapChainImpl
*
)
swapchain
)
->
frontBuffer
==
(
IWineD3DSurface
*
)
This
||
((
IWineD3DSwapChainImpl
*
)
swapchain
)
->
num_contexts
>=
2
)
...
...
@@ -4277,8 +4275,8 @@ static inline void surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT
/* We changed the filtering settings on the texture. Inform the container about this to get the filters
* reset properly next draw
*/
hr
=
IWineD3DSurface_GetContainer
((
IWineD3DSurface
*
)
This
,
&
IID_IWineD3DBaseTexture
,
(
void
**
)
&
texture
);
if
(
hr
==
WINED3D_OK
&&
texture
)
{
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
((
IWineD3DSurface
*
)
This
,
&
IID_IWineD3DBaseTexture
,
(
void
**
)
&
texture
)))
{
((
IWineD3DBaseTextureImpl
*
)
texture
)
->
baseTexture
.
states
[
WINED3DTEXSTA_MAGFILTER
]
=
WINED3DTEXF_POINT
;
((
IWineD3DBaseTextureImpl
*
)
texture
)
->
baseTexture
.
states
[
WINED3DTEXSTA_MINFILTER
]
=
WINED3DTEXF_POINT
;
((
IWineD3DBaseTextureImpl
*
)
texture
)
->
baseTexture
.
states
[
WINED3DTEXSTA_MIPFILTER
]
=
WINED3DTEXF_NONE
;
...
...
dlls/wined3d/surface_gdi.c
View file @
231e2c60
...
...
@@ -192,8 +192,8 @@ IWineGDISurfaceImpl_UnlockRect(IWineD3DSurface *iface)
#endif
/* Tell the swapchain to update the screen */
IWineD3DSurface_GetContainer
(
iface
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
);
if
(
swapchain
)
{
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
(
iface
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
)))
{
x11_copy_to_screen
(
swapchain
,
&
This
->
lockedRect
);
IWineD3DSwapChain_Release
((
IWineD3DSwapChain
*
)
swapchain
);
}
...
...
@@ -225,8 +225,8 @@ IWineGDISurfaceImpl_Flip(IWineD3DSurface *iface,
IWineD3DSwapChainImpl
*
swapchain
=
NULL
;
HRESULT
hr
;
IWineD3DSurface_GetContainer
(
iface
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
);
if
(
!
swapchain
)
{
if
(
FAILED
(
IWineD3DSurface_GetContainer
(
iface
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
)))
{
ERR
(
"Flipped surface is not on a swapchain
\n
"
);
return
WINEDDERR_NOTFLIPPABLE
;
}
...
...
@@ -481,8 +481,8 @@ HRESULT WINAPI IWineGDISurfaceImpl_RealizePalette(IWineD3DSurface *iface) {
/* Update the image because of the palette change. Some games like e.g Red Alert
call SetEntries a lot to implement fading. */
/* Tell the swapchain to update the screen */
IWineD3DSurface_GetContainer
(
iface
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
);
if
(
swapchain
)
{
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
(
iface
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
)))
{
x11_copy_to_screen
(
swapchain
,
NULL
);
IWineD3DSwapChain_Release
((
IWineD3DSwapChain
*
)
swapchain
);
}
...
...
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