Commit Graph

78 Commits

Author SHA1 Message Date
Ivan Gyurdiev 0472e9cd49 wined3d: Clean up drawPrimitive/drawPrimitiveDrawStrided. 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 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
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 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
Stefan Dösinger 7d31ab95e4 wined3d: Add support for VBOs to the drawing code. 2006-06-26 13:02:19 +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
H. Verbeet 701ce97d65 wined3d: Add and use GL_EXT_fog_coord defines. 2006-06-16 11:29:31 +02:00
Stefan Dösinger 3862f8e3d7 wined3d: Support more than one back buffer. 2006-06-15 16:51:41 +02:00
Stefan Dösinger 5c3c5903a5 wined3d: Correct vertex fog for transformed vertices and correctly
handle non-vertex, non-table fog.
2006-06-15 12:24:09 +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 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
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 d5d4568450 wined3d: Allow drawPrim to create and use the GLSL program. 2006-06-09 15:20:06 +02:00
Jason Green 1f1057fc9b wined3d: Move constant loading out of DrawPrimDrawStrided() and enable
loading float constants for GLSL.

- DrawPrim is just too big of a function.  This separates the passing
  of constants to the shader into new functions.
- Fixes an off-by-one error when loading vertex declaration constants
  (should be <, not <=)
- Adds a function for GLSL loading of constants (aka Uniforms)
- Adds a GLSL program variable to the stateblock and sets it to 0 (a
  future patch will actually create this program)
2006-06-09 13:26:51 +02:00
Ivan Gyurdiev 5f5969b3c5 wined3d: Remove constant type field in stateblock.
It is wrong to maintain a mapping from a constant index to a type
field, because different constant types do not share an index -
boolean constant 0 is supposed to co-exist with floating point
constant 0, not replace it. Drawprim and other code using the type
array to decide whether to look up a constant in bools, floats, or
ints is wrong - you can't make that decision based on the index.
2006-06-06 11:58:54 +02:00
Stefan Dösinger 2c3adec595 wined3d: Render target locking fixes. 2006-06-05 20:59:41 +02:00
Jason Green c60f296b70 wined3d: Fix regression introduced by recent multitexture patch. 2006-05-26 20:14:31 +02:00
Roderick Colenbrander 54e5f9c465 wined3d: Dynamicly load GL_ARB_multitexture functions. 2006-05-25 20:17:32 +02:00
Stefan Dösinger 5b8b776431 wined3d: Small rhw vertex fix.
Fix the one pixel displacement and move the glOrtho code in a common
function.
2006-05-25 20:09:57 +02:00
Jonathan Ernst 360a3f9142 Update the address of the Free Software Foundation. 2006-05-23 14:11:13 +02:00
Ivan Gyurdiev d59eeb3ee5 wined3d: Allow use of pixel shaders with drawStridedSlow. 2006-05-22 11:40:00 +02:00
Stefan Dösinger 9abdac6aaa wined3d: Implement IWineD3DDevice::ProcessVertices. 2006-05-15 13:57:17 +02:00
Stefan Dösinger 10ff0d8184 wined3d: rhw vertex fixup.
Change the rhw=0 range to ]1e-8,1e-8[ and move the value to a constant
in wined3d_types.h
2006-05-09 20:45:27 +02:00
Stefan Dösinger a173c8e35a wined3d: Add IWineD3DDevice::DrawPrimitiveStrided. 2006-05-08 14:51:13 +02:00
Ivan Gyurdiev dbf5450982 wined3d: Remove dead shader code. 2006-05-07 10:00:24 +02:00
Ivan Gyurdiev 07f4f70487 wined3d: QueryInterface corrections. 2006-05-05 20:23:41 +02:00
Ivan Gyurdiev 74117baa6c wined3d: Correct vtrace usage. 2006-04-21 11:34:31 +02:00
Stefan Dösinger bbe490abcc wined3d: Add WINED3DLOCKED_RECT to wined3d_types.h. 2006-04-06 22:23:31 +02:00
H. Verbeet 59af5c4a62 wined3d: Move fields common to vertex shaders and pixel shaders to IWineD3DBaseShader. 2006-03-30 21:55:15 +02:00
H. Verbeet 1aca53860a wined3d: Set vertex attribute pointers defined in vertex declarations properly. 2006-03-22 21:41:05 +01:00
Stefan Dösinger 913df5b143 wined3d: Consistently use WINED3DRESOURCETYPE. 2006-03-10 21:43:00 +01:00
H. Verbeet 76c469e5a4 wined3d: Use OpenGL fragment programs when available. 2006-03-09 13:10:42 +01:00
H. Verbeet 86b9041c0c wined3d: Remove an incorrect FIXME. 2006-03-09 13:10:30 +01:00
Stefan Dösinger 851bdfb5e0 wined3d: Add D3DLOCK_* types to wined3d_types.h. 2006-03-08 11:33:35 +01:00
H. Verbeet 78a43b3dbc wined3d: Fix a few FIXME's. 2006-03-07 10:56:52 +01:00
Stefan Dösinger 46e8d67787 wined3d: Update the glOrtho between 2 rhw draws if the viewport was changed. 2006-02-13 13:25:21 +01:00
H. Verbeet bcfa7dcf7d wined3d: Downgrade a FIXME to a TRACE. 2006-02-06 11:30:27 +01:00
H. Verbeet 4bd8b60bd3 wined3d: A shader isn't guaranteed to have a vertex declaration, so
add a NULL check for that.
2006-01-20 16:13:03 +01:00
Oliver Stieber 7c482cb9a1 wined3d: Vertex shader 8 support.
Start to add support for DirectX 8 vertex shaders, constants and
registers are now correctly assigned and loaded allowing support for
most basic d3d8 shaders.
2005-12-09 11:23:52 +01:00
Oliver Stieber aa9ce3577a Added support for vertex and pixel shader constants that have no type
i.e. they haven't been set yet or are clear.
2005-11-29 17:05:54 +01:00
Raphael Junqueira 705aec5a6f - defined D3DCOLOR_B macros to access byte values of D3DCOLOR
- use D3DCOLOR macros instead of using shift + masks
- fix a bug where diffuse.lpData checked instead of specular.lpData
- implement color fixup on ARB VShader compilation code:
 -> on input parameters using swizzle
 -> add is_color parameter on vshader_program_add_param
2005-11-15 12:03:13 +00:00
Francois Gouget 0edbaf7e80 Remove spaces before '\n' in traces. 2005-11-10 12:14:56 +00:00
Oliver Stieber c62e978d54 Verify that the texture coordinate used in DrawStridedSlow is in range
before trying to referencing the associated data.
2005-11-07 11:13:26 +00:00
Oliver Stieber 44b4777972 Add checks for ARB_vertex_program before allowing vertex shaders to
use ARB_vertex_program.
2005-10-11 20:27:54 +00:00
Oliver Stieber c99a3fafef Change the format of surface_SaveSnapshot to TGA from PPM and add
support for compressed textures and an alpha channel.
2005-09-27 10:49:59 +00:00
Oliver Stieber 1be54d8b79 Integrate hardware vertex shaders into the drawing pipeline. 2005-08-19 10:05:00 +00:00