Commit Graph

618 Commits

Author SHA1 Message Date
Henri Verbeet 111307dfba wined3d: Get rid of the GL_SUPPORT macro. 2009-10-29 13:09:33 +01:00
Henri Verbeet 48e03bc189 wined3d: Introduce a separate structure for various OpenGL implementation limits. 2009-10-29 13:09:27 +01:00
Henri Verbeet eeb54b9922 wined3d: Keep better track of where we're using wined3d contexts.
The idea here is that we can restore the thread's current GL context on
context_release() if it doesn't correspond to the current wined3d context on
context_acquire().
2009-10-28 11:15:19 +01:00
Henri Verbeet 6be41fd59a wined3d: Get rid of GL_LIMITS. 2009-10-22 10:46:05 +02:00
Henri Verbeet 55047f811a wined3d: Fix some GLINFO_LOCATION abuse. 2009-10-22 10:45:57 +02:00
Henri Verbeet fa548414f9 wined3d: Free the shader buffer in shader_glsl_free() (Valgrind). 2009-10-21 16:05:57 +02:00
Stefan Dösinger 435646550b wined3d: Use GLSL constant limits in GLSL. 2009-10-20 14:46:13 +02:00
Stefan Dösinger 2d802af4d9 wined3d: Make shader specific constants accessible via GL_LIMITS. 2009-10-20 14:46:08 +02:00
Stefan Dösinger dc45657f2c wined3d: Fix vs_2_0 sgn.
vs_2_0's sgn has two extra parameters - temporary registers for the
instruction. This patch fixes the crash of the d3d9:visual test on windows and
properly handles the vs_2_0 version of sgn.
2009-10-02 12:36:59 +02:00
Henri Verbeet f88c6e5ce5 wined3d: Move common shader fields to IWineD3DBaseShaderClass. 2009-09-25 15:14:35 +02:00
Rico Schüller 8a890d399a wined3d: Fix shader spam. 2009-09-18 10:47:17 -05:00
Henri Verbeet ab8523931a wined3d: Only warn about using Lod sample functions in fragment shaders is ARB_shader_texture_lod isn't supported. 2009-09-01 14:05:51 +02:00
Henri Verbeet 560d63548d wined3d: Remove trailing spaces. 2009-08-27 11:45:37 +02:00
Henri Verbeet dc8b1bdc0f wined3d: Rename some GLSL instruction handlers.
The pshader_glsl_* names are a leftover from when we had separate code for
vertex and fragment shaders.
2009-08-19 14:45:23 +02:00
Henri Verbeet e205973915 wined3d: Remove the redundant vs_nv_version and ps_nv_version fields from struct wined3d_gl_info. 2009-08-13 11:45:36 +02:00
Henri Verbeet f7918b978f wined3d: Make the "luminanceparams" shader_reg_maps member a bitmap. 2009-08-12 13:22:50 +02:00
Henri Verbeet 95bb4c0486 wined3d: Make the "bumpmat" shader_reg_maps member a bitmap. 2009-08-12 13:22:44 +02:00
Henri Verbeet 3d718d6414 wined3d: Make the "labels" shader_reg_maps member a bitmap. 2009-08-12 13:22:37 +02:00
Henri Verbeet 270f57e755 wined3d: Make the "address" shader_reg_maps member a bitmap. 2009-08-12 13:22:30 +02:00
Henri Verbeet 6fa9fa15da wined3d: Make the "temporary" shader_reg_maps member a bitmap. 2009-08-11 12:36:20 +02:00
Henri Verbeet 50853e295b wined3d: Make the "texcoord" shader_reg_maps member a bitmap. 2009-08-11 12:36:16 +02:00
Henri Verbeet b2ace3b1ab wined3d: Correctly check for luminance bumpmap parameters in shader_generate_glsl_declarations(). 2009-08-11 12:35:49 +02:00
Francois Gouget e74efb5487 Assorted spelling fixes. 2009-08-11 12:35:38 +02:00
Henri Verbeet 8d746c31ba wined3d: Properly handle negative loop step in shader_glsl_loop(). 2009-08-10 13:52:37 +02:00
Henri Verbeet 3bf0ad4528 wined3d: Explicitly pass the context to the shader_select() handler. 2009-08-07 12:11:06 +02:00
Henri Verbeet 4c1b3de936 wined3d: Call the shader_load_np2fixup_constants() handler directly from inside the shader backend. 2009-08-06 17:26:30 +02:00
Henri Verbeet 03686cb6bd wined3d: Explicitly pass the context to the shader_load_constants() handlers. 2009-08-06 17:26:30 +02:00
Henri Verbeet a7251f0f4e wined3d: Track render_offscreen in the context.
This makes sure the relevant states in FindContext() are actually marked dirty
when needed.
2009-08-06 17:26:30 +02:00
Henri Verbeet ee4d18cc83 wined3d: Pass NULL to ActivateContext() when we don't need a specific target.
Once we keep track of the wined3d context for each thread,
lastActiveRenderTarget won't do what we want here.
2009-07-21 14:22:44 +02:00
Stefan Dösinger cd7f43b00d wined3d: Don't activate a context unless we need one. 2009-07-20 12:23:07 +02:00
Henri Verbeet 43e6686a78 wined3d: Rename _WineD3D_GL_Info to struct wined3d_gl_info. 2009-07-17 11:22:07 +02:00
Henri Verbeet 38cb9d02b1 wined3d: Take geometry shaders into account in shader_glsl_load_constantsB(). 2009-07-10 12:13:29 +02:00
Henri Verbeet 60e0997c79 wined3d: Simplify the GLSL sRGB write code. 2009-07-10 12:13:03 +02:00
Henri Verbeet 9cf7888002 wined3d: Fix some cast-qual warnings. 2009-07-09 11:38:07 +02:00
Henri Verbeet 95d9b1271f wined3d: Get rid of the useless "fragcolor" variable in shader_glsl_generate_pshader(). 2009-07-09 11:38:05 +02:00
Henri Verbeet 483d552e21 wined3d: Allow shader_buffer_init() to fail. 2009-07-09 11:38:02 +02:00
Henri Verbeet 40b411958b wined3d: Rename "SHADER_BUFFER" to something sane. 2009-07-09 11:37:58 +02:00
Henri Verbeet bddc4d3f0d wined3d: Reuse the shader buffer between shaders. 2009-07-09 11:37:53 +02:00
Henri Verbeet e41831990d wined3d: Fix a sign compare warning in glsl_shader.c. 2009-07-08 20:14:35 +02:00
Henri Verbeet 949cd089d5 wined3d: Trace the D3D shader in find_glsl_vshader() / find_glsl_pshader().
It's quite useful to know to which D3D shader a GLSL shader corresponds.
2009-07-08 20:14:32 +02:00
Henri Verbeet 32fd8f2130 wined3d: checkGLcall() doesn't need a \n. 2009-07-07 11:50:22 +02:00
Henri Verbeet 2ac34bf231 wined3d: Add some missing float suffixes.
The compiler should be smart enough to fix most of these, but it looks sloppy.
2009-07-07 11:50:05 +02:00
Henri Verbeet 40bc47901c wined3d: Use flags for driver quirks. 2009-07-01 11:41:44 +02:00
Stefan Dösinger d5e2c14225 wined3d: Add a NOP ret handler to GLSL. 2009-06-29 12:28:49 +02:00
Francois Gouget 5aac7fe783 wined3d: Add a trailing '\n' to a FIXME() trace. 2009-06-26 14:40:21 +02:00
Henri Verbeet 7363b6e2e3 wined3d: Document GL context dependencies. 2009-06-26 12:05:07 +02:00
Tobias Jakobi a9f912466b wined3d: Force NP2 fixup constant reloading in shader_glsl_select. 2009-06-25 14:34:13 +02:00
Tobias Jakobi ef7f769be6 wined3d: Enable constant packing for NP2 texcoord fixup.
Previously every texture that was flagged for NP2 fixup used a vec2
uniform in the shader to store texture dimensions.  Turns out that the
GLSL compilers just maps vec2 to vec4, so essentially wasting 2
floats. The new code only uses vec4 uniforms but packs dimensions info
of 2 textures into a single uniform.
2009-06-25 14:34:13 +02:00
Tobias Jakobi 7906774339 wined3d: Add ps_np2fixup_info structure. 2009-06-25 14:34:13 +02:00
Stefan Dösinger 95788401af wined3d: GLSL 1.20 includes gl_FragData[] syntax.
This means we don't have to enable ARB_draw_buffers explicitly.
2009-06-22 11:27:20 +02:00
Henri Verbeet 2c009e4d87 wined3d: Only initialize unused components of varyings that are read. 2009-06-17 12:13:07 +02:00
Stefan Dösinger 298bd3c50d wined3d: Store the bumpmap ARB constants in ARB structures. 2009-06-10 11:51:49 +02:00
Henri Verbeet fcf6a27a9b wined3d: Simplify some code in set_glsl_shader_program(). 2009-06-09 17:01:14 +02:00
Henri Verbeet a6dc31e442 wined3d: Avoid comparing shader compile args if the relevant shader isn't present. 2009-06-09 17:01:14 +02:00
Henri Verbeet daeb86d620 wined3d: Don't use the vertex/pixel shader when we're not supposed to.
This also avoids removing programs from lists they're not in in
delete_glsl_program_entry().
2009-06-05 14:43:25 +02:00
Henri Verbeet cae6a32b08 wined3d: Check the result from wine_rb_get() before using it in WINE_RB_ENTRY_VALUE. 2009-06-05 14:43:25 +02:00
Henri Verbeet 37bdcd6b9b wined3d: Free priv->stack in shader_glsl_free(). 2009-06-04 12:18:27 +02:00
Henri Verbeet ad6279de9f wined3d: Replace the wined3d hash table with the generic red-black tree. 2009-06-03 11:40:14 +02:00
Henri Verbeet 812ee5208c wined3d: Partially revert 7433eb76b5.
The write mask sizes for the input and output semantics can be different,
resulting in compilation failure.
2009-06-02 11:57:22 +02:00
Henri Verbeet 7433eb76b5 wined3d: Use the proper OUT swizzle in handle_ps3_input(). 2009-05-29 11:26:54 +02:00
Henri Verbeet d37472f27b wined3d: Add missing ActivateContext calls to shader_destroy() implementations. 2009-05-29 11:26:32 +02:00
Stefan Dösinger e492dd858e wined3d: Add a function around the handler table.
This reduces the number of methods in the shader backend(the instr
modifiers can be handled in that wrapper) and it will help flow
control emulation in the ARB backend.
2009-05-28 12:45:45 +02:00
Stefan Dösinger aad92c0780 wined3d: Manage vs_compile_args in the backends. 2009-05-28 12:45:32 +02:00
Stefan Dösinger 814dd42f25 wined3d: Manage ps_compiled_shader in the backends. 2009-05-28 12:45:21 +02:00
Stefan Dösinger 8763f6eac5 wined3d: Make find_gl_vshader backend specific. 2009-05-28 12:45:10 +02:00
Stefan Dösinger 732a9a15d5 wined3d: Remove the forward declaration added in the last patch. 2009-05-28 12:44:59 +02:00
Stefan Dösinger d0d681c81e wined3d: Make find_gl_pshader backend private. 2009-05-28 12:44:43 +02:00
Stefan Dösinger 5865d9c01b wined3d: Store the compile args in the compile context, not the shader. 2009-05-28 12:44:22 +02:00
Henri Verbeet 2ee0d47a49 wined3d: Use strings for shader input/output semantics. 2009-05-27 11:12:12 +02:00
Henri Verbeet e6efb797c3 wined3d: Make "packed_output" a bitmap. 2009-05-27 11:11:57 +02:00
Henri Verbeet 10fadadc54 wined3d: Use the "input_registers" bitmap for vertex shader attributes as well. 2009-05-27 11:11:53 +02:00
Henri Verbeet 664b17b9ee wined3d: Make "packed_input" a bitmap. 2009-05-27 11:11:48 +02:00
Henri Verbeet 2153b4d998 wined3d: Split the info log into separate lines. 2009-05-26 13:49:50 +02:00
Stefan Dösinger 7b1d48721d wined3d: Emulate the 4 component address register in ARB. 2009-05-20 10:55:17 +02:00
Stefan Dösinger 2cb8f42168 wined3d: Support clipplanes with GLSL.
This is the Nth attemt to make clipping work with GLSL shaders. The patch now
uses the GLSL quirk table to handle cards that need a custom varying for
gl_ClipPos, and the code is adapted to the changed state table and shader
backend system.
2009-05-18 13:59:16 +02:00
Henri Verbeet b35e469d9d wined3d: Document functions that depend on the caller to do GL locking. 2009-05-15 10:25:41 +02:00
Henri Verbeet 12c4af8dd8 wined3d: Add missing GL locking to delete_glsl_program_entry() calls. 2009-05-14 11:12:30 +02:00
Henri Verbeet b7ac22004f wined3d: Add missing GL locking to shader_backend_t.shader_select() calls. 2009-05-13 12:01:57 +02:00
Henri Verbeet 59689262e7 wined3d: Add missing GL locking to shader_backend_t.shader_free_private() implementations. 2009-05-13 12:01:48 +02:00
Henri Verbeet cad271f13d wined3d: Print the correct limit in a WARN(). 2009-05-12 11:18:08 +02:00
Stefan Dösinger 2fd485ae31 winedd: Move shader_*_add_instruction_modifiers into the shader backend. 2009-05-08 12:20:18 +02:00
Henri Verbeet 69cbb57bfd wined3d: Add support for immediate constants to the GLSL backend. 2009-05-08 12:13:49 +02:00
Henri Verbeet 96005c0fca wined3d: Pass a struct wined3d_shader_register to shader_is_scalar(). 2009-05-08 12:13:46 +02:00
Henri Verbeet 4a18697246 wined3d: Pass a struct wined3d_shader_register to shader_glsl_get_register_name(). 2009-05-08 12:13:40 +02:00
Henri Verbeet 448dc84b6e wined3d: Fix shader_glsl_get_register_name() indentation. 2009-05-08 12:13:33 +02:00
Henri Verbeet 5e473cb17f wined3d: Group register information into struct wined3d_shader_register. 2009-05-08 12:13:17 +02:00
Henri Verbeet 69861b8fed wined3d: Increase the size of glsl_src_param_t.param_str.
It constains the register name plus potential modifiers, so it should be
larger than reg_name instead of smaller.
2009-05-07 14:44:22 +02:00
Henri Verbeet 65622a052c wined3d: Create a struct wined3d_shader_version to store version information.
The version tokens in SM1-3 and SM4 are similar, but not the same.
2009-05-07 14:44:21 +02:00
Stefan Dösinger f5e24f7a85 wined3d: Implement texldd.
GL_ARB_shader_texture is supported on dx9 ATI cards(and probably dx10
ones too). For Nvidia cards I included a fallback to normal texld.
GL_EXT_gpu_shader4 supports similar texture*Grad GLSL functions, just
with an EXT prefix instead of ARB. For dx9 NV cards we'd have to use
GL_NV_fragment_program2, which supports a texldd equivalent on those
cards.
2009-05-05 14:12:52 +02:00
Henri Verbeet 2a5a6a3439 wined3d: Store the SM 1-3 opcode information tables in the SM 1-3 frontend. 2009-05-05 11:34:28 +02:00
Henri Verbeet 2378108eb9 wined3d: Create a frontend for parsing shaders. 2009-05-04 12:53:08 +02:00
Stefan Dösinger 10ad2e8e03 wined3d: Hardcode local loop control ints into the code in reps.
This helps the compiler to unroll the loop and dodges a crash on OSX. It is
similar to what we do in "loop aL, iX" already.
2009-04-29 13:35:54 +02:00
Henri Verbeet 8d4c90496f wined3d: Store the sampler type in struct shader_reg_maps.
Instead of the usage token.
2009-04-29 13:08:01 +02:00
Henri Verbeet b8b12d2dc2 wined3d: Mask set bool/int constants with bool/int constants read. 2009-04-28 13:10:02 +02:00
Henri Verbeet e001876163 wined3d: Create a separate function to record register usage. 2009-04-28 13:10:02 +02:00
Stefan Dösinger 7ab6c22f5a wined3d: Support the full amount of constants in GLSL.
This patch advertises all GL reported float uniforms to the D3D app to
reach the 256 constants required by Shader Model 3.0 on dx9 cards. If
the shader does not use indirect addressing, all 256 constants are
declared. The compiler can then figure out which constants are
actually used. This makes shaders work that use high constant indices,
but don't use all 256 constants.
2009-04-27 13:24:00 +02:00
Henri Verbeet 35499d0c3c wined3d: Handle the opcode specific control shift in the frontend rather than the backend. 2009-04-24 11:52:28 +02:00
Henri Verbeet fec1fa93cf wined3d: Handle the swizzle shift in the frontend rather than the backend. 2009-04-22 13:14:14 +02:00
Henri Verbeet baf2f94b76 wined3d: Get rid of the WINED3DVS_* swizzle constants.
They're redundant.
2009-04-22 13:14:09 +02:00
Henri Verbeet 629801bccb wined3d: Get rid of the token field from struct wined3d_shader_src_param. 2009-04-22 13:14:03 +02:00
Henri Verbeet 88c80635c2 wined3d: Pass a struct wined3d_shader_src_param to shader_glsl_get_swizzle(). 2009-04-21 14:00:11 +02:00
Henri Verbeet 612c32ea08 wined3d: Add a separate function for converting swizzles to strings. 2009-04-21 14:00:06 +02:00
Henri Verbeet db5ab97125 wined3d: Store the source swizzle in struct wined3d_shader_src_param. 2009-04-21 14:00:02 +02:00
Henri Verbeet 7f58b906dd wined3d: Explicitly pass the source modifier to shader_glsl_gen_modifier(). 2009-04-21 13:57:04 +02:00
Francois Gouget 5ef481922f Assorted spelling fixes. 2009-04-20 15:25:26 +02:00
Henri Verbeet 48a096a638 wined3d: Pass a struct wined3d_shader_src_param to shader_glsl_add_src_param(). 2009-04-20 14:13:20 +02:00
Henri Verbeet c7660c57a0 wined3d: Pass a struct wined3d_shader_src_param to shader_glsl_get_register_name() for the relative addressing token. 2009-04-20 14:13:12 +02:00
Henri Verbeet 915b91757f wined3d: Store the destination relative addressing token as a struct wined3d_shader_src_param. 2009-04-20 14:13:08 +02:00
Henri Verbeet 0663eb9323 wined3d: Store the source relative addressing token as a struct wined3d_shader_src_param. 2009-04-20 14:13:00 +02:00
Henri Verbeet d6ee7d59a8 wined3d: Create a relative addressing token for 1.x shaders in the frontend.
Rather than handling this in the backends. Note that the ARB backend always
assumes 1.x shaders.
2009-04-20 14:12:52 +02:00
Henri Verbeet 8ac4c98be2 wined3d: Store the source modifiers in struct wined3d_shader_src_param. 2009-04-15 15:57:35 -05:00
Henri Verbeet b6668b0296 wined3d: Store the register index in struct wined3d_shader_src_param. 2009-04-15 15:57:30 -05:00
Henri Verbeet 4de1dba2c5 wined3d: Store the register type in struct wined3d_shader_src_param. 2009-04-15 15:57:25 -05:00
Henri Verbeet ff62cab537 wined3d: Introduce struct wined3d_shader_src_param. 2009-04-15 15:57:19 -05:00
Henri Verbeet 463de24e7b wined3d: Group instruction context information together in struct wined3d_shader_context. 2009-04-15 15:57:13 -05:00
Henri Verbeet a7e2c2d70c wined3d: Don't die if a vertex shader has samplers.
This fixes a regression introduced by 38239be58c.
2009-04-15 15:57:00 -05:00
Henri Verbeet d3fc7dca99 wined3d: Get rid of the "token" field from struct wined3d_shader_dst_param. 2009-04-14 15:25:07 -05:00
Tobias Jakobi 0c2514bd8f wined3d: Rename some NP2 fixup variables and update comments. 2009-04-13 17:32:11 -05:00
Tobias Jakobi 6e970c5d95 wined3d: glsl: Enable load_np2fixup_constants. 2009-04-10 14:00:58 +02:00
Tobias Jakobi 9b067a6ca5 wined3d: Add load_np2fixup_constants function to shader backend. 2009-04-10 14:00:50 +02:00
Stefan Dösinger 754b5cf2ad wined3d: Deal with reserved shader constants in the backend.
This moves the GLSL and ARB specific reserved constants out of directx.c into
the get_caps methods of the shader backends. That way the number of reserved
constants remains in the backend.

