Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
009cd78f
Commit
009cd78f
authored
Aug 04, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Cleanup Get/SetRenderTarget().
parent
6e30387f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
50 deletions
+57
-50
device.c
dlls/wined3d/device.c
+57
-50
No files found.
dlls/wined3d/device.c
View file @
009cd78f
...
...
@@ -5571,21 +5571,25 @@ static void WINAPI IWineD3DDeviceImpl_ClearRendertargetView(IWineD3DDevice *ifac
}
/* rendertarget and depth stencil functions */
static
HRESULT
WINAPI
IWineD3DDeviceImpl_GetRenderTarget
(
IWineD3DDevice
*
iface
,
DWORD
RenderTargetIndex
,
IWineD3DSurface
**
ppRenderTarget
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
static
HRESULT
WINAPI
IWineD3DDeviceImpl_GetRenderTarget
(
IWineD3DDevice
*
iface
,
DWORD
render_target_idx
,
IWineD3DSurface
**
render_target
)
{
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
iface
;
if
(
RenderTargetIndex
>=
This
->
adapter
->
gl_info
.
limits
.
buffers
)
TRACE
(
"iface %p, render_target_idx %u, render_target %p.
\n
"
,
iface
,
render_target_idx
,
render_target
);
if
(
render_target_idx
>=
device
->
adapter
->
gl_info
.
limits
.
buffers
)
{
ERR
(
"(%p) : Only %d render targets are supported.
\n
"
,
This
,
This
->
adapter
->
gl_info
.
limits
.
buffers
);
WARN
(
"Only %u render targets are supported.
\n
"
,
device
->
adapter
->
gl_info
.
limits
.
buffers
);
return
WINED3DERR_INVALIDCALL
;
}
*
ppRenderTarget
=
(
IWineD3DSurface
*
)
This
->
render_targets
[
RenderTargetInde
x
];
TRACE
(
"(%p) : RenderTarget %d Index returning %p
\n
"
,
This
,
RenderTargetIndex
,
*
ppRenderT
arget
);
/* Note inc ref on returned surface */
if
(
*
ppRenderTarget
!=
NULL
)
IWineD3DSurface_AddRef
(
*
ppRenderTarget
);
*
render_target
=
(
IWineD3DSurface
*
)
device
->
render_targets
[
render_target_id
x
];
if
(
*
render_target
)
IWineD3DSurface_AddRef
(
*
render_t
arget
);
TRACE
(
"Returning render target %p.
\n
"
,
*
render_target
);
return
WINED3D_OK
;
}
...
...
@@ -5698,63 +5702,66 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetDepthStencilSurface(IWineD3DDevice
}
}
static
HRESULT
WINAPI
IWineD3DDeviceImpl_SetRenderTarget
(
IWineD3DDevice
*
iface
,
DWORD
RenderTargetIndex
,
IWineD3DSurface
*
pRenderTarget
,
BOOL
set_viewport
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
static
HRESULT
WINAPI
IWineD3DDeviceImpl_SetRenderTarget
(
IWineD3DDevice
*
iface
,
DWORD
render_target_idx
,
IWineD3DSurface
*
render_target
,
BOOL
set_viewport
)
{
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
iface
;
TRACE
(
"(%p) : Setting rendertarget %d to %p
\n
"
,
This
,
RenderTargetIndex
,
pRenderTarget
);
TRACE
(
"iface %p, render_target_idx %u, render_target %p, set_viewport %#x.
\n
"
,
iface
,
render_target_idx
,
render_target
,
set_viewport
);
if
(
RenderTargetIndex
>=
This
->
adapter
->
gl_info
.
limits
.
buffers
)
if
(
render_target_idx
>=
device
->
adapter
->
gl_info
.
limits
.
buffers
)
{
WARN
(
"(%p) : Unsupported target %u set, returning WINED3DERR_INVALIDCALL(only %u supported)
\n
"
,
This
,
RenderTargetIndex
,
This
->
adapter
->
gl_info
.
limits
.
buffers
);
WARN
(
"Only %u render targets are supported.
\n
"
,
device
->
adapter
->
gl_info
.
limits
.
buffers
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
render_target
==
(
IWineD3DSurface
*
)
device
->
render_targets
[
render_target_idx
])
{
TRACE
(
"Trying to do a NOP SetRenderTarget operation.
\n
"
);
return
WINED3D_OK
;
}
/* Render target 0 can't be set to NULL. */
if
(
!
pRenderTarget
&&
!
RenderTargetInde
x
)
if
(
!
render_target
&&
!
render_target_id
x
)
{
WARN
(
"Trying to set render target 0 to NULL.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
pRenderTarget
&&
!
(((
IWineD3DSurfaceImpl
*
)
pRenderTarget
)
->
resource
.
usage
&
WINED3DUSAGE_RENDERTARGET
))
{
FIXME
(
"(%p)Trying to set the render target to a surface(%p) that wasn't created with a usage of WINED3DUSAGE_RENDERTARGET
\n
"
,
This
,
pRenderTarget
);
if
(
render_target
&&
!
(((
IWineD3DSurfaceImpl
*
)
render_target
)
->
resource
.
usage
&
WINED3DUSAGE_RENDERTARGET
))
{
FIXME
(
"Surface %p doesn't have render target usage.
\n
"
,
render_target
);
return
WINED3DERR_INVALIDCALL
;
}
/* If we are trying to set what we already have, don't bother */
if
(
pRenderTarget
==
(
IWineD3DSurface
*
)
This
->
render_targets
[
RenderTargetIndex
])
if
(
render_target
)
IWineD3DSurface_AddRef
(
render_target
);
if
(
device
->
render_targets
[
render_target_idx
])
IWineD3DSurface_Release
((
IWineD3DSurface
*
)
device
->
render_targets
[
render_target_idx
]);
device
->
render_targets
[
render_target_idx
]
=
(
IWineD3DSurfaceImpl
*
)
render_target
;
/* Render target 0 is special. */
if
(
!
render_target_idx
&&
set_viewport
)
{
TRACE
(
"Trying to do a NOP SetRenderTarget operation
\n
"
);
return
WINED3D_OK
;
}
if
(
pRenderTarget
)
IWineD3DSurface_AddRef
(
pRenderTarget
);
if
(
This
->
render_targets
[
RenderTargetIndex
])
IWineD3DSurface_Release
((
IWineD3DSurface
*
)
This
->
render_targets
[
RenderTargetIndex
]);
This
->
render_targets
[
RenderTargetIndex
]
=
(
IWineD3DSurfaceImpl
*
)
pRenderTarget
;
/* Render target 0 is special */
if
(
RenderTargetIndex
==
0
&&
set_viewport
)
{
/* Finally, reset the viewport and scissor rect as the MSDN states.
* Tests show that stateblock recording is ignored, the change goes
* directly into the primary stateblock.
*/
This
->
stateBlock
->
viewport
.
Height
=
This
->
render_targets
[
0
]
->
currentDesc
.
Height
;
This
->
stateBlock
->
viewport
.
Width
=
This
->
render_targets
[
0
]
->
currentDesc
.
Width
;
This
->
stateBlock
->
viewport
.
X
=
0
;
This
->
stateBlock
->
viewport
.
Y
=
0
;
This
->
stateBlock
->
viewport
.
MaxZ
=
1
.
0
f
;
This
->
stateBlock
->
viewport
.
MinZ
=
0
.
0
f
;
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_VIEWPORT
);
This
->
stateBlock
->
scissorRect
.
top
=
0
;
This
->
stateBlock
->
scissorRect
.
left
=
0
;
This
->
stateBlock
->
scissorRect
.
right
=
This
->
stateBlock
->
viewport
.
Width
;
This
->
stateBlock
->
scissorRect
.
bottom
=
This
->
stateBlock
->
viewport
.
Height
;
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_SCISSORRECT
);
/* Set the viewport and scissor rectangles, if requested. Tests show
* that stateblock recording is ignored, the change goes directly
* into the primary stateblock. */
device
->
stateBlock
->
viewport
.
Height
=
device
->
render_targets
[
0
]
->
currentDesc
.
Height
;
device
->
stateBlock
->
viewport
.
Width
=
device
->
render_targets
[
0
]
->
currentDesc
.
Width
;
device
->
stateBlock
->
viewport
.
X
=
0
;
device
->
stateBlock
->
viewport
.
Y
=
0
;
device
->
stateBlock
->
viewport
.
MaxZ
=
1
.
0
f
;
device
->
stateBlock
->
viewport
.
MinZ
=
0
.
0
f
;
IWineD3DDeviceImpl_MarkStateDirty
(
device
,
STATE_VIEWPORT
);
device
->
stateBlock
->
scissorRect
.
top
=
0
;
device
->
stateBlock
->
scissorRect
.
left
=
0
;
device
->
stateBlock
->
scissorRect
.
right
=
device
->
stateBlock
->
viewport
.
Width
;
device
->
stateBlock
->
scissorRect
.
bottom
=
device
->
stateBlock
->
viewport
.
Height
;
IWineD3DDeviceImpl_MarkStateDirty
(
device
,
STATE_SCISSORRECT
);
}
return
WINED3D_OK
;
}
...
...
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