Commit Graph

247 Commits

Author SHA1 Message Date
Stefan Dösinger dc918d4394 wined3d: Use FBOs when the onscreen depth stencil format isn't suitable.
This allows proper support of float depth buffers when rendering to onscreen surfaces.
2010-03-31 16:12:32 +02:00
Stefan Dösinger 19b6f5ca75 wined3d: Control the onscreen depth stencil format in the swapchain.
This allows the swapchain to know what depth format its window contexts have to see if the
requested depth format is compatible or a FBO fallback is needed, and it will be needed to
set the onscreen format to the requested auto depth stencil format instead of the
let's-hope-it-fits D24_UNORM_S8_UINT format.
2010-03-31 16:12:31 +02:00
Stefan Dösinger a4b0bedc30 wined3d: Split out offscreen rendering concerns from FindContext. 2010-03-31 16:12:31 +02:00
Henri Verbeet d5ff1e640c wined3d: glColorMask() changes the write mask for all render targets. 2010-03-26 10:29:17 +01:00
Henri Verbeet 3aaa6ee6e7 wined3d: Rename GlPixelFormatDesc to wined3d_format_desc. 2010-03-19 14:31:47 +01:00
Henri Verbeet e5673ddbc3 wined3d: Add a quirk to rebind FBOs when one of their attached textures is updated.
Updating a texture while it is attached to the currently bound FBO is
something GL implementations tend to get wrong. NVIDIA fails at
glTexSubImage2D(), fglrx and Mesa with glTexImage2D(). I'm afraid to try what
happens on OS X. Fortunately we never use glTexImage2D() while a texture is
attached to an FBO, so we only need to care about glTexSubImage2D().
2010-03-18 10:24:41 +01:00
Henri Verbeet bd4fb33a52 wined3d: Unify GLINFO_LOCATION in surface.c. 2010-03-18 10:24:33 +01:00
Henri Verbeet 2b86950c3b wined3d: Simplify context_apply_attachment_filter_states() flow a bit. 2010-03-17 10:06:12 +01:00
Henri Verbeet 78166b0b23 wined3d: Implement SetDestWindowOverride() by simply making the context current on a different window. 2010-03-16 11:45:15 +01:00
Henri Verbeet 18ec2525a4 wined3d: Store the swapchain instead of the surface in the context. 2010-03-16 11:44:44 +01:00
Henri Verbeet b281f23efe wined3d: Add a separate function to set the pixel format in context_create(). 2010-03-16 11:44:38 +01:00
Henri Verbeet 4133a0a4ff wined3d: Use "gl_info" in some more places in context_create(). 2010-03-16 11:44:32 +01:00
Henri Verbeet 4b671f4d54 wined3d: Move device context array functions to device.c. 2010-03-15 15:55:57 +01:00
Henri Verbeet 6ed7906852 wined3d: Don't partially initialize contexts in AddContextToArray().
Just add a context to the device's context array.
2010-03-15 15:55:51 +01:00
Henri Verbeet 8a107bc63a wined3d: Kill pbuffer offscreen rendering support.
Our pbuffer support is broken, nobody cares.
2010-03-15 15:55:38 +01:00
Henri Verbeet af7dfcd378 wined3d: Do not preload surfaces when attaching them to an FBO.
Just make sure the texture is allocated, so we have something to attach. Note
also that context_apply_attachment_filter_states() runs under the GL lock, so
preloading resources is actually unsafe there.
2010-02-04 13:39:26 +01:00
Henri Verbeet 040452ad90 wined3d: Update the stream info before applying states. 2010-02-03 13:54:02 +01:00
Henri Verbeet 31d51fb175 wined3d: Preload textures before applying states. 2010-02-03 13:54:02 +01:00
Henri Verbeet 96b150929b wined3d: Add an ARB_sync implementation of event queries. 2010-01-26 12:08:23 +01:00
Henri Verbeet 2650885cc8 wined3d: Use the element size to create "isStateDirty" bitmap indices. 2009-12-30 13:31:36 +01:00
Henri Verbeet 9c0bf89ed0 wined3d: Let "SetupForBlit()" figure out the target's width and height on its own. 2009-12-28 12:27:14 +01:00
Henri Verbeet 57ff4b4dea wined3d: Let "FindContext()" figure out the thread id on its own.
It doesn't work with anything other than the current thread anyway.
2009-12-28 12:27:13 +01:00
Henri Verbeet 9295de9b84 wined3d: Introduce "context_apply_state()" to setup a context for a specific usage. 2009-12-28 12:27:13 +01:00
Henri Verbeet cd623036fc wined3d: Mark the draw buffer as dirty in context_create().
Currently callers of this function are responsible for setting the draw buffer
correctly, but they don't do a very good job:
  - swapchain_init() sets the draw buffer to GL_BACK if there's a back buffer,
    even though the context's target is always the front buffer.
  - swapchain_create_context_for_thread() depends on (eventually) being called
    by FindContext().
  - create_primary_opengl_context() and
    IWineD3DSwapChainImpl_SetDestWindowOverride() don't bother setting a draw
    buffer at all.
