Commit Graph

893 Commits

Author SHA1 Message Date
Henri Verbeet e41831990d wined3d: Fix a sign compare warning in glsl_shader.c. 2009-07-08 20:14:35 +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 50e9ad66e2 wined3d: Clear the last device in WineD3D_CreateFakeGLContext(). 2009-07-02 12:00:44 +02:00
Henri Verbeet 40bc47901c wined3d: Use flags for driver quirks. 2009-07-01 11:41:44 +02:00
Stefan Dösinger 5859d87754 wined3d: Implement function calls with NV exts. 2009-06-29 12:28:21 +02:00
Stefan Dösinger bd14b6e2b4 wined3d: IFC requires GL_NV_fragment_program2. 2009-06-26 12:01:44 +02:00
Tobias Jakobi 7906774339 wined3d: Add ps_np2fixup_info structure. 2009-06-25 14:34:13 +02:00
Stefan Dösinger 85af0b2943 wined3d: Don't emulate clipplanes with ffp vp and fix a wrong if condition.
b2f09fd204 accidentally got the
device->vs_clipping check wrong. The FFP replacement should emulate
clipping if GL can't do this natively with vertex shaders, not the
other way. Also don't emulate clipping if we're using fixed function
vertex processing because (a) clipping is always supported by GL in
this case, and (b), fragment.texcoord[7] is undefined. (Or in the
worst case set to something bad by the app).
2009-06-23 15:53:00 +02:00
Stefan Dösinger 26d17fe04c wined3d: Implement MRTs in ARB. 2009-06-22 11:26:43 +02:00
Stefan Doesinger cd348ac897 wined3d: Use bitfields for reg_maps uses* members. 2009-06-17 12:19:45 +02:00
Stefan Doesinger 58c3a0c832 wined3d: Implement vpos and vface. 2009-06-17 12:19:31 +02:00
Stefan Doesinger ae600fe0c8 wined3d: Implement texldl in ARB. 2009-06-17 12:19:15 +02:00
Stefan Doesinger c220bafa2c wined3d: Unroll loops in ARB if needed.
This is needed to allow us to claim vs_2_0 support with plain
GL_ARB_vertex_program. vs_2_0 allows loops without breaks.
2009-06-16 13:57:04 +02:00
Henri Verbeet 23231d5a62 wined3d: Add format conversions for some depth stencil formats.
Although these formats aren't lockable, we still explicitly set the initial
surface data when creating the texture. Unfortunately that means we'll need
the conversion functions, even though all they'll ever convert will be zeroes.
2009-06-16 13:37:06 +02:00
Henri Verbeet fede35d1c5 wined3d: Introduce surface_calculate_size(). 2009-06-15 13:42:28 +02:00
Henri Verbeet 5f581975dc wined3d: Introduce surface_init() to handle most of the surface initialization. 2009-06-15 13:42:28 +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 61fd875bb4 wined3d: Store compression information about compressed formats. 2009-06-10 11:51:04 +02:00
Henri Verbeet fb7531599f wined3d: Only use stretch_rect_fbo() on surfaces that are FBO attachable. 2009-06-05 15:19:35 +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 97f320a77b wined3d: Introduce volumetexture_init() to handle most of the volume texture initialization. 2009-06-03 11:39:16 +02:00
Henri Verbeet b0ba731bd5 wined3d: Introduce cubetexture_init() to handle most of the cube texture initialization. 2009-06-03 11:39:04 +02:00
Henri Verbeet 5171a65d81 wined3d: Introduce texture_init() to handle most of the 2D texture initialization. 2009-06-03 11:38:50 +02:00
Henri Verbeet 451a416fcf wined3d: Call resource_init() from basetexture_init(). 2009-06-02 11:57:22 +02:00
Stefan Dösinger de12f880ce wined3d: Don't enable the NV frag extensions if we don't need them.
Enabling the NV extensions occupies a temp register for some reason. Avoid
needlessly enabling it.
2009-06-01 16:16:00 +02:00
Stefan Dösinger d8e219be75 wined3d: Avoid the TMP_COLOR mov in some cases.
Many 2.0 and 3.0 shaders end with a "mov oC0, rx". If sRGB writing is enabled,
the ARB backend writes to a TMP_COLOR temporary, and at the end of the shader
writes the sRGB corrected color to result.color. If oC0 is not partially
rewritten after the mov, we can ignore the mov, not declare TMP_COLOR at all,
and just use the rx register as input for the sRGB correction code. This saves
a temporary and an instruction.
2009-05-29 11:27:44 +02:00
Henri Verbeet 5654544725 wined3d: Add device resources from resource_init().
This is consistent with removing them from resource_cleanup().
2009-05-29 11:26:44 +02:00
Henri Verbeet 5e0f541621 wined3d: Remove ResourceReleased() from the public device interface. 2009-05-29 11:26:38 +02:00
Stefan Dösinger e70c80add9 wined3d: Emulate if(bool) in ARB shaders. 2009-05-28 12:46:01 +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 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
Stefan Dösinger 0629585c24 wined3d: Work around an ARBFP vs GLSL bug in Mac OS. 2009-05-27 11:57:54 +02:00
Henri Verbeet 2ee0d47a49 wined3d: Use strings for shader input/output semantics. 2009-05-27 11:12:12 +02:00
Henri Verbeet 19cb4594e3 wined3d: Use a separate structure for vertex shader attributes.
In D3D10 shaders input/output semantics are strings rather than predefined
types. Unfortunately, the code in vshader_get_input() can be performance
critical, depending on application behaviour. Since vshader_get_input() is
only relevant for d3d9 shaders anyway, just store the usage and usage_idx for
these shaders.
2009-05-27 11:12:07 +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
Stefan Dösinger 7b1d48721d wined3d: Emulate the 4 component address register in ARB. 2009-05-20 10:55:17 +02:00
Stefan Dösinger c7ca3793cc wined3d: Implement mova rounding in arb. 2009-05-20 10:55:03 +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 5d63179404 wined3d: Remove some unused defines. 2009-05-15 10:25:48 +02:00
Francois Gouget 514c5f2648 wined3d: Make surface_force_reload() static. 2009-05-13 12:45:36 +02:00
Rico Schüller 2ef751883d wined3d: Add UnregisterClass() on DLL_PROCESS_DETACH. 2009-05-12 12:33:57 +02:00
Henri Verbeet 0d446053da wined3d: Don't create more than WINED3D_MAX_FBO_ENTRIES FBO entries.
This essentially turns the FBO entry list into an LRU cache.
2009-05-12 11:18:15 +02:00
Henri Verbeet 9a579a43b1 wined3d: Use the output signature to map SM4 pixel shader outputs to the appropriate register. 2009-05-11 12:43:00 +02:00
Stefan Dösinger 2fd485ae31 winedd: Move shader_*_add_instruction_modifiers into the shader backend. 2009-05-08 12:20:18 +02:00
Stefan Dösinger f9276a6429 wined3d: Keep track of used float constants. 2009-05-08 12:15:15 +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 5e473cb17f wined3d: Group register information into struct wined3d_shader_register. 2009-05-08 12:13:17 +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
Henri Verbeet 5c63d93e18 wined3d: Store the shader version in the frontend's private data. 2009-05-07 14:44:21 +02:00
Henri Verbeet 9381a41681 wined3d: Add an initial shader_sm4_read_src_param() implementation. 2009-05-06 12:21:05 +02:00
Henri Verbeet 699eae0cf7 wined3d: Shift the writemask in the frontend. 2009-05-06 12:20:57 +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 454dd2ed07 wined3d: Implement shader_sm4_is_end(). 2009-05-05 11:34:39 +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 868f5bfc7c wined3d: Handle reading the shader header in the frontend.
In SM 1-3 this is just the version, in SM4 this also includes the token count.
2009-05-05 11:34:15 +02:00
Henri Verbeet ef074cdde1 wined3d: Introduce a stubbed SM4 shader frontend. 2009-05-05 11:34:07 +02:00
Henri Verbeet dddd1f0211 wined3d: Select the frontend based on the version token. 2009-05-04 12:53:16 +02:00
Henri Verbeet 5f96c0083a wined3d: Add a frontend function to determine if there are any tokens left. 2009-05-04 12:53:12 +02:00
Henri Verbeet 2378108eb9 wined3d: Create a frontend for parsing shaders. 2009-05-04 12:53:08 +02:00
Henri Verbeet 5a7afd9b2a wined3d: Move SM 1-3 parsing functions to their own file. 2009-05-04 12:53:04 +02:00
Henri Verbeet 7420a96736 wined3d: Merge wined3d_private_types.h into wined3d_private.h. 2009-05-01 13:11:57 +02:00
Henri Verbeet 65321dd1ce wined3d: Introduce shader_sm1_read_semantic(). 2009-04-29 13:08:08 +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
Stefan Dösinger 8513f64a01 wined3d: Emulate R16G16F and R32G32F if GL_ARB_texture_rg is not supported.
Nvidia doesn't offer it on geforce 7 and earlier cards, but some games need
it. This is surprising because the extension was made specifically for
compatibility purposes for older cards.
2009-04-28 13:10:03 +02:00
Henri Verbeet d32d308798 wined3d: Remove some redundant defines. 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
Henri Verbeet 2b07565d6e wined3d: Store D3D shader opcode names in a separate table. 2009-04-27 13:25:09 +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 2dcfdd5b55 wined3d: Use a more reasonable limit for the number of mipmap levels.
256 is quite ridiculous, considering the dimensions are only UINTs. Perhaps
these arrays should be dynamically allocated in the first place though.
2009-04-24 11:52:51 +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 d6494ad00c wined3d: Move some frontend specfic code to baseshader.c. 2009-04-23 14:22:06 +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 db5ab97125 wined3d: Store the source swizzle in struct wined3d_shader_src_param. 2009-04-21 14:00:02 +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 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 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 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
Stefan Dösinger 014c4bfc70 wined3d: Save some memory in vertex buffers.
In most cases we're fine with the vbo and glMapBuffer and never use the actual
heap memory copy. Try to stick to just the vbo copy and avoid allocating the
extra heap memory. In case it is needed(emulation or vertex conversion), fall
back to the old double buffering mode.
2009-04-10 11:14:32 +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
Stefan Dösinger cb1c9dcda9 d3d: Remove the format from index buffers. 2009-04-09 16:28:25 +02:00
Stefan Dösinger f0efa97413 wined3d: Remove the buffer fvf. 2009-04-09 16:28:10 +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 d12e489272 wined3d: Store a struct wined3d_shader_dst_param in struct wined3d_shader_semantic. 2009-04-08 11:41:59 +02:00
Stefan Dösinger 513a493f00 wined3d: Merge IWineD3DIndexBuffer and IWineD3DBuffer. 2009-04-08 11:37:29 +02:00
Stefan Dösinger 2a7a237170 wined3d: Merge indexbuffer and buffer implementations. 2009-04-08 11:37:24 +02:00