Commit Graph

986 Commits

Author SHA1 Message Date
Henri Verbeet 2da4f87a7e wined3d: Upload directly from the source surface in wined3d_surface_blt(), if possible.
This avoids either loading sysmem surfaces into video memory (wasting GPU
memory) and then doing a blit on the GPU, or downloading GPU surfaces to
sysmem, doing a blit on the CPU, and likely uploading it again. This mostly
matters for ddraw and d3d8 applications, d3d9 already has to go through
wined3d_device_update_surface() to transfer data from sysmem surfaces to GPU
surfaces.
2011-10-25 16:57:23 +02:00
Henri Verbeet e6101816a2 wined3d: Get rid of surface_gdi_cleanup().
It's effectively the same as surface_cleanup(). The GL objects that
surface_cleanup() destroys are never created for "GDI" surfaces.
2011-10-24 11:16:40 +02:00
Henri Verbeet 6e8273177a wined3d: Reject multisampled readbacks in wined3d_surface_get_render_target_data(). 2011-10-24 11:16:33 +02:00
Henri Verbeet 4229d865d2 wined3d: Only try to load surfaces from the drawable if the drawable is current in surface_load_sysmem(). 2011-10-24 11:16:27 +02:00
Henri Verbeet 82f067f5cd wined3d: Allow loading multisampled surfaces into sysmem. 2011-10-20 11:02:57 +02:00
Henri Verbeet 3042860478 wined3d: Detach any attached overlays on surface cleanup.
Spotted by Dan Kegel / Valgrind.
2011-10-19 12:23:47 +02:00
Henri Verbeet 68e1484bec wined3d: Mark default pool surfaces lost when they're unloaded. 2011-10-18 15:10:13 +02:00
Henri Verbeet ca43c49968 wined3d: Keep surfaces in sysmem if they're both already there in wined3d_surface_blt().
The idea is to avoid bouncing surfaces between the CPU and GPU when doing both
locks and blits on a surface. This is mostly an issue for ddraw applications.
2011-10-18 15:10:06 +02:00
Stefan Dösinger 496b438ede wined3d: Remove d3d8/9 palette support. 2011-10-11 13:37:49 +02:00
Henri Verbeet 5609f062d2 wined3d: Dump the WINEDDBLTFX structure in wined3d_surface_blt(). 2011-09-20 16:21:38 +02:00
Henri Verbeet b9fcf71c71 ddraw: Use real flips. 2011-09-16 17:23:08 +02:00
Henri Verbeet 8009a4947b wined3d: Flush after surface updates.
This is similar to 5d1d07abcf. We need to flush
to ensure resource updates are visible in other contexts, since otherwise GL
doesn't make any ordering guarantees between contexts.
2011-09-15 15:41:40 +02:00
Henri Verbeet bbb77cba74 wined3d: Add support for flipping compressed surfaces to surface_cpu_blt(). 2011-09-09 13:33:33 +02:00
Henri Verbeet 5c57b53a6c wined3d: Use the CPU blitter for blitting to converted surfaces. 2011-09-09 13:33:25 +02:00
Henri Verbeet e82e1c2ac5 wined3d: Disable sRGB decoding in draw_textured_quad().
We're always supposed to draw the RGB texture here. sRGB decoding may be
enabled if sRGB decoding was enabled to last time the surface was used as a
texture, or if it was never used as a texture at all.
2011-09-09 13:33:22 +02:00
Gerald Pfeifer 0affcc3a7d wined3d: Remove dead code (and variable) from wined3d_surface_flip. wined3d_surface_flip. 2011-09-08 20:08:06 +02:00
Henri Verbeet 19da825b12 wined3d: Use draw_binding for the surface_modify_location() call in surface_unmap() as well. 2011-09-08 11:11:10 +02:00
Henri Verbeet 79c438b2f2 wined3d: Implement wined3d_surface_flip() as a blit.
This allows us to actually take the "override" parameter into account. Plain
back -> front flips will be detected in wined3d_surface_flip() and will still
be handled by wined3d_swapchain_present().
2011-09-07 11:12:17 +02:00
Henri Verbeet 1b9bc1a950 wined3d: Try doing a present in wined3d_surface_blt() instead of IWineD3DSurfaceImpl_BltOverride(). 2011-09-06 10:48:36 +02:00
Henri Verbeet b86d69de16 wined3d: Don't override the swapchain present interval in IWineD3DSurfaceImpl_BltOverride(). 2011-09-06 10:48:31 +02:00
Henri Verbeet 3346fc747c wined3d: Get rid of the rect checks for present in IWineD3DSurfaceImpl_BltOverride(). 2011-09-05 10:56:54 +02:00
Henri Verbeet ca69a23d52 wined3d: Get rid of some redundant else statements in IWineD3DSurfaceImpl_BltOverride(). 2011-09-02 10:09:01 +02:00
Henri Verbeet 179d6f8087 wined3d: Remove a redundant compare in IWineD3DSurfaceImpl_BltOverride().
If the source surface isn't on the destination swapchain it can't be a
backbuffer there either.
2011-09-02 10:08:57 +02:00
Henri Verbeet cc10600b52 wined3d: Print a FIXME for any flags passed to wined3d_surface_flip(). 2011-09-02 10:08:53 +02:00
Henri Verbeet 55ce85ad29 wined3d: Merge the wined3d_surface_flip() implementations. 2011-09-01 18:06:36 +02:00
Henri Verbeet b587b85394 wined3d: Merge the wined3d_surface_set_mem() implementations. 2011-09-01 18:06:36 +02:00
Austin English b2f7461a4d wined3d: Remove an unused variable. 2011-09-01 18:06:36 +02:00
Henri Verbeet dd462052c6 wined3d: Use the resource size for copying between a surface's DIB and PBO. 2011-08-31 12:07:57 +02:00
Matteo Bruni 0386b44bad wined3d: Keep track of the current texture type for each texture unit. 2011-08-29 12:08:19 +02:00
Henri Verbeet 641f52ef96 wined3d: Add multisampling support. 2011-08-26 11:28:47 +02:00
Henri Verbeet 3b478afd10 wined3d: Get rid of the location fixup in surface_blt_fbo(). 2011-08-26 11:27:50 +02:00
Henri Verbeet eac640532d wined3d: Get rid of the location fixup for ORM_FBO in surface_modify_location(). 2011-08-26 11:27:46 +02:00
Henri Verbeet 68a5305dfd wined3d: Get rid of the location fixup for ORM_FBO in surface_load_location(). 2011-08-26 11:27:43 +02:00
Matteo Bruni d485e04576 wined3d: Fetch currently active texture unit from the wined3d_context. 2011-08-25 11:31:55 +02:00
Matteo Bruni f47f9f7c74 wined3d: Store currently active texture in the wined3d context. 2011-08-25 11:31:55 +02:00
Matteo Bruni e53ae83d74 wined3d: Pass around the context instead of gl_info. 2011-08-25 11:31:55 +02:00
Matteo Bruni be8ea9c36e wined3d: Make context_acquire() unconditional in a bunch of places. 2011-08-25 11:31:55 +02:00
Henri Verbeet 6cdfb95c8e wined3d: Use draw_binding in surface_unload(). 2011-08-25 11:31:53 +02:00
Henri Verbeet 1d43f07239 wined3d: Use draw_binding in surface_realize_palette(). 2011-08-25 11:31:53 +02:00
Henri Verbeet 683b52ed92 wined3d: Use draw_binding in surface_unmap(). 2011-08-25 11:31:53 +02:00
Henri Verbeet 1ae498dc59 wined3d: Use draw_binding in IWineD3DSurfaceImpl_BltOverride(). 2011-08-25 11:31:53 +02:00
Henri Verbeet 4673330cf4 wined3d: Use draw_binding in wined3d_surface_blt(). 2011-08-24 11:58:15 +02:00
Henri Verbeet e57b20c215 wined3d: Keep track of a surface's "draw location". 2011-08-24 11:58:14 +02:00
Henri Verbeet f73593c572 wined3d: Set the current location to SFLAG_INTEXTURE instead of SFLAG_INDRAWABLE in wined3d_surface_depth_blt().
These currently end up being the same thing, but that will change soon.
2011-08-24 11:58:14 +02:00
Henri Verbeet 4b1ba0e02d wined3d: Don't get rid of the user memory unless we're actually called with NULL in surface_set_mem().
In particular, some applications will call surface_set_mem() with the same
pointer to notify us the contents have changed.
2011-08-24 11:58:14 +02:00
Henri Verbeet 48911d7a1c wined3d: Reject color blits on sysmem surfaces in ffp_blit_supported(). 2011-08-23 16:53:51 +02:00
Henri Verbeet f58e55ec6c wined3d: Move arbfp based color blits from IWineD3DSurfaceImpl_BltOverride() to wined3d_surface_blt(). 2011-08-23 16:53:51 +02:00
Henri Verbeet a04f0e9c78 wined3d: Move FBO based color blits from IWineD3DSurfaceImpl_BltOverride() to wined3d_surface_blt(). 2011-08-22 16:14:37 +02:00
Henri Verbeet d063ff55e7 wined3d: Move surface_color_fill() based color fills from IWineD3DSurfaceImpl_BltOverride() to wined3d_surface_blt(). 2011-08-22 16:14:37 +02:00
Henri Verbeet a887128ffd wined3d: Reject color fills on sysmem surfaces in ffp_blit_supported(). 2011-08-22 16:14:36 +02:00
Henri Verbeet 18434ddc57 wined3d: Directly call surface_cpu_blt() in cpu_blit_color_fill().
And avoid a potential infinite recursion if wined3d_surface_blt() ends up
calling cpu_blit_color_fill().
2011-08-22 16:14:36 +02:00
Henri Verbeet 26484c9200 wined3d: Allow color fills on FBO attachable surfaces in ffp_blit_supported(). 2011-08-22 16:14:36 +02:00
Henri Verbeet e1ab5f6e6b wined3d: Don't allow blits with an invalid destination rectangle when a clipper is set either.
Clippers don't really work. Previously we mostly didn't run into this because
the rectangle was already rejected by ddraw_surface7_Blt(), although
ddraw_surface7_BltFast() might have been affected in a couple of cases. We
should of course implement clippers, but until that happens, completely
rejecting the blit is better than introducing memory corruption.

