Commit Graph

66 Commits

Author SHA1 Message Date
Jason Green 2d8e05f8a1 wined3d: Move constant loading into target-specific files.
- Moves GLSL constant loading code into glsl_shader.c and out of the
  over-populated drawprim.c.
- Creates a new file named arb_program_shader.c which will hold code
  specific to ARB_vertex_program & ARB_fragment_program.
- Remove the constant loading calls from drawprim.c
2006-06-19 10:49:52 +02:00
Francois Gouget 11ae0f6386 Assorted spelling fixes. 2006-06-16 11:32:29 +02:00
Jason Green cc06ed3d53 wined3d: Implement more GLSL instructions.
- Implemented: D3DSIO_SGN, LOOP, ENDLOOP, LOGP, LIT, DST, SINCOS
- Process instruction-based modifiers (function existed, it just
  wasn't being called)
- Add loop checking to register maps.
- Renamed "sng" to "sgn" for D3DSIO_SGN - it's not handled anywhere
  except for GLSL, so won't matter.
2006-06-15 12:20:20 +02:00
Ivan Gyurdiev 14a52e5c09 wined3d: Keep pshader and vshader constants in GLSL separate.
GLSL uniforms have as scope the entire program.
To prevent conflicts, name pshader and vshader constants differently.
Based on a patch by Jason Green.
2006-06-13 11:40:22 +02:00
Ivan Gyurdiev 0d08316523 wined3d: Improve Sampler support on 2.0 and 3.0 shaders.
- track sampler declarations and store the sampler usage in reg_maps structure
- store a fake sampler usage for 1.X shaders (defined as 2D sampler)
- re-sync glsl TEX implementation with the ARB one (no idea why they diverged..)
- use sampler type in new TEX implementation to support 2D, 3D, and Cube sampling
- change drawprim to bind pixel shader samplers

Additional improvements:
- rename texture limit to texcoord to prevent confusion
- add sampler limit, and use that for samplers - *not* the same as texcoord above
2006-06-13 11:40:22 +02:00
Ivan Gyurdiev e99926ee06 wined3d: Cast more things.
Anything with a swizzle has to be casted to vec4, or it won't work properly.
There's multiple ways to do this, for the moment pick the easiest one.
2006-06-13 11:40:22 +02:00
Ivan Gyurdiev a1f4dfe4e3 wined3d: Add support for shader model 3.0 I/O registers.
SM 3.0 can pack multiple "semantics" into 12 generic input/output registers.

To support that, define temporaries called IN and OUT, and use those as
the output registers. At the end of the vshader, unpack the OUT temps
into the proper GL variables. At the beginning of the pshader, pack the
GL variables back into 12 IN registers.
2006-06-13 11:40:22 +02:00
Ivan Gyurdiev 1a3003338f wined3d: Trivial cleanups
- compiler warnings and errors should be FIXME
- remove obsolete comment, and change variable type.
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
Ivan Gyurdiev f144d58ac2 wined3d: The namedArrays code path is dead (always FALSE).
Delete the entire namedArrays code path and all its dependencies (one
of which is quite long - storeOrder in drawprim is always FALSE, for
example). Delete declaredArrays, and make its code path the default.
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
Jason Green 42dd4653e3 wined3d: Change fog output variable name for GLSL shaders. 2006-06-10 12:43:10 +02:00
Jason Green e8c97e9421 wined3d: Fix regression from register maps switch for ARB shaders.
I missed a register mask in the move to share the shader_hw_def()
function between pixel and vertex shaders for ARB shaders.  Fixed
that, and made the GLSL version use the same mask for consistency.
2006-06-10 12:43:02 +02:00
Jason Green 08295f4cfc wined3d: GLSL shader cleanup patch.
- Based on comments from H. Verbeet
- Changed the distinction from .rgba & .xyzw masks to only use .xyzw
  in GLSL shaders.  They are interchangeable, and only served to make
  the trace look more intuitive, but they don't always apply as-is, so
  we'll just leave everything to .xyzw.
- Got rid of the "UseProgramObjectARB(0)" call in drawprim.  If there
  is no shader set on the next primitive, then that primitive will
  call UseProgramObjectARB(0) when it begins to draw.
2006-06-09 21:09:03 +02:00
Jason Green 0c59ca6448 wined3d: Add the bulk of the GLSL string generation functions.
- Add a new file glsl_shader.c which contains almost every GLSL specific function we'll need
- Move print_glsl_info() into glsl_shader.c
- Move the shader_reg_maps struct info into the private header, and make it part of SHADER_OPCODE_ARG.
- Create a new shared ps/vs register map for float constants (future patch will make ARB programs use this, too)
2006-06-09 13:47:55 +02:00