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
ec97383f
Commit
ec97383f
authored
Sep 23, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Add support for ARB_framebuffer_object.
parent
c4c86215
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
145 additions
and
48 deletions
+145
-48
context.c
dlls/wined3d/context.c
+0
-0
device.c
dlls/wined3d/device.c
+31
-22
directx.c
dlls/wined3d/directx.c
+57
-4
surface.c
dlls/wined3d/surface.c
+33
-22
utils.c
dlls/wined3d/utils.c
+0
-0
wined3d_gl.h
dlls/wined3d/wined3d_gl.h
+24
-0
No files found.
dlls/wined3d/context.c
View file @
ec97383f
This diff is collapsed.
Click to expand it.
dlls/wined3d/device.c
View file @
ec97383f
...
...
@@ -2210,6 +2210,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface,
D3DCB_DESTROYSWAPCHAINFN
D3DCB_DestroySwapChain
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
const
struct
wined3d_context
*
context
;
const
struct
wined3d_gl_info
*
gl_info
;
int
sampler
;
UINT
i
;
TRACE
(
"(%p)
\n
"
,
This
);
...
...
@@ -2219,7 +2221,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface,
/* I don't think that the interface guarantees that the device is destroyed from the same thread
* it was created. Thus make sure a context is active for the glDelete* calls
*/
ActivateContext
(
This
,
NULL
,
CTXUSAGE_RESOURCELOAD
);
context
=
ActivateContext
(
This
,
NULL
,
CTXUSAGE_RESOURCELOAD
);
gl_info
=
context
->
gl_info
;
if
(
This
->
logo_surface
)
IWineD3DSurface_Release
(
This
->
logo_surface
);
...
...
@@ -2273,7 +2276,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface,
}
if
(
This
->
depth_blt_rb
)
{
ENTER_GL
();
GL_EXTCALL
(
glDeleteRenderbuffersEXT
(
1
,
&
This
->
depth_blt_rb
)
);
gl_info
->
fbo_ops
.
glDeleteRenderbuffers
(
1
,
&
This
->
depth_blt_rb
);
LEAVE_GL
();
This
->
depth_blt_rb
=
0
;
This
->
depth_blt_rb_w
=
0
;
...
...
@@ -5952,7 +5955,7 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface,
context
=
ActivateContext
(
This
,
surface
,
CTXUSAGE_RESOURCELOAD
);
ENTER_GL
();
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
_EXT
,
NULL
);
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
,
NULL
);
buffer
=
surface_get_gl_buffer
(
surface
,
swapchain
);
glDrawBuffer
(
buffer
);
checkGLcall
(
"glDrawBuffer()"
);
...
...
@@ -5961,9 +5964,9 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface,
context
=
ActivateContext
(
This
,
NULL
,
CTXUSAGE_RESOURCELOAD
);
ENTER_GL
();
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
_EXT
,
&
context
->
dst_fbo
);
context_attach_surface_fbo
(
context
,
GL_FRAMEBUFFER
_EXT
,
0
,
surface
);
context_attach_depth_stencil_fbo
(
context
,
GL_FRAMEBUFFER
_EXT
,
NULL
,
FALSE
);
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
,
&
context
->
dst_fbo
);
context_attach_surface_fbo
(
context
,
GL_FRAMEBUFFER
,
0
,
surface
);
context_attach_depth_stencil_fbo
(
context
,
GL_FRAMEBUFFER
,
NULL
,
FALSE
);
}
if
(
rect
)
{
...
...
@@ -6320,6 +6323,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
GLbitfield
mask
=
GL_COLOR_BUFFER_BIT
;
/* TODO: Support blitting depth/stencil surfaces */
IWineD3DSwapChain
*
src_swapchain
,
*
dst_swapchain
;
const
struct
wined3d_gl_info
*
gl_info
;
struct
wined3d_context
*
context
;
GLenum
gl_filter
;
POINT
offset
=
{
0
,
0
};
...
...
@@ -6350,6 +6354,8 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
else
if
(
dst_swapchain
)
context
=
ActivateContext
(
This
,
dst_surface
,
CTXUSAGE_RESOURCELOAD
);
else
context
=
ActivateContext
(
This
,
NULL
,
CTXUSAGE_RESOURCELOAD
);
gl_info
=
context
->
gl_info
;
if
(
src_swapchain
)
{
GLenum
buffer
=
surface_get_gl_buffer
(
src_surface
,
src_swapchain
);
...
...
@@ -6373,17 +6379,17 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
}
ENTER_GL
();
context_bind_fbo
(
context
,
GL_READ_FRAMEBUFFER
_EXT
,
NULL
);
context_bind_fbo
(
context
,
GL_READ_FRAMEBUFFER
,
NULL
);
glReadBuffer
(
buffer
);
checkGLcall
(
"glReadBuffer()"
);
}
else
{
TRACE
(
"Source surface %p is offscreen
\n
"
,
src_surface
);
ENTER_GL
();
context_bind_fbo
(
context
,
GL_READ_FRAMEBUFFER
_EXT
,
&
context
->
src_fbo
);
context_attach_surface_fbo
(
context
,
GL_READ_FRAMEBUFFER
_EXT
,
0
,
src_surface
);
glReadBuffer
(
GL_COLOR_ATTACHMENT0
_EXT
);
context_bind_fbo
(
context
,
GL_READ_FRAMEBUFFER
,
&
context
->
src_fbo
);
context_attach_surface_fbo
(
context
,
GL_READ_FRAMEBUFFER
,
0
,
src_surface
);
glReadBuffer
(
GL_COLOR_ATTACHMENT0
);
checkGLcall
(
"glReadBuffer()"
);
context_attach_depth_stencil_fbo
(
context
,
GL_READ_FRAMEBUFFER
_EXT
,
NULL
,
FALSE
);
context_attach_depth_stencil_fbo
(
context
,
GL_READ_FRAMEBUFFER
,
NULL
,
FALSE
);
}
LEAVE_GL
();
...
...
@@ -6412,29 +6418,29 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
}
ENTER_GL
();
context_bind_fbo
(
context
,
GL_DRAW_FRAMEBUFFER
_EXT
,
NULL
);
context_bind_fbo
(
context
,
GL_DRAW_FRAMEBUFFER
,
NULL
);
glDrawBuffer
(
buffer
);
checkGLcall
(
"glDrawBuffer()"
);
}
else
{
TRACE
(
"Destination surface %p is offscreen
\n
"
,
dst_surface
);
ENTER_GL
();
context_bind_fbo
(
context
,
GL_DRAW_FRAMEBUFFER
_EXT
,
&
context
->
dst_fbo
);
context_attach_surface_fbo
(
context
,
GL_DRAW_FRAMEBUFFER
_EXT
,
0
,
dst_surface
);
glDrawBuffer
(
GL_COLOR_ATTACHMENT0
_EXT
);
context_bind_fbo
(
context
,
GL_DRAW_FRAMEBUFFER
,
&
context
->
dst_fbo
);
context_attach_surface_fbo
(
context
,
GL_DRAW_FRAMEBUFFER
,
0
,
dst_surface
);
glDrawBuffer
(
GL_COLOR_ATTACHMENT0
);
checkGLcall
(
"glDrawBuffer()"
);
context_attach_depth_stencil_fbo
(
context
,
GL_DRAW_FRAMEBUFFER
_EXT
,
NULL
,
FALSE
);
context_attach_depth_stencil_fbo
(
context
,
GL_DRAW_FRAMEBUFFER
,
NULL
,
FALSE
);
}
glDisable
(
GL_SCISSOR_TEST
);
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_RENDER
(
WINED3DRS_SCISSORTESTENABLE
));
if
(
flip
)
{
GL_EXTCALL
(
glBlitFramebufferEXT
(
src_rect
->
x1
,
src_rect
->
y1
,
src_rect
->
x2
,
src_rect
->
y2
,
dst_rect
->
x1
,
dst_rect
->
y2
,
dst_rect
->
x2
,
dst_rect
->
y1
,
mask
,
gl_filter
)
)
;
gl_info
->
fbo_ops
.
glBlitFramebuffer
(
src_rect
->
x1
,
src_rect
->
y1
,
src_rect
->
x2
,
src_rect
->
y2
,
dst_rect
->
x1
,
dst_rect
->
y2
,
dst_rect
->
x2
,
dst_rect
->
y1
,
mask
,
gl_filter
);
checkGLcall
(
"glBlitFramebuffer()"
);
}
else
{
GL_EXTCALL
(
glBlitFramebufferEXT
(
src_rect
->
x1
,
src_rect
->
y1
,
src_rect
->
x2
,
src_rect
->
y2
,
dst_rect
->
x1
,
dst_rect
->
y1
,
dst_rect
->
x2
,
dst_rect
->
y2
,
mask
,
gl_filter
)
)
;
gl_info
->
fbo_ops
.
glBlitFramebuffer
(
src_rect
->
x1
,
src_rect
->
y1
,
src_rect
->
x2
,
src_rect
->
y2
,
dst_rect
->
x1
,
dst_rect
->
y1
,
dst_rect
->
x2
,
dst_rect
->
y2
,
mask
,
gl_filter
);
checkGLcall
(
"glBlitFramebuffer()"
);
}
...
...
@@ -6878,10 +6884,13 @@ static BOOL is_display_mode_supported(IWineD3DDeviceImpl *This, const WINED3DPRE
void
delete_opengl_contexts
(
IWineD3DDevice
*
iface
,
IWineD3DSwapChain
*
swapchain_iface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DSwapChainImpl
*
swapchain
=
(
IWineD3DSwapChainImpl
*
)
swapchain_iface
;
const
struct
wined3d_context
*
context
;
const
struct
wined3d_gl_info
*
gl_info
;
UINT
i
;
IWineD3DBaseShaderImpl
*
shader
;
ActivateContext
(
This
,
NULL
,
CTXUSAGE_RESOURCELOAD
);
context
=
ActivateContext
(
This
,
NULL
,
CTXUSAGE_RESOURCELOAD
);
gl_info
=
context
->
gl_info
;
IWineD3DDevice_EnumResources
(
iface
,
reset_unload_resources
,
NULL
);
LIST_FOR_EACH_ENTRY
(
shader
,
&
This
->
shaders
,
IWineD3DBaseShaderImpl
,
baseShader
.
shader_list_entry
)
{
...
...
@@ -6894,7 +6903,7 @@ void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain_
This
->
depth_blt_texture
=
0
;
}
if
(
This
->
depth_blt_rb
)
{
GL_EXTCALL
(
glDeleteRenderbuffersEXT
(
1
,
&
This
->
depth_blt_rb
)
);
gl_info
->
fbo_ops
.
glDeleteRenderbuffers
(
1
,
&
This
->
depth_blt_rb
);
This
->
depth_blt_rb
=
0
;
This
->
depth_blt_rb_w
=
0
;
This
->
depth_blt_rb_h
=
0
;
...
...
dlls/wined3d/directx.c
View file @
ec97383f
...
...
@@ -1872,10 +1872,63 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_gl_info *gl_info)
* shaders), but 8 texture stages (register combiners). */
gl_info
->
max_sampler_stages
=
max
(
gl_info
->
max_fragment_samplers
,
gl_info
->
max_texture_stages
);
/* We can only use ORM_FBO when the hardware supports it. */
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
&&
!
gl_info
->
supported
[
EXT_FRAMEBUFFER_OBJECT
])
{
WARN_
(
d3d_caps
)(
"GL_EXT_framebuffer_object not supported, falling back to backbuffer offscreen rendering mode.
\n
"
);
wined3d_settings
.
offscreen_rendering_mode
=
ORM_BACKBUFFER
;
if
(
gl_info
->
supported
[
ARB_FRAMEBUFFER_OBJECT
])
{
gl_info
->
fbo_ops
.
glIsRenderbuffer
=
gl_info
->
glIsRenderbuffer
;
gl_info
->
fbo_ops
.
glBindRenderbuffer
=
gl_info
->
glBindRenderbuffer
;
gl_info
->
fbo_ops
.
glDeleteRenderbuffers
=
gl_info
->
glDeleteRenderbuffers
;
gl_info
->
fbo_ops
.
glGenRenderbuffers
=
gl_info
->
glGenRenderbuffers
;
gl_info
->
fbo_ops
.
glRenderbufferStorage
=
gl_info
->
glRenderbufferStorage
;
gl_info
->
fbo_ops
.
glRenderbufferStorageMultisample
=
gl_info
->
glRenderbufferStorageMultisample
;
gl_info
->
fbo_ops
.
glGetRenderbufferParameteriv
=
gl_info
->
glGetRenderbufferParameteriv
;
gl_info
->
fbo_ops
.
glIsFramebuffer
=
gl_info
->
glIsFramebuffer
;
gl_info
->
fbo_ops
.
glBindFramebuffer
=
gl_info
->
glBindFramebuffer
;
gl_info
->
fbo_ops
.
glDeleteFramebuffers
=
gl_info
->
glDeleteFramebuffers
;
gl_info
->
fbo_ops
.
glGenFramebuffers
=
gl_info
->
glGenFramebuffers
;
gl_info
->
fbo_ops
.
glCheckFramebufferStatus
=
gl_info
->
glCheckFramebufferStatus
;
gl_info
->
fbo_ops
.
glFramebufferTexture1D
=
gl_info
->
glFramebufferTexture1D
;
gl_info
->
fbo_ops
.
glFramebufferTexture2D
=
gl_info
->
glFramebufferTexture2D
;
gl_info
->
fbo_ops
.
glFramebufferTexture3D
=
gl_info
->
glFramebufferTexture3D
;
gl_info
->
fbo_ops
.
glFramebufferRenderbuffer
=
gl_info
->
glFramebufferRenderbuffer
;
gl_info
->
fbo_ops
.
glGetFramebufferAttachmentParameteriv
=
gl_info
->
glGetFramebufferAttachmentParameteriv
;
gl_info
->
fbo_ops
.
glBlitFramebuffer
=
gl_info
->
glBlitFramebuffer
;
gl_info
->
fbo_ops
.
glGenerateMipmap
=
gl_info
->
glGenerateMipmap
;
}
else
{
if
(
gl_info
->
supported
[
EXT_FRAMEBUFFER_OBJECT
])
{
gl_info
->
fbo_ops
.
glIsRenderbuffer
=
gl_info
->
glIsRenderbufferEXT
;
gl_info
->
fbo_ops
.
glBindRenderbuffer
=
gl_info
->
glBindRenderbufferEXT
;
gl_info
->
fbo_ops
.
glDeleteRenderbuffers
=
gl_info
->
glDeleteRenderbuffersEXT
;
gl_info
->
fbo_ops
.
glGenRenderbuffers
=
gl_info
->
glGenRenderbuffersEXT
;
gl_info
->
fbo_ops
.
glRenderbufferStorage
=
gl_info
->
glRenderbufferStorageEXT
;
gl_info
->
fbo_ops
.
glGetRenderbufferParameteriv
=
gl_info
->
glGetRenderbufferParameterivEXT
;
gl_info
->
fbo_ops
.
glIsFramebuffer
=
gl_info
->
glIsFramebufferEXT
;
gl_info
->
fbo_ops
.
glBindFramebuffer
=
gl_info
->
glBindFramebufferEXT
;
gl_info
->
fbo_ops
.
glDeleteFramebuffers
=
gl_info
->
glDeleteFramebuffersEXT
;
gl_info
->
fbo_ops
.
glGenFramebuffers
=
gl_info
->
glGenFramebuffersEXT
;
gl_info
->
fbo_ops
.
glCheckFramebufferStatus
=
gl_info
->
glCheckFramebufferStatusEXT
;
gl_info
->
fbo_ops
.
glFramebufferTexture1D
=
gl_info
->
glFramebufferTexture1DEXT
;
gl_info
->
fbo_ops
.
glFramebufferTexture2D
=
gl_info
->
glFramebufferTexture2DEXT
;
gl_info
->
fbo_ops
.
glFramebufferTexture3D
=
gl_info
->
glFramebufferTexture3DEXT
;
gl_info
->
fbo_ops
.
glFramebufferRenderbuffer
=
gl_info
->
glFramebufferRenderbufferEXT
;
gl_info
->
fbo_ops
.
glGetFramebufferAttachmentParameteriv
=
gl_info
->
glGetFramebufferAttachmentParameterivEXT
;
gl_info
->
fbo_ops
.
glGenerateMipmap
=
gl_info
->
glGenerateMipmapEXT
;
}
else
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
)
{
WARN_
(
d3d_caps
)(
"Framebuffer objects not supported, falling back to backbuffer offscreen rendering mode.
\n
"
);
wined3d_settings
.
offscreen_rendering_mode
=
ORM_BACKBUFFER
;
}
if
(
gl_info
->
supported
[
EXT_FRAMEBUFFER_BLIT
])
{
gl_info
->
fbo_ops
.
glBlitFramebuffer
=
gl_info
->
glBlitFramebufferEXT
;
}
if
(
gl_info
->
supported
[
EXT_FRAMEBUFFER_MULTISAMPLE
])
{
gl_info
->
fbo_ops
.
glRenderbufferStorageMultisample
=
gl_info
->
glRenderbufferStorageMultisampleEXT
;
}
}
/* MRTs are currently only supported when FBOs are used. */
...
...
dlls/wined3d/surface.c
View file @
ec97383f
...
...
@@ -70,7 +70,7 @@ static void surface_cleanup(IWineD3DSurfaceImpl *This)
LIST_FOR_EACH_ENTRY_SAFE
(
entry
,
entry2
,
&
This
->
renderbuffers
,
renderbuffer_entry_t
,
entry
)
{
GL_EXTCALL
(
glDeleteRenderbuffersEXT
(
1
,
&
entry
->
id
)
);
gl_info
->
fbo_ops
.
glDeleteRenderbuffers
(
1
,
&
entry
->
id
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
}
...
...
@@ -610,6 +610,7 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, GLenum internal,
/* GL locking is done by the caller */
void
surface_set_compatible_renderbuffer
(
IWineD3DSurface
*
iface
,
unsigned
int
width
,
unsigned
int
height
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
const
struct
wined3d_gl_info
*
gl_info
=
&
This
->
resource
.
wineD3DDevice
->
adapter
->
gl_info
;
renderbuffer_entry_t
*
entry
;
GLuint
renderbuffer
=
0
;
unsigned
int
src_width
,
src_height
;
...
...
@@ -636,10 +637,10 @@ void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int wi
}
if
(
!
renderbuffer
)
{
GL_EXTCALL
(
glGenRenderbuffersEXT
(
1
,
&
renderbuffer
)
);
GL_EXTCALL
(
glBindRenderbufferEXT
(
GL_RENDERBUFFER_EXT
,
renderbuffer
)
);
GL_EXTCALL
(
glRenderbufferStorageEXT
(
GL_RENDERBUFFER_EXT
,
This
->
resource
.
format_desc
->
glInternal
,
width
,
height
)
)
;
gl_info
->
fbo_ops
.
glGenRenderbuffers
(
1
,
&
renderbuffer
);
gl_info
->
fbo_ops
.
glBindRenderbuffer
(
GL_RENDERBUFFER
,
renderbuffer
);
gl_info
->
fbo_ops
.
glRenderbufferStorage
(
GL_RENDERBUFFER
,
This
->
resource
.
format_desc
->
glInternal
,
width
,
height
);
entry
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
renderbuffer_entry_t
));
entry
->
width
=
width
;
...
...
@@ -814,6 +815,8 @@ static void WINAPI IWineD3DSurfaceImpl_UnLoad(IWineD3DSurface *iface) {
IWineD3DBaseTexture
*
texture
=
NULL
;
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
IWineD3DDeviceImpl
*
device
=
This
->
resource
.
wineD3DDevice
;
const
struct
wined3d_context
*
context
;
const
struct
wined3d_gl_info
*
gl_info
;
renderbuffer_entry_t
*
entry
,
*
entry2
;
TRACE
(
"(%p)
\n
"
,
iface
);
...
...
@@ -844,7 +847,8 @@ static void WINAPI IWineD3DSurfaceImpl_UnLoad(IWineD3DSurface *iface) {
IWineD3DSurface_ModifyLocation
(
iface
,
SFLAG_INSRGBTEX
,
FALSE
);
This
->
Flags
&=
~
(
SFLAG_ALLOCATED
|
SFLAG_SRGBALLOCATED
);
ActivateContext
(
device
,
NULL
,
CTXUSAGE_RESOURCELOAD
);
context
=
ActivateContext
(
device
,
NULL
,
CTXUSAGE_RESOURCELOAD
);
gl_info
=
context
->
gl_info
;
/* Destroy PBOs, but load them into real sysmem before */
if
(
This
->
Flags
&
SFLAG_PBO
)
{
...
...
@@ -857,7 +861,7 @@ static void WINAPI IWineD3DSurfaceImpl_UnLoad(IWineD3DSurface *iface) {
*/
LIST_FOR_EACH_ENTRY_SAFE
(
entry
,
entry2
,
&
This
->
renderbuffers
,
renderbuffer_entry_t
,
entry
)
{
ENTER_GL
();
GL_EXTCALL
(
glDeleteRenderbuffersEXT
(
1
,
&
entry
->
id
)
);
gl_info
->
fbo_ops
.
glDeleteRenderbuffers
(
1
,
&
entry
->
id
);
LEAVE_GL
();
list_remove
(
&
entry
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
...
...
@@ -1885,7 +1889,8 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
break
;
case
WINED3DFMT_D15S1
:
if
(
GL_SUPPORT
(
EXT_PACKED_DEPTH_STENCIL
))
if
(
GL_SUPPORT
(
ARB_FRAMEBUFFER_OBJECT
)
||
GL_SUPPORT
(
EXT_PACKED_DEPTH_STENCIL
))
{
*
convert
=
CONVERT_D15S1
;
*
target_bpp
=
4
;
...
...
@@ -1893,7 +1898,8 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
break
;
case
WINED3DFMT_D24X4S4
:
if
(
GL_SUPPORT
(
EXT_PACKED_DEPTH_STENCIL
))
if
(
GL_SUPPORT
(
ARB_FRAMEBUFFER_OBJECT
)
||
GL_SUPPORT
(
EXT_PACKED_DEPTH_STENCIL
))
{
*
convert
=
CONVERT_D24X4S4
;
}
...
...
@@ -3581,7 +3587,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
* FBO support, so it doesn't really make sense to try and make it work with different offscreen rendering
* backends.
*/
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
&&
GL_SUPPORT
(
EXT_FRAMEBUFFER_BLIT
)
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
&&
myDevice
->
adapter
->
gl_info
.
fbo_ops
.
glBlitFramebuffer
&&
surface_can_stretch_rect
(
Src
,
This
))
{
stretch_rect_fbo
((
IWineD3DDevice
*
)
myDevice
,
SrcSurface
,
&
srect
,
...
...
@@ -3645,7 +3652,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
Src
->
palette
=
This
->
palette
;
}
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
&&
GL_SUPPORT
(
EXT_FRAMEBUFFER_BLIT
)
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
&&
myDevice
->
adapter
->
gl_info
.
fbo_ops
.
glBlitFramebuffer
&&
!
(
Flags
&
(
WINEDDBLT_KEYSRC
|
WINEDDBLT_KEYSRCOVERRIDE
))
&&
surface_can_stretch_rect
(
Src
,
This
))
{
...
...
@@ -4342,6 +4350,7 @@ void surface_load_ds_location(IWineD3DSurface *iface, struct wined3d_context *co
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
IWineD3DDeviceImpl
*
device
=
This
->
resource
.
wineD3DDevice
;
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
TRACE
(
"(%p) New location %#x
\n
"
,
This
,
location
);
...
...
@@ -4373,7 +4382,7 @@ void surface_load_ds_location(IWineD3DSurface *iface, struct wined3d_context *co
/* Note that we use depth_blt here as well, rather than glCopyTexImage2D
* directly on the FBO texture. That's because we need to flip. */
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
_EXT
,
NULL
);
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
,
NULL
);
if
(
This
->
texture_target
==
GL_TEXTURE_RECTANGLE_ARB
)
{
glGetIntegerv
(
GL_TEXTURE_BINDING_RECTANGLE_ARB
,
&
old_binding
);
...
...
@@ -4395,30 +4404,32 @@ void surface_load_ds_location(IWineD3DSurface *iface, struct wined3d_context *co
/* Setup the destination */
if
(
!
device
->
depth_blt_rb
)
{
GL_EXTCALL
(
glGenRenderbuffersEXT
(
1
,
&
device
->
depth_blt_rb
)
);
gl_info
->
fbo_ops
.
glGenRenderbuffers
(
1
,
&
device
->
depth_blt_rb
);
checkGLcall
(
"glGenRenderbuffersEXT"
);
}
if
(
device
->
depth_blt_rb_w
!=
This
->
currentDesc
.
Width
||
device
->
depth_blt_rb_h
!=
This
->
currentDesc
.
Height
)
{
GL_EXTCALL
(
glBindRenderbufferEXT
(
GL_RENDERBUFFER_EXT
,
device
->
depth_blt_rb
)
);
gl_info
->
fbo_ops
.
glBindRenderbuffer
(
GL_RENDERBUFFER
,
device
->
depth_blt_rb
);
checkGLcall
(
"glBindRenderbufferEXT"
);
GL_EXTCALL
(
glRenderbufferStorageEXT
(
GL_RENDERBUFFER_EXT
,
GL_RGBA8
,
This
->
currentDesc
.
Width
,
This
->
currentDesc
.
Height
));
gl_info
->
fbo_ops
.
glRenderbufferStorage
(
GL_RENDERBUFFER
,
GL_RGBA8
,
This
->
currentDesc
.
Width
,
This
->
currentDesc
.
Height
);
checkGLcall
(
"glRenderbufferStorageEXT"
);
device
->
depth_blt_rb_w
=
This
->
currentDesc
.
Width
;
device
->
depth_blt_rb_h
=
This
->
currentDesc
.
Height
;
}
context_bind_fbo
(
context
,
GL_FRAMEBUFFER_EXT
,
&
context
->
dst_fbo
);
GL_EXTCALL
(
glFramebufferRenderbufferEXT
(
GL_FRAMEBUFFER_EXT
,
GL_COLOR_ATTACHMENT0_EXT
,
GL_RENDERBUFFER_EXT
,
device
->
depth_blt_rb
));
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
,
&
context
->
dst_fbo
);
gl_info
->
fbo_ops
.
glFramebufferRenderbuffer
(
GL_FRAMEBUFFER
,
GL_COLOR_ATTACHMENT0
,
GL_RENDERBUFFER
,
device
->
depth_blt_rb
);
checkGLcall
(
"glFramebufferRenderbufferEXT"
);
context_attach_depth_stencil_fbo
(
context
,
GL_FRAMEBUFFER
_EXT
,
iface
,
FALSE
);
context_attach_depth_stencil_fbo
(
context
,
GL_FRAMEBUFFER
,
iface
,
FALSE
);
/* Do the actual blit */
surface_depth_blt
(
This
,
device
->
depth_blt_texture
,
This
->
currentDesc
.
Width
,
This
->
currentDesc
.
Height
,
bind_target
);
checkGLcall
(
"depth_blt"
);
if
(
context
->
current_fbo
)
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
_EXT
,
&
context
->
current_fbo
->
id
);
else
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
_EXT
,
NULL
);
if
(
context
->
current_fbo
)
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
,
&
context
->
current_fbo
->
id
);
else
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
,
NULL
);
LEAVE_GL
();
}
else
{
...
...
@@ -4430,12 +4441,12 @@ void surface_load_ds_location(IWineD3DSurface *iface, struct wined3d_context *co
ENTER_GL
();
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
_EXT
,
NULL
);
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
,
NULL
);
surface_depth_blt
(
This
,
This
->
texture_name
,
This
->
currentDesc
.
Width
,
This
->
currentDesc
.
Height
,
This
->
texture_target
);
checkGLcall
(
"depth_blt"
);
if
(
context
->
current_fbo
)
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
_EXT
,
&
context
->
current_fbo
->
id
);
if
(
context
->
current_fbo
)
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
,
&
context
->
current_fbo
->
id
);
LEAVE_GL
();
}
else
{
...
...
dlls/wined3d/utils.c
View file @
ec97383f
This diff is collapsed.
Click to expand it.
dlls/wined3d/wined3d_gl.h
View file @
ec97383f
...
...
@@ -4097,6 +4097,29 @@ typedef BOOL (WINAPI * WINED3D_PFNWGLSETPIXELFORMATWINE) (HDC hdc, int iPixelFor
* Structures
****************************************************/
struct
wined3d_fbo_ops
{
PGLFNGLISRENDERBUFFERPROC
glIsRenderbuffer
;
PGLFNGLBINDRENDERBUFFERPROC
glBindRenderbuffer
;
PGLFNGLDELETERENDERBUFFERSPROC
glDeleteRenderbuffers
;
PGLFNGLGENRENDERBUFFERSPROC
glGenRenderbuffers
;
PGLFNGLRENDERBUFFERSTORAGEPROC
glRenderbufferStorage
;
PGLFNRENDERBUFFERSTORAGEMULTISAMPLEPROC
glRenderbufferStorageMultisample
;
PGLFNGLGETRENDERBUFFERPARAMETERIVPROC
glGetRenderbufferParameteriv
;
PGLFNGLISFRAMEBUFFERPROC
glIsFramebuffer
;
PGLFNGLBINDFRAMEBUFFERPROC
glBindFramebuffer
;
PGLFNGLDELETEFRAMEBUFFERSPROC
glDeleteFramebuffers
;
PGLFNGLGENFRAMEBUFFERSPROC
glGenFramebuffers
;
PGLFNGLCHECKFRAMEBUFFERSTATUSPROC
glCheckFramebufferStatus
;
PGLFNGLFRAMEBUFFERTEXTURE1DPROC
glFramebufferTexture1D
;
PGLFNGLFRAMEBUFFERTEXTURE2DPROC
glFramebufferTexture2D
;
PGLFNGLFRAMEBUFFERTEXTURE3DPROC
glFramebufferTexture3D
;
PGLFNGLFRAMEBUFFERRENDERBUFFERPROC
glFramebufferRenderbuffer
;
PGLFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC
glGetFramebufferAttachmentParameteriv
;
PGLFNGLBLITFRAMEBUFFERPROC
glBlitFramebuffer
;
PGLFNGLGENERATEMIPMAPPROC
glGenerateMipmap
;
};
#define USE_GL_FUNC(type, pfn, ext, replace) type pfn;
struct
wined3d_gl_info
...
...
@@ -4145,6 +4168,7 @@ struct wined3d_gl_info
BOOL
supported
[
WINED3D_GL_EXT_COUNT
];
struct
wined3d_fbo_ops
fbo_ops
;
/* GL function pointers */
GL_EXT_FUNCS_GEN
/* WGL function pointers */
...
...
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