Commit Graph

919 Commits

Author SHA1 Message Date
Henri Verbeet 0ee57cf142 wined3d: Set the texture name at surface creation.
This prevents the target from changing during the first PreLoad() call
on a surface, which would be inconvenient when attaching a surface to
a FBO for example.
2008-09-25 11:52:50 +02:00
Henri Verbeet 9d192c6251 wined3d: Skip copying the depth stencil if it's discarded.
This gives a small performance improvement for applications that are
smart enough to set the D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL flag, or
to create depth stencils with Discard set to TRUE.
2008-09-23 12:25:18 +02:00
Henri Verbeet d95ae08ad4 wined3d: Get rid of the wantsDepthStencilBuffer in IWineD3DSwapChainImpl. 2008-09-23 12:25:04 +02:00
Roderick Colenbrander 0362ee3d16 wined3d: UpdateSurface should take into account the offset from the source rectangle. 2008-09-22 13:19:57 +02:00
Henri Verbeet 3862347bce wined3d: Fix a memory leak. 2008-09-22 12:20:28 +02:00
Henri Verbeet 76de76e508 wined3d: Destroy FBO entries in the context. 2008-09-22 12:20:24 +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 d51ea01159 wined3d: Reset the auto depth stencil. 2008-09-10 12:05:31 +02:00
Francois Gouget e1797b530d wined3d: Remove spaces before '\n' in Wine traces. 2008-09-05 13:39:08 +02:00
Stefan Dösinger da1030f36c wined3d: Compressed surface sizes are multiples of 4.
Since those surfaces are stored in blocks, the 4 pixel step doesn't only apply to surfaces < 4, but
also to surfaces bigger than that, with a non-multiple-of-4 size.
2008-09-04 12:44:00 +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
Henri Verbeet 615f75faec wined3d: IWineD3DSurface_PreLoad() doesn't do an implicit glBindTexture() anymore.
This was exposed by moving texture id generation from Preload() to BindTexture().
2008-09-04 11:15:33 +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
Alexander Dorofeyev 379f400990 wined3d: Add glFlush when clearing the front buffer in ClearSurface. 2008-09-03 13:14:52 +02:00
Stefan Dösinger 8b1727ae62 wined3d: Report incorrect filtering settings in ValidateDevice. 2008-09-02 14:56:06 +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 a580325a47 wined3d: Remove some more junk code. 2008-08-28 11:24:49 +02:00
Stefan Dösinger 462ddaa254 wined3d: Make the texture stage mapping nvrc independent. 2008-08-27 13:21:24 +02:00
Stefan Dösinger a674ae71ae wined3d: Remove dead code. 2008-08-27 13:21:24 +02:00
Stefan Dösinger 9a6bc683e1 wined3d: Use the correct texture limit.
We have to use the texture limit of the fragment pipeline in use here,
not the fixed function GL texture limit.
2008-08-26 12:07:41 +02:00
Stefan Dösinger e8b9f167d6 wined3d: Fix the texcoord size mask.
There is room for 8 texture coordinates, not just 4.
2008-08-26 12:07:41 +02:00
David Adam bb67a925d6 ddraw: Only ddraw checks wether one can give a null pointer to SetMaterial. 2008-08-22 11:32:09 +02:00
Roderick Colenbrander fd0e60180a wined3d: Fix window rewrite regression. 2008-08-22 10:39:23 +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
H. Verbeet 040c33de5a wined3d: Don't allocate This->draw_buffers in the error path for Init3D(). 2008-08-21 11:36:29 +02:00
H. Verbeet c33e03cca3 wined3d: Don't free backends if they're not created yet.
This would crash if CreateAdditionalSwapChain() failed.
2008-08-21 11:36:18 +02:00
Stefan Dösinger fc6b977486 wined3d: Start a framework for color conversion shaders in blits. 2008-08-20 12:25:26 +02:00
Stefan Dösinger 25c07dc86c wined3d: Remove the ddraw_window device member. 2008-08-19 12:25:05 +02:00
Stefan Dösinger 376944ebe4 wined3d: Remove the device-global fullscreen flag. 2008-08-19 12:24:57 +02:00
Stefan Dösinger 34b37fe241 d3d: Remove IWineD3DDevice::SetHwnd. 2008-08-19 12:22:05 +02:00
Stefan Dösinger 7f2b8f9bba wined3d: Support redirecting the primary context. 2008-08-19 12:21:49 +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 44d419ad8e wined3d: Call glFlush outside the GL lock. 2008-08-05 14:09:36 +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 9a9414dfe2 wined3d: Mark STATE_SCISSORRECT dirty in color_fill_fbo().
As pointed out by Alexander Dorofeyev.
2008-08-05 14:09:34 +02:00
H. Verbeet d28a310f92 wined3d: Use CTXUSAGE_RESOURCELOAD for ActivateContext() in color_fill_fbo().
CTXUSAGE_CLEAR will apply the FBO state in a later patch.
2008-08-04 13:52:16 +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 14b24058d6 wined3d: GL_ARB_fragment_program ffp implementation. 2008-07-31 13:02:04 +02:00
Alexander Dorofeyev 76e02581a9 wined3d: Add ActivateContext in color_fill_fbo.
Also removes dirtifying of SCISSORTESTENABLE state that is made
redundant by ActivateContext(...,CTXUSAGE_CLEAR).
2008-07-30 13:54:40 +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 d66c05ce1d wined3d: Fix a copy and paste bug.
This happened to work because most cards have the same amount of
pshader and vshader constants, but for some reason this doesn't hold
true on this macbook pro here, which lead to a crash due to heap
corruption
2008-07-22 13:00:58 +02:00
Stefan Dösinger cafec08516 wined3d: Use the nofilter mipmap lookup for np2 textures.
This is cleaner than the if statements in the code. Also np2 textures
should in theory support linear filtering, but fglrx doesn't seem to
like it. This needs further investigation. So far we've never used
linear filtering on np2 textures, so there should not be a
regression. Furthermore I think shader support is more important than
filtering, since NP2 textures are mostly used for 1:1 copying to the
screen.
2008-07-18 11:41:21 +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
Stefan Dösinger e7733eacb7 wined3d: Remove the atifs shader backend.
Since atifs is only doing the fragment pipeline replacement right now
there is no need for the shader backend structure any longer. The ffp
private data is stored in new fragment pipeline private data(which
could potentially be set to equal the shader private data if needed).
2008-07-14 11:43:09 +02:00
H. Verbeet 6129e92e99 wined3d: Destroy the shader backend after the stateblock.
Destroying the stateblock potentially references the shader backend.
If the stateblock has active shaders when it is released, the shader's
destructor will tell the shader backend to destroy the corresponding
resources. This was exposed by my patch that moved the glsl program
lookup table into the backend's private data.
2008-07-11 13:58:13 +02:00
H. Verbeet 54ae3ebfd4 wined3d: Destroy depth_blt resources in the backend's destructor.
No need to expose this in the interface.
2008-07-10 12:17:06 +02:00
H. Verbeet a85a5ffb1b wined3d: Store the glsl program lookup table in the backend's private data. 2008-07-09 10:42:57 +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
Stefan Dösinger 9be8f36c2e wined3d: Correct an off-by-one error in constant dirtification.
Constant numbers start at 0, and the loading loop has a for(i; i <
dirtyconsts; i++). This means that the highest dirty constant isn't
loaded correctly. Rather than replacing the < with <=, which would
make it impossible to have no dirty constant, add 1 to the dirty
constant counter.
2008-07-07 12:33: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
H. Verbeet e7d0ef72ba wined3d: Use dst_fbo to do the depth blit.
This makes the depth copy independent of the currently attached render
targets. This is important for the next patch because it might do a
depth copy when the render targets aren't in a valid configuration
(SetDepthStencilSurface()).
2008-07-03 11:50:51 +02:00
H. Verbeet 22421b8476 wined3d: Make sure the FBO doesn't have any depth attachments in color_fill_fbo() and stretch_rect_fbo().
Currently this is already true, but the next patch will break that assumption.
2008-07-03 11:50:51 +02:00
Stefan Dösinger 8d930f6009 wined3d: Restore the gamma when destroying the swapchain. 2008-07-02 12:27:05 +02:00
Stefan Dösinger 2d4d18b59d wined3d: Delay render target activation.
The ActivateContext in SetRenderTarget was an old regression prevention,
but now it is time to remove it.
2008-07-02 12:25:12 +02:00
Stefan Dösinger c4eae160d7 wined3d: RENDERTARGET | AUTOGENMIPMAP are compatible.
The test used D3DPOOL_MANAGED which is mutually exclusive with
RENDERTARGET usage, thus the call failed.
2008-07-02 12:24:12 +02:00
H. Verbeet d5a8875b93 wined3d: Extract an attach_depth_stencil_fbo() function.
The idea is to make setting depth attachments a bit more consistent
with set_render_target_fbo()/attach_surface_fbo(). I've also got an
upcoming patch in my tree that needs this.
2008-07-02 11:37:31 +02:00
H. Verbeet a1a14fb2c3 wined3d: Get rid of a redundant local variable. 2008-07-02 11:37:25 +02:00
H. Verbeet 90b7efe2c4 wined3d: Delete depth_blt_texture on IWineD3DDeviceImpl_Uninit3D(). 2008-06-27 11:10:11 +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
Francois Gouget 42a61d7ed7 Assorted spelling fixes. 2008-05-06 16:10:20 +02:00
Andrew Talbot 0de14c37e5 wined3d: Remove unused variables. 2008-04-30 10:25:47 +02:00
Stefan Dösinger 1c9f1f8ddd wined3d: Support framebuffer reading from texture_rectangle sources. 2008-04-24 11:43:18 +02:00
Austin English 6e59cd2c34 Spelling fixes. 2008-04-22 12:20:12 +02:00
David Adam 7df193676e wined3d: Fix a possible null dereference. 2008-04-21 16:54:00 +02:00
Chris Robinson fd823fc2d2 wined3d: Check for NULL vertex declarations. 2008-04-09 12:17:35 +02:00
Stefan Dösinger 481bcdfe2a wined3d: Disable MAG filters on formats that do not support them. 2008-04-09 11:53:35 +02:00
Stefan Dösinger 0cbd08b2b9 wined3d: Disable texture filtering on textures that do not support it.
OpenGL always offers filtering on all formats, and if the hardware
doesn't support it the driver falls back to software. Direct3D on the
other hand silently disables filtering, so that's what we should do too.
2008-04-09 11:48:13 +02:00
Stefan Dösinger 4bb54a1ab7 wined3d: Make the min mip lookup type a texture property. 2008-04-09 11:47:58 +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 df2b1bea63 wined3d: Mark the SYSMEM copy outdated after releasing memory.
Strictly speaking this is redundant because the UnLoad before did the
job, but if we mess with the allocated memory we have to tell the
surface about that. Updating INDRAWABLE will automatically mark SYSMEM
outdated.
2008-04-08 11:59:46 +02:00
Rico Schüller 73d98ccd4e wined3d: Filter out invalid stuff in SetStreamSourceFreq(). 2008-04-07 21:19:57 +02:00
Alexander Dorofeyev 71ca80355d wined3d: move ENTER_GL in IWineD3DDeviceImpl_Init3D. 2008-04-07 21:18:28 +02:00
Alexander Dorofeyev 2157c7d76c wined3d: Add ENTER_GL/LEAVE_GL in IWineD3DDeviceImpl_ResourceReleased. 2008-04-07 21:17:37 +02:00
Alexander Dorofeyev a2017f4f21 wined3d: Add ENTER_GL/LEAVE_GL in IWineD3DDeviceImpl_ColorFill. 2008-04-07 21:17:31 +02:00
Alexander Dorofeyev 7c261553d0 wined3d: Add ENTER_GL/LEAVE_GL in IWineD3DDeviceImpl_Uninit3D. 2008-04-07 21:17:26 +02:00
Francois Gouget 8a18e0e43a Assorted spelling fixes. 2008-04-07 13:36:18 +02:00
Alexander Dorofeyev d6ba069d9e wined3d: Improve detection of device palette change. 2008-04-03 11:31:57 +02:00
Stefan Dösinger b1d8af7926 wined3d: Update copyright lines. 2008-04-02 20:22:42 +02:00
Stefan Dösinger ab86a4e963 wined3d: Catch D3DUSAGE_AUTOGENMIPMAP and D3DUSAGE_RENDERTARGET combos. 2008-04-01 20:31:59 +02:00
Stefan Dösinger a29a229324 wined3d: Refuse 3D initialization without opengl. 2008-04-01 20:31:44 +02:00
Stefan Dösinger f761b90801 wined3d: Free heapMemory, not allocatedMemory when adjusting the surface. 2008-03-27 11:19:05 +01:00
Alexander Dorofeyev 165970992a wined3d: Make device palettes dynamically allocated. 2008-03-27 11:09:06 +01:00
Stefan Dösinger 28fdebe404 wined3d: Alloc / free shader private data and blt stuff in Init3D/Uninit3D. 2008-03-25 19:48:24 +01:00
Stefan Dösinger ac57b4e2f5 wined3d: Free shader private data on reset.
Since the shader backend implementations might track opengl resources in
their private data inform them about reset calls. For example, the atifs
backend keeps track of the replacement shaders, which are lost during an
opengl context recreation.
2008-03-25 19:48:14 +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
Andrew Talbot 19c105c79c wined3d: Assign to structs instead of using memcpy. 2008-03-21 11:24:05 +01:00
Stefan Dösinger c5117dab68 wined3d: Set the fullscreen flag before the display Mode. 2008-03-11 12:11:52 +01:00
Stefan Dösinger c81b114269 wined3d: Only restore the style and exStyle when it is untouched. 2008-03-11 12:11:52 +01:00
Stefan Dösinger a9fb81b2ed wined3d: Only adjust windows in fullscreen mode to the screen. 2008-03-11 12:11:52 +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
Stefan Dösinger 32be503c62 wined3d: Give occlusion queries their own vtable. 2008-03-03 11:58:10 +01:00
Stefan Dösinger 071d4afb2b wined3d: Subclass queries. 2008-03-03 11:57:59 +01:00
James Hawkins c2a627c6e8 janitorial: Remove links to any microsoft site. 2008-03-01 12:17:07 +01:00
Stefan Dösinger 220d9eb44c wined3d: Move the dummy texture creation to the device. 2008-02-26 11:31:47 +01:00
Stefan Dösinger f912f18b13 wined3d: Move shader model private data into its own structure. 2008-02-26 11:31:39 +01:00