Commit Graph

580 Commits

Author SHA1 Message Date
Jason Green 3529e0ceeb wined3d: Fix D3DSIO_M#X# instruction for both ARB and GLSL shaders.
This instruction was being handled incorrectly in the case where the
2nd src argument contained a relatively addressed constant.
2006-07-06 16:31:24 +02:00
Ivan Gyurdiev 0472e9cd49 wined3d: Clean up drawPrimitive/drawPrimitiveDrawStrided. 2006-07-06 16:07:38 +02:00
Ivan Gyurdiev 1309844913 wined3d: Implement FVF to DECL9 conversion (with tests). 2006-07-06 16:07:38 +02:00
Ivan Gyurdiev 276609e1e5 wined3d: Move register count pass to SetFunction.
Move semantics pointers out of the reg_maps, make them persistent data
in the shader (again, for future software shaders).
2006-07-06 16:07:38 +02:00
Ivan Gyurdiev bbe7b40a71 wined3d: Fix STREAM flag override. 2006-07-06 16:07:38 +02:00
Ivan Gyurdiev e260e9fd98 wined3d: Add missing PSIZE register for decl8->9 conversion. 2006-07-06 16:07:38 +02:00
Ivan Gyurdiev b324fc0fdb wined3d: Allow mix of SW vertex and GLSL pixel shader.
Do not attach non-GLSL shaders to the GLSL program, that will cause a
crash. Mix with ARB shaders is never going to happen, because the
selection code will always choose GLSL for both or ARB for both.
2006-07-06 16:07:37 +02:00
Ivan Gyurdiev 771623692e wined3d: Rework shader mode selection.
- currently half the shader selection code (GLSL vs ARB) is in
fillGLcaps. The parts that check for software shaders are in
GetDeviceCaps. That placement, will work, but is definitely not optimal.
FillGLcaps should detect support - it should not make decision as to
what's used, because that's not what the purpose of the function is.
GetDeviceCaps should report support as it has already been selected.
Instead, select shader mode in its own function, called in the
appropriate places.

- unifying pixel and vertex shaders into a single selection is a
mistake. A software vertex shader can be coupled with a hardware arb or
glsl pixel shader, or no shader at all. Split them back into two and add
a SHADER_NONE variant.

- drawprim is doing support checks for ARB_PROGRAM, and making shader
decisions based on that - that's wrong, support has already been
checked, and decided upon, and shaders can be implemented via software,
ARB_PROGRAm or GLSL, so that support check isn't valid.

- Store the shader selected mode into the shader itself. Different types
of shaders can be combined, so this is an improvement. In fact, storing
the mode into the settings globally is a mistake as well - it should be
done per device, since different cards have different capabilities.
2006-07-06 16:07:37 +02:00
Stefan Dösinger 1a82976908 wined3d: Flip WINED3DFMT_R8G8B8 to GL_RGB. 2006-07-06 12:45:27 +02:00
Ivan Gyurdiev 7e9fd0b4c1 wined3d: Add a function to print out D3DDECLUSAGE9 values. 2006-07-03 12:04:37 +02:00
Ivan Gyurdiev 0111e15e1f wined3d: Fix faulty DCL trace. 2006-07-03 12:04:23 +02:00
Ivan Gyurdiev 1bfec25031 wined3d: Resync ARB mnxn function with GLSL mnxn function. 2006-07-03 12:04:09 +02:00
Ivan Gyurdiev fd896d8652 wined3d: Use shader_get_regtype() in register counting pass. 2006-07-03 12:03:58 +02:00
Ivan Gyurdiev d06e13db99 wined3d: Move SHADER_ARB code into arb_program_shader.c. 2006-07-03 12:03:31 +02:00
Ivan Gyurdiev fce0c625f0 wined3d: Cleanup: print constants in device code. 2006-07-03 12:02:04 +02:00
Stefan Dösinger 77448f588b wined3d: Perform sanity checks on the rectangle in LockRect. 2006-06-30 20:44:27 +02:00
Jason Green 4fbe97e5e7 wined3d: Fix a few GLSL shader instruction translations.
This fixes the translations for a few instructions in GLSL and allows
Cubemap sampling in pixel shaders < 2.0.  It makes some of the
lighting on textures in Half Life 2 look better, including some of the
water effects.  It's not perfect yet, but much closer now.
2006-06-29 14:41:01 +02:00
H. Verbeet 7f9e61f7d2 wined3d: Use register combiners for texture stage operations.
Make wined3d use register combiners for texture stage operations. In
order to do that the texture unit index needs to be separated from the
texture stage index. For cards that don't support the
NV_register_combiners extension nothing should change.
2006-06-28 16:34:36 +02:00
H. Verbeet f3a2a9f30a wined3d: Add code for using register combiners for texture stage operations.
On nVidia cards the value of GL_MAX_TEXTURE_UNITS is generally not
larger than 4. In Direct3D that would correspond to
MaxSimultaneousTextures in the caps, rather than MaxTextureBlendStages
(which can be much larger) to which it currently corresponds in
wined3d. Using register combiners we can get around that limitation
and get up to GL_MAX_GENERAL_COMBINERS_NV (typically 8) texture
stages. This patch adds code for doing the texture operations with
register combiners instead of ARB_texture_env_combine or
NV_texture_env_combine4, but doesn't make use of that code yet. That's
what the next patch will do.
2006-06-28 16:08:36 +02:00
H. Verbeet ac98d566ac wined3d: Fix uploading of textures for shaders.
The code for uploading / binding textures for use with pixel shaders
is slightly different from the one for uploading / binding textures
for use with the fixed function pipeline. It would be possible to keep
the code in a single function with a couple of conditionals, but in
combination with the changes needed for register combiners that would
become quite messy.
2006-06-28 16:08:17 +02:00
H. Verbeet a54e36adfe wined3d: Texture limits fixes.
GL_LIMITS(textures) is currently used for both the number of texture
stages and the maximum number of simultaneous textures. In the current
code that's the same, but in a later patch that will be separated,
since a texture stage doesn't have to reference an actual
texture. Also, shaders can access a larger number of samplers than the
number of texture units the fixed function pipeline can access.
2006-06-28 16:06:25 +02:00
H. Verbeet 085e20c0da wined3d: Add & use D3DTEXTUREOP dumping code. 2006-06-28 15:43:53 +02:00
Stefan Dösinger cea41b0a0f wined3d: Vertex buffer can be locked multiple times. 2006-06-27 21:14:02 +02:00
Jason Green baf38b3007 wined3d: Implement more GLSL instructions and a little cleanup.
- Implement D3DSIO_DP2ADD, D3DSIO_TEXKILL, D3DSIO_TEXM3X3PAD
- Partially implement D3DSIO_TEXBEM, D3DSIO_TEXM3X3VSPEC (as much as
  they are implemented in ARB_fragment_program at least).
