Commit Graph

893 Commits

Author SHA1 Message Date
Stefan Dösinger 8dcd51286d WineD3D: Put vertex shader duplication infrastructure in place. 2009-02-11 12:21:25 +01:00
Stefan Dösinger 50109aa969 wined3d: Get rid of last_was_foggy_shader & friends.
The fog settings do not depend on wether the shader writes to oFog or not,
instead they depend on the FOGVERTEXMODE and FOGTABLEMODE settings, and if a
vertex shader is bound at all.

It works the same way as with the fixed function, and having a vertex shader
is the same as using pretransformed vertices, just that the fog coord comes
from the shader instead of the specular color:

FOGTABLEMODE != NONE: The Z coord is used, oFog is ignored
FOGTABLEMODE == NONE, with VS: oFog is used
FOGTABLEMODE == NONE, no VS, XYZ: Z is used
FOGTABLEMODE == NONE, no VS, XYZRHW: diffuse color is used
2009-01-20 12:45:40 +01:00
Stefan Dösinger 3c3272dc41 wined3d: Don't single-allocate new gl shaders. 2009-01-20 12:45:09 +01:00
Henri Verbeet a966293f59 wined3d: Add an IWineD3DDeviceParent interface.
Other than being a bit nicer than passing function pointers all over the
place, this helps dxgi/d3d10. While the swapchain itself is created in dxgi,
its surfaces are constructed in d3d10core, which makes it impractical for dxgi
to pass the appropriate function pointers.
2009-01-16 13:29:32 +01:00
Henri Verbeet 9440dfedf4 wined3d: Remove AddDirtyRect() from the public interface. 2009-01-14 13:51:00 +01:00
Henri Verbeet fd90021666 wined3d: Remove AddDirtyBox() from the public interface.
This is an internal wined3d function.
2009-01-14 13:51:00 +01:00
Henri Verbeet e4cfbdd4f7 wined3d: Get rid of D3DCREATERESOURCEOBJECTINSTANCE. 2009-01-13 15:20:28 +01:00
Henri Verbeet 894edc49cc wined3d: Get rid of D3DCREATESHADEROBJECTINSTANCE. 2009-01-12 13:22:02 +01:00
Henri Verbeet 87627c811e wined3d: Get rid of D3DINITIALIZEBASETEXTURE. 2009-01-12 13:21:56 +01:00
Stefan Dösinger 1deafcb5a7 wined3d: Split the remains of state_fog. 2009-01-12 13:02:49 +01:00
Stefan Dösinger 2dd18635c9 wined3d: Move fogdensity and fogcolor to the fragment pipeline. 2009-01-12 13:02:29 +01:00
Allan Tong 29dd286d79 wined3d: Add code to cleanup device multistate_funcs. 2009-01-10 17:43:11 +01:00
Henri Verbeet b1812c690c wined3d: Add support for EXT_vertex_array_bgra.
This allows us to skip BGRA->RGBA color conversion for vertex attributes if
this extension is present.
2009-01-08 13:21:51 +01:00
Henri Verbeet 6791e6b752 wined3d: Simplify handling of swizzled attributes.
This should also be a little bit faster.
2009-01-08 13:21:43 +01:00
Henri Verbeet cc447eac55 wined3d: Move position_transformed out of u.s in struct WineDirect3DVertexStridedData. 2009-01-08 13:21:31 +01:00
Henri Verbeet 5f8c62e45d wined3d: Remove a redundant parameter to drawPrimitive().
startIdx should be the first index to draw, either from the vertex
array or the index array, depending on if the draw is indexed or
not. Having both at the same time wouldn't make sense.
2009-01-07 12:22:12 +01:00
Henri Verbeet bddf5e76ea wined3d: Convert textureState to a bitmap in struct SAVEDSTATES. 2009-01-06 12:45:52 +01:00
Henri Verbeet a8697d90e4 wined3d: Renumber WINED3DTEXTURESTAGESTATETYPE enum elements.
Saves some space by not having unused entries is the arrays tracking these
states.
2009-01-06 12:45:43 +01:00
Henri Verbeet fd33f0f97f wined3d: Convert samplerState to a bitmap in struct SAVEDSTATES. 2009-01-05 12:41:17 +01:00
Henri Verbeet c33b38117e wined3d: Convert renderState to a bitmap in struct SAVEDSTATES. 2009-01-05 12:41:08 +01:00
Henri Verbeet fc39831e4c wined3d: Convert transform to a bitmap in struct SAVEDSTATES. 2009-01-05 12:40:57 +01:00
Henri Verbeet 9a889f6b0b wined3d: Convert textures to a bitmap in struct SAVEDSTATES. 2009-01-03 14:55:31 +01:00
Henri Verbeet 3b5c75d991 wined3d: Convert clipplane to a bitmap in struct SAVEDSTATES. 2009-01-02 11:53:04 +01:00
Henri Verbeet 52a900d4e8 wined3d: Convert streamSource and streamFreq to bitmaps in struct SAVEDSTATES. 2009-01-02 11:52:34 +01:00
Henri Verbeet 457037f4de wined3d: Fix the value of HIGHEST_TRANSFORMSTATE.
The highest transform state should be 511.
2009-01-02 11:52:02 +01:00
Henri Verbeet 3920d42f71 wined3d: Convert some BOOLs to bitfields in struct SAVEDSTATES. 2008-12-31 12:26:57 +01:00
Henri Verbeet 29a0d06518 wined3d: Convert some BOOLs to bitfields in struct IWineD3DDeviceImpl.
Also fills a 3 byte hole.
2008-12-31 12:26:33 +01:00
Henri Verbeet 3f12f59aa4 wined3d: Convert some BOOLs to bitfields in struct WineD3DContext.
Also happens to fill two 3 byte holes.
2008-12-31 12:26:23 +01:00
Henri Verbeet 813c7ed202 wined3d: Remove an unused field from the device. 2008-12-31 12:26:02 +01:00
Henri Verbeet 2b926db50d wined3d: Make use_vs() and use_ps() work on a stateblock instead of a device.
Most callers work on a stateblock rather than a device, and the main fields
we check (vertexShader and pixelShader) are part of the stateblock as well.
2008-12-31 12:25:56 +01:00
Henri Verbeet 6f5af4047f wined3d: Get rid of the glname field in struct SHADER_OPCODE.
It's only used for shader_hw_map2gl() and vshader_hw_rsq_rcp(), and we
can handle those the same way we handle the GLSL equivalents.
2008-12-30 11:36:35 +01:00
Maarten Lankhorst 4eca43e702 winex11.drv/wined3d: Fix tsx11 calling convention. 2008-12-23 12:51:44 +01:00
Henri Verbeet 4a19d893e5 wined3d: Only apply shader constants that changed.
This improves performance a bit for applications that use a lot of
shaders with a lot of constants.
2008-12-20 11:11:45 +01:00
Stefan Dösinger 690cbe76ac wined3d: Make pixelshaders disable fog properly.
This is a first step towards cleaning up the fog mess. The fog
parameter is added to the pixelshader compile args structure. That way
multiple pshaders are compiled for different fog settings, and the
pixel shader can remove the fog line if fog is not enabled. That way
we don't need special fog start and end settings, and this allows us
to implement EXP and EXP2 fog in the future too.
2008-12-19 17:17:16 +01:00
Stefan Dösinger 61e581abb4 wined3d: Pass the ps_compile_args structures to the shader generation code. 2008-12-19 17:16:39 +01:00
Henri Verbeet d099dde7a9 wined3d: Track shader constants in the shader backend. 2008-12-18 13:17:02 +01:00
Henri Verbeet 73823ef5f6 wined3d: Remove the shader_cleanup() method from the shader backend. 2008-12-17 14:02:24 +01:00
Henri Verbeet 4adb342327 wined3d: Remove GetFVF() and SetFVF() from IWineD3DDevice. 2008-12-17 14:02:03 +01:00
Stefan Dösinger 31da3c0578 wined3d: Emulate GL_EXT_fog_coord. 2008-12-16 14:34:11 +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 f3743fb402 wined3d: Shaders will never have a NULL function. 2008-12-16 12:52:04 +01:00
Henri Verbeet 8553665cb1 wined3d: Move the shader version to reg_maps. 2008-12-15 14:00:26 +01:00
Henri Verbeet 7d29aecd6f wined3d: Use a simpler way to calculate the number of texture levels.
It's probably slightly faster too.
2008-12-12 11:40:39 +01:00
Henri Verbeet 70ed814b95 wined3d: Get rid of the textureDimensions field in the state block. 2008-12-12 11:40:32 +01:00
Henri Verbeet f36c377d0e wined3d: We only care is a sampler is sampled at all in device_map_vsamplers(), not the specific type. 2008-12-12 11:40:26 +01:00
Henri Verbeet fb475c7c29 wined3d: Don't reparse the entire shader just to update the sampler types. 2008-12-12 11:40:20 +01:00
Stefan Dösinger f2f90b6965 wined3d: Fix ARG_UNUSED and use it properly.
That bug was uncovered by Henri's change of the bitfield sizes.
2008-12-11 14:07:31 +01:00
Stefan Dösinger 4916cd5478 wined3d: Don't load INT and BOOL constants needlessly. 2008-12-11 14:06:04 +01:00
Henri Verbeet 8124f5e14a wined3d: shader_trace_init() shouldn't have side effects.
This moves setting baseShader.hex_version and baseShader.functionLength to
shader_get_registers_used(), where it's more appropriate.
2008-12-11 12:14:50 +01:00
Henri Verbeet 4aa00e8a21 wined3d: Rename texture_stage_op.color_correction to texture_stage_op.color_fixup.
This is consistent with other uses of struct color_fixup_desc.
2008-12-10 10:50:24 +01:00
Henri Verbeet 50a87e23e7 wined3d: Fix the IWineD3DVertexShader and IWineD3DPixelShader IUnknown methods.
IWineD3DVertexShader isn't supposed to implement IWineD3DPixelShader.
2008-12-09 11:27:32 +01:00
Henri Verbeet 4997bee1bf wined3d: Add functions to initialize and free shader buffers. 2008-12-09 11:27:13 +01:00
Henri Verbeet 5ad3bbabda wined3d: Avoid disabling numbered arrays if we're going to enable them afterwards anyway. 2008-12-08 12:28:31 +01:00
Henri Verbeet a13df0e4ef wined3d: Explicitly pass the version and instruction table to shader_get_opcode(). 2008-12-05 11:59:02 +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 9f2fa8ba25 wined3d: Remove sampled_format from IWineD3DBaseShaderClass, it isn't used anywhere. 2008-12-04 11:59:14 +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
Alexandre Julliard 6800d3dbb7 wined3d: Fix some macros definitions to make them proper C statements. 2008-12-03 10:03:45 +01:00
Henri Verbeet 5284fce1ac wined3d: Disable checkGLcall when WINE_NO_DEBUG_MSGS is specified. 2008-12-03 09:49:14 +01:00
Henri Verbeet 70968e69ac wined3d: Use a bitmask to store which bool and int constants are set.
Note that constants_set was never actually NULL for
shader_glsl_load_constantsB() and shader_glsl_load_constantsI().
2008-12-03 09:49:10 +01:00
Henri Verbeet 0ae60765de wined3d: Make functions static where possible. 2008-12-03 09:47:35 +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
Henri Verbeet 4d60b6633c wined3d: Rename basetexture functions to reflect that they're not COM functions. 2008-12-03 09:47:16 +01:00
Henri Verbeet 92b93172df wined3d: Remove some unused code. 2008-12-02 14:04:40 +01:00
Henri Verbeet 5532c990b6 wined3d: Const correctness fixes. 2008-12-02 14:04:15 +01:00
Henri Verbeet 7c0cb8c0c3 wined3d: Const correctness fixes for state.c. 2008-12-02 14:04:08 +01:00
Henri Verbeet 50ebf26894 wined3d: Const correctness fixes for directx.c. 2008-12-01 12:45:10 +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 fecfddfb3a wined3d: Const correctness fixes for glsl_shader.c. 2008-11-26 12:05:21 +01:00
Henri Verbeet d8f6e63541 wined3d: Const correctness fixes for arb_program_shader.c. 2008-11-26 12:05:14 +01:00
Henri Verbeet cfb3bea895 wined3d: Make the SHADER_OPCODE_ARG parameter to shader handlers const. 2008-11-26 12:05:06 +01:00
Henri Verbeet eb78c2a082 wined3d: Const correctness fixes for utils.c. 2008-11-26 12:04:56 +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
Henri Verbeet a6917b143d wined3d: Use IDL to generate wined3d.h. 2008-11-25 13:37:22 +01:00
Stefan Dösinger 0bf32b12f5 wined3d: Add the ability to duplicate GL pixel shaders.
Some stateblock parameters have to be compiled into the GL pixel
shader code, like lines for pixelformat fixups. This leads to problems
when applications switch those settings, requiring a recompilation of
the shader. This patch enables wined3d to have multiple GL shaders for
a D3D shader(pixel shaders only so far) to handle this more
efficiently.
2008-11-25 13:07:03 +01:00
Stefan Dösinger aed9305c78 wined3d: Store shader IDs in the vs and ps impl structures. 2008-11-25 13:06:45 +01:00
Stefan Dösinger dd8905543b wined3d: Pass some stateblock values around directly.
This was suggested by Ivan quite a while ago, and we need it to better
handle conflicting texture format corrections and similar stateblock
value changes which until now required a recompilation of the entire
shader
2008-11-25 13:06:35 +01:00
Stefan Dösinger ff767f4984 wined3d: Make the shader backend call CompileShader.
A number of considerations contribute to this:

1) The shader backend knows best which shader(s) it needs. GLSL needs
both, arb only one
2) The shader backend may pass some parameters to the compilation
code(e.g. which pixel format fixup to use)
3) The structures used in (2) are different in vs and ps, so a
baseshader::Compile won't work
4) The structures in (2) are wined3d-private structures, so
having a public method in the vtable won't work(its a bad idea
anyway).
2008-11-25 13:06:23 +01:00
Roderick Colenbrander 273357264a wined3d: Add registry key for overriding the pci vendor id. 2008-11-24 14:52:32 +01:00
Roderick Colenbrander 52d59718c7 wined3d: Add registry key for overriding pci device id. 2008-11-24 14:52:25 +01:00
Henri Verbeet ba78f072e2 wined3d: Remove some unused code. 2008-11-20 14:25:11 +01:00
Henri Verbeet 8899f3412b wined3d: wined3d_gl.h should be internal to wined3d. 2008-11-20 14:24:56 +01:00
Stefan Dösinger 5c79a9f437 wined3d: Rename the fragment ffp desc structures.
This reflects the fact that they describe the fragment pipeline.
The vertex pipeline will use its own structures.
2008-11-20 12:17:45 +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
Kjell Rune Skaaraas ed96dd72e3 wined3d: Implement IWineD3DResourceImpl_GetPriority and IWineD3DResourceImpl_SetPriority for resource management. 2008-10-08 14:17:03 +02:00
Henri Verbeet 3a7fcec4d7 wined3d: Handle texture coordinates the same way we handle other vertex attributes. 2008-09-25 11:53:10 +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 5ba40c3d58 wined3d: Make some more GLSL functions private to the backend. 2008-09-24 12:53:23 +02:00
Henri Verbeet a0940051eb wined3d: Make some more ARB program functions private to the backend. 2008-09-24 12:53:16 +02:00
Henri Verbeet daef052daa wined3d: atifs_shader_backend doesn't exist anymore. 2008-09-24 12:53:10 +02:00
Henri Verbeet 2e76954097 wined3d: Move part of the shader instruction table to the backend. 2008-09-24 12:53:05 +02:00
Henri Verbeet ca28930113 wined3d: Merge pshader_hw_map2gl() and vshader_hw_map2gl().
This isn't the prettiest way to merge those functions, but it's a start.
2008-09-23 12:25:27 +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
Henri Verbeet f84680e66c wined3d: Don't try to draw with unsupported attribute data types. 2008-09-22 12:20:34 +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 ee49230cd2 Make some ARB program structs and functions private to the backend. 2008-09-16 22:33:42 +02:00
Henri Verbeet c2178eb64f wined3d: Make some GLSL structs and functions private to the backend. 2008-09-16 22:33:35 +02:00
Stefan Dösinger 421b6558c1 wined3d: Pack the ffp_desc structure better. 2008-09-05 11:22:55 +02:00
Henri Verbeet 81effcf30d wined3d: Set the viewport to the texture size in depth_blt(). 2008-09-05 10:50:55 +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
Henri Verbeet b4f43e372e wined3d: Remove useless hash_table_t typedef. 2008-08-29 12:26:55 +02:00
Stefan Dösinger af8d268a39 wined3d: Handle projected textures properly in arbfp and atifs.
GL_ARB_fragment_program and GL_ATI_fragment_shader can disable
projected textures properly, and they can also handle
D3DTTFF_PROJECTED | D3DTTFF_COUNT3 properly.
2008-08-28 11:24:49 +02:00
Stefan Dösinger 750973cec5 wined3d: Remove BaseTexture::UnBindTexture. 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 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 61a900fdfc wined3d: Fix the drawStridedSlow callback function calling convention.
Since some of those function pointers are direct GL functions the function
prototype needs the WINE_GLAPI calling convention. This makes prevents
drawStridedSlow from crashing with USE_WIN32_OPENGL.
2008-08-25 12:26:17 +02:00
Stefan Dösinger f39e122477 wined3d: Add fixed function sRGB write correction. 2008-08-25 12:25:13 +02:00
H. Verbeet b917bdaa52 wined3d: Remove useless hash_table_entry_t typedef.
It doesn't add much.
2008-08-22 10:39:08 +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 8fe6bf0bad wined3d: Fix the unused arg marker. 2008-08-20 12:34:44 +02:00
Stefan Dösinger 1f4cf3513d wined3d: Implement YUV emulation with GL_ARB_fragment_program. 2008-08-20 12:26:14 +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
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 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 e5de2fc82c wined3d: Move some swapchain code into a base class. 2008-08-19 12:20:47 +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 e795d842ec wined3d: Implement overlay position tracking. 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 f037eb8696 wined3d: Move setting the draw buffer to a separate function. 2008-08-04 13:52:09 +02:00
Stefan Dösinger 399825cd8e wined3d: Report the pitch alignment to ddraw. 2008-08-04 13:10:37 +02:00
Stefan Dösinger 228f2cf3c2 wined3d: Initialize the texture op function properly. 2008-08-04 13:07:26 +02:00
Stefan Dösinger 14b24058d6 wined3d: GL_ARB_fragment_program ffp implementation. 2008-07-31 13:02:04 +02:00
Stefan Dösinger bc4435e406 wined3d: Use a hashmap to store the ffp shaders. 2008-07-31 13:01:50 +02:00
Stefan Dösinger d4d133f032 wined3d: Use C bitfields to compact the ffp description. 2008-07-31 13:01:36 +02:00
Stefan Dösinger 294f1b4aad wined3d: Add fog and tex types to the ffp fragment description. 2008-07-28 11:36:15 +02:00
Stefan Dösinger eea2c95727 wined3d: Move set_tex_op(_nvrc) to their specific files. 2008-07-22 13:01:45 +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
Stefan Dösinger 35f33ef409 wined3d: Add extension information to the states.
This patch adds a new field to the state templates. If this extension
field is != 0, then the line is only applied to the final state table
if the extension is supported. Once a line is applied to the final
table, all further templates for this state from the same pipeline
part are ignored. This allows removing some extension checks from the
state handlers, which cleans them up and saves a few CPU cycles when
applying the states.
2008-07-17 11:44:08 +02:00
Stefan Dösinger 88ae2fe14a wined3d: Give nv* fixed function stuff its own state template. 2008-07-14 11:46:11 +02:00
Stefan Dösinger 86b033bbb9 wined3d: Give the nvts/nvrc code its own pipeline implementation.
This code creates the structures and the pipeline selection, as well
as the caps filling. It does not yet move the actual code around,
since this will be a bigger task.
2008-07-14 11:44:26 +02:00
Stefan Dösinger 51e64b3fe9 wined3d: Move fixed function texture dimension updates to the fragment pipeline.
This is a further separation of the sampler state, and a preparation
to move the nv texture shader stuff to its own pipeline implementation.
2008-07-14 11:43: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
Stefan Dösinger e4078fb0ba wined3d: Set ffp caps in the ffp backend, not the shader backend. 2008-07-11 14:32:53 +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
H. Verbeet b37cc08721 wined3d: Don't call shader_select() in depth_blt().
Calling shader_select() from inside depth_blt() isn't necessarily
safe. shader_select() assumes CompileShader() has been called for the
current shaders, but that depends on STATE_VSHADER / STATE_PIXELSHADER
being applied. That isn't always true when depth_blt() gets called,
with the result that sometimes GLSL programs could be created with no
shader objects attached.
2008-07-10 20:33:29 +02:00
Francois Gouget 8320d214d4 wined3d: Move float_32_to_16() to surface_base.c which is the only place where it's used, and because it needs port.h for isinf(). 2008-07-10 12:18:43 +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 3a2743f25d wined3d: Remove the state table from the shader backend. 2008-07-08 21:08:54 +02:00
Stefan Dösinger 2d7cdc3ec2 wined3d: Remove the DLL load init function. 2008-07-08 21:08:54 +02:00
Stefan Dösinger c15dfb87e9 wined3d: Create fragment processing state templates and select one.
For now the atifs selection sticks to the old rules, thus it is bound to
the available and selected shader capabilities. We may want to change that
in the future.
2008-07-08 21:08:54 +02:00
H. Verbeet a637fda7bf wined3d: Store the current GLSL program in the backend's private data. 2008-07-08 10:47:30 +02:00
Stefan Dösinger 141f31f05d wined3d: Move stream source and vshader to misc and vertex pipeline tables. 2008-07-08 10:46:42 +02:00
Stefan Dösinger 68dec9d161 wined3d: Implement the state merger and start to use it. 2008-07-08 10:46:20 +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
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
Stefan Dösinger 8d930f6009 wined3d: Restore the gamma when destroying the swapchain. 2008-07-02 12:27:05 +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
H. Verbeet a6fa6a4a31 wined3d: Use gl_Color and gl_SecondaryColor to support more varyings in SM3.0 shaders.
SM3.0 requires 10 4 component float varyings for passing stuff between
vertex and pixel shaders. GF7 and earlier report 8 generic varyings +
gl_Color and gl_SecondaryColor in GLSL. This patch allows us to use
gl_Color and gl_SecondaryColor to get 2 extra varyings, which some
games, like C&C3 with highest gfx settings, require.
2008-06-19 11:47:52 +02:00
Roderick Colenbrander 042d0394dc wined3d: Add a registry key to allow/disallow multisampling.
Right now it is set to disabled due to an Nvidia GLXBadDrawable
bug. Second there is some issue (driver bug too?) in FBO mode.
2008-06-03 11:17:09 +02:00
Francois Gouget 42a61d7ed7 Assorted spelling fixes. 2008-05-06 16:10:20 +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 628e4eece3 wined3d: Add multisampling support. 2008-04-30 10:23:25 +02:00
Roderick Colenbrander 31dc00a073 wined3d: Store more information about pixel formats. This is needed for some WineD3D_ChoosePixelFormat restructuring. 2008-04-28 13:27:51 +02:00
Stefan Dösinger 9ee7e42de8 wined3d: Call activate_dimensions from the atifs code. 2008-04-24 11:54:28 +02:00
Stefan Dösinger 1c9f1f8ddd wined3d: Support framebuffer reading from texture_rectangle sources. 2008-04-24 11:43:18 +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 481bcdfe2a wined3d: Disable MAG filters on formats that do not support them. 2008-04-09 11:53:35 +02:00
Stefan Dösinger a22203adeb wined3d: Make the mag filter lookup a separate array.
This makes it easier to make this a per texture / per adapter property.
Somewhen we should rename the remaining lookup type in the general
lookup table to wraplookup.
2008-04-09 11:48:30 +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
Alexander Dorofeyev d6ba069d9e wined3d: Improve detection of device palette change. 2008-04-03 11:31:57 +02:00
Stefan Dösinger bd68237096 wined3d: Implement TSSARGTEMP with register combiners. 2008-04-02 20:07:40 +02:00
Stefan Dösinger 287f60a2b2 wined3d: Implement D3DTA_TEMP in the GL_ATI_fragment_shader codepath. 2008-04-02 20:07:19 +02:00
Stefan Dösinger 9e831a8733 wined3d: Create a fake non-gl adapter. 2008-04-01 20:31:30 +02:00
Alexander Dorofeyev 165970992a wined3d: Make device palettes dynamically allocated. 2008-03-27 11:09:06 +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 a440051016 wined3d: Add a shader DLL init callback. 2008-03-25 19:49:17 +01:00
Stefan Dösinger ee7e149998 wined3d: Move shader caps setting into the arb and glsl shader backends. 2008-03-25 19:39:23 +01:00
Stefan Dösinger 5ab5202e0f wined3d: Set shader specific caps in the shader backend.
The whole control structures in directx.c get terribly confusing with
the various codepaths for texturing and different shader
implementations. It is also hard to reflect the shader model
decisions this way too. This patch moves the shader specific parts of
the caps code into the shader backend where we can set our caps
dependent of the shader model decisions and without complex caps flag
checks.
2008-03-25 19:39:11 +01:00
Stefan Dösinger a66fb40d83 wined3d: Move shader generation into the shader backend.
Generating the shader ID and parts of the shader prolog and epilog was
done by the common vertexshader.c / pixelshader.c, which is ugly.