This fixes a regression introduced by commit
92e616f355.
2011-08-22 16:14:36 +02:00
Henri Verbeet 56428c6386 wined3d: Reuse convert_a8r8g8b8_x8r8g8b8() for B8G8R8X8 -> B8G8R8A8 conversions. 2011-08-22 16:14:36 +02:00
Henri Verbeet 156d24c634 wined3d: Add compressed surface support to surface_cpu_blt(). 2011-08-22 16:14:36 +02:00
Henri Verbeet a84275075d wined3d: Implement wined3d_surface_bltfast() on top of wined3d_surface_blt(). 2011-08-05 09:17:39 +02:00
Henri Verbeet 662de19ad3 wined3d: Move some flags handling from surface_cpu_blt() to wined3d_surface_blt(). 2011-08-04 09:04:49 +02:00
Henri Verbeet 7e3ecd683c wined3d: Move rectangle validation from surface_cpu_blt() to wined3d_surface_blt().
This fixes some tests because these were getting skipped for the BltOverride() path.
2011-08-04 09:04:39 +02:00
Henri Verbeet b166cb29f8 wined3d: Remove src_rect and dst_rect NULL checks from surface_cpu_blt(). 2011-08-04 09:04:25 +02:00
Henri Verbeet e74d1358ac wined3d: Remove the unused blit_op parameter to arbfp_blit_surface(). 2011-08-04 09:04:20 +02:00
Henri Verbeet 41cff1618c wined3d: Merge wined3d_surface_blt(), surface_blt() and gdi_surface_blt(). 2011-08-03 09:23:30 +02:00
Henri Verbeet c12627562b wined3d: Go to the fallbacks for cross-swapchain blits. 2011-08-03 09:23:20 +02:00
Henri Verbeet 111e8fe77c wined3d: Add WINED3DFMT_P8_UINT support to wined3d_format_convert_from_float(). 2011-08-03 09:23:16 +02:00
Henri Verbeet cf1c641cbb wined3d: Fix switching color keying on / off. 2011-08-03 09:23:12 +02:00
Henri Verbeet e4efcea223 wined3d: Set the read buffer to GL_NONE in surface_load_ds_location().
On GL implementations that don't support GL_ARB_ES2_compatibility the
framebuffer's read buffer has to be valid, even if we're not reading from it.
2011-08-03 09:23:08 +02:00
Henri Verbeet 98650e841e wined3d: Go to the fallbacks if D3D is not initialized in surface_blt().
Even though this is the "OpenGL" surface implementation, this can still happen
in e.g. ddraw if no swapchain is created yet. That's something we should fix,
but not today.
2011-08-02 11:40:20 +02:00
Henri Verbeet 7539cc8faa wined3d: Go straight to the fallbacks for complex blits in surface_blt().
At the moment this is only marginally useful, since it just avoids silly
things like color keyed depth fills that are probably invalid anyway. However,
the idea is to gradually move normal color fill and blit handling out of
IWineD3DSurfaceImpl_BltOverride() and surface_cpu_blt(), and eventually make
those functions go away completely.
2011-08-02 11:40:16 +02:00
Henri Verbeet 4bdd4ef45b wined3d: Check for locked surfaces in wined3d_surface_blt(). 2011-08-02 11:40:11 +02:00
Henri Verbeet 50d883c37e wined3d: IWineD3DSurfaceImpl_BltOverride() is always passed valid source and destination rectangles.
So no need to call surface_get_rect() anymore.
2011-08-02 11:40:07 +02:00
Henri Verbeet ace241ad59 wined3d: Resolve source and destination rectangles in wined3d_surface_blt(). 2011-08-02 11:40:01 +02:00
Henri Verbeet 33fafc6166 wined3d: Get rid of context_bind_fbo() calls outside context.c. 2011-08-01 11:16:12 +02:00
Henri Verbeet dcc969c32c wined3d: Get rid of dst_fbo.
As a result we can get rid of a couple of other things as well.
2011-08-01 11:16:08 +02:00
Henri Verbeet ccb3a51a44 wined3d: Just invalidate STATE_FRAMEBUFFER in surface_load_ds_location(). 2011-08-01 11:16:03 +02:00
Henri Verbeet 2bf020e26f wined3d: Only invalidate state for the current context in surface_blt_fbo(). 2011-07-28 11:29:14 +02:00
Henri Verbeet 51c0f2a787 wined3d: Only invalidate state for the current context in wined3d_surface_depth_blt_fbo(). 2011-07-27 11:51:53 +02:00
Henri Verbeet c5f8a33a86 wined3d: Make the surface parameter to ffp_blit_p8_upload_palette() const. 2011-07-19 14:05:59 +02:00
Henri Verbeet 437cec1a49 wined3d: Make the surface parameter to surface_depth_blt() const. 2011-07-18 16:23:29 +02:00
Henri Verbeet a97ed53460 wined3d: Make the surface parameter to surface_convert_color_to_float() const. 2011-07-18 16:23:29 +02:00
Henri Verbeet d314aa2d6e wined3d: Make the surface parameter to surface_convert_depth_to_float() const. 2011-07-18 16:23:29 +02:00
Henri Verbeet 416a55c7aa wined3d: Make the surface parameter to surface_is_full_rect() const. 2011-07-18 16:23:29 +02:00
Henri Verbeet db12216301 wined3d: Make the surface parameter to surface_get_rect() const. 2011-07-18 16:23:29 +02:00
Henri Verbeet abfd6b479a wined3d: Make the surface parameter to d3dfmt_p8_init_palette() const. 2011-07-11 11:53:32 +02:00
Henri Verbeet 3e9930f307 wined3d: Make the device parameter to primary_render_target_is_p8() const. 2011-07-11 11:53:28 +02:00
Henri Verbeet a26c5f9b13 wined3d: Make the surface parameter to d3dfmt_get_conv() const. 2011-07-08 11:25:31 +02:00
Henri Verbeet aa55404682 wined3d: Make the src_surface parameter to draw_textured_quad() const. 2011-07-08 11:25:28 +02:00
Henri Verbeet 0d18f5df0e wined3d: Make the surface parameter to surface_upload_data() const. 2011-07-08 11:25:25 +02:00
Henri Verbeet faebcc0236 wined3d: Make the surface parameter to surface_translate_drawable_coords() const. 2011-07-08 11:25:21 +02:00
Henri Verbeet bb4b86f365 wined3d: Make the rt parameter to surface_set_compatible_renderbuffer() const. 2011-07-08 11:25:17 +02:00
Henri Verbeet 640234c504 wined3d: Rename "flag" to "location" in surface_modify_location(). 2011-07-07 12:31:46 +02:00
Henri Verbeet 3ccf12a77c wined3d: Rename "flag" to "location" in surface_load_location().
This makes much more sense.
2011-07-06 11:14:20 +02:00
Stefan Dösinger 053071e343 wined3d: Pass a struct wined3d_fb_state to device_clear_render_targets. 2011-07-05 17:33:51 +02:00
Stefan Dösinger cd96c59d91 wined3d: Track framebuffer changes. 2011-07-05 17:33:43 +02:00
Henri Verbeet 4e8c7f00f2 wined3d: Print an ERR for unknown / invalid surface locations in surface_load_location(). 2011-07-05 13:46:24 +02:00
Henri Verbeet 1c3b691f10 wined3d: Introduce a separate function for loading the SFLAG_INTEXTURE and SFLAG_INSRGBTEX surface locations. 2011-07-05 13:46:20 +02:00
Henri Verbeet cabcb362c1 wined3d: Introduce a separate function for loading the SFLAG_INDRAWABLE surface location. 2011-07-05 13:46:15 +02:00
Henri Verbeet aacd8f8b93 wined3d: Introduce a separate function for loading the SFLAG_INSYSMEM surface location. 2011-07-05 13:46:11 +02:00
Henri Verbeet b1664a2c85 wined3d: Get rid of some IWineD3D* references. 2011-07-04 13:44:41 +02:00
Henri Verbeet c461d312ba wined3d: Request per-surface palettes in the client libs. 2011-06-24 08:49:48 -05:00
Henri Verbeet fd8dbf0847 wined3d: Make the surface parameter to surface_get_gl_buffer() const. 2011-06-24 08:49:34 -05:00
Henri Verbeet 0ce282edf7 wined3d: Make the surface parameter to surface_is_offscreen() const. 2011-06-24 08:49:28 -05:00