- Stop copying the SHADER_PARSE_STATE struct in each ARB shader
  routine - use a pointer instead.
2006-06-27 11:16:10 +02:00
H. Verbeet 3489f1b9b1 wined3d: Remove some redundant code. 2006-06-27 11:15:54 +02:00
H. Verbeet f460b38612 wined3d: Fix compilation (VBO constants). 2006-06-27 11:15:47 +02:00
Francois Gouget 9bfbfcbeb4 Assorted spelling, case and grammar fixes. 2006-06-26 13:06:11 +02:00
Stefan Dösinger e18b89aca7 wined3d: Fix single buffering.
Tell gl to draw to the back buffer when a back buffer is used, do not
use the value from gl.
2006-06-26 13:03:56 +02:00
Stefan Dösinger 2a40642804 wined3d: Fix a bad trace. 2006-06-26 13:03:43 +02:00
Stefan Dösinger 2122026713 wined3d: Create vertex buffer objects for D3D vertex buffers. 2006-06-26 13:03:08 +02:00
Stefan Dösinger 232dfc9b3a wined3d: Vertex fixups. 2006-06-26 13:02:36 +02:00
Stefan Dösinger 7d31ab95e4 wined3d: Add support for VBOs to the drawing code. 2006-06-26 13:02:19 +02:00
Stefan Dösinger 495e46197a ddraw/wined3d: IDirectDrawSurface7::SetSurfaceDesc corrections. 2006-06-26 12:38:55 +02:00
Stefan Dösinger 3518747165 wined3d: Pixel format cleanup. 2006-06-21 12:15:50 +02:00
Louis. Lenders 6601e8eefe wined3d: Add an "\n" to a fixme to fix an overflow. 2006-06-21 11:16:15 +02:00
Jason Green e0ccbeb282 wined3d: Bind correct number of samplers for GLSL shaders.
We are only checking against GL_MAX_TEXTURES when binding samplers,
when we should be checking against the maximum number of samplers that
the card supports.  Spotted by H. Verbeet.
2006-06-21 11:16:07 +02:00
Jason Green 0b09ecb291 wined3d: Move D3DSIO_DEF instruction for ARB shaders into arb_program_shader.c. 2006-06-20 11:28:15 +02:00
Jason Green 99c855e6ae wined3d: Fix DEF instructions in GLSL for non-Nvidia platforms.
- NVidia allows "const vec4 = {1.0, 2.0, 3.0, 4.0};", even though
  that's not part of the spec.
- It should be  "const vec4 = vecr4(1.0, 2.0, 3.0, 4.0);"
- This patch fixes this for D3DSIO_DEF and D3DSIO_DEFI.
2006-06-20 11:28:05 +02:00
Jason Green c13f097de3 wined3d: Correct implementation of D3DSIO_LOOP.
I initially misread the specification.  src0.x is the iteration count,
not the max amount for the loop register.  This fixes that.
2006-06-19 11:11:45 +02:00
Jason Green fd83de7129 wined3d: Fix lookup for LOOP register. 2006-06-19 11:11:24 +02:00
Jason Green 9afa540eb5 wined3d: Added correct cast support for gl_FogFragCoord and gl_PointSize output registers. 2006-06-19 11:11:05 +02:00
Jason Green 406ec20459 wined3d: Load boolean and integer constants into the GLSL shader program. 2006-06-19 10:59:58 +02:00
Jason Green f444009bfb wined3d: Implement locally defined boolean and integer constants in GLSL. 2006-06-19 10:59:13 +02:00
Jason Green 34d271bab6 wined3d: Add preliminary support for constant boolean and integer registers in GLSL.
- Separate the declaration phase of the shader string generator into
  the arb and glsl specific files.
- Add declarations and recognition for application-sent constant
  integers and booleans (locally defined ones will follow).
- Standardize capitilization of pixel/vertex specific variable names.
2006-06-19 10:50:14 +02:00
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
Jason Green 7f18b4e5fa wined3d: Remove dead vertex shader code. 2006-06-19 10:39:36 +02:00
Paul Vriens edaac6f696 wined3d: GetScissorRect should use zero-based scissorBox (Coverity). 2006-06-16 14:42:36 +02:00
Francois Gouget 9eb81363ad Add trailing '\n's to ok() calls.
Remove spaces before '\n'.
2006-06-16 11:32:42 +02:00
Francois Gouget 11ae0f6386 Assorted spelling fixes. 2006-06-16 11:32:29 +02:00
H. Verbeet 701ce97d65 wined3d: Add and use GL_EXT_fog_coord defines. 2006-06-16 11:29:31 +02:00