This patch doesn't get rid of all the uglyness, somewhen we'll still
have to sort out the relationship of [arb|glsl]_generate_shader and
[arb|glsl]_generate_declarations.
2008-03-25 19:35:58 +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 51a8162330 wined3d: Check pixel formats of the same pixel type. 2008-03-21 15:19:05 +01:00
Roderick Colenbrander d44c295651 wined3d: Check the render target capabilities of a resource type. 2008-03-17 11:42:19 +01:00
Stefan Dösinger 167a271434 wined3d: Support more than one texbem instruction per shader. 2008-03-05 19:22:44 +01:00
Stefan Dösinger aeb0e43e3e wined3d: Hardcode local constants in ARB shaders if possible. 2008-03-04 12:15:26 +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
Stefan Dösinger 8c758a62e8 wined3d: Remove VBFLAG_LOAD. 2008-02-28 20:10:40 +01:00
Stefan Dösinger f912f18b13 wined3d: Move shader model private data into its own structure. 2008-02-26 11:31:39 +01:00
Stefan Dösinger 825506d5ff wined3d: General cross format blitting infrastrucutre, R32F->R16F blits. 2008-02-26 11:31:19 +01:00
Stefan Dösinger 81de2fa10a wined3d: Add a test for the vFace register. 2008-02-15 09:40:03 +01:00
Stefan Dösinger e7393a8a11 wined3d: Move vertex buffer vbo creation to PreLoad. 2008-02-05 12:42:30 +01:00
Stefan Dösinger 1424e7fd09 wined3d: Make Clear aware of the depth stencil sharing. 2008-02-05 12:37:01 +01:00
Stefan Dösinger 3d2aa7afa0 wined3d: De-Statify depth blit opengl resources. 2008-02-05 12:33:15 +01:00
Stefan Dösinger a0f2e6e55e wined3d: Move some UnLoad code to the base texture class. 2008-02-05 12:32:58 +01:00
Austin English 3471f841a1 wined3d: Spelling fixes. 2008-01-18 12:53:33 +01:00
Stefan Dösinger 09bf3d5aea wined3d: Keep track of shaders. 2008-01-14 15:20:42 +01:00
Stefan Dösinger e59ddb0ab1 wined3d: Add a new IWineD3DResource::UnLoad method. 2008-01-14 15:10:17 +01:00
Alexander Dorofeyev f5aaabd1f2 wined3d: Rewrite IWineD3DSurfaceImpl_BltOverride colorfill codepath. 2007-12-21 13:58:13 +01:00
Stefan Dösinger 6d575ec301 wined3d: Change the vertex buffer declaration's data format.
This hopefully makes the vertex attribute detection simpler, more solid, 
readable and flexible.
2007-12-21 13:14:36 +01:00
Stefan Dösinger b5f925cae0 wined3d: Implement half float vertex buffer conversion. 2007-12-21 13:13:56 +01:00
Stefan Dösinger b83dc6bbf6 wined3d: Move the GL info structure into the adapter. 2007-12-20 12:10:08 +01:00
Stefan Dösinger 6ac59b96ed wined3d: Fix vertex buffers based on type, not semantic. 2007-12-20 12:09:56 +01:00
Stefan Dösinger 2d90449500 wined3d: Fixed function vertex attribute types are flexible. 2007-12-20 10:49:42 +01:00
Stefan Dösinger a3c2fb9e64 wined3d: Store if half float conversion is needed in the decl. 2007-12-20 10:48:16 +01:00
Stefan Dösinger 7a1d35e513 wined3d: Emulate half float vertices if GL_NV_half_float is not there. 2007-12-19 12:19:27 +01:00
Stefan Dösinger df77e28854 wined3d: Implement D3DFMT_G16R16. 2007-12-18 14:08:18 +01:00
Stefan Dösinger 7f10ee453a wined3d: Use the adapter to read the display mode. 2007-12-11 12:14:35 +01:00
Stefan Dösinger 0e8c13e630 wined3d: A more detailed occlusion query test and fixes. 2007-12-07 15:27:11 +01:00
Stefan Dösinger 54fa712981 wined3d: Initialize output texcoord .w to 1.0 if needed.
The GL_ARB_vertex_program extension does not define a standard value for
output texture coordinates. This makes problems when using vertex
shaders with fixed function fragment processing because fffp divides the
texture coords by its .w component. This means that gl shaders have to
write to the .w component of texture coords. Direct3D shaders however
do not.
2007-12-07 14:54:22 +01:00
Stefan Dösinger 9bc6200ece wined3d: Add a method for querying the gl drawable size of rendertarget. 2007-12-04 14:32:39 +01:00
Stefan Dösinger 3cc253c557 wined3d: Enabling too many lights is silently ignored.
I'm resending this patch because my reply to Henri's concern came too late. 
Henri noted that I am enabling lights that do not exist. Existing tests show 
that if no light is assigned to the index, LightEnable creates a light with a 
set of default parameters, so the tests should be fine.

