Commit Graph

822 Commits

Author SHA1 Message Date
Roderick Colenbrander 4cb6255907 wined3d: We don't need color keying for sysmem->drawable uploads. 2010-04-15 17:03:52 +02:00
Roderick Colenbrander 2a949ec323 wined3d: Remove call to d3dfmt_get_conv from read_from_framebuffer_texture. 2010-04-15 17:03:49 +02:00
Roderick Colenbrander 1a61f46bbb wined3d: Remove temporary conv_byte_count fixup from d3dfmt_get_conv. 2010-04-15 17:03:47 +02:00
Roderick Colenbrander bccfd7cc06 wined3d: Add BLT_OP_COLOR_FILL to blit_supported and use it in BltOverride. 2010-04-15 14:20:48 +02:00
Roderick Colenbrander 4c87bc0c41 wined3d: Move A4L4 conversion to the formats table. 2010-04-14 18:00:47 +02:00
Roderick Colenbrander cda78c01e6 wined3d: Move G16R16/R16G16F conversion to the formats table. 2010-04-14 18:00:47 +02:00
Henri Verbeet 8eb2a2cf0c wined3d: Disable strict draw ordering by default.
While some performance hit from the extra flushes was expected and would be
acceptable, the performance hit can be over 50% on some configurations, which
clearly isn't acceptable. This patch introduces a "StrictDrawOrdering"
registry key for applications affected by this, until we have a more
structural solution.
2010-04-13 21:13:36 +02:00
Roderick Colenbrander e35f54ef1f wined3d: Move R32G32F convertion to the formats table. 2010-04-13 17:56:35 +02:00
Roderick Colenbrander 5c635f4146 wined3d: Move D15S1 over to the formats table. 2010-04-13 17:56:32 +02:00
Roderick Colenbrander 6a081ef95a wined3d: Move D24X4S4 to the formats table. 2010-04-13 17:56:29 +02:00
Roderick Colenbrander 485040bb5c wined3d: Move D24FS8 to formats table. 2010-04-13 17:56:27 +02:00
Roderick Colenbrander 798ba56c1b wined3d: Move L6V5U5 conversion to the formats table. 2010-04-13 17:56:24 +02:00
Roderick Colenbrander 76a9712779 wined3d: Add an initial implementation of arbfp_blit_surface. 2010-04-09 16:50:21 +02:00
Roderick Colenbrander f1ca14cb5b wined3d: Add an initial fbo_blit_supported implementation. 2010-04-09 16:50:21 +02:00
Roderick Colenbrander 7df7ce40c3 wined3d: Move X8L8V8U8 surface conversion to the format table. 2010-04-09 16:50:21 +02:00
Roderick Colenbrander 60c6294f84 wined3d: Move Q8W8V8U8 conversion to the format table. 2010-04-09 16:50:20 +02:00
Roderick Colenbrander d7e1b973c7 wined3d: Start moving texture format fixups to the formats table. 2010-04-09 16:50:20 +02:00
Roderick Colenbrander a4559e761b wined3d: Move srgb checks away from d3dfmt_get_conv. 2010-04-09 16:50:20 +02:00
Roderick Colenbrander 00598c3e36 wined3d: Let d3dfmt_get_conv return a wined3d_format_desc. 2010-04-09 16:50:20 +02:00
Roderick Colenbrander 1c02a909e5 wined3d: Remove remaining redundant code from d3dfmt_get_conv. 2010-04-08 17:34:18 +02:00
Roderick Colenbrander 2c5eee25ca wined3d: Only apply float R16G16F/R32G32F fixup when ARB_texture_rg isn't around and remove redundant code. 2010-04-07 18:14:05 +02:00
Roderick Colenbrander edcdbc2a76 wined3d: Remove redundant gl format/type code from d3dfmt_get_conv since it is already in the table. 2010-04-07 18:13:49 +02:00
Roderick Colenbrander e7a71e15b5 wined3d: Turn blit_shader color_fixup_supported into blit_supported. 2010-04-07 18:13:35 +02:00
Henri Verbeet 83443273c1 wined3d: Pass the correct window to Present() in IWineD3DSurfaceImpl_Flip(). 2010-04-07 13:50:16 +02:00
Henri Verbeet 3b7774b37b wined3d: Pass the correct window to Present() in IWineD3DSurfaceImpl_BltOverride(). 2010-04-07 13:50:12 +02:00
Roderick Colenbrander e6ae272efe wined3d: Due to code rewrites is_color_fixup_supported is not needed anymore in RealizePalette.
The code in question should be executed in all cases. This also fixes
palette refresh issues when shaders / paletted textures aren't around.
2010-04-06 13:55:14 +02:00
Roderick Colenbrander 1f2976a302 wined3d: Move the arbfp p8 fixup to the format table and get rid of the d3dfmt_get_conv override. 2010-04-06 13:55:02 +02:00
Roderick Colenbrander a5a4be4fc5 wined3d: Disable framebuffer to texture blitting.
The current code doesn't work for this at all and causes major
rendering issues in e.g. C&C. I don't think we should fix this code
either since it isn't worth the effort and requires evil things like
paletteOverride.
2010-04-06 13:54:47 +02:00
Roderick Colenbrander 69902ab6d0 wined3d: Move EXT_PALETTED_TEXTURE code over to ffp_blit. 2010-04-06 13:53:21 +02:00
Roderick Colenbrander 3b6aea5934 wined3d: Move palette uploading code over to arbfp blit_shader. 2010-04-06 13:53:15 +02:00
Roderick Colenbrander ae8d9e21e3 wined3d: Remove the swapchain parameter from fb_copy_to_texture_hwstretch in order to unify all blit calls. 2010-04-02 15:22:51 +02:00
Roderick Colenbrander ff82e66a69 wined3d: Move upsideDown calculation to blit implementation. 2010-04-02 15:22:51 +02:00
Roderick Colenbrander c6f0ddcb1a wined3d: Remove some unneeded source rectangle calculations from BltOverride. 2010-03-31 16:12:30 +02:00
Roderick Colenbrander 87b5b2f738 wined3d: Remove the last use of the WINED3DRECT destination rectangle in BltOverride. 2010-03-31 16:12:30 +02:00
Roderick Colenbrander 40f3f0b041 wined3d: Use RECT instead of WINED3DRECT in fb_copy_to_texture_hwstretch. 2010-03-31 16:12:29 +02:00
Roderick Colenbrander 7f1f61e28e wined3d: Use RECT instead of WINED3DRECT in fb_copy_to_texture_direct. 2010-03-31 16:12:28 +02:00
Roderick Colenbrander ae26d9defd wined3d: Use RECT instead of WINED3DRECT in stretch_rect_fbo. 2010-03-31 16:12:27 +02:00
Roderick Colenbrander c864ae6348 wined3d: Disable flipping through the source rectangle in BltOverride. 2010-03-30 14:10:45 +02:00
Roderick Colenbrander 334fea7d79 wined3d: Fix a destination flipping bug using the destination rectangle. 2010-03-30 14:10:37 +02:00
Roderick Colenbrander a91f844a3d wined3d: Use RECT instead of WINED3DRECT in more parts of BltOverride. 2010-03-30 13:54:45 +02:00
Roderick Colenbrander 682c969e9a wined3d: Add a helper function for getting a valid rectangle. 2010-03-30 13:54:35 +02:00
Roderick Colenbrander a7d3b616c4 wined3d: Add color_fill to blit_shader. 2010-03-30 13:54:24 +02:00
Roderick Colenbrander 9a1fd552d2 wined3d: Introduce a helper function which converts a color from the surface format to ARGB. 2010-03-30 13:54:12 +02:00
Roderick Colenbrander 5ffb088975 wined3d: Fix depth blit regression. 2010-03-22 11:40:40 +01:00
Henri Verbeet 3aaa6ee6e7 wined3d: Rename GlPixelFormatDesc to wined3d_format_desc. 2010-03-19 14:31:47 +01:00
Roderick Colenbrander fb8812db89 wined3d: Get rid of d3dfmt_get_conv in RealizePalette. 2010-03-19 13:15:26 +01:00
Roderick Colenbrander 27a96e477a wined3d: Start moving paletted texture support to the blit_shader. 2010-03-19 13:15:21 +01:00
Roderick Colenbrander fd99ab78c2 wined3d: Use draw_textured_quad in BltOverride. 2010-03-19 13:15:06 +01:00
Roderick Colenbrander 4bd627cc7f wined3d: Add a helper function for drawing a textured quad. 2010-03-19 13:15:03 +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 0ae49c35fb wined3d: Use the context's window handle in IWineD3DSurfaceImpl_BltOverride(). 2010-03-16 11:44:55 +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
Roderick Colenbrander 604caf0caa wined3d: Remove oversize texture support. 2010-03-15 14:23:15 +01:00
Roderick Colenbrander 74bf524a99 wined3d: Use surface_get_blt_info to compute texture coordinates for surface_blt_to_drawable. 2010-03-15 14:22:57 +01:00
Roderick Colenbrander 360384277b wined3d: Extend surface_get_depth_blt_info with texture coordinate code from surface_blt_to_drawable. 2010-03-15 14:22:44 +01:00
Roderick Colenbrander c0ef7a1a93 wined3d: Move the 8-bit palette shader code over to the blit_shader backend. 2010-03-03 12:53:51 +01:00
Stefan Dösinger 5c4d3fb5a2 wined3d: Control SFLAG_CONVERTED in surface_prepare_texture.
This makes sure that the flag is set correctly when
surface_allocate_surface is called and client storage is disabled
properly for converted surfaces.
2010-02-17 16:50: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 02e0b3ae1a wined3d: Introduce surface_prepare_texture().
Similar to surface_prepare_system_memory(). In the long term we'll probably
want to move the whole location management to resource.c and unify buffers and
textures there.
2010-02-04 13:39:26 +01:00
Henri Verbeet b0583a2410 wined3d: Never acquire a context in IWineD3DSurfaceImpl_BindTexture().
The caller is already responsible for doing this, so it's redundant at best.
2010-02-04 13:39:26 +01:00
Henri Verbeet c03d367d3c wined3d: Get rid of an unnecessary GetContainer() call in surface_blt_to_drawable(). 2010-01-29 13:30:06 +01:00
Henri Verbeet ce42470138 wined3d: Ensure draw ordering across contexts. 2010-01-28 11:07:59 +01:00
Henri Verbeet ea2f7a2739 wined3d: Remove some redundant returns. 2009-12-30 13:31:26 +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
Henri Verbeet 97f04248fc wined3d: Use surface_is_offscreen() in flush_to_framebuffer_drawpixels(). 2009-12-16 12:22:03 +01:00
Henri Verbeet bf113bd284 wined3d: Use surface_is_offscreen() in read_from_framebuffer_texture(). 2009-12-16 12:21:58 +01:00
Henri Verbeet 51438eec46 wined3d: Use surface_is_offscreen() in fb_copy_to_texture_hwstretch(). 2009-12-16 12:21:50 +01:00
Stefan Dösinger cde3217268 wined3d: Properly release client storage memory. 2009-12-15 16:09:12 +01:00
Henri Verbeet 82556b613e wined3d: Let the context handle the draw buffer in fb_copy_to_texture_hwstretch(). 2009-12-14 12:04:05 +01:00
Henri Verbeet 59db3ecaa0 wined3d: Let the context handle the draw buffer in flush_to_framebuffer_drawpixels(). 2009-12-14 12:04:05 +01:00
Henri Verbeet b3defd4c80 wined3d: Rename "wineD3DDevice" to "device". 2009-12-10 11:54:47 +01:00
Henri Verbeet b6ef17f23d wined3d: Remove unused GetDevice() implementations. 2009-12-09 13:51:04 +01:00
Henri Verbeet 54f3dec8e6 wined3d: Rename the "wineD3D" device field to "wined3d". 2009-12-08 12:33:29 +01:00
Stefan Dösinger 817714912b wined3d: Infrastructure to render swapchains to a FBO. 2009-12-07 14:33:24 +01:00
Stefan Dösinger 64291c60cb wined3d: A function for checking if a surface is offscreen. 2009-12-07 14:32:54 +01:00
Stefan Dösinger 54f0d3f785 wined3d: Add a function for initializing surface sysmem. 2009-12-07 14:32:29 +01:00
Stefan Dösinger 6a19339207 wined3d: Remove needless NULL checks (coverity). 2009-12-03 11:45:15 +01:00
Marcus Meissner 9f8a73ab96 wined3d: Check for NULL before context_release (Coverity). 2009-11-03 21:22:46 +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 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 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 ade350b4d4 wined3d: Compare and copy the actual palette in palette9_changed() (Valgrind). 2009-10-23 12:03:37 +02:00
Henri Verbeet 6be41fd59a wined3d: Get rid of GL_LIMITS. 2009-10-22 10:46:05 +02:00
Henri Verbeet 55047f811a wined3d: Fix some GLINFO_LOCATION abuse. 2009-10-22 10:45:57 +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 4fe014cb54 wined3d: Fix sRGB->RGB copy condition.
The old condition happened to work, because SFLAG_INTEXTURE was not
set(we're loading it), and neither was SFLAG_INDRAWABLE(otherwise
INTEXTURE would be set too). If the fbo INDRAWABLE == INTEXTURE is
replaced by INDRAWABLE == INSRGBTEX this doesn't hold true any longer
because SFLAG_INDRAWABLE is set, but not used because the drawable
readback is never used for fbos.
2009-09-23 13:25:33 +02:00
Stefan Dösinger 33ca3c0207 wined3d: Don't mark SFLAG_INTEXTURE up to date with fbo stretchrect.
FBO stretchrect marks SFLAG_INDRAWABLE up to date, which currently
also marks SFLAG_INTEXTURE up to date. However, this will change when
we enable rendering to the srgb copy, in which case the drawable could
be equal to the srgb copy, not the rgb copy.
2009-09-23 13:25:21 +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 34dd27e3a8 wined3d: Don't create a depthstencil renderbuffer if ARB_framebuffer_object is supported. 2009-09-23 12:37:06 +02:00
Henri Verbeet ec97383f6f wined3d: Add support for ARB_framebuffer_object. 2009-09-23 12:37:00 +02:00
Henri Verbeet 0a4fa886a7 wined3d: Revert 4ba16b84a9.
Unfortunately surface_can_stretch_rect() doesn't check just for
WINED3DFMT_FLAG_FBO_ATTACHABLE.
2009-09-22 16:16:55 +02:00
Henri Verbeet dbc4dfc495 wined3d: Move "parent_ops" to IWineD3DResourceClass. 2009-09-18 08:55:33 -05:00
Henri Verbeet 4ba16b84a9 wined3d: Get rid of some redundant checks for ORM_FBO.
ORM_FBO is already implied by surface_can_stretch_rect() because
WINED3DFMT_FLAG_FBO_ATTACHABLE can only be set when ORM_FBO is.
2009-09-17 10:09:50 -05:00
Henri Verbeet a5214c306f wined3d: Don't free D3D surfaces until the wined3d surface is destroyed.
This prevents for example a d3d9 depth stencil from being destroyed when it
has no external references but is still in use by the device/stateblock. A
nice side effect is that it simplifies handling of "implicit" surfaces like
the frontbuffer and backbuffers, as well as the forwarding of reference counts
for surfaces that are part of a texture.
2009-09-16 13:04:32 -05:00
Stefan Dösinger e1469961d4 wined3d: Test and fix ddraw and d3d9 GetDC differences.
The MSDN is not totally correct: A8R8G8B8 and A1R5G5B5 also allow GetDC. The
main differences that have to be filtered out in d3d9.dll are GetDC on
A8B8G8R8, X8B8G8R8 and P8.
2009-09-08 13:04:52 +02:00
Henri Verbeet 560d63548d wined3d: Remove trailing spaces. 2009-08-27 11:45:37 +02:00
Stefan Dösinger 52731a80c8 wined3d: Make it clear that glFlush and glFinish are WGL functions. 2009-08-26 14:35:41 +02:00
Rico Schüller d9784c1a2f wined3d: Fix some checkGLcalls. 2009-08-19 14:41:49 +02:00
Henri Verbeet b8078fc747 wined3d: Use WINED3D_UNMAPPED_STAGE in some more places. 2009-08-17 13:57:50 +02:00
Henri Verbeet ecd2dc7603 wined3d: Make RTL_READTEX the default rendertarget locking method.
For most cards this should make more sense than RTL_READDRAW, even if e.g.
surface_upload_data() has some room for improvement.
2009-08-14 13:59:09 +02:00
Roderick Colenbrander 5a00c8053e wined3d: Get rid of two dead render target lock mode options. 2009-08-10 13:10:49 +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 351d6de818 wined3d: Add functions to lookup texture filters. 2009-08-05 11:20:09 +02:00
Stefan Dösinger f3b39d9085 wined3d: Preload the correct texture location. 2009-08-05 11:19:35 +02:00
Henri Verbeet b7812932bc wined3d: Don't respecify compressed textures in surface_upload_data().
Passing NULL to glCompressedTexImage2DARB() doesn't work particularly well
when both client storage and PBOs are enabled. Also, two years is long enough
to give driver developers a chance to fix the bug this was supposed to work
around.
2009-08-03 15:01:55 +02:00
Henri Verbeet da1e5573da wined3d: Rename WineD3DContext to struct wined3d_context. 2009-08-03 15:01:48 +02:00
Henri Verbeet be536ebe2f wined3d: Get rid of activeContext. 2009-07-24 13:10:57 +02:00
Henri Verbeet c8fe24d29e wined3d: Explicitly pass the context to surface_load_ds_location(). 2009-07-24 13:10:47 +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
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 43e6686a78 wined3d: Rename _WineD3D_GL_Info to struct wined3d_gl_info. 2009-07-17 11:22:07 +02:00
Stefan Dösinger 3c2fa6aea4 wined3d: Set the depth blit helper texture address mode to clamp.
On ATI cards we use the driver's GL_ARB_texture_non_power_of_two emulation to
support conditional NP2 textures without having to deal with the denormalized
coordinates. The default GL_TEXTURE_2D address mode is incompatible with
GL_ARB_texture_rectangle however.
2009-07-15 13:17:12 +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 038d939941 wined3d: Remove GetGlDesc() from the public IWineD3DSurface interface. 2009-07-10 12:13:09 +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 532b99078e wined3d: Don't abuse blending to disable color writes in surface_depth_blt(). 2009-07-03 13:05:52 +02:00
Henri Verbeet 7363b6e2e3 wined3d: Document GL context dependencies. 2009-06-26 12:05:07 +02:00
Henri Verbeet 626baad817 wined3d: Make sure we have an active GL context before calling d3dfmt_p8_upload_palette(). 2009-06-26 12:05:00 +02:00
Henri Verbeet 1b306c25e2 wined3d: Make sure we have an active GL context before calling surface_remove_pbo(). 2009-06-26 12:04:57 +02:00
Henri Verbeet db5b126da6 wined3d: Make sure we have an active GL context in IWineD3DSurfaceImpl_UnLoad(). 2009-06-26 12:04:53 +02:00
Stefan Dösinger 20401fa9af wined3d: Invalidate the srgb tex in surface::unload. 2009-06-22 11:25:57 +02:00
Henri Verbeet 51902b89fb wined3d: Remove a redundant ActivateContext() call in IWineD3DSurfaceImpl_UnlockRect().
The various LoadLocation() handlers already take care of activating an
appropriate context.
2009-06-18 15:17:27 +02:00
Henri Verbeet c7b684f345 wined3d: Simplify IWineD3DSurfaceImpl_LockRect() a bit. 2009-06-18 15:17:27 +02:00
Stefan Doesinger 7d5285acc1 wined3d: Properly free srgb textures. 2009-06-18 15:17:26 +02:00
Michael Abbott 2e119a2718 wined3d: Remove division from inner loop. 2009-06-18 15:17:26 +02:00
Henri Verbeet dad6c311ec wined3d: Fix a typo. 2009-06-17 12:13:07 +02:00
Henri Verbeet 23231d5a62 wined3d: Add format conversions for some depth stencil formats.
Although these formats aren't lockable, we still explicitly set the initial
surface data when creating the texture. Unfortunately that means we'll need
the conversion functions, even though all they'll ever convert will be zeroes.
2009-06-16 13:37:06 +02:00
Henri Verbeet fede35d1c5 wined3d: Introduce surface_calculate_size(). 2009-06-15 13:42:28 +02:00
Henri Verbeet 5f581975dc wined3d: Introduce surface_init() to handle most of the surface initialization. 2009-06-15 13:42:28 +02:00
Henri Verbeet 32613eb628 wined3d: Introduce surface_cleanup(). 2009-06-15 13:42:28 +02:00
Henri Verbeet 669891c817 wined3d: Respect the "srgb" parameter to IWineD3DSurfaceImpl_BindTexture().
This is mostly for consistency, standalone surfaces can't be used for
texturing, so in practice "srgb" should always be FALSE in this path.
2009-06-12 17:33:15 +02:00
Henri Verbeet 8f67918f1d wined3d: Use WINED3DFMT_FLAG_COMPRESSED instead of checking for specific formats. 2009-06-12 17:33:15 +02:00
Henri Verbeet b052c6e8aa wined3d: Remove some redundant s3tc extension checks.
If the extension isn't available to surface shouldn't have been created. We
don't do extension checks for all the other formats either.
2009-06-11 11:53:54 +02:00
Henri Verbeet a25e63c62d wined3d: Check the correct extensions in d3dfmt_get_conv().
According to Stefan these are either typos or leftovers from using GL_HILO8_NV.
2009-06-10 11:50:44 +02:00
Henri Verbeet 5ac8a7b054 wined3d: Set explicitly sized internal formats for color key conversion in d3dfmt_get_conv(). 2009-06-10 11:50:31 +02:00
Henri Verbeet 910455e435 wined3d: Add some FIXMEs about blitting with unsupported fixups. 2009-06-09 17:01:14 +02:00
Henri Verbeet 08d95233e3 wined3d: Don't modify the internal format in d3dfmt_get_conv().
For most conversions the internal format is irrelevant. Color key conversions
are an exception, because they need to ensure an alpha channel is present.
2009-06-09 17:01:14 +02:00
Henri Verbeet fb7531599f wined3d: Only use stretch_rect_fbo() on surfaces that are FBO attachable. 2009-06-05 15:19:35 +02:00
Henri Verbeet 85107d81f4 wined3d: Remove some unnecessary forward declarations. 2009-05-25 11:23:32 +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 177d883d95 wined3d: Add missing GL locking to ffp_blit_set() and ffp_blit_unset(). 2009-05-15 10:25:27 +02:00
Henri Verbeet 5bc449553b wined3d: Add missing GL locking to d3dfmt_p8_upload_palette(). 2009-05-15 10:25:22 +02:00
Francois Gouget 514c5f2648 wined3d: Make surface_force_reload() static. 2009-05-13 12:45:36 +02:00
Stefan Dösinger 8513f64a01 wined3d: Emulate R16G16F and R32G32F if GL_ARB_texture_rg is not supported.
Nvidia doesn't offer it on geforce 7 and earlier cards, but some games need
it. This is surprising because the extension was made specifically for
compatibility purposes for older cards.
2009-04-28 13:10:03 +02:00
Henri Verbeet 4469fbd43d wined3d: Don't use rtInternal for surfaces that are on a swapchain.
These surfaces won't be attached to an FBO anyway, so avoid the cost of a
potential format conversion when blitting from a non-RT surface. This is
mostly an issue for ddraw applications with 16 bit render targets.
2009-03-25 11:12:49 +01:00
Henri Verbeet 899df56ebe wined3d: Add a more convenient way to check if a surface is on a swapchain.
This won't help if we actually need the swapchain, of course.
2009-03-25 11:12:40 +01:00
Henri Verbeet afc5744e70 wined3d: Pass format_desc to set_shader().
This should be the last unnecessary getFormatDescEntry() call.
2009-03-24 12:57:45 +01:00
Henri Verbeet b7744f8158 wined3d: Remove the bytesPerPixel field from IWineD3DSurfaceImpl and IWineD3DVolumeImpl.
We can use the information from format_desc instead.
2009-03-24 12:57:21 +01:00
Henri Verbeet 2dc7fc2916 wined3d: Remove the format field from IWineD3DResourceClass. 2009-03-13 11:29:19 +01:00
Henri Verbeet a3657c164d wined3d: Remove some redundant fields from struct glDescriptor. 2009-03-13 11:28:50 +01:00
Henri Verbeet a139683a60 wined3d: Eliminate the heightscale field from IWineD3DSurfaceImpl. 2009-03-13 11:28:45 +01:00
Henri Verbeet 1dcf222ab2 wined3d: Get rid of some calls to getFormatDescEntry().
Use the format description stored in the resource instead.
2009-03-12 13:09:55 +01:00
Henri Verbeet 8cefc47d81 wined3d: Add DXGI formats to WINED3DFORMAT. 2009-02-20 11:10:37 +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 68c251f327 wined3d: Add a debug function for surface locations. 2009-02-17 12:51:17 +01:00
Stefan Dösinger c585b4de99 wined3d: Duplicate GL textures for srgb switching.
This reduces the number of srgb switching reloads quite a lot. The only
situation in which a reload is needed is if the rgb copy is modified on the GL
side and the srgb copy is needed.
2009-02-17 12:48:05 +01:00
Michael Stefaniuc 118c75a8c7 wined3d: Remove superfluous pointer casts. 2009-02-03 12:40:14 +01:00
Henri Verbeet 9440dfedf4 wined3d: Remove AddDirtyRect() from the public interface. 2009-01-14 13:51:00 +01:00
Rico Schüller 5e79b0608d wined3d: Add a checkGLcall() after glReadBuffer. 2009-01-10 18:04:28 +01:00
Stefan Dösinger a69c86d3f5 ddrawex: Add a test for the permanent DC function. 2009-01-09 16:26:06 +01:00
Henri Verbeet 9d8c6326c0 wined3d: Remove stray tabs. 2009-01-09 14:06:14 +01:00
Stefan Dösinger 616ea53226 ddraw: Add a test for IDirectDrawSurface::GetDC. 2009-01-03 15:14:38 +01:00
Vincent Pelletier 23dcf61e61 wined3d: Make WARN about oversized texture output surface and texture sizes. 2009-01-03 14:55:31 +01:00
Nick Burns 9dea6f7de5 wined3d: Fix glReadPixels call from read_from_framebuffer. 2008-12-26 13:42:17 +01:00
Stefan Dösinger 0dc0444c14 wined3d: Reinstall the G16R16F format surface load fixup.
We cannot remove this because we still have to load the surface as
RGB. The shader may take care of setting the blue channel to 1.0 now,
but we still get the red and green channels loaded incorrectly if we
don't insert a blue channel before loading.
2008-12-16 14:32:11 +01:00
Stefan Dösinger 199a3468bf wined3d: Fake GL_ARB_multitexture. 2008-12-16 14:31:25 +01:00
Henri Verbeet 74acbf9c16 wined3d: Get rid of vcheckGLcall.
Everywhere it's used a regular checkGLcall will do just as well.
2008-12-04 12:00:29 +01:00
Stefan Dösinger e04556bb16 wined3d: Fix D3DFMT_R32F, R16F, G16R16F, ... in the pixel shader.
This allows us to drop the load time conversion and the clear
readback hack and replaces it with a color fixup in the fixed
function pipeline replacement.
2008-12-04 12:00:15 +01:00
Henri Verbeet 89139b7589 wined3d: Make shader texture format fixups more generic.
Based on a patch by Stefan Dösinger. This is more flexible, and allows
the shader backend implementation to be simpler, since it doesn't have
to know about specific formats. The next patch makes use of this.
2008-12-04 11:59:58 +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
Henri Verbeet 2acf8d7947 wined3d: Rename resource functions to reflect that they're not COM functions. 2008-12-03 09:47:26 +01:00
Alexandre Julliard 9c306e9871 wined3d: Make some functions and variables static. 2008-12-02 15:31:17 +01:00
Andrew Talbot 33e0d1610a wined3d: Sign-compare warnings fix. 2008-12-02 14:12:39 +01:00
Henri Verbeet c7880e8916 wined3d: Make minMipLookup_noFilter and magLookup_noFilter const.
Note that minMipLookup and magLookup aren't particularly safe to use,
they're global arrays initialized from IWineD3DImpl_FillGLCaps(). The same
goes for the other global dynamic lookup tables.
2008-11-28 12:53:57 +01:00
Henri Verbeet 4cea13dec7 wined3d: Const correctness fixes for surface.c. 2008-11-26 12:05:27 +01:00
Henri Verbeet f552c90c30 wined3d: Make some functions static. 2008-11-25 13:37:55 +01:00
Henri Verbeet f0a816e8cb wined3d: Slightly reduce the scope of fragment_palette_conversion. 2008-11-25 13:37:50 +01:00
Henri Verbeet 49b55f677e wined3d: Don't call IWineD3DSurfaceImpl_GetData() from surface_gdi.c. 2008-11-25 13:37:45 +01:00
Henri Verbeet b4f0b5bdd0 wined3d: Const correctness fixes. 2008-11-25 13:37:39 +01:00
Francois Gouget c0e271c4de wined3d: Remove WINAPI on static functions where not needed. 2008-11-25 11:49:57 +01:00
Christian Costa 632d34651f wined3d: Implement CONVERT_CK_RGB24 in d3dfmt_convert_surface. 2008-11-24 14:18:41 +01:00
Henri Verbeet 29f2fefc2b wined3d: Fix the cube map coordinates in surface_blt_to_drawable().
I don't see how this can ever have worked properly.
2008-11-19 14:22:29 +01:00
Stefan Dösinger 620a423b22 wined3d: Kill the GL_ATI_envmap_bumpmap code.
GL_ATI_envmap_bumpmap provides two things: Signed V8U8 pixel formats,
and bump mapping. The extension is only supported on fglrx, and this
driver also supports GL_ARB_fragment_program.  Thus the bump mapping
code is never used on any driver out there.  Furthermore, if it is
used, it tends to crash the driver