Just marking the draw buffer dirty lets the context management sort it all
out, and is much simpler.
2009-12-16 12:22:29 +01:00
Henri Verbeet a215d326a5 wined3d: Get rid of the "swapchain" parameter to surface_get_gl_buffer().
Casting the container to "IWineD3DSwapChainImpl *" is always safe when
SFLAG_SWAPCHAIN is set on the surface. Most callers don't have a real
need for the swapchain, and end up calling GetContainer() just to pass
it to surface_get_gl_buffer().
2009-12-16 12:22:18 +01:00
Stefan Dösinger 2ee6bb1cbb wined3d: Frontbuffers are onscreen. 2009-12-15 11:58:53 +01:00
Henri Verbeet 2f56ef09e6 wined3d: Use surface_is_offscreen() in context_apply_draw_buffer(). 2009-12-15 11:44:20 +01:00
Henri Verbeet 840b5af77e wined3d: Properly invalidate the context's draw buffer in color_fill_fbo(). 2009-12-11 12:16:25 +01:00
Henri Verbeet b3defd4c80 wined3d: Rename "wineD3DDevice" to "device". 2009-12-10 11:54:47 +01:00
Stefan Dösinger 817714912b wined3d: Infrastructure to render swapchains to a FBO. 2009-12-07 14:33:24 +01:00
Henri Verbeet bf10dbe8a6 wined3d: Map D3DFMT_D24S8 to WINED3DFMT_D24_UNORM_S8_UINT.
The internal order of the depth and stencil bits is unspecified since the
format isn't lockable.
2009-10-30 11:28:52 +01:00
Henri Verbeet fbae08672b wined3d: It's not an error to request multisampling. 2009-10-30 11:28:35 +01:00
Henri Verbeet 111307dfba wined3d: Get rid of the GL_SUPPORT macro. 2009-10-29 13:09:33 +01:00
Henri Verbeet 48e03bc189 wined3d: Introduce a separate structure for various OpenGL implementation limits. 2009-10-29 13:09:27 +01:00
Henri Verbeet e6ca176a48 wined3d: Rename DestroyContext() to context_destroy(). 2009-10-28 11:16:05 +01:00
Henri Verbeet c0050b8ec9 wined3d: Restore the thread's GL context on context_release() if it wasn't created by wined3d.
The background on this is that some applications use OpenGL and DirectDraw/Direct3D on
the same thread, typically using OpenGL for rendering and DirectDraw to get
the amount of available video memory. This means that we might replace the
application's current GL context with one with a completely different state,
but also that our current GL context might not be what we think it is.
2009-10-28 11:15:59 +01:00
Henri Verbeet 98027cb535 wined3d: Call context_release() for wined3d contexts made current by context_create(). 2009-10-28 11:15:27 +01:00
Henri Verbeet eeb54b9922 wined3d: Keep better track of where we're using wined3d contexts.
The idea here is that we can restore the thread's current GL context on
context_release() if it doesn't correspond to the current wined3d context on
context_acquire().
2009-10-28 11:15:19 +01:00
Henri Verbeet 401173ffde wined3d: Restore the thread's previous GL context in context_destroy_gl_resources(). 2009-10-28 11:15:00 +01:00
Henri Verbeet 94509f85b5 wined3d: Restore the wglMakeCurrent() call in context_destroy_gl_resources().
e3ca576576 removed this call because we don't
need it to tell if the context is valid, but we still need it to actually make
the context current.
2009-10-27 10:55:27 +01:00
Stefan Dösinger 70d6304a21 wined3d: Use the shader backend reported constant limit outside the shader backend. 2009-10-26 11:41:43 +01:00
Henri Verbeet 483d5d0a0d wined3d: Print an ERR instead of crashing in context_check_fbo_status().
Some version of Mesa will claim the window system provided framebuffer is
incomplete when using indirect rendering, although the framebuffer objects
spec says this can never happen. Printing an ERR instead of crashing should
make it clearer that this isn't a wined3d problem.
2009-10-26 11:20:52 +01:00
Henri Verbeet 6be41fd59a wined3d: Get rid of GL_LIMITS. 2009-10-22 10:46:05 +02:00
Henri Verbeet 94d33d3e86 wined3d: Destroy FBO entries from the context that created them.
EXT_framebuffer_object doesn't specify if FBOs are shareable between GL
contexts, but ARB_framebuffer_object explicitly prohibits it.
2009-10-20 14:00:37 +02:00
Henri Verbeet e3ca576576 wined3d: Use context->valid in context_destroy_gl_resources().
Instead of relying on wglMakeCurrent() to do what we want.
2009-10-20 14:00:36 +02:00
Henri Verbeet 43aaaa8a4b wined3d: Validate the D3D context in FindContext().
Apparently it's valid to use a D3D device after its window is destroyed.
OpenGL isn't always so forgiving, so this patch is a first step to avoid
making GL calls on a context without window.
2009-10-20 14:00:36 +02:00
Henri Verbeet 0cb6f28751 wined3d: Get rid of the useless "isPBuffer" bitfield in struct wined3d_context. 2009-10-20 14:00:36 +02:00
Henri Verbeet 47c84f4f7f wined3d: Use the DXGI naming convention for all formats. 2009-09-25 15:15:44 +02:00
Stefan Dösinger 5b5e3bd0d2 wined3d: Track GL texture states in a separate structure. 2009-09-23 13:24:16 +02:00
Henri Verbeet 1c93ab1ee0 wined3d: Cleanup after wglMakeCurrent() failures in context_set_current().
The D3D context is potentially destroyed, so we need to clear the thread's
current D3D context. Found by Rico Schüller.
2009-09-23 12:37:25 +02:00