From 9ee4c61805b50886f79e87d744b52f27b7b00b4e Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan@codeweavers.com>
Date: Thu, 29 Nov 2007 13:22:47 +0100
Subject: [PATCH] WineD3D: Enabling too many lights is silently ignored

This patch adds tests for all d3d versions that show that Windows
pretends that enabling more lights than supported succeeds. D3D_OK is
returned, and the light is reported as enabled.

What is not tested in this patch is the rendering output of this
situation, thus the FIXME is still written.
2007-12-03 13:44:07 +01:00
Stefan Dösinger d09cbcec91 wined3d: Activate GL_ARB_texture_rectangle. 2007-11-29 13:36:55 +01:00
Alexandre Julliard 57d1548b51 wined3d: Add printf format checking to the shader_addline function and fix resulting warnings. 2007-11-28 13:40:29 +01:00
Stefan Dösinger 959212304d wined3d: Track vertex declaration changes on vertex shaders.
If an attribute has type D3DDECLTYPE_D3DCOLOR, the red and blue channels
are swizzled in the shader. Since the attribute is stored in the vertex
declaration and not the vertex shader, it can change by setting a new
vertex declaration. If this happens, we have to recompile the shader
with the swizzling of that specific attribute turned on or off.
2007-11-21 12:18:02 +01:00
Stefan Dösinger cfc5725760 wined3d: Move glsl shader destruction to the glsl shader backend. 2007-11-21 12:06:27 +01:00
Stefan Dösinger 1fc1fe3c6e wined3d: Use standard wine lists for the resource list. 2007-11-20 13:10:46 +01:00
Stefan Dösinger 7a97d4e2ec wined3d: Free the shader function when freeing the shader. 2007-11-20 13:02:07 +01:00
Stefan Dösinger bd97580683 wined3d: Move IUnknown functions to IWineD3DBaseShader. 2007-11-20 12:53:07 +01:00
Stefan Dösinger f13bb40671 wined3d: Do not call PreLoad in surface_download_data. 2007-11-16 13:23:02 +01:00
Stefan Dösinger 26f7eae9cf wined3d: Non power of two texture fixes. 2007-11-14 11:59:21 +01:00
Stefan Dösinger e4f8a2da2b wined3d: Depth stencil fixes. 2007-11-14 11:58:36 +01:00
Stefan Dösinger edb78187a9 wined3d: Hardcode local constants into the shader if possible. 2007-11-14 11:51:26 +01:00
Stefan Dösinger 6fd4f8f699 wined3d: Store integer uniform locations. 2007-11-09 12:32:02 +01:00
Stefan Dösinger bfec6c352d wined3d: Store the special uniforms' locations in the linked program. 2007-11-09 12:31:54 +01:00
Stefan Dösinger fb0dde7b27 wined3d: Relative addressing offsets are limited to [-64; 63] in arb. 2007-11-08 11:54:43 +01:00
Stefan Dösinger 1b23dd1ba1 wined3d: Implement the varying map. 2007-11-07 12:08:32 +01:00
Stefan Dösinger 409103f801 wined3d: Install a varying map. 2007-11-07 12:08:24 +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 3febe738ab wined3d: Handle ps 3.0 varyings in a different way. 2007-11-06 13:34:57 +01:00
Stefan Dösinger 393ed4a070 wined3d: Make resource memory 32 byte aligned. 2007-11-01 12:38:45 +01:00
Stefan Dösinger 4d4fce7e33 wined3d: Disconnect allocatedMemory and Heap allocation. 2007-11-01 12:38:37 +01:00
Stefan Dösinger a175e7b68e wined3d: Move a part of LockRect to the base class. 2007-11-01 12:38:17 +01:00
Stefan Dösinger 948292dbc3 wined3d: Move texture -> drawable blits to LoadLocation. 2007-11-01 12:37:43 +01:00
Stefan Dösinger f6637cae98 wined3d: Move texture loading to LoadLocation. 2007-10-29 12:04:11 +01:00
Stefan Dösinger dcff7dc213 wined3d: Begin centralizing surface location management. 2007-10-26 15:17:19 +02:00
Stefan Dösinger 8f3accc718 wined3d: Care for the inverted y coords in dsy. 2007-10-22 15:59:04 +02:00
Roderick Colenbrander 134aa67ec9 wined3d: Use a fragment shader to do P8 palette conversion in hardware. 2007-10-12 11:07:23 +02:00
Stefan Dösinger 3f16f02940 wined3d: Nested loop support. 2007-10-04 12:03:59 +02:00
Stefan Dösinger 3d3369a77c wined3d: d3d ignores the sign of the input value in the log instruction. 2007-10-03 11:03:12 +02:00
Stefan Dösinger 9c6cdda147 wined3d: Reverse the position fixup if the pshader is reading vpos. 2007-10-03 11:02:48 +02:00
Stefan Dösinger 822030e329 wined3d: Enable the mNxN implementation for pixel shaders. 2007-10-01 13:00:19 +02:00