Commit Graph

420 Commits

Author SHA1 Message Date
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
Henri Verbeet eca28c942d wined3d: Add support for ARB_provoking_vertex.
This is just EXT_provoking_vertex promoted to ARB.
2009-09-23 12:37:18 +02:00
Henri Verbeet ec97383f6f wined3d: Add support for ARB_framebuffer_object. 2009-09-23 12:37:00 +02:00
Rico Schüller 8c414df17f wined3d: Don't call wglMakeCurrent(NULL, NULL) in context_set_current() if the current context is NULL. 2009-09-22 17:47:02 +02:00
Henri Verbeet 4ec2b09d8f wined3d: Don't check for a "representative" in the MarkStateDirty() functions.
States without representative should never be called. Arguably they shouldn't
exist in the first place, but allowing them simplifies the state table.
2009-08-21 11:10:21 +02:00
Henri Verbeet a36e30b541 wined3d: Mark the correct state dirty. 2009-08-21 11:10:07 +02:00
Jörg Höhle 7763da811b wined3d: Check GL_SUPPORT prior to an ARB occlusion call. 2009-08-17 19:36:41 +02:00
Henri Verbeet b8078fc747 wined3d: Use WINED3D_UNMAPPED_STAGE in some more places. 2009-08-17 13:57:50 +02:00
Henri Verbeet 3b06fc92f4 wined3d: Use EXT_provoking_vertex to match Direct3D's provoking vertex convention. 2009-08-10 13:52:50 +02:00
Stefan Dösinger 4f9f8fef0b wined3d: Dirtify the correct state. 2009-08-07 14:57:09 +02:00
Henri Verbeet 41729ca919 wined3d: Check the return value of wglDeleteContext() in context_destroy_gl_resources(). 2009-08-07 12:11:27 +02:00
Henri Verbeet 7ed116da2e wined3d: Merge the context->current_rt check for rendertarget readback with the code above.
Also update the comments.
2009-08-07 12:11:17 +02:00
Henri Verbeet 3bf0ad4528 wined3d: Explicitly pass the context to the shader_select() handler. 2009-08-07 12:11:06 +02:00
Henri Verbeet a7251f0f4e wined3d: Track render_offscreen in the context.
This makes sure the relevant states in FindContext() are actually marked dirty
when needed.
2009-08-06 17:26:30 +02:00
Henri Verbeet da1e5573da wined3d: Rename WineD3DContext to struct wined3d_context. 2009-08-03 15:01:48 +02:00
Henri Verbeet 0047c55e86 wined3d: Handle destruction of a context's current render target. 2009-08-03 15:01:18 +02:00
Henri Verbeet 9baf7864c5 wined3d: Return proper NULLs from CreateContext(). 2009-07-24 13:11:01 +02:00
Henri Verbeet be536ebe2f wined3d: Get rid of activeContext. 2009-07-24 13:10:57 +02:00
Henri Verbeet fb77678e9f wined3d: Manage event queries in the context. 2009-07-24 13:10:28 +02:00
Henri Verbeet 4ab7af6575 wined3d: Manage occlusion queries in the context. 2009-07-24 13:10:19 +02:00
Henri Verbeet ea2caa9ba1 wined3d: Return the activated context from ActivateContext(). 2009-07-23 11:22:22 +02:00
Henri Verbeet 85e2c05e4f wined3d: Explicitly pass the wined3d context to context_apply_draw_buffer(). 2009-07-23 11:22:18 +02:00
Henri Verbeet 9253bbcb05 wined3d: Get rid of last_device. 2009-07-23 11:22:13 +02:00
Henri Verbeet 401e99b0c0 wined3d: Remove some unnecessary code.
Now that we don't depend on activeContext and lastActiveRenderTarget to be
non-NULL this code can go.
2009-07-23 11:22:08 +02:00
Henri Verbeet 57ccdb7e36 wined3d: Don't reuse contexts marked for destruction. 2009-07-23 11:22:03 +02:00
Henri Verbeet e5d621c081 wined3d: Try to reuse the thread's current context in FindContext(). 2009-07-22 14:42:51 +02:00
Henri Verbeet 9ceda3a6fd wined3d: Move some context selection code from ActivateContext() to FindContext(). 2009-07-22 14:42:51 +02:00
Henri Verbeet 219d3abdd1 wined3d: Simplify FindContext() a bit. 2009-07-22 14:42:51 +02:00
Henri Verbeet ce436a76e2 wined3d: Get rid of getActiveContext(). 2009-07-22 14:42:50 +02:00
Henri Verbeet 377cda97e7 wined3d: Avoid destroying contexts that are current in another thread. 2009-07-22 14:42:50 +02:00
Henri Verbeet 1a43030664 wined3d: Keep track of a thread's wined3d context. 2009-07-22 14:42:50 +02:00
Henri Verbeet c114b04016 wined3d: Remove the useless lastThread field from IWineD3DDeviceImpl. 2009-07-21 14:23:06 +02:00
Henri Verbeet 2d7500600b wined3d: Get rid of lastActiveRenderTarget. 2009-07-21 14:23:02 +02:00
Henri Verbeet 223b9d5c01 wined3d: Get rid of lastActiveRenderTarget in FindContext(). 2009-07-21 14:22:58 +02:00
Henri Verbeet 6c0c1671b2 wined3d: Keep track of a context's current render target. 2009-07-21 14:22:49 +02:00
Henri Verbeet ee4d18cc83 wined3d: Pass NULL to ActivateContext() when we don't need a specific target.
Once we keep track of the wined3d context for each thread,
lastActiveRenderTarget won't do what we want here.
2009-07-21 14:22:44 +02:00
Stefan Dösinger e06997359f wined3d: Set the highest dirty marker after marking shader constants dirty. 2009-07-20 12:23:14 +02:00
Henri Verbeet a80247f58b wined3d: Avoid redundant FBO binds.
Apparently this is an expensive operation for certain drivers, even if the
binding doesn't actually change.
2009-07-17 11:22:07 +02:00
Henri Verbeet 710f6f8456 wined3d: Always use context_bind_fbo() to change the framebuffer binding. 2009-07-17 11:22:07 +02:00
Henri Verbeet 7485173849 wined3d: Pass the context instead of the device to the various context functions. 2009-07-17 11:22:07 +02:00
Henri Verbeet a01616a6c3 wined3d: Store a pointer to wined3d_gl_info in struct WineD3DContext. 2009-07-17 11:22:07 +02:00
Henri Verbeet ae8e8ac73f wined3d: Check the return values for some wgl calls. 2009-07-15 13:24:24 +02:00
Henri Verbeet 476c83522b wined3d: Remove the remains of an ATI_fragment_shader hack.
This was originally added as a workaround for a Mesa bug by commit
ddf52dda15. The other half of the hack has since
been removed. This code causes problems when wglDeleteContext() from a
different thread causes our current context to be destroyed, since
wglGetCurrentContext() will return a destroyed context in that case. That is a
flaw in our wgl implementation, since wglDeleteContext() shouldn't allow a
context that's current in a different thread to be destroyed, but this hack is
a bad idea regardless.
2009-07-15 13:24:19 +02:00
Henri Verbeet 69b7612265 wined3d: Get rid of struct glDescriptor.
In general it might not be a bad idea to group GL specific data into a
separate struct, but IWineD3DSurfaceImpl is currently the only thing that
bothers. It doesn't get it quite right either, since e.g. the PBO isn't in
glDescriptor either.
2009-07-10 12:13:24 +02:00
Henri Verbeet 32fd8f2130 wined3d: checkGLcall() doesn't need a \n. 2009-07-07 11:50:22 +02:00
Henri Verbeet 2ac34bf231 wined3d: Add some missing float suffixes.
The compiler should be smart enough to fix most of these, but it looks sloppy.
2009-07-07 11:50:05 +02:00
Henri Verbeet 50e9ad66e2 wined3d: Clear the last device in WineD3D_CreateFakeGLContext(). 2009-07-02 12:00:44 +02:00
Henri Verbeet f57967c983 wined3d: Always check the result of wglMakeCurrent(). 2009-06-29 12:30:28 +02:00
Henri Verbeet 40565211fb wined3d: Prevent GL calls from DestroyContext() if we failed to make the GL context current.
This can happen if the window is destroyed before the device is released.
2009-06-29 12:30:24 +02:00
Henri Verbeet 7363b6e2e3 wined3d: Document GL context dependencies. 2009-06-26 12:05:07 +02:00
Henri Verbeet 5dcbc40581 wined3d: Make sure we have an active GL context in context_resource_released(). 2009-06-25 11:47:28 +02:00
Henri Verbeet 94cd8656ea wined3d: Make context_resource_released() responsible for activating a different GL context.
In case lastActiveRenderTarget is destroyed.
2009-06-25 11:47:24 +02:00
Henri Verbeet 7422babd88 wined3d: Set FBO stencil attachments for relevant depth stencil formats. 2009-06-08 12:44:27 +02:00
Henri Verbeet a2244051ef wined3d: Use context_attach_depth_stencil_fbo() to clear FBO depth attachments. 2009-06-08 12:44:22 +02:00
Stefan Dösinger 0629585c24 wined3d: Work around an ARBFP vs GLSL bug in Mac OS. 2009-05-27 11:57:54 +02:00
Chris Robinson 12799db349 wined3d: Decrement fbo_entry_count when one is removed from the list. 2009-05-25 11:22:25 +02:00
Henri Verbeet b35e469d9d wined3d: Document functions that depend on the caller to do GL locking. 2009-05-15 10:25:41 +02:00
Henri Verbeet e260132701 wined3d: Add missing GL locking to set_blit_dimension() calls. 2009-05-14 11:12:46 +02:00
Henri Verbeet 1070e075e4 wined3d: Add missing GL locking to calls to FBO functions. 2009-05-14 11:12:38 +02:00
Henri Verbeet b7ac22004f wined3d: Add missing GL locking to shader_backend_t.shader_select() calls. 2009-05-13 12:01:57 +02:00
Henri Verbeet 7f14ea01c6 wined3d: Add missing GL locking to state table calls. 2009-05-13 12:01:52 +02:00
Henri Verbeet 0d446053da wined3d: Don't create more than WINED3D_MAX_FBO_ENTRIES FBO entries.
This essentially turns the FBO entry list into an LRU cache.
2009-05-12 11:18:15 +02:00
Stefan Dösinger 668328a697 wined3d: Work around a bad crash in fglrx. 2009-05-08 12:16:50 +02:00
Henri Verbeet 42e31a4242 wined3d: Fix a few sign compare warnings. 2009-03-25 11:12:30 +01:00
Henri Verbeet dd1f0d9c48 wined3d: Pass format_desc to getColorBits() and getDepthStencilBits(). 2009-03-24 12:57:38 +01:00
Henri Verbeet 1f4e7b27ed wined3d: Set the currently active context to NULL when it's destroyed.
This should make us crash when trying to use the "currently active" context
after it has been destroyed, rather than messing around with freed memory.
2009-03-23 14:08:02 +01:00
Henri Verbeet 2dc7fc2916 wined3d: Remove the format field from IWineD3DResourceClass. 2009-03-13 11:29:19 +01:00
Henri Verbeet a56e3a102b wined3d: Only return a pointer to struct GlPixelFormatDesc from getFormatDescEntry(). 2009-03-13 11:29:10 +01:00
Henri Verbeet 4e2c87dd22 wined3d: Handle error conditions better in RemoveContextFromArray(). 2009-03-09 14:44:02 +01:00
Stefan Dösinger 4386a827e9 wined3d: Pass the requested srgb flag to PreLoad.
Add a new wined3d-internal PreLoad function to textures and surfaces
that takes a parameter specifying wether the rgb or srgb texture
should be loaded.
2009-02-17 12:51:36 +01:00
Stefan Dösinger 365e1f3b07 wined3d: Avoid hooking non-fog glEnable/glDisable calls.
This prevents fallout from the GL_EXT_fog_coord emulation. glEnable
and glDisable calls other than those that change GL_FOG are not
hooked. The glEnableWINE and glDisableWINE functions can be used to
add other hooks too if ever needed.
2009-01-12 13:03:47 +01:00
Henri Verbeet 73823ef5f6 wined3d: Remove the shader_cleanup() method from the shader backend. 2008-12-17 14:02:24 +01:00
Stefan Dösinger 31da3c0578 wined3d: Emulate GL_EXT_fog_coord. 2008-12-16 14:34:11 +01:00
Stefan Dösinger d707f018df wined3d: Remove some needless initializations.
They're not needed, they are handled by the state management anyway.
2008-12-16 14:32:43 +01:00
Stefan Dösinger 199a3468bf wined3d: Fake GL_ARB_multitexture. 2008-12-16 14:31:25 +01:00
Henri Verbeet b451048eb7 wined3d: Move GlPixelFormatDesc to wined3d_private.h where it belongs.
Also remove the silly typedef.
2008-12-04 11:59:06 +01:00
Andrew Talbot fdba8b8593 wined3d: Sign-compare warnings fix. 2008-11-21 11:29:12 +01:00
Roderick Colenbrander e848aed2b8 wined3d: ActivateContext caused a lot of recursive ENTER_GL calls while it is especially dangerous in here as this function can indirectly trigger GDI calls. 2008-10-20 11:38:36 +02:00
Alexandre Julliard 6cfef95ce7 wined3d: Convert source files to utf-8. 2008-10-18 19:21:20 +02:00
Henri Verbeet 723f3656e5 wined3d: Modifying GL_TEXTURE_MIN_FILTER modifies both the MINFILTER and MIPFILTER sampler states. 2008-10-16 12:35:51 +02:00
Henri Verbeet bd5abfb1e4 wined3d: Remove a redundant local variable in apply_draw_buffer(). 2008-10-16 12:35:40 +02:00
Henri Verbeet 231e2c60b5 wined3d: The container is always non-NULL if GetContainer() succeeds. 2008-10-16 12:35:34 +02:00
Henri Verbeet af6636c21c wined3d: Don't do GL calls without a context. 2008-10-09 12:14:15 +02:00
Henri Verbeet 0420f17b1f wined3d: Remove a redundant initialization of cfgs in WineD3D_ChoosePixelFormat. 2008-10-08 12:16:48 +02:00
Henri Verbeet 76de76e508 wined3d: Destroy FBO entries in the context. 2008-09-22 12:20:24 +02:00
Henri Verbeet 459673da1a wined3d: Make sure update_minfilter and update_magfilter are initialized. 2008-09-22 12:20:18 +02:00
Henri Verbeet 45820046e8 wined3d: Create a FBO for each combination of render targets and depth stencil.
The main reason for this change is crappy performance for reconfiguring FBOs.
2008-09-19 11:30:00 +02:00
Henri Verbeet 3a8ab00fe1 wined3d: Get rid of context_set_depth_stencil_fbo().
Integrate clearing the depth stencil attachment in context_attach_depth_stencil_fbo().
2008-09-19 11:29:48 +02:00
Henri Verbeet 8f2ed870f1 wined3d: Get rid of context_set_render_target_fbo().
Integrate clearing the attachment in context_attach_surface_fbo().
2008-09-19 11:29:39 +02:00
Henri Verbeet 734b31e00b wined3d: Handle drawbuffers in context_apply_fbo_state() instead of context_set_render_target_fbo(). 2008-09-19 11:29:27 +02:00
Henri Verbeet 9533a5cbbf wined3d: Split off a function for applying an attachment's filter states. 2008-09-19 11:29:18 +02:00
Henri Verbeet a269236649 wined3d: Move FBO handling functions to context.c. 2008-09-19 11:29:13 +02:00
Stefan Dösinger c36e033856 wined3d: Fix the pixelformat selection logic. 2008-09-05 11:23:09 +02:00
Henri Verbeet 4b6887b8e3 wined3d: Be more careful when deleting FBOs.
Clear all attachments before deleting FBOs. It should be valid to
delete FBOs that still have attachments, but for some reason the
nvidia drivers don't like it. The resulting memory corruption can be
pretty nasty, and this workaround seems clean enough.
2008-09-04 11:14:53 +02:00
Stefan Dösinger 0e2713a1e1 wined3d: Remove unneeded code.
The fixed function backend disables the extension. Also messing
with the final combiner shouldn't be needed if nvrc is disabled.
2008-08-27 13:21:24 +02:00
Stefan Dösinger e110f2c680 wined3d: Don't retry less strict formats if a match was found. 2008-08-25 12:26:26 +02:00
Henri Verbeet e3507a725f wined3d: glDeleteFramebuffersEXT() needs a context. 2008-08-25 11:39:10 +02:00
H. Verbeet 05931f4a5a wined3d: Track FBOs per-context.
Although sharing FBOs across contexts is allowed by EXT_framebuffer_object
(issue 76), it causes issues with nVidia drivers. Considering the GL 3 spec
explicitly disallows sharing of FBOs accross contexts (Appendix D), this
patch is probably the right thing to do.
2008-08-22 10:38:59 +02:00
Alexander Dorofeyev 1da8a032af wined3d: Disable TEXTURE_RECTANGLE in SetupForBlit. 2008-08-21 13:35:23 +02:00
Stefan Dösinger 77204574d1 wined3d: Prefer aux buffer matches over alpha matches.
Half Life 2 uses D3DFMT_X8R8G8B8 for the back buffer, but macos
supports aux buffers only on D3DFMT_A8R8G8B8. I think having aux
buffers is more important right now than having a precise alpha
match.
2008-08-21 13:33:09 +02:00
Stefan Dösinger 5d75939b09 wined3d: Keep track of the last used device. 2008-08-20 12:33:25 +02:00
H. Verbeet 2d6d879562 wined3d: Handle CTXUSAGE_BLIT with offscreen targets and FBO ORM.
This is mostly for correctness, in practice we should always be able
to avoid using CTXUSAGE_BLIT for offscreen targets when FBO ORM is
used.
2008-08-05 14:09:34 +02:00
H. Verbeet b685b84e66 wined3d: Apply FBO state in ActivateContext().
Fixes some GL errors due to calling glDrawBuffer(GL_BACK) when an FBO
is still active.
2008-08-05 14:09:34 +02:00
H. Verbeet f037eb8696 wined3d: Move setting the draw buffer to a separate function. 2008-08-04 13:52:09 +02:00
Stefan Dösinger 40cfec2582 wined3d: Do not enable GL_TEXTURE_SHADER_NV unconditionally. 2008-07-28 11:36:04 +02:00
Stefan Dösinger 1219e3d4a7 wined3d: Use less strict pixel format matching if the match fails.
Some drivers(the open source ones most notably) cannot satisfy all
possible D3D formats. This doesn't mean we should fall back to the
emergency fallback instantly. Instead, try to loosen the requirements
step by step.
2008-07-22 13:00:47 +02:00
H. Verbeet 7f741f0414 wined3d: Use rev_tex_unit_map instead of assuming there's a 1:1 mapping between samplers and texture units. 2008-07-16 17:54:41 +02:00
Stefan Dösinger c48195e417 wined3d: Move shader_fragment_enable to the fragment pipeline implementation.
It isn't related to the shader backend any longer. The nvts_enable in
the ffp code isn't quite right as well, it should be moved away once
there is a dedicated nvts fragment pipeline replacement
2008-07-11 14:32:37 +02:00
Stefan Dösinger 98faed8ff5 wined3d: Start the state splitup.
The idea of this patchset is to split the monolithic state set into 3
parts, vertex processing, fragment processing and other states(depth,
stencil, scissor, ...). The states will be provided in templates which
can be (mostly) independently combined, and are merged into a single
state table at device creation time. This way we retain the advantages
of the single state table and having the advantage of separated
pipeline implementations which can be combined without any manually
written glue code.
2008-07-08 10:45:56 +02:00
H. Verbeet 4f77c29bcf wined3d: Track depth stencil location per-surface.
This gets rid of depth_copy_state in the device, and instead tracks
the most up to date location per-surface. This makes things a lot
easier to follow, and allows us to make a copy when switching depth
stencils in SetDepthStencilSurface().
2008-07-03 11:50:52 +02:00
Stefan Dösinger 74c5684f90 wined3d: Update the blit ortho on size changes.
SetupForBlit sets up the GL viewport and projection matrix for
screen-cordinate access to the framebuffer. These settings were not
updated if the other gl states were already set up for blitting. Guild
Wars reads back an offscreen rendered texture from the framebuffer,
which currently sets up CTXUSAGE_BLIT, then changes the render target,
and draws to the texture, which has to be reloaded from system memory
before it can be rendered to(since GW loaded some data into it). If the
two render targets had different size this failed.
2008-07-02 12:24:35 +02:00
Stefan Dösinger 535e61892c wined3d: Only read back offscreen targets on a target change.
This avoids calling PreLoad needlessly on a thread change during offscreen
rendering and breaks up the endless recursion due to lastTID != newTID.
2008-06-13 10:15:48 +02:00
Stefan Dösinger 78d963039b wined3d: Do not PreLoad the new render target.
There is no reason to do that, now that the SetGLTextureDesc bug is
fixed. This avoids an infinite recursion because PreLoad calls
ActivateContext at some point.
2008-06-13 10:15:26 +02:00
Roderick Colenbrander 0ca7d443ac wined3d: Add a WineD3D_ChoosePixelFormat line. 2008-06-03 11:17:27 +02:00
Roderick Colenbrander bd5c02e245 wined3d: Request a WGL depth stencil capable pixel format by default until we have proper SetDepthStencilSurface support. 2008-05-19 20:20:35 +02:00
Roderick Colenbrander 7b5561cbb8 wined3d: Allow stencil support when it wasn't requested on broken drivers. 2008-05-05 21:03:39 +02:00
Roderick Colenbrander e3b662bb20 wined3d: At the start of RemoveContextFromArray numContexts is decreased by 1, the loop which loops through the whole array doesn't take this into account.
Discovered by Peter Oberndorfer.
2008-05-05 12:53:52 +02:00
Roderick Colenbrander cb0f0af131 wined3d: We don't want double buffering in pbuffer mode. 2008-05-01 18:11:26 +02:00
Roderick Colenbrander 96c770d9bf wined3d: In window mode (!pbuffer) we want both a window drawable format and double buffering. 2008-05-01 18:11:26 +02:00
Roderick Colenbrander 628e4eece3 wined3d: Add multisampling support. 2008-04-30 10:23:25 +02:00
Roderick Colenbrander 4428cc32de wined3d: Fix a few small bugs in WineD3D_ChoosePixelFormat. 2008-04-29 12:47:07 +02:00
Roderick Colenbrander 34d06a5e96 wined3d: Also use WineD3D_ChoosePixelFormat for pbuffers. 2008-04-28 13:27:51 +02:00
Roderick Colenbrander a38e5a95ef wined3d: Let WineD3D_ChoosePixelFormat operate on the pixel format database we store at WineD3D startup. 2008-04-28 13:27:51 +02:00
Roderick Colenbrander ec5400b4f8 wined3d: Split WGL pixel format selection code off from CreateContext. 2008-04-28 13:27:51 +02:00
Roderick Colenbrander f0307d9366 wgl: Add a wine specific WGL extension which allows you to change the pixel format multiple times. 2008-04-24 12:32:38 +02:00
Stefan Dösinger e3bd5b6dcd wined3d: Use the shader backend to enable / disable atifs and nvts.
The previous logic assumed that if NVTS or ATIFS are available they
will be used. This happens to be true for NVTS, but ATIFS is only used
if neither ARBFP nor GLSL are supported. This breaks fixed function
fragment processing on ATI r300 and newer cards
2008-04-24 11:37:17 +02:00
Austin English 6e59cd2c34 Spelling fixes. 2008-04-22 12:20:12 +02:00
Stefan Dösinger fb8fde81d1 wined3d: Disable blending when clearing. 2008-04-09 11:53:44 +02:00
Stefan Dösinger 67e0943ba3 wined3d: Store the number of aux buffers in the context. 2008-04-09 11:47:24 +02:00
Stefan Dösinger ddf52dda15 wined3d: Deactivate GL_FRAGMENT_SHADER_ATI before deactivating a context.
Mesa has a bug that causes a crash due to a NULL pointer dereference
with the R200 driver when making a context current that has
GL_FRAGMENT_SHADER_ATI enabled. This patch works around this bug by
making sure that GL_FRAGMENT_SHADER_ATI is disabled before deactivating
a context, and reactivates it afterwards. The context manager keeps
GL_ATI_FRAGMENT_SHADER generally enabled, except if the context is in 2D
blit mode.
2008-04-03 12:02:24 +02:00
Stefan Dösinger b1d8af7926 wined3d: Update copyright lines. 2008-04-02 20:22:42 +02:00
Roderick Colenbrander 4120188f99 wined3d: Request a pixel format with alpha support in case of P8 render targets. 2008-03-31 13:01:24 +02:00
Roderick Colenbrander 4eaa424c79 wined3d: Initial post pixelshader blending support. [attempt 2].
For each pixel format we store a flag in the table whether it supports
post pixelshader blending. Before applying blending or during a
context switch we verify that blending is turned off for the
format. In case of R32F this gave a 5-6x performance boost (without
filtering and software conversion).
2008-03-28 15:50:24 +01:00
Stefan Dösinger 4640be8dc8 wined3d: Fragment processing using GL_ATI_fragment_shader.
This adds code for handling fixed function fragment processing with the
GL_ATI_fragment_shader extension. This is a sort-of programmable
interface for fragment processing at the level of shader model 1.4 in
d3d. This code is of use on r200, r250 and r280 cards(radeon 8500 to
9200) which do not support GL_ARB_fragment_program, but support pixel
shader 1.4 on Windows. This code is somewhat a counterpart to the
existing fragment processing code using GL_NV_register_combiners and
GL_NV_texture_shader.
2008-03-25 19:50:32 +01:00
Stefan Dösinger 84258723f9 wined3d: Make the state table a property of the shader backend. 2008-03-25 19:35:32 +01:00
Roderick Colenbrander 690f496bd4 wined3d: We want to compare the old and the new format and not the old with the old. 2008-03-24 13:27:14 +01:00
Stefan Dösinger 6ea0880e43 wined3d: Fix a small bug in a patch from yesterday. 2008-03-05 11:21:51 +01:00
Stefan Dösinger 107e80a79c wined3d: Implement a different constant dirtification algorithm.
Add a new property of the shader backend which indicates whether the
shader backend is able to dirtify single constants rather than
dirtifying vshader and pshader constants as a whole. Depending on this
a different Set*ConstantF implementation is used which marks constants
dirty. The ARB shader backend uses this and marks constants clean
after uploading.
2008-03-04 12:15:16 +01:00
Roderick Colenbrander e5bef99fbe wined3d: Request aux buffers when using backbuffer rendering. 2008-02-25 12:17:36 +01:00
Roderick Colenbrander 68467cf344 wined3d: Request alpha in backbuffer mode, to work correctly with multiple opengl pixel formats. 2008-02-25 12:14:36 +01:00
Francois Gouget d0794c4aeb Assorted spelling fixes. 2008-01-23 21:16:22 +01:00
Austin English 3471f841a1 wined3d: Spelling fixes. 2008-01-18 12:53:33 +01:00
Stefan Dösinger f700cbe74b wined3d: Add an alpha blending test. 2007-12-07 16:26:43 +01:00
Stefan Dösinger a4461e03f7 wined3d: Disable the scissor test when blitting. 2007-12-04 14:32:39 +01:00
Stefan Dösinger 4dbee07ff5 wined3d: Disable GL_TEXTURE_2D in the standard blit setup. 2007-11-29 13:35:53 +01:00
Roderick Colenbrander 817b520c3d wined3d: Prevent unneeded context switches. 2007-11-12 14:13:21 +01:00
Roderick Colenbrander df892ff67d wined3d: Rewrite the draw buffer selection code.
Before it was done in findContext, before selecting the new context
which is bad (it doesn't always work). The new code works and this
change also fixes some draw buffer regressions that happened during
the surface rewrite from the last couple of days.
2007-11-06 13:56:55 +01:00
Stefan Dösinger dcff7dc213 wined3d: Begin centralizing surface location management. 2007-10-26 15:17:19 +02:00
Roderick Colenbrander 3978535ced wined3d: Remove an unused ChoosePixelFormat line. 2007-10-09 11:39:50 +02:00
Roderick Colenbrander b6951822c1 wined3d: Make sure we receive a hw accelerated pixel format with OpenGL support. 2007-10-09 11:39:40 +02:00
Roderick Colenbrander 9ad3807c15 wined3d: Only call ENTER_GL for the parts in ActivateContext that actually need it. 2007-10-01 12:35:47 +02:00
Roderick Colenbrander 001f380ac9 wined3d: CreateContext should not be called between ENTER_GL/LEAVE_GL. 2007-10-01 12:35:36 +02:00
Stefan Dösinger 5a63b79a66 wined3d: Untie culling and offscreen rendering. 2007-09-19 11:39:55 +02:00
Roderick Colenbrander 9be5a5e9db wined3d: Ask for enough RGB bits for pbuffers. 2007-08-29 11:58:28 +02:00
Stefan Dösinger 6857fc6b61 wined3d: Disable specular color when blitting. 2007-08-27 12:00:21 +02:00
Roderick Colenbrander 318f606869 wined3d: Improve pixelformat selection code. 2007-08-27 11:59:07 +02:00
Roderick Colenbrander 9ca3a22487 wined3d: Dynamically load WGL functions. 2007-08-17 12:03:13 +02:00
Roderick Colenbrander 1dc0298a55 wined3d: Check the results of SetPixelFormat. 2007-08-13 12:37:34 +02:00
Roderick Colenbrander 5754726aeb wined3d: Use the proper depth stencil format. 2007-08-13 12:36:55 +02:00
Roderick Colenbrander 7818cbda4a wined3d: Add better pixelformat selection code for pbuffers. 2007-08-10 12:58:17 +02:00
Roderick Colenbrander 4647cbb625 wined3d: Better pixelformat selection code. 2007-08-09 14:11:19 +02:00
Roderick Colenbrander ac3927a73e wined3d: Move over to WGL. 2007-08-08 15:32:01 +02:00
Roderick Colenbrander 58275065a1 wined3d: Prepare pbuffer code for WGL transition. 2007-08-08 15:32:01 +02:00
Roderick Colenbrander e77da5ef8a wined3d: Don't call ActivateContext between ENTER_GL/LEAVE_GL. 2007-08-07 12:36:32 +02:00
H. Verbeet b4e596e70e wined3d: Flip the scissor rect when rendering offscreen. 2007-07-26 11:51:34 +02:00
Stefan Dösinger 9dedfd71e0 wined3d: Store the last active thread. 2007-07-10 13:31:19 +02:00
Stefan Dösinger 1fb168f018 wined3d: Make ActivateContext a bit smaller. 2007-07-10 13:31:10 +02:00
Stefan Dösinger fdadf26c20 wined3d: Add CTXUSAGE_CLEAR context usage. 2007-07-10 13:30:51 +02:00
Stefan Dösinger 9928a4c4fd wined3d: Offscreen rendering from foreign threads. 2007-07-06 19:29:28 +02:00
Stefan Dösinger b462ff0876 wined3d: Create multiple contexts for onscreen render targets. 2007-07-03 12:32:33 +02:00
Stefan Dösinger 13f24c3808 wined3d: Select onscreen contexts based on the thread id. 2007-07-03 12:30:33 +02:00
H. Verbeet 5e78a83cb2 wined3d: Call IWineD3DDeviceImpl_FindTexUnitMap for cards without support for NV_REGISTER_COMBINERS as well. 2007-07-02 13:35:50 +02:00
Stefan Dösinger a3854be0b3 wined3d: Some point sprite fixes. 2007-06-25 20:04:58 +02:00
Stefan Dösinger 6e5a5d2736 wined3d: DDraw surfaces are QWORD aligned. 2007-06-14 13:22:52 +02:00
H. Verbeet b9d5c18062 wined3d: Call IWineD3DDeviceImpl_FindTexUnitMap() when activating the context. 2007-06-13 11:23:18 +02:00
Stefan Dösinger a460a2df43 wined3d: Store the gl information in a per adapter structure and initialize it only once. 2007-06-11 13:51:06 +02:00
Stefan Dösinger 81504d6a2d wined3d: Support bump environment mapping using GL_NV_texture_shader. 2007-05-10 11:40:27 +02:00
Stefan Dösinger adb9b13b81 wined3d: Implement vertex blending using GL_ARB_vertex_blend. 2007-05-03 14:24:46 +02:00
H. Verbeet 3d4e054b55 wined3d: Handle FBO attachments slightly more efficiently. 2007-04-09 12:38:53 +02:00
Felix Nawothnig 2d0016c5bc wined3d: Preload target in ActivateContext() for ORM_BACKBUFFER/ORM_PBUFFER. 2007-04-09 12:17:07 +02:00
Stefan Dösinger 4f5d33311b wined3d: Use GL_APPLE_client_storage if available. 2007-04-02 11:34:12 +02:00
Felix Nawothnig 18c9e5d5d0 wined3d: Use GL_TEXTURE_2D for dummy textures. 2007-03-30 11:25:23 +02:00
Felix Nawothnig 335f978e91 wined3d: Only disable GL_TEXTURE_CUBE_MAP_ARB if supported. 2007-03-30 11:24:56 +02:00
Phil Costin 1f03896e00 wined3d: Ensure all states affected by a change in render_offscreen are marked dirty in ActivateContext. 2007-03-21 11:55:52 +01:00
Stefan Dösinger 90fe64cee0 wined3d: Store an array of contexts in the swapchain.
This is a preparation for using multiple contexts on one drawable to
handle multithreading.
2007-03-19 12:23:16 +01:00
Stefan Dösinger fcb83e7111 wined3d: Activate a context before doing opengl calls. 2007-03-19 12:22:57 +01:00
Stefan Dösinger 603e7933ea wined3d: Blit the offscreen texture into the drawable if needed.
When using pbuffer or back buffer offscreen rendering the content of
the drawable will have been overwritten. Thus the texture has to be
written into the drawable. An exception is the (pretty common) case
that the whole render target is cleared before rendering to it.
2007-03-12 12:02:05 +01:00
Stefan Dösinger c54a0fc2cf wined3d: Rework surface dirtification.
Previously the surfaces stored a flag if the system memory copy was
ahead of the gl copy(SFLAG_DIRTY) or the gl copy is
ahead(SFLAG_GLDIRTY). The pbuffer copy was 'managed' differently using
SFLAG_INPBUFFER and SFLAG_INTEXTURE.

This patch replaces them with 3 flags, INSYSMEM, INPBUFFER and
INTEXTURE which specify which copy contains the most up to date
copy. It is perfectly valid to have more than one of those flags
set. One must be set at least (except at init, when no content is in
the surface yet). When one copy is modified, the flags for the others
are removed.
2007-03-07 12:18:14 +01:00
Stefan Dösinger ebe274feed wined3d: Remove IWineD3DSurface::SetPBufferState.
The method is removed because it does not really help with
anything. It should not be exported from wined3d, there is no need for
the other libs to call it. It does not help abstraction and code
simplification in any way because it is very specific and the code
calling it has to know what is happening in the surface to use this
method.
2007-03-07 12:17:33 +01:00
Stefan Dösinger 6ac8d88d5c wined3d: Prepare only fixed function samplers for blit. 2007-03-01 11:39:17 +01:00
Stefan Dösinger 8d9a553d89 wined3d: Support for using auxilliary buffers for offscreen rendering.
OpenGL AUX buffers provide a way for offscreen rendering which is very
similar to our back buffer "offscreen" rendering emulation. Not all
card support aux buffers, but if they are available they are a nice
present which is easy to use.
2007-02-28 21:04:47 +01:00
Francois Gouget 93494f2ac0 Assorted spelling fixes. 2007-02-20 20:30:51 +01:00
H. Verbeet bd5488cda9 wined3d: Add WINED3DCREATE flags and use them. 2007-02-16 12:31:11 +01:00
Stefan Dösinger f5f501d573 wined3d: Use the context manager to create onscreen contexts. 2007-02-13 12:08:02 +01:00
Stefan Dösinger 12252d0589 wined3d: Use the context manager to select the primary render target. 2007-02-13 12:05:35 +01:00
Stefan Dösinger 7253fae31f wined3d: Make the context array dynamic. 2007-02-13 12:04:40 +01:00
Stefan Dösinger f22d37e4dd wined3d: Use the context manager to prepare for blitting. 2007-02-13 12:04:08 +01:00
Stefan Dösinger c1623d4e7b wined3d: Use the context manager to prepare for drawing. 2007-02-13 12:03:40 +01:00