Commit Graph

3305 Commits

Author SHA1 Message Date
Henri Verbeet a44f84fdf7 wined3d: Add a proper enum value for "no extension".
This would allow an extension check for ARB_COLOR_BUFFER_FLOAT to work.
2009-06-04 12:19:02 +02:00
Henri Verbeet 0a059aafbe wined3d: Check FBO compatibility after the fixups are applied. 2009-06-04 12:18:47 +02:00
Henri Verbeet faaea93573 wined3d: Remove WINED3DFMT_R16G16B16A16_SNORM from the GL formats template.
This entry obviously can't work correctly.
2009-06-04 12:18:42 +02:00
Henri Verbeet 0cf49767ad wined3d: Remove entries without an internal format from the GL formats template. 2009-06-04 12:18:33 +02:00
Henri Verbeet 37bdcd6b9b wined3d: Free priv->stack in shader_glsl_free(). 2009-06-04 12:18:27 +02:00
Henri Verbeet ad6279de9f wined3d: Replace the wined3d hash table with the generic red-black tree. 2009-06-03 11:40:14 +02:00
Henri Verbeet 97f320a77b wined3d: Introduce volumetexture_init() to handle most of the volume texture initialization. 2009-06-03 11:39:16 +02:00
Henri Verbeet 9e69b86a03 wined3d: Introduce volumetexture_cleanup(). 2009-06-03 11:39:09 +02:00
Henri Verbeet b0ba731bd5 wined3d: Introduce cubetexture_init() to handle most of the cube texture initialization. 2009-06-03 11:39:04 +02:00
Henri Verbeet aabb51286d wined3d: Introduce cubetexture_cleanup(). 2009-06-03 11:38:55 +02:00
Henri Verbeet 5171a65d81 wined3d: Introduce texture_init() to handle most of the 2D texture initialization. 2009-06-03 11:38:50 +02:00
Stefan Dösinger 2afcb794f2 wined3d: Implement clipplanes in the ARB backend.
Using GL_NV_vertex_program2_option so far. If we're really desparate we can
handle some cases without the extension by using a custom varying and texkill
in the fragment program.
2009-06-02 12:09:54 +02:00
Stefan Dösinger 1276b090b4 wined3d: Update clipplanes on a shader-fixed function switch.
The view matrix that was set at the time the clipplane was applied is
hardcoded into the clipplane. With vertex shaders clip planes ignore
the view matrix in d3d. We implement that, but this also means that
the clip planes potentially change when we switch between vs and fixed
func.
2009-06-02 12:09:46 +02:00
Stefan Dösinger dfc9141458 wined3d: Use condition code for sRGB write correction if available.
This gives a small performance improvement. Don't enable NVfp for it though,
because the NVfp penalty is bigger than the gain from this patch. But if NVfp
is enabled anyway, make use of it.
2009-06-02 12:09:38 +02:00
Stefan Dösinger 7e1100d0e4 wined3d: Handle LRP in vertex shaders.
The ARB "LRP" instruction is a fragment program only instruction. It is
however valid in vs_2_0+ vertex shaders, so we have to emulate it.
2009-06-02 12:09:26 +02:00
Henri Verbeet 22022cf8b3 wined3d: Create a texture_cleanup() function. 2009-06-02 11:57:22 +02:00
Henri Verbeet 451a416fcf wined3d: Call resource_init() from basetexture_init(). 2009-06-02 11:57:22 +02:00
Henri Verbeet 812ee5208c wined3d: Partially revert 7433eb76b5.
The write mask sizes for the input and output semantics can be different,
resulting in compilation failure.
2009-06-02 11:57:22 +02:00
Stefan Dösinger 38076e08ca wined3d: Add a comment about texbem and X2D. 2009-06-01 16:16:00 +02:00
Stefan Dösinger de12f880ce wined3d: Don't enable the NV frag extensions if we don't need them.
Enabling the NV extensions occupies a temp register for some reason. Avoid
needlessly enabling it.
2009-06-01 16:16:00 +02:00
Stefan Dösinger 5a07bacd36 wined3d: Write result.color in one mov.
Otherwise the Nvidia assembler needs one temp reg.
2009-06-01 16:16:00 +02:00
Stefan Dösinger 050735be79 wined3d: Revert "WineD3D: use CMP instead of SLT and SGE in sRGB correction".
This reverts patch ba35760f9f.