The signed pixel format is used, as it can be used by pixel shaders or
the ARBfp replacement. However, the format is broken in fglrx, and
negative values are clamped to 0.0. This results in test
failures. WineD3D has an alternative codepath using scale+bias to
enable V8U8 using a standard signed RGB which works correctly on
fglrx.
2008-11-04 11:41:14 +01:00
Henri Verbeet d262752aea wined3d: Handle lack of NPOT support for depth blts. 2008-10-29 11:52:06 +01:00
Henri Verbeet 80818bfc8d wined3d: Support some more depth blt texture types in surface_depth_blt(). 2008-10-29 11:52:01 +01:00
Henri Verbeet 437b342424 wined3d: Pass explicit texcoords to depth blt. 2008-10-28 12:33:27 +01:00
Henri Verbeet 57401fcab2 wined3d: Pass the texture type to the shader depth blt function. 2008-10-28 12:33:18 +01:00
Henri Verbeet 4034a29f19 wined3d: Move depth_blt to surface.c. 2008-10-28 12:33:13 +01:00
Roderick Colenbrander b98a7b5082 wined3d: Fix recursive ENTER_GL in LoadLocation. 2008-10-20 11:38:19 +02:00
Roderick Colenbrander e5ed8edb89 wined3d: Fix a recursive ENTER_GL in read_from_framebuffer. 2008-10-20 11:38:11 +02:00
Roderick Colenbrander 5163a360e0 wined3d: arbfp_blit_unset should call ENTER_GL/LEAVE_GL instead of the caller. 2008-10-20 11:37:46 +02:00
Roderick Colenbrander 8a002b09c1 wined3d: arbfp_set_shader_blit should handle ENTER_GL/LEAVE_GL instead of the caller. 2008-10-20 11:37:38 +02:00
Alexandre Julliard 6cfef95ce7 wined3d: Convert source files to utf-8. 2008-10-18 19:21:20 +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 f5fbfe47d7 wined3d: Handle offscreen rendering a bit nicer in surface_blt_to_drawable(). 2008-10-16 12:35:09 +02:00
Henri Verbeet e22bda24c6 wined3d: Simplify texture target handling in surface_blt_to_drawable(). 2008-10-15 15:22:11 +02:00
Henri Verbeet c777f962a2 wined3d: We only need to enable texturing for a target if we're going to draw with it (without a shader).
Also, these enables cause problems if they're done while the context
is setup for blitting.
2008-10-15 15:22:06 +02:00
Henri Verbeet a98b19cef5 wined3d: Pass the correct RECT to LoadLocation() in LockRect(). 2008-10-10 12:27:21 +02:00
Henri Verbeet eaf2474003 wined3d: Split SetGlTextureDesc() up.
This creates a function for setting the texture name and one for
setting the texture target. The idea is that the texture target should
get set right after the surface is created, and won't change, while
generating a texture name can wait.
2008-09-25 11:52:42 +02:00
Henri Verbeet 254349fb4d wined3d: Remove the "Wine 1.0 safety path". 2008-09-24 12:53:29 +02:00
Roderick Colenbrander c13b3f6179 wined3d: Re-add a comment which got lost. 2008-09-22 12:20:42 +02:00
Stefan Dösinger 2e6717ab79 wined3d: Initialize standalone surface parameters. 2008-09-22 12:20:13 +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 a269236649 wined3d: Move FBO handling functions to context.c. 2008-09-19 11:29:13 +02:00
Henri Verbeet 99981f2604 wined3d: Remove some assumptions that PreLoad() will always bind the texture. 2008-09-17 20:49:38 +02:00
Henri Verbeet 53a7951230 wined3d: Clarify a comment. 2008-09-17 20:49:33 +02:00
Henri Verbeet 147ec1a1a4 wined3d: Use the internal format for renderbuffer storage.
Note that using GL_DEPTH_COMPONENT instead of eg. GL_DEPTH_COMPONENT24
will work, but will create a renderbuffer with the format of the
onscreen depth buffer.
2008-09-16 22:34:03 +02:00
Henri Verbeet 047e42da08 wined3d: Improve a TRACE. 2008-09-16 22:33:46 +02:00
Henri Verbeet 81effcf30d wined3d: Set the viewport to the texture size in depth_blt(). 2008-09-05 10:50:55 +02:00
Alexander Dorofeyev 78312704d9 wined3d: Remove obsolete code & ModifyLocation TODO.
This fbo logic appears to have already been implemented in ModifyLocation.
2008-09-04 12:29:57 +02:00
Alexander Dorofeyev 1bcd6e4508 wined3d: Get rid of gl buffer variable in BltOverride.
Uses This == dstSwapchain->frontBuffer instead as suggested by Henri Verbeet.
2008-09-04 12:29:50 +02:00
Alexander Dorofeyev 7c38816819 wined3d: Remove glDrawBuffer calls in BltOverride.
Handled in ActivateContext, must be remains of pre-context management code.
2008-09-04 12:29:42 +02:00
Alexander Dorofeyev 5c7f2906ee wined3d: Make the condition to enter p8 conversion shader path more strict.
This prevents shader path from being entered for an offscreen surface
when there is p8 render target and fixes failures in ddraw visual test
(with opengl rendering and RTL_READDRAW mode) and visual glitches in
Red Alert.
2008-09-04 12:29:35 +02:00
Alexander Dorofeyev e13d0efb01 wined3d: Remove glFlush in RealizePalette.
glFlush was added to surface_blt_to_drawable some time ago, which is a
more general fix and makes this one superfluous.
2008-09-03 13:14:52 +02:00
Stefan Dösinger 3b48660f43 wined3d: Implement YV12 support for emulated overlays.
This is the prefered format of many codecs, and for some codecs this
is the only supported output format. As usual I try to handle all the
conversion in the GPU and keep the CPU involvement minimal to gain the
full performance of PBO transfers.
2008-09-02 14:55:50 +02:00
Stefan Dösinger 6c87a66355 wined3d: Get a GL context before creating a PBO. 2008-08-25 12:24:43 +02:00
Stefan Dösinger ba58adaaf6 wined3d: Remove a few texture initializations.
This is done by LoadLocation now.
2008-08-25 12:24:33 +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
Stefan Dösinger bab367e1a0 wined3d: Update the overlay when the destination was drawn to. 2008-08-21 13:27:47 +02:00
Stefan Dösinger bfe7067973 wined3d: Ask the ffp/shader/blit implementation about format support.
If a format is not supported natively by opengl, a shader may be able
to convert it. Up to now, CheckDeviceFormat had magic knowldge which
GL extensions lead to which supported format. This patch adds
functions that allow CheckDeviceFormat to ask the actual
implementation for its capabilities.
2008-08-20 12:26:02 +02:00
Stefan Dösinger fc6b977486 wined3d: Start a framework for color conversion shaders in blits. 2008-08-20 12:25:26 +02:00
Roderick Colenbrander 4421e3ebe5 wined3d: Fix BltOverride regression. 2008-08-20 11:45:41 +02:00
H. Verbeet f71fdecdc7 wined3d: Move creating a texture id from PreLoad to BindTexture.
This is consistent with BindTexture in basetexture/texture/etc. and has the
added benefit that it makes LoadLocation work properly.
2008-08-20 10:26:19 +02:00
Stefan Dösinger 25c07dc86c wined3d: Remove the ddraw_window device member. 2008-08-19 12:25:05 +02:00
Stefan Dösinger e178ddd9e1 wined3d: Use a swapchain for GDI surfaces.
This is a long-needed cleanup aimed at removing the ddraw_primary,
ddraw_window, ddraw_width and ddraw_height members from
IWineD3DDeviceImpl, which just do not belong there.  Destination
window and screen handling is supposed to be done by swapchains.
2008-08-19 12:21:32 +02:00
Stefan Dösinger dff3a42233 wined3d: Track overlay surfaces in the overlayed surface. 2008-08-05 14:09:37 +02:00
Stefan Dösinger 851dd7339e wined3d: Implement overlay flipping. 2008-08-05 14:09:36 +02:00
Stefan Dösinger fad3f9ba98 wined3d: Basic overlay emulation with opengl. 2008-08-05 14:09:36 +02:00
Stefan Dösinger eb0264e2b3 wined3d: Remove a glFlush. 2008-08-05 14:09:36 +02:00
Stefan Dösinger 44d419ad8e wined3d: Call glFlush outside the GL lock. 2008-08-05 14:09:36 +02:00
Stefan Dösinger 474e7ed98c wined3d: Beware of the frontbuffer coordinate system difference. 2008-08-04 13:09:43 +02:00
Stefan Dösinger dc25a86cc5 wined3d: Support ATI's D3DFMT_ATI2N format.
This is an ATI specific format designed for compressed normal maps,
and quite a few games check for its existence. While it is an
ATI-specific "extension" in d3d9, it is a core part of
D3D10(DXGI_FORMAT_BC5), and supported on Geforce 8 cards.
2008-07-24 11:56:24 +02:00
Stefan Dösinger c088edeae7 wined3d: Use GL_ARB_texture_non_power_of_two emulation.
ATI cards prior to the radeon HD series did not have unconditional non
power of two support. So far we've used texture_rectangle for that, or
created a bigger power of two texture with padding. This had the
disadvantage that we had to correct the coordinates, which causes
extreme problems with shaders(doesn't work, pretty much).

Both the MacOS and the fglrx driver have support for
GL_ARB_texture_non_power_of_two, and run it on the hardware as long as
we stay within the texture_rectangle limitations. This allows us to
have conditional non power of two textures with normalized
coordinates. This patch adds an internal extension, and the code
creates a regular GL_TEXTURE_2D texture with NP2 size, but refuses
mipmapping, filtering and texture_rectangle incompatible
operations. This makes np2 textures work with shaders on fglrx and
macos.
2008-07-18 11:41:09 +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
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 1c7f39ed1e wined3d: Use CTXUSAGE_RESOURCELOAD for fb->texture reads.
There is no need for _BLIT usage. RESOURCELOAD should be faster.
2008-07-02 12:24:54 +02:00
H. Verbeet d5cbb8375e wined3d: Use ModifyLocation() to force a reload on color key change.
Just unsetting SFLAG_INTEXTURE doesn't work for FBOs because the
drawable and texture are the same there (and ModifyLocation() is the
correct way to do this anyway). Fixes another ddraw test failure with
FBO ORM.
2008-07-01 12:25:54 +02:00
H. Verbeet 8d6dc9daa7 wined3d: Move setting a palette up a couple of lines in BltOverride().
This prevents a few failures in the ddraw tests when using FBOs due to
using P8 surfaces without a palette set.
2008-06-30 12:47:34 +02:00
H. Verbeet 469e791f00 wined3d: Invert "upsidedown" in fb_copy_to_texture_direct() and fb_copy_to_texture_hwstretch() rather than BltOverride().
This inversion is specific to the blit implementation being used,
stretch_rect_fbo() doesn't need it.
2008-06-30 12:47:25 +02:00
Stefan Dösinger 6ab3d17104 wined3d: Remove a broken AddDirtyRect call. 2008-06-13 10:15:02 +02:00
H. Verbeet 35bdc00479 wined3d: Set the surface location to SFLAG_INSYSMEM for depth stencils on Reset. 2008-06-03 11:11:44 +02:00
Andrew Talbot c58e59f40f wined3d: Remove unneeded "extern" from function definition. 2008-05-22 11:29:05 +02:00
Alexander Dorofeyev a25651138a wined3d: Activate context for the right target in surface_blt_to_drawable. 2008-05-12 13:27:44 +02:00
Alexander Dorofeyev e1c60caa42 wined3d: glFlush when updating front buffer.
Fixes screen not updating or getting updated inconsistently when apps blit to 
front buffer or lock it when RenderTargetLockMode=readtex, as happens in e.g. 
Red Alert 2 and also in p8_primary_test in ddraw tests.
2008-05-12 13:27:40 +02:00
Alexander Dorofeyev b8a5742358 wined3d: Set alpha to index even when there is no palette.
Fixes a failure in p8_primary_test when running with opengl ddraw renderer.
2008-05-09 11:20:01 +02:00
Alexander Dorofeyev 6d86e7f861 wined3d: Use source colorkey when passed KEYSRC or KEYSRCOVERRIDE.
Fixes failure in p8_primary_test when using opengl ddraw renderer.
2008-05-09 11:19:39 +02:00