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
8a6799d4
Commit
8a6799d4
authored
Jul 07, 2005
by
Oliver Stieber
Committed by
Alexandre Julliard
Jul 07, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement render targets using either textures, swapchains or
standalone surfaces.
parent
e419cb88
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
181 additions
and
40 deletions
+181
-40
device.c
dlls/d3d9/device.c
+44
-36
device.c
dlls/wined3d/device.c
+0
-0
directx.c
dlls/wined3d/directx.c
+0
-1
surface.c
dlls/wined3d/surface.c
+0
-0
utils.c
dlls/wined3d/utils.c
+134
-0
wined3d_private.h
dlls/wined3d/wined3d_private.h
+3
-3
No files found.
dlls/d3d9/device.c
View file @
8a6799d4
...
@@ -374,53 +374,61 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateOffscreenPlainSurface(LPDIRECT3DDEVI
...
@@ -374,53 +374,61 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateOffscreenPlainSurface(LPDIRECT3DDEVI
/* TODO: move to wineD3D */
/* TODO: move to wineD3D */
HRESULT
WINAPI
IDirect3DDevice9Impl_SetRenderTarget
(
LPDIRECT3DDEVICE9
iface
,
DWORD
RenderTargetIndex
,
IDirect3DSurface9
*
pRenderTarget
)
{
HRESULT
WINAPI
IDirect3DDevice9Impl_SetRenderTarget
(
LPDIRECT3DDEVICE9
iface
,
DWORD
RenderTargetIndex
,
IDirect3DSurface9
*
pRenderTarget
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
HRESULT
hr
=
S_OK
;
IDirect3DSurface9Impl
*
pSurface
=
(
IDirect3DSurface9Impl
*
)
pRenderTarget
;
TRACE
(
"(%p) Relay
\n
"
,
This
);
return
IWineD3DDevice_SetRenderTarget
(
This
->
WineD3DDevice
,
RenderTargetIndex
,(
IWineD3DSurface
*
)
pSurface
->
wineD3DSurface
);
}
/* If pRenderTarget == NULL, it seems to default to back buffer */
HRESULT
WINAPI
IDirect3DDevice9Impl_GetRenderTarget
(
LPDIRECT3DDEVICE9
iface
,
DWORD
RenderTargetIndex
,
IDirect3DSurface9
**
ppRenderTarget
)
{
if
(
pRenderTarget
==
NULL
)
pRenderTarget
=
(
IDirect3DSurface9
*
)
This
->
backBuffer
;
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
HRESULT
hr
=
D3D_OK
;
/* If we are trying to set what we already have, don't bother */
IWineD3DSurface
*
pRenderTarget
;
if
((
IDirect3DSurface9Impl
*
)
pRenderTarget
==
This
->
renderTarget
)
{
TRACE
(
"Trying to do a NOP SetRenderTarget operation
\n
"
);
TRACE
(
"(%p) Relay
\n
"
,
This
);
}
else
{
/* Otherwise, set the render target up */
if
(
ppRenderTarget
==
NULL
)
{
TRACE
(
"(%p) : newRender@%p (default is backbuffer=(%p))
\n
"
,
This
,
pRenderTarget
,
This
->
backBuffer
);
return
D3DERR_INVALIDCALL
;
hr
=
E_FAIL
;
/* not supported yet */
}
}
hr
=
IWineD3DDevice_GetRenderTarget
(
This
->
WineD3DDevice
,
RenderTargetIndex
,
&
pRenderTarget
);
return
hr
;
if
(
hr
==
D3D_OK
&&
pRenderTarget
!=
NULL
)
{
IWineD3DResource_GetParent
((
IWineD3DResource
*
)
pRenderTarget
,(
IUnknown
**
)
ppRenderTarget
);
IWineD3DResource_Release
((
IWineD3DResource
*
)
pRenderTarget
);
}
else
{
FIXME
(
"Call to IWineD3DDevice_GetRenderTarget failed
\n
"
);
*
ppRenderTarget
=
NULL
;
}
return
hr
;
}
}
/* TODO: move to wineD3D */
HRESULT
WINAPI
IDirect3DDevice9Impl_SetDepthStencilSurface
(
LPDIRECT3DDEVICE9
iface
,
IDirect3DSurface9
*
pZStencilSurface
)
{
HRESULT
WINAPI
IDirect3DDevice9Impl_GetRenderTarget
(
LPDIRECT3DDEVICE9
iface
,
DWORD
RenderTargetIndex
,
IDirect3DSurface9
**
ppRenderTarget
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
TRACE
(
"(%p)->returning (%p) default is backbuffer=(%p)
\n
"
,
This
,
This
->
renderTarget
,
This
->
backBuffer
);
IDirect3DSurface9Impl
*
pSurface
;
*
ppRenderTarget
=
(
LPDIRECT3DSURFACE9
)
This
->
renderTarget
;
IDirect3DSurface9Impl_AddRef
((
LPDIRECT3DSURFACE9
)
*
ppRenderTarget
);
TRACE
(
"(%p) Relay
\n
"
,
This
);
return
D3D_OK
;
pSurface
=
(
IDirect3DSurface9Impl
*
)
pZStencilSurface
;
return
IWineD3DDevice_SetDepthStencilSurface
(
This
->
WineD3DDevice
,
NULL
==
pSurface
?
NULL
:
(
IWineD3DSurface
*
)
pSurface
->
wineD3DSurface
);
}
}
/* TODO: move to wineD3D */
HRESULT
WINAPI
IDirect3DDevice9Impl_GetDepthStencilSurface
(
LPDIRECT3DDEVICE9
iface
,
IDirect3DSurface9
**
ppZStencilSurface
)
{
HRESULT
WINAPI
IDirect3DDevice9Impl_SetDepthStencilSurface
(
LPDIRECT3DDEVICE9
iface
,
IDirect3DSurface9
*
pZStencilSurface
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
D3D_OK
;
/* If we are trying to set what we already have, don't bother */
IWineD3DSurface
*
pZStencilSurface
;
if
((
IDirect3DSurface9Impl
*
)
pZStencilSurface
==
This
->
stencilBufferTarget
)
{
TRACE
(
"Trying to do a NOP SetDepthStencilSurface operation
\n
"
);
TRACE
(
"(%p) Relay
\n
"
,
This
);
}
else
{
if
(
ppZStencilSurface
==
NULL
){
/* Otherwise, set the target up */
return
D3DERR_INVALIDCALL
;
TRACE
(
"(%p) : newDepthStencil@%p (default is stencilbuffer=(%p))
\n
"
,
This
,
pZStencilSurface
,
This
->
depthStencilBuffer
);
hr
=
E_FAIL
;
/* not supported yet */
}
}
return
D3D_OK
;
}
/* TODO: move to wineD3D */
hr
=
IWineD3DDevice_GetDepthStencilSurface
(
This
->
WineD3DDevice
,
&
pZStencilSurface
);
HRESULT
WINAPI
IDirect3DDevice9Impl_GetDepthStencilSurface
(
LPDIRECT3DDEVICE9
iface
,
IDirect3DSurface9
**
ppZStencilSurface
)
{
if
(
hr
==
D3D_OK
&&
pZStencilSurface
!=
NULL
){
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
IWineD3DResource_GetParent
((
IWineD3DResource
*
)
pZStencilSurface
,(
IUnknown
**
)
ppZStencilSurface
);
TRACE
(
"(%p)->returning (%p) default is stencilbuffer=(%p)
\n
"
,
This
,
This
->
stencilBufferTarget
,
This
->
depthStencilBuffer
);
IWineD3DResource_Release
((
IWineD3DResource
*
)
pZStencilSurface
);
*
ppZStencilSurface
=
(
LPDIRECT3DSURFACE9
)
This
->
stencilBufferTarget
;
}
else
{
if
(
NULL
!=
*
ppZStencilSurface
)
IDirect3DSurface9Impl_AddRef
((
LPDIRECT3DSURFACE9
)
*
ppZStencilSurface
);
FIXME
(
"Call to IWineD3DDevice_GetRenderTarget failed
\n
"
);
*
ppZStencilSurface
=
NULL
;
}
return
D3D_OK
;
return
D3D_OK
;
}
}
...
...
dlls/wined3d/device.c
View file @
8a6799d4
This diff is collapsed.
Click to expand it.
dlls/wined3d/directx.c
View file @
8a6799d4
...
@@ -1572,7 +1572,6 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
...
@@ -1572,7 +1572,6 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
object
->
createParms
.
BehaviorFlags
=
BehaviourFlags
;
object
->
createParms
.
BehaviorFlags
=
BehaviourFlags
;
/* Initialize other useful values */
/* Initialize other useful values */
object
->
presentParms
.
BackBufferCount
=
1
;
/* Opengl only supports one? */
object
->
adapterNo
=
Adapter
;
object
->
adapterNo
=
Adapter
;
object
->
devType
=
DeviceType
;
object
->
devType
=
DeviceType
;
...
...
dlls/wined3d/surface.c
View file @
8a6799d4
This diff is collapsed.
Click to expand it.
dlls/wined3d/utils.c
View file @
8a6799d4
...
@@ -1761,4 +1761,138 @@ SHORT D3DFmtGetBpp(IWineD3DDeviceImpl* This, D3DFORMAT fmt) {
...
@@ -1761,4 +1761,138 @@ SHORT D3DFmtGetBpp(IWineD3DDeviceImpl* This, D3DFORMAT fmt) {
TRACE
(
"bytes/Pxl for fmt(%u,%s) = %d
\n
"
,
fmt
,
debug_d3dformat
(
fmt
),
retVal
);
TRACE
(
"bytes/Pxl for fmt(%u,%s) = %d
\n
"
,
fmt
,
debug_d3dformat
(
fmt
),
retVal
);
return
retVal
;
return
retVal
;
}
}
/* Convertes a D3D format into a OpenGL configuration format */
int
D3DFmtMakeGlCfg
(
D3DFORMAT
BackBufferFormat
,
D3DFORMAT
StencilBufferFormat
,
int
*
attribs
,
int
*
nAttribs
,
BOOL
alternate
){
#define PUSH1(att) attribs[(*nAttribs)++] = (att);
#define PUSH2(att,value) attribs[(*nAttribs)++] = (att); attribs[(*nAttribs)++] = (value);
/*We need to do some Card specific stuff in here at some point,
D3D now support floating point format buffers, and their are a number of different OpelGl ways on managing thease e.g.
GLX_ATI_pixel_format_float
*/
switch
(
BackBufferFormat
)
{
/* color buffer */
case
WINED3DFMT_P8
:
PUSH2
(
GLX_RENDER_TYPE
,
GLX_COLOR_INDEX_BIT
);
PUSH2
(
GLX_BUFFER_SIZE
,
8
);
PUSH2
(
GLX_DOUBLEBUFFER
,
TRUE
);
break
;
case
WINED3DFMT_R3G3B2
:
PUSH2
(
GLX_RENDER_TYPE
,
GLX_RGBA_BIT
);
PUSH2
(
GLX_RED_SIZE
,
3
);
PUSH2
(
GLX_GREEN_SIZE
,
3
);
PUSH2
(
GLX_BLUE_SIZE
,
2
);
break
;
case
WINED3DFMT_A1R5G5B5
:
PUSH2
(
GLX_ALPHA_SIZE
,
1
);
case
WINED3DFMT_X1R5G5B5
:
PUSH2
(
GLX_RED_SIZE
,
5
);
PUSH2
(
GLX_GREEN_SIZE
,
5
);
PUSH2
(
GLX_BLUE_SIZE
,
5
);
break
;
case
WINED3DFMT_R5G6B5
:
PUSH2
(
GLX_RED_SIZE
,
5
);
PUSH2
(
GLX_GREEN_SIZE
,
6
);
PUSH2
(
GLX_BLUE_SIZE
,
5
);
break
;
case
WINED3DFMT_A4R4G4B4
:
PUSH2
(
GLX_ALPHA_SIZE
,
4
);
case
WINED3DFMT_X4R4G4B4
:
PUSH2
(
GLX_RED_SIZE
,
4
);
PUSH2
(
GLX_GREEN_SIZE
,
4
);
PUSH2
(
GLX_BLUE_SIZE
,
4
);
break
;
case
WINED3DFMT_A8R8G8B8
:
PUSH2
(
GLX_ALPHA_SIZE
,
8
);
case
WINED3DFMT_R8G8B8
:
case
WINED3DFMT_X8R8G8B8
:
PUSH2
(
GLX_RED_SIZE
,
8
);
PUSH2
(
GLX_GREEN_SIZE
,
8
);
PUSH2
(
GLX_BLUE_SIZE
,
8
);
break
;
default
:
break
;
}
if
(
!
alternate
){
switch
(
StencilBufferFormat
)
{
case
WINED3DFMT_D16_LOCKABLE
:
case
WINED3DFMT_D16
:
PUSH2
(
GLX_DEPTH_SIZE
,
16
);
break
;
case
WINED3DFMT_D15S1
:
PUSH2
(
GLX_DEPTH_SIZE
,
15
);
PUSH2
(
GLX_STENCIL_SIZE
,
1
);
/*Does openGl support a 1bit stencil?, I've seen it used elsewhere
e.g. http://www.ks.uiuc.edu/Research/vmd/doxygen/OpenGLDisplayDevice_8C-source.html*/
break
;
case
WINED3DFMT_D24X8
:
PUSH2
(
GLX_DEPTH_SIZE
,
24
);
break
;
case
WINED3DFMT_D24X4S4
:
PUSH2
(
GLX_DEPTH_SIZE
,
24
);
PUSH2
(
GLX_STENCIL_SIZE
,
4
);
break
;
case
WINED3DFMT_D24S8
:
PUSH2
(
GLX_DEPTH_SIZE
,
24
);
PUSH2
(
GLX_STENCIL_SIZE
,
8
);
break
;
case
WINED3DFMT_D32
:
PUSH2
(
GLX_DEPTH_SIZE
,
32
);
break
;
default
:
break
;
}
}
else
{
/* it the device doesn't support the 'exact' format, try to find something close */
switch
(
StencilBufferFormat
)
{
case
WINED3DFMT_D16_LOCKABLE
:
case
WINED3DFMT_D16
:
PUSH2
(
GLX_DEPTH_SIZE
,
1
);
break
;
case
WINED3DFMT_D15S1
:
PUSH2
(
GLX_DEPTH_SIZE
,
1
);
PUSH2
(
GLX_STENCIL_SIZE
,
1
);
/*Does openGl support a 1bit stencil?, I've seen it used elsewhere
e.g. http://www.ks.uiuc.edu/Research/vmd/doxygen/OpenGLDisplayDevice_8C-source.html*/
break
;
case
WINED3DFMT_D24X8
:
PUSH2
(
GLX_DEPTH_SIZE
,
1
);
break
;
case
WINED3DFMT_D24X4S4
:
PUSH2
(
GLX_DEPTH_SIZE
,
1
);
PUSH2
(
GLX_STENCIL_SIZE
,
1
);
break
;
case
WINED3DFMT_D24S8
:
PUSH2
(
GLX_DEPTH_SIZE
,
1
);
PUSH2
(
GLX_STENCIL_SIZE
,
1
);
break
;
case
WINED3DFMT_D32
:
PUSH2
(
GLX_DEPTH_SIZE
,
1
);
break
;
default
:
break
;
}
}
return
*
nAttribs
;
}
#undef GLINFO_LOCATION
#undef GLINFO_LOCATION
dlls/wined3d/wined3d_private.h
View file @
8a6799d4
...
@@ -394,7 +394,6 @@ typedef struct IWineD3DDeviceImpl
...
@@ -394,7 +394,6 @@ typedef struct IWineD3DDeviceImpl
/* Internal use fields */
/* Internal use fields */
D3DDEVICE_CREATION_PARAMETERS
createParms
;
D3DDEVICE_CREATION_PARAMETERS
createParms
;
D3DPRESENT_PARAMETERS
presentParms
;
UINT
adapterNo
;
UINT
adapterNo
;
D3DDEVTYPE
devType
;
D3DDEVTYPE
devType
;
...
@@ -403,8 +402,6 @@ typedef struct IWineD3DDeviceImpl
...
@@ -403,8 +402,6 @@ typedef struct IWineD3DDeviceImpl
int
numberOfSwapChains
;
int
numberOfSwapChains
;
/* Render Target Support */
/* Render Target Support */
IWineD3DSurface
*
frontBuffer
;
IWineD3DSurface
*
backBuffer
;
IWineD3DSurface
*
depthStencilBuffer
;
IWineD3DSurface
*
depthStencilBuffer
;
IWineD3DSurface
*
renderTarget
;
IWineD3DSurface
*
renderTarget
;
...
@@ -850,6 +847,9 @@ GLenum D3DFmt2GLFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
...
@@ -850,6 +847,9 @@ GLenum D3DFmt2GLFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
GLenum
D3DFmt2GLType
(
IWineD3DDeviceImpl
*
This
,
D3DFORMAT
fmt
);
GLenum
D3DFmt2GLType
(
IWineD3DDeviceImpl
*
This
,
D3DFORMAT
fmt
);
GLint
D3DFmt2GLIntFmt
(
IWineD3DDeviceImpl
*
This
,
D3DFORMAT
fmt
);
GLint
D3DFmt2GLIntFmt
(
IWineD3DDeviceImpl
*
This
,
D3DFORMAT
fmt
);
int
D3DFmtMakeGlCfg
(
D3DFORMAT
BackBufferFormat
,
D3DFORMAT
StencilBufferFormat
,
int
*
attribs
,
int
*
nAttribs
,
BOOL
alternate
);
/*****************************************************************************
/*****************************************************************************
* To enable calling of inherited functions, requires prototypes
* To enable calling of inherited functions, requires prototypes
*
*
...
...
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