134 Commits

Author SHA1 Message Date
Ivan Gyurdiev
a42925ee09 wined3d: Register map cleanups.
Various cleanups:
- do not use DWORD as a bitmask, that places artificial limit of 32 on
  registers
- track attributes that are used and declare only those
- move declarations function call in pshader/vshader to allow us to
  insert pixel or vertex specific code between the declarations and
  the rest of the code
- remove redundant 0 intializers
- remove useless continue statement
2006-06-13 11:40:22 +02:00
Ivan Gyurdiev
17b0d26c1e wined3d: Share trace pass
Now that the declaration function is out of the way, the tracing pass,
which is very long and 100% the same can be shared between pixel and
vertex shaders.

The new function is called shader_trace_init(), and is responsible for:
- tracing the shader
- initializing the function length
- setting the shader version [needed very early]
2006-06-13 11:40:22 +02:00
Ivan Gyurdiev
9bae7755ab wined3d: Rework dcl processing.
The new function is called in pass 2 (getister counting/maps), and
it's now in baseshader. It operates on all INPUT and OUTPUT registers,
which, in addition to the old vertex shader input declarations covers
Shader Model 3.0 vshader output and pshader input declarations. The
result is stored into the reg_map structure.
2006-06-13 11:40:21 +02:00
Alexandre Julliard
dbfb3739aa wined3d: Make all the local shader functions static. 2006-06-10 13:22:27 +02:00
Alexandre Julliard
e9cbc66e93 wined3d: Make the virtual table functions static where possible. 2006-06-10 13:15:32 +02:00
Ivan Gyurdiev
a09c941677 wined3d: Enable CND/CMP for SHADER_ARB. 2006-06-10 12:42:09 +02:00
Ivan Gyurdiev
d44d0b5edb wined3d: Downgrade Get*Shader FIXME to TRACE. 2006-06-10 12:41:44 +02:00
Jason Green
5798356d21 wined3d: Map pixel shader instructions to GLSL generating functions. 2006-06-09 15:19:02 +02:00
Jason Green
806aaa1287 wined3d: Added more declarations to GLSL.
- Declare more variable names for GLSL programs.
- Some of these won't need to be declared eventually, but it doesn't hurt to do it for now.
- Correct output name for pixel shaders (gl_FragColor instead of glFragColor).
2006-06-09 15:14:22 +02:00
Jason Green
ca70d13af4 wined3d: Unified float constant register mapping between ARB pixel and vertex shaders.
- Got rid of the separate constant maps.
- Side effect of this is that the map is a bit larger for pixel shaders than it needs to be
2006-06-09 14:36:50 +02:00
Ivan Gyurdiev
ac46320f57 wined3d: TEXREG2GB is valid on pshaders 1.1. 2006-06-07 15:23:23 +02:00
Ivan Gyurdiev
79029c1099 wined3d: Add limits for ps_2_x. 2006-06-06 11:50:20 +02:00
Ivan Gyurdiev
aec2e3e46d wined3d: Trace improvements. 2006-06-06 11:49:03 +02:00
Ivan Gyurdiev
2c232990ee wined3d: pshader defi has 5 parameters. 2006-06-06 11:48:48 +02:00
Jason Green
473ce80fa2 wined3d: Add ability to generate GLSL shader objects for vertex and pixel shaders. 2006-05-27 11:01:05 +02:00
Jonathan Ernst
360a3f9142 Update the address of the Free Software Foundation. 2006-05-23 14:11:13 +02:00
Ivan Gyurdiev
7b861b3c03 wined3d: Simplify input/output modifier line handling. 2006-05-22 11:41:23 +02:00
Jason Green
683e5bfc55 wined3d: Move PARAM C[] program.env[] into baseshader and out of vertex shaders. 2006-05-20 17:37:48 +02:00
Ivan Gyurdiev
42b89791ff wined3d: Take predication tokens into account.
Each instruction can have a predication token. Account for it in the
trace pass, register count pass, and store it in the SHADER_OPCODE_ARG
structure for generation. MSDN claims the token is at the end of the
instruction, but that's not true - testing a demo, which lets me
manipulate the shader shows the predication token is the first source
token immediately following the destination token.
2006-05-18 10:32:54 +02:00
Ivan Gyurdiev
3d905baf50 wined3d: SETP takes 3 parameters. 2006-05-18 10:32:08 +02:00
Ivan Gyurdiev
c65a86828c wined3d: Use COLOROUT/DEPTHOUT for pixel shaders 2.0+.
As previously mentioned, RASTOUT is invalid on pixel shaders.
On shaders 1.x, r0 is treated as the color output register:
http://www.gamedev.net/columns/hardcore/dxshader3/page2.asp
That's what we currently do in all cases, change it not to do so
for shaders >= 2.0. Support COLOROUT/DEPTHOUT instead.
2006-05-17 10:56:25 +02:00
Ivan Gyurdiev
8470e54bdf wined3d: Remove detailed traces from map2gl/input_modifiers functions. 2006-05-17 10:55:50 +02:00
Ivan Gyurdiev
c05bc5d9c1 wined3d: Write "unrecognized_register" in fallback case for get_register_name(). 2006-05-17 10:55:39 +02:00
Ivan Gyurdiev
746d1b1cd3 wined3d: Modify shader_dump_param() to take into account address token.
Currently we hardcode a0.x, which I think is correct for shaders 1.0.
However, for shaders 2.0, we must look into the address token, and
print the register there. Handle both cases to correct the trace.
2006-05-17 10:55:11 +02:00
Ivan Gyurdiev
03b67e3030 wined3d: Use shader_get_param() in trace pass, reg. count pass, generation pass.
Change the trace pass, the register counting pass, and the hw
generator pass to take into account the new get_params() function. For
hw generation, store the address tokens into the SHADER_OPCODE_ARG
structure, so they're available to generator functions.
2006-05-17 10:54:23 +02:00
Ivan Gyurdiev
404eff792f wined3d: Add shader_get_param() fn, which processes address tokens.
Add a new function to process parameters.
On shaders 1.0, processing parameters amounts to *pToken++.
On shaders 2.0+, we have a relative addressing token to account for.
This function should be used, instead of relying on num_params everywhere.
2006-05-17 10:53:18 +02:00
Ivan Gyurdiev
d4dd9869b8 wined3d: Allow multiple output modifiers. 2006-05-17 10:51:47 +02:00
Ivan Gyurdiev
c94ecdff61 wined3d: Fix SINCOS parameters.
SINCOS has 4 parameters in shaders 2.0.
It has 2 parameters in shaders 3.0.
It's undefined in shaders 1.0.
2006-05-17 10:50:33 +02:00
Ivan Gyurdiev
8b7401c39a wined3d: Shaders: share dump_param function, version functions. 2006-05-15 16:07:31 +02:00
Ivan Gyurdiev
c61af3af8d wined3d: Share shader_dump_ins_modifiers().
Share shader_dump_ins_modifiers(), and make vertex shaders use it.
The saturate modifer (_sat) is valid on vs_3_0+, and it isn't being
shown in the trace.
2006-05-11 12:10:59 +02:00
Jason Green
246677ae46 wined3d: Modified the opcode tables (and struct) to include a pointer to a GLSL generator function. 2006-05-10 12:20:08 +02:00
Jason Green
68f75555d3 wined3d: Use GenerateShader in pixel shaders and remove old function. 2006-05-10 12:19:42 +02:00
Jason Green
087c67c459 wined3d: Add GenerateShader function to pixel shaders. 2006-05-10 12:19:19 +02:00
Jason Green
cc2ea9e08c wined3d: Place # of textures, addresses, & temps used inside the baseShader struct to prepare for GenerateShader merge. 2006-05-10 12:16:22 +02:00
Jason Green
653e71d774 wined3d: Further split up GenerateProgramArbHW for pixelshaders. 2006-05-10 12:16:02 +02:00
Jason Green
eee6fc9277 wined3d: Move DCL, DEF operations out of Generate loop and into separate functions. 2006-05-10 12:15:12 +02:00
Jason Green
5308e026d1 wined3d: Move program_dump_decl_usage into baseshader. 2006-05-10 12:14:39 +02:00
Ivan Gyurdiev
9d4960bfcb wined3d: Clean up some dead code. 2006-05-10 11:29:44 +02:00
Ivan Gyurdiev
b187242ab6 wined3d: Break out texture instruction processing. 2006-05-10 11:28:49 +02:00
Ivan Gyurdiev
cdfe848b6d wined3d: Break out arithmetic instruction processing. 2006-05-10 11:28:11 +02:00
Ivan Gyurdiev
320e33dcb3 wined3d: Merge register counting pass. 2006-05-10 11:26:01 +02:00
Ivan Gyurdiev
1d0c672393 wined3d: Share get_opcode. 2006-05-09 20:45:10 +02:00
Ivan Gyurdiev
c93239d36d wined3d: Clean up per version shader limits code. 2006-05-09 11:58:14 +02:00
Ivan Gyurdiev
5f10560762 wined3d: Addline cleanup. 2006-05-09 11:55:45 +02:00
Marcus Meissner
80dc1f9cb3 wined3d: Fix possible buffer overflow.
Increase size of passed buffer to print into.
2006-05-08 15:26:55 +02:00
Ivan Gyurdiev
4b3079438b wined3d: Share get_register_code(). 2006-05-08 15:15:30 +02:00
Ivan Gyurdiev
aea0b5d0f8 wined3d: Separate pshader/vshader tables. 2006-05-08 13:36:31 +02:00
Ivan Gyurdiev
07f4f70487 wined3d: QueryInterface corrections. 2006-05-05 20:23:41 +02:00
Ivan Gyurdiev
744f3ae1c4 wined3d: Improve/implement D3DSIO_TEX.
- unify per-version cases into a single sequence
- make use of get_register_name() for the destination register
- ignore destination write mask - it's only allowed on 2.0+ shaders,
  and only the default mask is allowed there (xyzw)
- enable swizzle on texld 1.4 (it works together with dw/dz modifiers)
- implement for shaders 2.0-3.0
2006-04-21 11:35:34 +02:00
Ivan Gyurdiev
63ef9788dd wined3d: Trace corrections/improvements. 2006-04-20 15:38:00 +02:00