GL_LIMITS({v/p}shader_constantsF) now contains the real number of constants as
advertised by GL instead of some mixture of GL info and backend implementation
specifics. This makes it easier for backends to decide how many constants to
use.
2009-04-10 11:22:55 +02:00
Henri Verbeet 62d9dc2177 wined3d: Store the relative addressing mode in struct wined3d_shader_dst_param. 2009-04-10 10:23:20 +02:00
Henri Verbeet 22e57d025c wined3d: Store the destination shift in struct wined3d_shader_dst_param. 2009-04-10 10:23:15 +02:00
Henri Verbeet 3a0eb81cea wined3d: Get rid of a redundant strcat in shader_glsl_get_register_name(). 2009-04-09 11:27:29 +02:00
Henri Verbeet ff58255f4e wined3d: Explicitly pass parameter properties to shader_glsl_get_register_name(). 2009-04-09 11:27:25 +02:00
Henri Verbeet f3e5e92a18 wined3d: Pass a struct wined3d_shader_dst_param to shader_glsl_get_write_mask(). 2009-04-09 11:27:21 +02:00
Henri Verbeet d299f865f7 wined3d: Add a separate function for converting write masks to strings. 2009-04-09 11:27:17 +02:00
Henri Verbeet 2df49ea8ef wined3d: Eliminate a useless local variable. 2009-04-08 11:42:24 +02:00
Henri Verbeet 9ec0b09d35 wined3d: Store usage and usage_idx in struct wined3d_shader_semantic.
Instead of the usage token.
2009-04-08 11:42:19 +02:00
Henri Verbeet a1dedbdf58 wined3d: Properly check if input/output varyings are used. 2009-04-08 11:42:12 +02:00
Henri Verbeet 375780a5a8 wined3d: Fix some more 3 space indentation. 2009-04-08 11:42:05 +02:00
Henri Verbeet d12e489272 wined3d: Store a struct wined3d_shader_dst_param in struct wined3d_shader_semantic. 2009-04-08 11:41:59 +02:00
Henri Verbeet a4c942f606 wined3d: Simplify shader_glsl_cmp() and shader_glsl_cnd(). 2009-04-07 14:22:00 +02:00
Henri Verbeet a374ba54e5 wined3d: Simplify shader_glsl_color_correction(). 2009-04-07 14:21:54 +02:00
Henri Verbeet 0f92bbc6bc wined3d: Store the register type in struct wined3d_shader_dst_param. 2009-04-07 14:21:49 +02:00
Henri Verbeet f7f61a58f4 wined3d: Explicitly pass register type and index to shader_is_scalar(). 2009-04-07 14:21:44 +02:00
Henri Verbeet 6f66c1ddbd wined3d: Store the write mask in struct wined3d_shader_dst_param. 2009-04-07 14:21:37 +02:00
Henri Verbeet f0de1622d0 wined3d: Store the destination modifiers in struct wined3d_shader_dst_param. 2009-04-06 12:57:52 +02:00
Henri Verbeet decc1cec9d wined3d: Pass a pointer to struct wined3d_shader_dst_param to shader_glsl_add_dst_param(). 2009-04-06 12:57:44 +02:00
Henri Verbeet 72aff27e0e wined3d: Pass a pointer to struct wined3d_shader_dst_param to shader_glsl_append_dst_ext(). 2009-04-06 12:57:37 +02:00
Henri Verbeet 91305b1f49 wined3d: Use a more appropriate mask for masking out the write mask. 2009-04-06 12:57:32 +02:00
Henri Verbeet 1120f0f585 wined3d: Unset the current GLSL program when it's destroyed. 2009-04-06 12:57:27 +02:00
Henri Verbeet 7b62165546 wined3d: Store the register index in struct wined3d_shader_dst_param. 2009-04-03 13:01:44 +02:00
Henri Verbeet 7245cd2b81 wined3d: Add a struct wined3d_shader_dst_param for storing destination parameter information. 2009-04-03 13:01:38 +02:00
Henri Verbeet 04b2e0b19b wined3d: Remove the opcode field from struct wined3d_shader_instruction. 2009-04-03 13:01:30 +02:00
Henri Verbeet 7bde2792c2 wined3d: Store the source and destination parameter count in struct wined3d_shader_instruction. 2009-04-02 16:28:29 +02:00
Henri Verbeet 44648b2b91 wined3d: Store the instruction handler index in struct wined3d_shader_instruction.
This allows us to avoid comparing against WINED3DSIO_*, which is specific to
the bytecode.
2009-04-02 16:28:29 +02:00
Henri Verbeet fb6547a3e1 wined3d: Compare num_params against 1 in shader_glsl_map2gl().
num_params includes the destination parameter, while we're only interested in
source parameters. This doesn't cause problems for any of the instrctions
currently handled by shader_glsl_map2gl() though, since they all happen to
have at least 1 source parameter.
2009-04-02 16:28:29 +02:00
Henri Verbeet c697bdc3a1 wined3d: Remove some code that doesn't make a whole lot of sense.
The "instr" parameter to shader_glsl_gen_modifier() is actually a source
parameter, so comparing against WINED3DSIO_TEXKILL is just silly.
2009-04-02 16:28:29 +02:00
Henri Verbeet c3a01b315e wined3d: Use a more reasonable name for "SHADER_OPCODE_ARG". 2009-04-01 14:24:19 +02:00
Henri Verbeet ec43489e10 wined3d: Don't use the opcode_token field in the GLSL backend.
The idea is that we want to prevent backends from parsing the tokens
themselves, which is pretty much a requirement for adding SM4 support.
2009-04-01 14:23:56 +02:00
Tobias Jakobi 38239be58c wined3d: GLSL: Implement texrect coord fixup. 2009-03-31 12:40:21 +02:00
Henri Verbeet 42e31a4242 wined3d: Fix a few sign compare warnings. 2009-03-25 11:12:30 +01:00
Henri Verbeet 2219749ae9 wined3d: Explicitly pass the texUnitMap to shader_glsl_load_vsamplers() and shader_glsl_load_psamplers().
The general idea here is to reduce dependencies on the entire stateblock, and
pass the real dependencies explicitly. This should make it clearer what
context a shader really needs.
2009-03-12 13:09:55 +01:00
Henri Verbeet 67da604eca wined3d: Get rid of a few stack buffers. 2009-03-10 12:07:02 +01:00
Henri Verbeet 1fa83c95de wined3d: Don't call shader_glsl_append_dst() from shader_glsl_texldl().
shader_glsl_gen_sample_code() already takes care of adding the destination.
2009-03-10 12:06:47 +01:00
Henri Verbeet 695c69f6a0 wined3d: Use shader_glsl_get_write_mask_size() to calculate the write mask size. 2009-03-09 14:39:48 +01:00
Henri Verbeet 4ff5736edf wined3d: Don't compare texUnitMap entries to -1. 2009-03-09 14:39:34 +01:00
Henri Verbeet 703ef0de02 wined3d: Use flags for shader_glsl_get_sample_function().
Having three BOOL parameters looks a bit awkward.
2009-03-04 12:07:20 +01:00
Stefan Dösinger 8781174a98 wined3d: Create a common sampling function in GLSL.
This way the individual instruction handlers don't have to bother about the
color correction, and there's now a single place to implement fixup dependent
sampling writemask selection.
2009-02-27 13:14:46 +01:00
Stefan Dösinger d7a6859960 wined3d: Make shader_glsl_get_sample_function aware of *Lod functions. 2009-02-27 13:14:33 +01:00
Stefan Dösinger 5cf764aec2 wined3d: Put the color_correction calls into the instruction handlers.
The color correction cannot be done behind the back of the individual
instruction handlers because it might conflict with the instruction's
color modifications and the D3D provided writemask.
2009-02-27 13:14:23 +01:00
Francois Gouget 83d18602d8 wined3d: Add a trailing '\n' to shader_addline() calls. 2009-02-12 17:53:35 +01:00
Stefan Dösinger 66778ed9ec wined3d: Implement EXP and EXP2 fog in GLSL. 2009-02-11 12:21:51 +01:00
Stefan Dösinger 693d9ded47 wined3d: Properly set the fog frag coord according to the FOGTABLEMODE.
This also fixes the test that an earlier patch broke, so the todo_wine can be
removed again.
2009-02-11 12:21:44 +01:00
Stefan Dösinger 8dcd51286d WineD3D: Put vertex shader duplication infrastructure in place. 2009-02-11 12:21:25 +01:00
Michael Stefaniuc 118c75a8c7 wined3d: Remove superfluous pointer casts. 2009-02-03 12:40:14 +01:00
Stefan Dösinger 3c3272dc41 wined3d: Don't single-allocate new gl shaders. 2009-01-20 12:45:09 +01:00
Henri Verbeet 5d875906c1 wined3d: Remove some superfluous pointer casts. 2009-01-20 12:34:05 +01:00
Stefan Dösinger 7c21147dcd wined3d: Remove the pixelshader fogstart/fogend optimization. 2009-01-12 13:01:49 +01:00
Henri Verbeet 6791e6b752 wined3d: Simplify handling of swizzled attributes.
This should also be a little bit faster.
2009-01-08 13:21:43 +01:00
Henri Verbeet 3c14b3936f wined3d: Don't bother with the GLSL info log if nobody's looking. 2009-01-03 14:55:30 +01:00
Henri Verbeet 2e0212e998 wined3d: Fix the line number for some fglrx spam.
We added a #version line a while ago, so the line number for the
warning changed.
2009-01-03 14:55:30 +01:00
Henri Verbeet 2b926db50d wined3d: Make use_vs() and use_ps() work on a stateblock instead of a device.
Most callers work on a stateblock rather than a device, and the main fields
we check (vertexShader and pixelShader) are part of the stateblock as well.
2008-12-31 12:25:56 +01:00
Henri Verbeet 4a19d893e5 wined3d: Only apply shader constants that changed.
This improves performance a bit for applications that use a lot of
shaders with a lot of constants.
2008-12-20 11:11:45 +01:00
Stefan Dösinger 690cbe76ac wined3d: Make pixelshaders disable fog properly.
This is a first step towards cleaning up the fog mess. The fog
parameter is added to the pixelshader compile args structure. That way
multiple pshaders are compiled for different fog settings, and the
pixel shader can remove the fog line if fog is not enabled. That way
we don't need special fog start and end settings, and this allows us
to implement EXP and EXP2 fog in the future too.
2008-12-19 17:17:16 +01:00
Stefan Dösinger 7d92b54a97 wined3d: Use the ps_compile_args struct in glsl. 2008-12-19 17:17:04 +01:00
Stefan Dösinger 30d542c3dd wined3d: Make use of the ps_compile_args structure in glsl_shader.
Only a first step, many more occasions need fixing. This is an easy
one though.
2008-12-19 17:16:50 +01:00
Stefan Dösinger 61e581abb4 wined3d: Pass the ps_compile_args structures to the shader generation code. 2008-12-19 17:16:39 +01:00
Henri Verbeet d099dde7a9 wined3d: Track shader constants in the shader backend. 2008-12-18 13:17:02 +01:00
Henri Verbeet 73823ef5f6 wined3d: Remove the shader_cleanup() method from the shader backend. 2008-12-17 14:02:24 +01:00
Henri Verbeet 8553665cb1 wined3d: Move the shader version to reg_maps. 2008-12-15 14:00:26 +01:00
Stefan Dösinger 4916cd5478 wined3d: Don't load INT and BOOL constants needlessly. 2008-12-11 14:06:04 +01:00
Henri Verbeet b409061337 wined3d: Make some constant arrays also static.
As pointed out by Dan Kegel.
2008-12-10 10:50:37 +01:00
Henri Verbeet 4997bee1bf wined3d: Add functions to initialize and free shader buffers. 2008-12-09 11:27:13 +01:00
Henri Verbeet a13df0e4ef wined3d: Explicitly pass the version and instruction table to shader_get_opcode(). 2008-12-05 11:59:02 +01:00
Henri Verbeet 89139b7589 wined3d: Make shader texture format fixups more generic.
Based on a patch by Stefan Dösinger. This is more flexible, and allows
the shader backend implementation to be simpler, since it doesn't have
to know about specific formats. The next patch makes use of this.
2008-12-04 11:59:58 +01:00
Henri Verbeet 9f2fa8ba25 wined3d: Remove sampled_format from IWineD3DBaseShaderClass, it isn't used anywhere. 2008-12-04 11:59:14 +01:00
Henri Verbeet 70968e69ac wined3d: Use a bitmask to store which bool and int constants are set.
Note that constants_set was never actually NULL for
shader_glsl_load_constantsB() and shader_glsl_load_constantsI().
2008-12-03 09:49:10 +01:00
Andrew Talbot 89509eb628 wined3d: Sign-compare warnings fix. 2008-12-01 14:25:52 +01:00
Henri Verbeet fecfddfb3a wined3d: Const correctness fixes for glsl_shader.c. 2008-11-26 12:05:21 +01:00
Henri Verbeet d8f6e63541 wined3d: Const correctness fixes for arb_program_shader.c. 2008-11-26 12:05:14 +01:00
Henri Verbeet cfb3bea895 wined3d: Make the SHADER_OPCODE_ARG parameter to shader handlers const. 2008-11-26 12:05:06 +01:00
Henri Verbeet eb78c2a082 wined3d: Const correctness fixes for utils.c. 2008-11-26 12:04:56 +01:00
Stefan Dösinger 2f98fce9cf wined3d: Put the ps compile parameters into the glsl program hashmap.
This avoids the double search for a pixel shader. The pixel shader
compilation parameter structure is recorded in the GLSL program
hashmap, together with the WineD3D pixel shader.
2008-11-25 13:07:23 +01:00
Stefan Dösinger 0bf32b12f5 wined3d: Add the ability to duplicate GL pixel shaders.
Some stateblock parameters have to be compiled into the GL pixel
shader code, like lines for pixelformat fixups. This leads to problems
when applications switch those settings, requiring a recompilation of
the shader. This patch enables wined3d to have multiple GL shaders for
a D3D shader(pixel shaders only so far) to handle this more
efficiently.
2008-11-25 13:07:03 +01:00
Stefan Dösinger aed9305c78 wined3d: Store shader IDs in the vs and ps impl structures. 2008-11-25 13:06:45 +01:00
Stefan Dösinger dd8905543b wined3d: Pass some stateblock values around directly.
This was suggested by Ivan quite a while ago, and we need it to better
handle conflicting texture format corrections and similar stateblock
value changes which until now required a recompilation of the entire
shader
2008-11-25 13:06:35 +01:00
Stefan Dösinger ff767f4984 wined3d: Make the shader backend call CompileShader.
A number of considerations contribute to this:

1) The shader backend knows best which shader(s) it needs. GLSL needs
both, arb only one
2) The shader backend may pass some parameters to the compilation
code(e.g. which pixel format fixup to use)
3) The structures used in (2) are different in vs and ps, so a
baseshader::Compile won't work
4) The structures in (2) are wined3d-private structures, so
having a public method in the vtable won't work(its a bad idea
anyway).
2008-11-25 13:06:23 +01:00
Stefan Dösinger 620a423b22 wined3d: Kill the GL_ATI_envmap_bumpmap code.
GL_ATI_envmap_bumpmap provides two things: Signed V8U8 pixel formats,
and bump mapping. The extension is only supported on fglrx, and this
driver also supports GL_ARB_fragment_program.  Thus the bump mapping
code is never used on any driver out there.  Furthermore, if it is
used, it tends to crash the driver

The signed pixel format is used, as it can be used by pixel shaders or
the ARBfp replacement. However, the format is broken in fglrx, and
negative values are clamped to 0.0. This results in test
failures. WineD3D has an alternative codepath using scale+bias to
enable V8U8 using a standard signed RGB which works correctly on
fglrx.
2008-11-04 11:41:14 +01:00