Commit Graph

178 Commits

Author SHA1 Message Date
Jason Green 75950b5bf8 wined3d: Replace memset/memcpy routines on stateblock (fixes dynamic shader constants regression). 2006-07-24 12:57:34 +02:00
Stefan Dösinger 9423fd2d9f wined3d: Do not try to create a vbo more than once. 2006-07-21 20:21:00 +02:00
H. Verbeet a8f2c1075a wined3d: Compilation fixes. 2006-07-20 12:11:06 +02:00
Jason Green 718716b77a wined3d: Make the number of floating point shader constants dynamic. 2006-07-19 09:54:30 +02:00
Stefan Dösinger 739d565c59 wined3d: Add a setting for the render target locking method. 2006-07-18 11:22:51 +02:00
Jason Green 6a97f2202e wined3d: Fix for vertex shaders. 2006-07-17 15:05:38 +02:00
Ivan Gyurdiev 33293df143 wined3d: More flow control instructions.
- Implement call, callnz, label, and ret
- Implement support for NOT modifier
2006-07-11 17:14:24 +02:00
Ivan Gyurdiev 6ede56495a wined3d: More flow control instructions
- Implement if, else, endif, rep, endrep, break
- Implement ifc, breakc, using undocumented comparison bits in the instruction token
- Fix bug in main loop processing of codes with no dst token
- Fix bug in GLSL output modifier processing of codes with no dst token
- Fix bug in loop implementation (src1 contains the integer data, src0 is aL)
- Add versioning for all the instructions above, and remove
  GLSL_REQUIRED thing, which is useless and should be removed from all
  opcodes in general.
2006-07-11 17:13:05 +02:00
Ivan Gyurdiev e9de563e41 wined3d: Place immediate constants in the same array as global constants.
- move DEF, DEFI, DEFB handling into the register counting pass
- keep track of defined constants as a linked list (because there's a
  few of them)
- apply immediate constants after global constants in the constant
  loading function
- both types of constants now get loaded with array notation in the
  shader (into the same array)
2006-07-11 17:11:30 +02:00
Ivan Gyurdiev 5b3c500efe wined3d: Reverse semantics maps for shaders. 2006-07-07 17:39:26 +02:00
Ivan Gyurdiev c611012df5 wined3d: Make WINED3D_ATR macros more flexible.
Make them operate on a type, as opposed to a semantic name.
2006-07-07 17:37:25 +02:00
Ivan Gyurdiev 85aa8ab855 wined3d: Add position_transformed flag to Strided data format. 2006-07-07 17:35:36 +02:00
Michael Stefaniuc 32b1a24501 janitorial: Move the storage specifier to the beginning of the declaration. 2006-07-07 14:30:35 +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
Ivan Gyurdiev 7e9fd0b4c1 wined3d: Add a function to print out D3DDECLUSAGE9 values. 2006-07-03 12:04:37 +02:00
Ivan Gyurdiev d06e13db99 wined3d: Move SHADER_ARB code into arb_program_shader.c. 2006-07-03 12:03:31 +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 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 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
Stefan Dösinger 7d31ab95e4 wined3d: Add support for VBOs to the drawing code. 2006-06-26 13:02:19 +02:00
Stefan Dösinger 3518747165 wined3d: Pixel format cleanup. 2006-06-21 12:15:50 +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
Stefan Dösinger 3862f8e3d7 wined3d: Support more than one back buffer. 2006-06-15 16:51:41 +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
Alexandre Julliard 836b5c7e93 wined3d: Use unsigned int instead of size_t to avoid printf format warnings. 2006-06-13 14:14:20 +02:00
Ivan Gyurdiev 8c6ee8df0d wined3d: Mark instructions without a destination token.
There are a total of 17 instructions without a destination token. Of
those 9 have num_params != 0, which means that we will not process any
of them correctly, because we assume the first token (if present) is a
destination token.

Those are basically all the flow control instructions, which we plan to
support very soon. They have source tokens, and no destination. Add a
flag that marks them up to the ins table. Use this flag in the trace
pass, and generation pass.
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 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 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
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
Jan Zerebecki 7528fc0de1 wined3d: Fix stencil related render states. 2006-06-13 10:50:55 +02:00
H. Verbeet 405e11ea62 wined3d: Cleanup GetSrcAndOpFromValue().
- Cleanup GetSrcAndOpFromValue().
- Use naming more consistent with the rest of the file.
2006-06-12 16:07:58 +02:00
Ivan Gyurdiev 621f075fb9 wined3d: Print out sampler state names. 2006-06-10 12:41:54 +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 d59714b78c wined3d: Prototype the GLSL functions for use with pixel and vertex shaders. 2006-06-09 15:14:34 +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
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
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 4d66615bbb wined3d: Fix missing light recording.
Write a light with the default parameters in disabled state if
capturing a missing light.
2006-06-07 15:20:00 +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
Ivan Gyurdiev aec2e3e46d wined3d: Trace improvements. 2006-06-06 11:49:03 +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
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