The original patch did not achive its goal, because CMP is a macro that is
expanded to SLT, SGE, MUL, MAD, at least on nvidia hardware. To make matters
worse, it uses a temporary register, and the assembler usually is not clever
enough to find a free temporary from the shader code. If we generate the code
outselves we can pick one of our temps for this job.
2009-06-01 16:16:00 +02:00
Stefan Dösinger 8665ee5906 wined3d: Use Rx registers for sRGB correction if possible.
This removes another reason to declare TA, TB and TC.
2009-06-01 16:16:00 +02:00
Stefan Dösinger 7168b62323 wined3d: Use NRM from GL_NV_fragment_program2 if available. 2009-05-29 11:27:51 +02:00
Stefan Dösinger d8e219be75 wined3d: Avoid the TMP_COLOR mov in some cases.
Many 2.0 and 3.0 shaders end with a "mov oC0, rx". If sRGB writing is enabled,
the ARB backend writes to a TMP_COLOR temporary, and at the end of the shader
writes the sRGB corrected color to result.color. If oC0 is not partially
rewritten after the mov, we can ignore the mov, not declare TMP_COLOR at all,
and just use the rx register as input for the sRGB correction code. This saves
a temporary and an instruction.
2009-05-29 11:27:44 +02:00
Stefan Dösinger da7176be2a wined3d: Use DP2A or X2D for dp2add if available. 2009-05-29 11:27:29 +02:00
Stefan Dösinger e2be741bc0 wined3d: Remove a MESA hack. 2009-05-29 11:27:23 +02:00
Stefan Dösinger 5f723bc44a wined3d: Allocate the proper size for the lconst map. 2009-05-29 11:27:14 +02:00
Henri Verbeet 7433eb76b5 wined3d: Use the proper OUT swizzle in handle_ps3_input(). 2009-05-29 11:26:54 +02:00
Henri Verbeet 5654544725 wined3d: Add device resources from resource_init().
This is consistent with removing them from resource_cleanup().
2009-05-29 11:26:44 +02:00
Henri Verbeet 5e0f541621 wined3d: Remove ResourceReleased() from the public device interface. 2009-05-29 11:26:38 +02:00
Henri Verbeet d37472f27b wined3d: Add missing ActivateContext calls to shader_destroy() implementations. 2009-05-29 11:26:32 +02:00
Louis Lenders 06936f04c0 wined3d: Fix CheckDeviceMultiSampleType when queried with D3DMULTISAMPLE_NONE. 2009-05-28 15:02:08 +02:00
Stefan Dösinger e70c80add9 wined3d: Emulate if(bool) in ARB shaders. 2009-05-28 12:46:01 +02:00
Stefan Dösinger e492dd858e wined3d: Add a function around the handler table.
This reduces the number of methods in the shader backend(the instr
modifiers can be handled in that wrapper) and it will help flow
control emulation in the ARB backend.
2009-05-28 12:45:45 +02:00
Stefan Dösinger aad92c0780 wined3d: Manage vs_compile_args in the backends. 2009-05-28 12:45:32 +02:00
Stefan Dösinger 814dd42f25 wined3d: Manage ps_compiled_shader in the backends. 2009-05-28 12:45:21 +02:00
Stefan Dösinger 8763f6eac5 wined3d: Make find_gl_vshader backend specific. 2009-05-28 12:45:10 +02:00
Stefan Dösinger 732a9a15d5 wined3d: Remove the forward declaration added in the last patch. 2009-05-28 12:44:59 +02:00
Stefan Dösinger d0d681c81e wined3d: Make find_gl_pshader backend private. 2009-05-28 12:44:43 +02:00
Stefan Dösinger 5865d9c01b wined3d: Store the compile args in the compile context, not the shader. 2009-05-28 12:44:22 +02:00
Henri Verbeet 13a05caa97 wined3d: Remove the "declaration" parameter to IWineD3DDeviceImpl_CreateVertexShader().
Once upon a time this was used for creating fake vertex shader
attribute semantics for d3d8 shaders. We don't need this anymore since
device_stream_info_from_declaration() will use the vertex
declaration's output slot to load the data, if present. That also
avoids the potentially expensive matching of attribute semantics
between vertex shader and declaration for d3d8.
2009-05-28 12:42:18 +02:00
Henri Verbeet fcf7844653 wined3d: Match the d3d10 name for WINED3DDECLUSAGE_POSITION.
I.e., make sure that if a SM4 shader uses SV_POSITION it ends up as position
data.
2009-05-28 12:42:18 +02:00
Henri Verbeet 3925cd5f15 wined3d: Use the output signature to setup SM4 vertex shader output semantics. 2009-05-28 12:42:18 +02:00
Stefan Dösinger 0629585c24 wined3d: Work around an ARBFP vs GLSL bug in Mac OS. 2009-05-27 11:57:54 +02:00
Stefan Dösinger 6492622350 wined3d: sincos for vertex shaders.
SCS is unfortunately a fragment program only instruction. If we have the NV
extensions we can use SIN and COS. Otherwise we have to approximate sine and
cosine with a taylor series. Luckily we're provided with the necessary
constants by the application.
2009-05-27 11:56:53 +02:00
Stefan Dösinger 2f3faf4526 wined3d: Put some ARB declarations in the right place.
TMP_POS is only used in vertex shaders, declare it in the vshader
specific code. The sRGB constants are only used by pixel shaders, so
move them to the ps specific code, and avoid reading the stateblock.
2009-05-27 11:56:29 +02:00
Stefan Dösinger f484cbbf91 wined3d: Get rid of Tx hardcoding in texbem. 2009-05-27 11:56:07 +02:00
Stefan Dösinger da1b8d0c8e wined3d: Replace a few hardcoded Tx registers with proper name getters. 2009-05-27 11:56:01 +02:00
Stefan Dösinger 7fc4279cb8 wined3d: Implement DSX in ARB.
DSY is not that easy because we have to deal with the inverted coordinate
system in onscreen(!) rendering - see GLSL dsy.
2009-05-27 11:55:52 +02:00
Henri Verbeet 2ee0d47a49 wined3d: Use strings for shader input/output semantics. 2009-05-27 11:12:12 +02:00
Henri Verbeet 19cb4594e3 wined3d: Use a separate structure for vertex shader attributes.
In D3D10 shaders input/output semantics are strings rather than predefined
types. Unfortunately, the code in vshader_get_input() can be performance
critical, depending on application behaviour. Since vshader_get_input() is
only relevant for d3d9 shaders anyway, just store the usage and usage_idx for
these shaders.
2009-05-27 11:12:07 +02:00
Henri Verbeet e6efb797c3 wined3d: Make "packed_output" a bitmap. 2009-05-27 11:11:57 +02:00
Henri Verbeet 10fadadc54 wined3d: Use the "input_registers" bitmap for vertex shader attributes as well. 2009-05-27 11:11:53 +02:00
Henri Verbeet 664b17b9ee wined3d: Make "packed_input" a bitmap. 2009-05-27 11:11:48 +02:00
Henri Verbeet 1ccfab171f wined3d: Use SM3 shader limits for SM4.
This isn't completely right, since as far as I'm aware SM4 doesn't have shader
limits in the same sense as previous shader models, but this should do for now.
2009-05-26 13:50:08 +02:00
Henri Verbeet f0e303b0f2 wined3d: Add the output signature to IWineD3DDevice_CreateVertexShader(). 2009-05-26 13:49:55 +02:00
Henri Verbeet 2153b4d998 wined3d: Split the info log into separate lines. 2009-05-26 13:49:50 +02:00
Henri Verbeet 1d7845dd33 wined3d: Pass a proper format desc to resource_init() in IWineD3DDeviceImpl_CreateBuffer(). 2009-05-26 13:49:37 +02:00
Louis Lenders f55522ab6b wined3d: Match device name string to windows one. 2009-05-25 14:21:56 +02:00
Henri Verbeet 6a9212a1b2 wined3d: Fix debug_d3dusagequery() to handle combinations of flags. 2009-05-25 11:23:53 +02:00
Henri Verbeet 7c2e91c592 wined3d: Fix debug_d3dusage() to handle combinations of flags. 2009-05-25 11:23:47 +02:00
Henri Verbeet f347374470 wined3d: Remove some apparently leftover debug code. 2009-05-25 11:23:39 +02:00
Henri Verbeet 85107d81f4 wined3d: Remove some unnecessary forward declarations. 2009-05-25 11:23:32 +02:00
Chris Robinson 12799db349 wined3d: Decrement fbo_entry_count when one is removed from the list. 2009-05-25 11:22:25 +02:00
Chris Robinson 1d757fd6da wined3d: Prevent erroneous FIXMEs on newer cards.
Cards that have 12 or more combined samplers can trigger a fixme if they have
the same amount of vertex samplers, even though it's plenty enough.
2009-05-25 11:22:13 +02:00
Stefan Dösinger 122af07a30 wined3d: Implement SGN in ARB. 2009-05-21 16:17:52 +02:00
Stefan Dösinger 8e45e48b0c wined3d: Support vec4 A0 with NV_vertex_program2_option. 2009-05-21 16:17:52 +02:00
Stefan Dösinger d0756ee537 wined3d: Support ABS and ABSNEG with NV extensions if available. 2009-05-21 16:17:52 +02:00
Stefan Dösinger 01ec5068e2 wined3d: Add NV asm extension support to the ARB backend. 2009-05-21 16:17:51 +02:00
Stefan Dösinger 60f20a2f39 wined3d: Support ABS and ABSNEG in ARB. 2009-05-21 16:17:51 +02:00
Stefan Dösinger 7b1d48721d wined3d: Emulate the 4 component address register in ARB. 2009-05-20 10:55:17 +02:00
Stefan Dösinger 72e9e80f6e wined3d: Prepare for vec4 address registers in ARB. 2009-05-20 10:55:09 +02:00
Stefan Dösinger c7ca3793cc wined3d: Implement mova rounding in arb. 2009-05-20 10:55:03 +02:00
Stefan Dösinger bffb89101f wined3d: Fix srgb correction. 2009-05-20 10:54:56 +02:00
Stefan Dösinger e6cc81d287 wined3d: Get rid of the TMP register in fragment shaders.
To be able keep the temporary register in the type independent NRM
instruction, the vertex temporary register is renamed to TA to match
the name of a pixel shader register.
2009-05-20 10:54:50 +02:00
Stefan Dösinger ba35760f9f wined3d: Use CMP instead of SLT and SGE in sRGB correction.
This shortens the code and reduces the amount of temp regs used by 1.
2009-05-19 15:24:48 +02:00
Stefan Dösinger ad217029b0 wined3d: Get rid of TMP accesses in texm3x3* instructions. 2009-05-19 15:24:39 +02:00
Stefan Dösinger ced325f816 wined3d: Get rid of TMP access in texm3x2*.
texm3x2pad knows which register the following texm3x2depth or tex instruction
will use, and it knows that this register is uninitialized. So use it for
temporary storage instead of TMP.
2009-05-19 15:24:31 +02:00
Stefan Dösinger 17b001788f wined3d: Get rid of TMP2 and some easy TMP register uses.
We have 5 temporary registers declared for private use. We can get rid of two
of them.
2009-05-19 15:24:21 +02:00
Stefan Dösinger 4bf980962a wined3d: Only declare TMP_OUT in vertex shaders. 2009-05-19 15:24:13 +02:00
Stefan Dösinger d7f282f241 WineD3D: Support more constants in ARB shaders.
GL_LIMIT - 1 for vertex programs and the GL limit in fragment programs. The
indirect addressing limitation in GLSL applies here as well.
2009-05-18 13:59:31 +02:00
Stefan Dösinger c7839112c9 wined3d: Avoid declaring helper_const in vertex programs if possible. 2009-05-18 13:59:24 +02:00
Stefan Dösinger 2cb8f42168 wined3d: Support clipplanes with GLSL.
This is the Nth attemt to make clipping work with GLSL shaders. The patch now
uses the GLSL quirk table to handle cards that need a custom varying for
gl_ClipPos, and the code is adapted to the changed state table and shader
backend system.
2009-05-18 13:59:16 +02:00
Stefan Dösinger 45563979bd wined3d: Update the bump constants after a shader change.
Since we're using local constants now, we have to update the constants after a
shader change.
2009-05-18 13:58:57 +02:00
Stefan Dösinger 3372846aa6 wined3d: Use local constants for bump parameters.
This simplifies the loading code a bit. The constants were never
designed to be at the same location in all shaders, so there's no
point in using program.env. This way we don't collide with the d3d
shader constants and its easier to work together with NP2 fixups and
other shaders.
2009-05-18 13:58:47 +02:00
Robert Key 0cea80708f wined3d: Remove HD 4800 "2048MB for X2 versions" comment. 2009-05-18 13:36:23 +02:00
Robert Key cce62569df wined3d: Fix ATI HD4800 being reported as ATI 9500. 2009-05-15 11:55:20 +02:00
Stefan Dösinger 6fe1a5daa5 wined3d: Don't use TMP_COLOR unless srgb is enabled.
This was needed unconditionally in the past to apply fog, but since we're
using the ARBfp fog defines it is only needed if an sRGB correction is done
at the end of the shader.
2009-05-15 11:45:18 +02:00
Henri Verbeet 5d63179404 wined3d: Remove some unused defines. 2009-05-15 10:25:48 +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 3022a4a73c wined3d: Add missing GL locking to check_fbo_compat(). 2009-05-15 10:25:32 +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
Stefan Dösinger 0123f81ce5 wined3d: Centralize WINED3DSPDM_SATURATE handling.
Besides the cleanup this patch will help to implement D3DSPDM_PARTIALPRECISION 
with GL_NV_vertex_program2_option / GL_NV_fragment_program_option.
2009-05-14 14:27:33 +02:00
Stefan Dösinger aeddd2da63 wined3d: Fix remaining incorrect dst register getters. 2009-05-14 14:27:25 +02:00
Stefan Dösinger bcb20ae96c wined3d: Fix a few more hardcoded pixel shader registers. 2009-05-14 14:27:19 +02:00
Stefan Dösinger 2327e316a2 wined3d: Tidy up pshader_hw_texreg2rgb and friends. 2009-05-14 14:27:14 +02:00
Stefan Dösinger 05cc344e7d wined3d: Tidy up pshader_hw_dp2add. 2009-05-14 14:27:07 +02:00
Henri Verbeet 318fb7036b wined3d: Add missing GL locking to test_pbo_functionality(). 2009-05-14 11:12:57 +02:00