965 Commits

Author SHA1 Message Date
Stefan Dösinger
bb8bcf5878 wined3d: Reload the first 8 constants on a 1.x and != 1.x ps switch.
ps 1.x constants are clamped to [-1;1], constants in >= 2.0 pshaders
are not. This means we have to reload constants when switching between
those shader types in ARB. In GLSL this is not a concern because
constants are tied to program objects and are reloaded on a shader
change anyway.
2009-06-22 11:26:33 +02:00
Stefan Dösinger
2364ce08e5 d3d9: Add a SGN test. 2009-06-22 11:26:14 +02:00
Stefan Doesinger
b2f09fd204 wined3d: Emulate clipplanes in ARB if the NV extensions are not available.
This patch tries to find a free texture coordinate to load up to 4 clip
coordinates into the pixel shader, and uses KIL to throw away fragments
that are cut by a clipplane. If no free texture coordinate is found,
clipping is not done. If more than 4 clipplanes are used, only the first
4 are actually enabled. That should be pretty rare though.
2009-06-19 14:54:00 +02:00
Stefan Doesinger
7baf7c6518 wined3d: Implement vertex texture fetch in ARB. 2009-06-19 14:53:50 +02:00
Stefan Doesinger
f1e97cdfbc wined3d: Don't run out of varyings because of clipplanes. 2009-06-19 14:53:43 +02:00
Stefan Doesinger
b53b5909ff wined3d: Handle SM 3.0 varyings in ARB. 2009-06-19 14:53:20 +02:00
Stefan Doesinger
3aaa530ca9 wined3d: Properly load the y correction. 2009-06-18 15:17:26 +02:00
Stefan Doesinger
c9ef1ed28c wined3d: Deal with instructions that do not support _SAT. 2009-06-17 12:24:43 +02:00
Stefan Doesinger
a7b605af64 wined3d: Implement D3DSPDM_PARTIALPRECISION support. 2009-06-17 12:24:35 +02:00
Stefan Doesinger
dfd338de77 wined3d: Add modifier support to tex and friends. 2009-06-17 12:20:54 +02:00
Stefan Doesinger
7856c1c26f wined3d: Fix texm3x3pad.
The register number is already in the name we got from get_register_name,
don't add it twice.
2009-06-17 12:20:48 +02:00
Stefan Doesinger
58c3a0c832 wined3d: Implement vpos and vface. 2009-06-17 12:19:31 +02:00
Stefan Doesinger
ae600fe0c8 wined3d: Implement texldl in ARB. 2009-06-17 12:19:15 +02:00
Stefan Doesinger
4830a29101 wined3d: Implement texldd in ARB. 2009-06-16 13:57:34 +02:00
Stefan Doesinger
2f6a713805 wined3d: Use flags instead of bools to control shader_hw_sample. 2009-06-16 13:57:30 +02:00
Stefan Doesinger
e608ef856e wined3d: Implement IFC in ARB. 2009-06-16 13:57:20 +02:00
Stefan Doesinger
dfefbcd00d wined3d: Implement break and breakc. 2009-06-16 13:57:15 +02:00
Stefan Doesinger
c220bafa2c wined3d: Unroll loops in ARB if needed.
This is needed to allow us to claim vs_2_0 support with plain
GL_ARB_vertex_program. vs_2_0 allows loops without breaks.
2009-06-16 13:57:04 +02:00
Stefan Dösinger
258d99d289 wined3d: Implement dsy in ARB. 2009-06-10 11:52:15 +02:00
Stefan Dösinger
51cdc9d361 wined3d: Implement loops with the NV extensions. 2009-06-10 11:52:01 +02:00
Stefan Dösinger
298bd3c50d wined3d: Store the bumpmap ARB constants in ARB structures. 2009-06-10 11:51:49 +02:00
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
ad6279de9f wined3d: Replace the wined3d hash table with the generic red-black tree. 2009-06-03 11:40:14 +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
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
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 ba35760f9fd5fd90a0fa34077862f04513d1ab16.

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
d37472f27b wined3d: Add missing ActivateContext calls to shader_destroy() implementations. 2009-05-29 11:26:32 +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
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