Commit Graph

3305 Commits

Author SHA1 Message Date
Stefan Dösinger df5d82dd5b wined3d: Pack ARB srgb constants better.
There's no need to waste constants for repeatedly loading the same value.
2009-05-05 14:13:20 +02:00
Stefan Dösinger d2e12a19ca wined3d: Make use of GL_ARB_half_float_vertex.
This extension is a subset of GL_NV_half_float that defines support
for the stream format(same constant), but doesn't define texture
formats or immediate mode entrypoints.
2009-05-05 14:13:02 +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 15a2a5eea6 wined3d: Add a minimal implementation of shader_sm4_read_opcode(). 2009-05-05 11:34:21 +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 6eb43e35c9 wined3d: Get rid of the remaining WINED3DSP_REGNUM_MASK usage. 2009-05-04 12:52:59 +02:00
Henri Verbeet 5e072395b4 wined3d: Avoid using WINED3DSP_REGNUM_MASK in the def/defi/defb handlers. 2009-05-01 13:12:08 +02:00
Henri Verbeet a605fcd2fd wined3d: Introduce shader_sm1_read_comment() to read shader comments. 2009-05-01 13:12: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 59705b9c20 wined3d: Use the shader_sm1_read_*() functions in shader_trace_init(). 2009-05-01 13:11:42 +02:00
Henri Verbeet 752d80400d wined3d: Merge shader_dump_arr_entry() into shader_dump_register(). 2009-05-01 13:11:37 +02:00
Henri Verbeet 53169b98d2 wined3d: Define GL_FENCE_APPLE to the correct value. 2009-04-30 12:48:03 +02:00
Henri Verbeet bf4f7bf34a wined3d: Split shader_dump_param() in shader_dump_src_param() and shader_dump_dst_param(). 2009-04-30 12:47:59 +02:00
Henri Verbeet 54a3054e5a wined3d: Pass a struct wined3d_shader_semantic to shader_dump_decl_usage(). 2009-04-30 12:47:56 +02:00
Henri Verbeet 032b8d4c02 wined3d: Explicitly pass register type, index, etc. to shader_dump_param(). 2009-04-30 12:47:52 +02:00
Henri Verbeet 18df05eb34 wined3d: Explicitly pass the register type and index to shader_get_float_offset(). 2009-04-30 12:47:44 +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 88b6d5eb0b wined3d: Relative addressing tokens are always source parameters.
So the "is_src" argument to shader_dump_arr_entry() is redundant (and wrong).
2009-04-29 13:08:29 +02:00
Henri Verbeet 52644ab053 wined3d: The "input" parameter to shader_dump_param() should be a BOOL.
It's used to determine if the token is a source or destination parameter. A
subsequent patch will split shader_dump_param() in two different functions.
2009-04-29 13:08:22 +02:00
Henri Verbeet 42a8041cb8 wined3d: Handle the sampler type shift in the frontend. 2009-04-29 13:08:14 +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 25a59fe71b wined3d: Set the max mipmap level in the pbo test.
fglrx refuses to use PBOs on not mipmap complete textures. The texture code
already takes care of this, do the same in the test.
2009-04-28 13:10:03 +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
Stefan Dösinger 1fbc6e560d wined3d: Fix an issue in buffer_get_sysmem.
Checking for the doublebuffer flag can cause confusion if no VBO has
been allocated for the buffer. Checking for allocatedMemory is the
more direct approach.
2009-04-28 13:10:03 +02:00
Stefan Dösinger 926fe798c5 wined3d: Activate a thread before mapping a buffer.
This fixes a regression in EverQuest 2.
2009-04-28 13:10:02 +02:00
Stefan Dösinger 3dc55010ea wined3d: Fix a few more direct buffer accesses. 2009-04-28 13:10:02 +02:00
Henri Verbeet d32d308798 wined3d: Remove some redundant defines. 2009-04-28 13:10:02 +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 9db67a5971 wined3d: Clear reg_maps in shader_get_registers_used() instead of the callers. 2009-04-28 13:10:02 +02:00
Henri Verbeet 0df4514894 wined3d: Use shader_sm1_read_dst_param() and shader_sm1_read_src_param() in shader_get_registers_used(). 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 abc253f52f wined3d: Add a function to read a destination parameter from SM1-3 bytecode. 2009-04-27 13:25:26 +02:00
Henri Verbeet 4e97e430d9 wined3d: Add a function to read a source parameter from SM1-3 bytecode. 2009-04-27 13:25:21 +02:00
Henri Verbeet 15953b94b6 wined3d: Use shader_sm1_read_opcode() in shader_trace_init(). 2009-04-27 13:25:16 +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
Stefan Dösinger 9f1731edb6 d3d: Limit d3d8 and d3d9 vshader constants to 256.
DX10 cards support 512(ATI) or 1024(Nvidia) vertex shader constants in
GL. The dx9 DXCapsViewer shows that dx10 windows drivers only claim
256 constants on Windows, so we can and should do the same.
2009-04-27 13:23:36 +02:00
Henri Verbeet 19b84ffda1 wined3d: Use shader_sm1_read_opcode() in shader_get_registers_used(). 2009-04-24 11:53:18 +02:00
Henri Verbeet 521fcf11db wined3d: Add a function to read an opcode from SM1-3 bytecode. 2009-04-24 11:53:12 +02:00
Henri Verbeet e63bd2ce21 wined3d: The first shader token should be the version token. 2009-04-24 11:53: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
David Adam 33eb939390 wined3d: SetDepthStencilSurface is always called when AutoDepthStencil is enabled. 2009-04-24 11:51:27 +02:00
Francois Gouget 6376941266 wined3d: Avoid using an implicit value to set fogcoord to 0.0. 2009-04-23 18:14:27 +02:00
Henri Verbeet 6f33b97c94 wined3d: Get rid of the shared_handle parameter.
I don't expect us to support this in the near future, and right now it's just
dead code.
2009-04-23 14:22:06 +02:00
Henri Verbeet f88bd17ef6 wined3d: Downgrade an ERR to a WARN. 2009-04-23 14:22:06 +02:00
Henri Verbeet fba6f871cf wined3d: Move frontend specfic constants to baseshader.c. 2009-04-23 14:22:06 +02:00
Henri Verbeet d6494ad00c wined3d: Move some frontend specfic code to baseshader.c. 2009-04-23 14:22:06 +02:00
Henri Verbeet fc60083ed2 wined3d: Handle the destination modifier shift in the frontend rather than the backend. 2009-04-23 14:22:06 +02:00
Henri Verbeet cf1bfc8c68 wined3d: Handle the source modifier shift in the frontend rather than the backend. 2009-04-22 13:14:26 +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 7a3d4ce76f wined3d: Pass a struct wined3d_shader_src_param to shader_arb_get_swizzle(). 2009-04-22 13:13:57 +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
Henri Verbeet 644439ff0d wined3d: Pass a struct wined3d_shader_src_param to pshader_gen_input_modifier_line(). 2009-04-21 13:56:58 +02:00
Stefan Dösinger de4f3dc8e8 wined3d: Merge match_apple and implementation_is_apple. 2009-04-20 16:39:55 +02:00
Stefan Dösinger 39877a2ad2 wined3d: Reserve additional GLSL constants on some drivers.
Some drivers apparently need private constants, or don't have an efficient
immval packing. For example, MacOS seems to need 1 float for each different
relative addressing offset. fglrx has the same issue, although it is more
efficient in general

Previously this worked on most drivers because the 16 + 4 reserved int and
bool constants kept the problem hidden. Now that we are more aggressive with
uniforms we have to keep free room for some drivers.
2009-04-20 16:38:39 +02:00
Stefan Dösinger 78d26a659d wined3d: Move the remaining quirks into the quirk table. 2009-04-20 16:38:07 +02:00
Stefan Dösinger 50e91f8d84 wined3d: Move the generic mac glsl uniform fixup to the quirk table. 2009-04-20 16:37:46 +02:00
Stefan Dösinger 7b7f027221 wined3d: Add a more formal framework for driver quirks.
This allows better defining of driver desc fixups without adding extra if
lines for each card.

For starters, there's a fixup for the advertised GLSL constants in ATI cards.
fglrx advertises 512 GLSL uniforms instead of the supported 1024(means 128
instead of 256 vec4's). This bug was confirmed by ATI.
2009-04-20 16:37:31 +02:00
Francois Gouget 5ef481922f Assorted spelling fixes. 2009-04-20 15:25:26 +02:00
Henri Verbeet ea0b3b42eb wined3d: Pass a struct wined3d_shader_src_param to shader_arb_add_src_param(). 2009-04-20 14:13:33 +02:00
Henri Verbeet 1ae060be4a wined3d: Simplify replicating the .x swizzle in shader_hw_mov().
It becomes even simpler once the swizzle shift and token field are eliminated.
2009-04-20 14:13:28 +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
Henri Verbeet 18cdcc0b7e wined3d: Pass a struct wined3d_shader_dst_param to shader_arb_get_write_mask(). 2009-04-14 15:25:01 -05:00
Roderick Colenbrander f2e2e3e499 wined3d: Report the driver description as reported by the Windows drivers when a device string is entered in our device table. 2009-04-13 17:35:44 -05:00
Roderick Colenbrander c238541656 wined3d: Update Nvidia driver version information. 2009-04-13 17:35:25 -05:00
Tobias Jakobi 0c2514bd8f wined3d: Rename some NP2 fixup variables and update comments. 2009-04-13 17:32:11 -05:00
Tobias Jakobi 9657e81429 wined3d: Add newline to fixme. 2009-04-13 17:32:03 -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
Stefan Dösinger 99d88c15ea wined3d: Fix the drawRectPatch vertex count.
DrawPrimitive now accepts the number of vertices, not the number of
primitives. This code was forgotten in the patch that changed this.
We're drawing triangles, so we are drawing num_primitives * 3 vertices.
2009-04-10 11:14:45 +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 3a5bbe6a0c wined3d: Split vshader_program_add_param() in shader_arb_add_src_param() and shader_arb_add_dst_param(). 2009-04-10 10:23:38 +02:00
Henri Verbeet e6031afdfa wined3d: Merge pshader_get_register_name() and part of vshader_program_add_param(). 2009-04-10 10:23:33 +02:00
Henri Verbeet 9a28d273bc wined3d: Explicitly pass the register type and index to pshader_get_register_name(). 2009-04-10 10:23:24 +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 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 877e252681 wined3d: Only update the swizzle and use map for streams that are actually used in device_stream_info_from_strided().
This fixes a regression introduced by d7c7c76850
and exposed by ef2d704183. Unfortunately having
EXT_vertex_array_bgra support masks the problem, which is why the regression
tests didn't catch it.
2009-04-09 11:27:10 +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
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
Stefan Dösinger 3ed94329a3 wined3d: Use Map and Unmap for index buffers.
Just a change in name to prepare for the next patch
2009-04-08 11:36:18 +02:00
Stefan Dösinger dc80a3ede5 d3d: Unify WINED3DVERTEXBUFFER_DESC and WINED3DINDEXBUFFER_DESC. 2009-04-08 11:36:02 +02:00
Stefan Dösinger bc07ad0579 d3d8, d3d9: Don't rely on the wined3d buffer type. 2009-04-08 11:35:29 +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
Roderick Colenbrander a932fdcb2f wined3d: Update NVidia pci ids. 2009-04-06 11:16:24 +02:00
Henri Verbeet 6660978b44 wined3d: Use register_idx in the ARB shader backend. 2009-04-03 13:01:50 +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 29c9dc989d wined3d: Use the source and destination parameter count in the ARB shader backend. 2009-04-03 13:01:20 +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 d633b6d47e wined3d: Avoid comparing against WINED3DSIO_* in the ARB shader backend. 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 de4e8cf0f9 wined3d: Avoid a forward declaration. 2009-04-01 14:24:11 +02:00
Henri Verbeet e44335585e wined3d: Don't use the opcode_token field in the ARB backend. 2009-04-01 14:24:02 +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
Henri Verbeet 7f740f2a51 wined3d: Don't leak the swapchain in IWineD3DDeviceImpl_Reset() if the display mode is unsupported. 2009-03-31 12:42:20 +02:00
Henri Verbeet 4ccbc948a1 d3d10core: Set the initial buffer data, when present. 2009-03-31 12:42:07 +02:00
Henri Verbeet 0591442469 wined3d: Care for things like pitch and blocksize when copying DXT surfaces. 2009-03-31 12:42:00 +02:00
Tobias Jakobi 94a7cd42ed wined3d: Simplify sampler_texmatrix using pow2Matrix_identity. 2009-03-31 12:40:30 +02:00
Tobias Jakobi 38239be58c wined3d: GLSL: Implement texrect coord fixup. 2009-03-31 12:40:21 +02:00
Tobias Jakobi 1b335dfaaa wined3d: Add texrect_fixup bitfield to ps_compile_args struct.
Initialization of the bitfield done in find_ps_compile_args
based on the previously introduced pow2Matrix_identity flag.
2009-03-31 12:40:10 +02:00
Tobias Jakobi 31f8cd9621 wined3d: Add pow2Matrix_identity flag to BaseTextureClass struct.
New flag helps to quickly find out whether the pow2Matrix is a
identity matrix (no texcoord fixup needed) or not.
2009-03-31 12:39:27 +02:00
Henri Verbeet 1205c33c90 wined3d: Use the output slot when we have one. 2009-03-30 15:11:29 +02:00
Henri Verbeet ef2d704183 wined3d: Store the format_desc itself in struct wined3d_stream_info_element. 2009-03-30 15:11:24 +02:00
Roderick Colenbrander 5d08f3b705 wined3d: Check for the presence of wglGetExtensionsStringARB. 2009-03-30 15:10:00 +02:00
Stefan Dösinger 3e099d0147 wined3d: Advertise post pixelshader blending for a few more formats.
Windows advertises it on all these formats(Nvidia Geforce 7400), and
Trackmania Nations needs it on D3DFMT_Q8W8V8U8 to accept ps_3_0 support.
2009-03-30 14:22:06 +02:00
Stefan Dösinger 3fbdb64270 wined3d: Update a comment.
shader_select takes care of compiling the shader since we have the shader
duplication infrastructure. However, there's still a motivation to skip the
shader_select call if the vertex shader is dirty.
2009-03-30 14:21:52 +02:00
Stefan Dösinger 703dcca61b wined3d: Fix some whitespace. 2009-03-30 14:21:44 +02:00
Stefan Dösinger 8d4ac8ac1b wined3d: Remove a TODO.
init_materials() doesn't exist, and I don't know what the TODO means with
primitive type (the diffuse stuff is already handled properly).
2009-03-30 14:21:08 +02:00
Henri Verbeet 4434d00f84 wined3d: Unify vertex and texture formats.
Some fields should be redundant now, eg. gl_vtx_type and glType. I'll leave
that for a different patch to fix though.
2009-03-27 15:51:25 +01:00
Henri Verbeet 6f206c75ec wined3d: Don't create an END element for wined3d vertex declarations.
Wined3d doesn't need it since it already has the element count.
2009-03-27 15:51:25 +01:00
Henri Verbeet 9f26fed28d wined3d: Separate the internal representation of vertex declaration elements from the struct used to create it.
Internally we want to store some extra data, like ffp_valid. One of the later
patches also stores the format desc in the declaration elements, instead of
the current WINED3DDECLTYPE.
2009-03-27 15:51:25 +01:00
Henri Verbeet 4330d20d0d wined3d: Remove IWineD3DVertexDeclaration_SetDeclaration() from the public interface. 2009-03-27 15:51:25 +01:00
Henri Verbeet d8a4cc6648 wined3d: Remove IWineD3DVertexDeclarationImpl_GetDeclaration().
It's never used.
2009-03-27 15:51:25 +01:00
Henri Verbeet d7c7c76850 wined3d: Use separate structures for ddraw style strided data and wined3d's internal stream info. 2009-03-27 15:51:25 +01:00
Henri Verbeet 5390628e6f wined3d: Make sure the format actually exists in init_format_texture_info(). 2009-03-27 15:51:24 +01:00
Henri Verbeet 837f163662 wined3d: Create a separate function for setting a format's GL texture info. 2009-03-27 15:50:24 +01:00
Henri Verbeet b8f25ef6f2 wined3d: Create a separate function for setting format fixups. 2009-03-27 15:50:16 +01:00
Henri Verbeet 7874a6b74b wined3d: Create a separate function for checking a format's FBO compatibility. 2009-03-27 15:50:08 +01:00
Henri Verbeet 1407bd6b1a wined3d: Create a separate function for setting basic format info. 2009-03-27 11:23:41 +01:00
Henri Verbeet c0c1c42288 wined3d: Pass the number of components to glVertexBlendARB(). 2009-03-26 14:48:16 +01:00
Henri Verbeet 663e5a6a4c wined3d: Simplify the "transformed" check in state_lighting().
It doesn't really matter if lighting is enabled or not if we don't have
position data.
2009-03-26 14:48:10 +01:00
Henri Verbeet a7d6128547 wined3d: Simplify IWineD3DDeviceImpl_ProcessVertices(). 2009-03-26 14:48:04 +01:00
Henri Verbeet c1a42ff024 wined3d: Simplify remove_vbos(). 2009-03-26 14:47:58 +01:00
Henri Verbeet 6afd97cc9f wined3d: Remove unused attributes from WineDirect3DVertexStridedData.
These are essentially unused, and mostly just complicate the code.
2009-03-26 14:47:52 +01:00
Henri Verbeet 25b60e168a wined3d: Do the ffp_valid check before even trying to use the element. 2009-03-25 11:12:55 +01:00
Henri Verbeet 4469fbd43d wined3d: Don't use rtInternal for surfaces that are on a swapchain.
These surfaces won't be attached to an FBO anyway, so avoid the cost of a
potential format conversion when blitting from a non-RT surface. This is
mostly an issue for ddraw applications with 16 bit render targets.
2009-03-25 11:12:49 +01:00
Henri Verbeet 899df56ebe wined3d: Add a more convenient way to check if a surface is on a swapchain.
This won't help if we actually need the swapchain, of course.
2009-03-25 11:12:40 +01:00
Henri Verbeet 42e31a4242 wined3d: Fix a few sign compare warnings. 2009-03-25 11:12:30 +01:00
Henri Verbeet 59c5962828 wined3d: Make the texunit field in struct stb_const_desc unsigned. 2009-03-25 11:12:13 +01:00
Henri Verbeet 771fe7fd8a wined3d: Implement WINED3DTSS_TCI_SPHEREMAP. 2009-03-25 11:12:07 +01:00
Henri Verbeet 3234a4af2d wined3d: Reduce the number of checkGLcall's in tex_coordindex() a bit. 2009-03-25 11:12:02 +01:00
Henri Verbeet 61cd872fa7 wined3d: Print a FIXME in tex_coordindex() when NV_TEXGEN_REFLECTION isn't supported. 2009-03-25 11:11:57 +01:00
Henri Verbeet f63313fe3e wined3d: Fix the indentation in tex_coordindex().
The indentation here is pretty horrible. Also removes a couple of fairly
useless comments.
2009-03-25 11:11:32 +01:00
Henri Verbeet 8255dde127 wined3d: Print a warning when the stage isn't mapped to a valid texture unit in tex_coordindex(). 2009-03-25 11:11:24 +01:00
Henri Verbeet afc5744e70 wined3d: Pass format_desc to set_shader().
This should be the last unnecessary getFormatDescEntry() call.
2009-03-24 12:57:45 +01:00
Henri Verbeet dd1f0d9c48 wined3d: Pass format_desc to getColorBits() and getDepthStencilBits(). 2009-03-24 12:57:38 +01:00
Henri Verbeet a02d801888 wined3d: Pass format_desc to the Check*Capability() function.
Rather than looking it up all the time.
2009-03-24 12:57:31 +01:00
Henri Verbeet b7744f8158 wined3d: Remove the bytesPerPixel field from IWineD3DSurfaceImpl and IWineD3DVolumeImpl.
We can use the information from format_desc instead.
2009-03-24 12:57:21 +01:00
Henri Verbeet a56a143461 wined3d: Set the byte count for WINED3DFMT_UNKNOWN to 0.
As far as I can tell nothing depends on this being 1, and there's some code
that checks for WINED3DFMT_UNKNOWN and uses 0 for the byte count in that case.
2009-03-24 12:57:12 +01:00
Henri Verbeet 8ce2506aa8 wined3d: Try to make Coverity shut up (CID 863, 905).
Comparing gl_shaders against NULL after potentially dereferencing it a few
lines earlier probably confuses Coverity. Checking num_gl_shaders instead
should avoid this.
2009-03-24 12:56:19 +01:00
Henri Verbeet 1f4e7b27ed wined3d: Set the currently active context to NULL when it's destroyed.
This should make us crash when trying to use the "currently active" context
after it has been destroyed, rather than messing around with freed memory.
2009-03-23 14:08:02 +01:00
Henri Verbeet 89721c2173 wined3d: Compare the actual formats. 2009-03-23 14:08:02 +01:00
Henri Verbeet 24a4503d61 wined3d: Unload resources on Uninit3D().
This should prevent destroying GL objects without a GL context. Eg. when a ddraw
surface has a GL texture and is released after a call to Uninit3D().
2009-03-23 14:07:48 +01:00
Roderick Colenbrander 4544efc972 wined3d: Add a classic WGL pixel format backend as not all OpenGL implementations support WGL_ARB_pixel_format.
This should help for instance VirtualBox.
2009-03-23 13:25:50 +01:00
Roderick Colenbrander 9181ddcd16 wined3d: Add WGL_ARB_pixel_format detection.
Right now we assume that the extension is there but this isn't always
the case. The next patch in this series will add a
non-WGL_ARB_pixel_format codepath to help VirtualBox and others.
2009-03-23 13:25:17 +01:00
Henri Verbeet 2dc7fc2916 wined3d: Remove the format field from IWineD3DResourceClass. 2009-03-13 11:29:19 +01:00
Henri Verbeet a56e3a102b wined3d: Only return a pointer to struct GlPixelFormatDesc from getFormatDescEntry(). 2009-03-13 11:29:10 +01:00
Henri Verbeet 53bf5c2658 wined3d: Add fields from StaticPixelFormatDesc to struct GlPixelFormatDesc.
The idea here is that we should lookup format information in struct
GlPixelFormatDesc, while StaticPixelFormatDesc and GlPixelFormatDescTemplate
will only be used to build the table.
2009-03-13 11:29:01 +01:00
Henri Verbeet fbfc7c9742 wined3d: Remove the width and height fields from IWineD3DTextureImpl. 2009-03-13 11:28:55 +01:00
Henri Verbeet a3657c164d wined3d: Remove some redundant fields from struct glDescriptor. 2009-03-13 11:28:50 +01:00
Henri Verbeet a139683a60 wined3d: Eliminate the heightscale field from IWineD3DSurfaceImpl. 2009-03-13 11:28:45 +01:00
Henri Verbeet e56a4cb799 wined3d: Also change the resource's format desc in IWineD3DBaseSurfaceImpl_SetFormat(). 2009-03-13 11:28:40 +01:00
Henri Verbeet e3bcc7544c wined3d: Remove the shader_color_fixup field from IWineD3DBaseTextureClass.
This is redundant now.
2009-03-12 13:09:55 +01:00
Henri Verbeet 1dcf222ab2 wined3d: Get rid of some calls to getFormatDescEntry().
Use the format description stored in the resource instead.
2009-03-12 13:09:55 +01:00
Henri Verbeet 38178541b0 wined3d: Store a pointer to the format description in the resource.
The goal is to eventually use a pointer to the format description in most
places where we currently use WINED3DFORMAT. IWineD3DSurfaceImpl for example
has copies of several fields from the format description, but also needs to
lookup the format description itself in several places.
2009-03-12 13:09:55 +01:00
Henri Verbeet 81075d2db3 wined3d: Remove a redundant check.
This is redundant now, InitAdapters() will only be called once for each
IWineD3DImpl object, as pointed out by Allan Tong.
2009-03-12 13:09:55 +01:00
Henri Verbeet e4ea7976a5 wined3d: Remove an unused field. 2009-03-12 13:09:55 +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 40d4f9b7ec wined3d: Don't leak WineD3DAdapter.cfgs. 2009-03-11 13:03:32 +01:00
Henri Verbeet ddae14169b wined3d: Get rid of the PUSH1 macro. 2009-03-11 13:03:32 +01:00
Henri Verbeet 2cc43393f0 wined3d: The adapters array should be owned by IWineD3DImpl. 2009-03-11 13:03:32 +01:00
Henri Verbeet 3644a7f6d7 wined3d: Free the logo path when we're done with it. 2009-03-11 13:03:32 +01:00
Henri Verbeet a75590343a wined3d: Set the correct texture names on cube surfaces. 2009-03-11 13:03:32 +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 4e2c87dd22 wined3d: Handle error conditions better in RemoveContextFromArray(). 2009-03-09 14:44:02 +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 362bc0d694 wined3d: Don't compare const_num against -1. 2009-03-09 14:39:39 +01:00
Henri Verbeet 4ff5736edf wined3d: Don't compare texUnitMap entries to -1. 2009-03-09 14:39:34 +01:00
Henri Verbeet a3df476706 wined3d: Buffer object ID's are supposed to be unsigned. 2009-03-09 14:39:18 +01:00
Henri Verbeet aa3027a604 wined3d: Merge IWineD3DVertexBuffer with IWineD3DBuffer.
That still leaves IWineD3DIndexBuffer, but that code is also mostly similar,
except for the conversion code (which will be unused there).
2009-03-06 15:35:58 +01:00
Henri Verbeet 6324ba66ca wined3d: Simplify IWineD3DVertexBufferImpl_PreLoad() a bit. 2009-03-06 15:35:50 +01:00
Henri Verbeet 594cc7ebc1 wined3d: Also set VBFLAG_HASDESC if we can determine we don't need conversion. 2009-03-06 15:35:28 +01:00
Henri Verbeet 702eeb6b0c wined3d: Add separate methods for setting the primitive type. 2009-03-05 16:16:25 +01:00
Henri Verbeet 3b07e7059e wined3d: Add d3d10 primitive types. 2009-03-05 16:16:24 +01:00
Henri Verbeet 3f9e0d9320 wined3d: Add support for ARB_geometry_shader4. 2009-03-05 16:16:24 +01:00
Henri Verbeet 17e12611b8 wined3d: Fix some prototypes. 2009-03-05 16:16:24 +01:00
Henri Verbeet 602bb1f551 wined3d: Pass the vertex count rather than the primitive count to wined3d draw methods. 2009-03-05 16:16:24 +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
Henri Verbeet b4830feb34 wined3d: Accept WINED3DFMT_R8G8B8A8_UNORM in getColorBits(). 2009-02-25 12:37:06 +01:00
Henri Verbeet 7facc6906d wined3d: Implement IWineD3DDeviceImpl_ClearRendertargetView(). 2009-02-25 12:37:06 +01:00
Stefan Dösinger 6012475e59 wined3d: Properly update last_was_pshader. 2009-02-24 16:57:30 +01:00
Henri Verbeet c796f76483 wined3d: Add IWineD3DRendertargetView. 2009-02-24 16:57:29 +01:00
Henri Verbeet 33dd39c4d0 wined3d: Merge indexbuffer.c with buffer.c. 2009-02-23 12:21:10 +01:00
Henri Verbeet 392cfefbeb wined3d: Merge vertexbuffer.c with buffer.c.
This just moves to code to the same file, but we want to merge the
implementations as well at some point.
2009-02-23 12:21:02 +01:00
Henri Verbeet 399d992a07 wined3d: Add IWineD3DBuffer, use it in d3d10core. 2009-02-23 12:20:45 +01:00
Henri Verbeet 0048a0373b d3d10core: Keep a reference to the wined3d device in the d3d10 device. 2009-02-23 12:20:29 +01:00
Henri Verbeet 8cefc47d81 wined3d: Add DXGI formats to WINED3DFORMAT. 2009-02-20 11:10:37 +01:00
Henri Verbeet 828f42cb1f wined3d: Add some traces to state handlers.
Should make it a bit clearer what's happening in some cases.
2009-02-19 12:53:44 +01:00
Henri Verbeet c8a3f3f13f wined3d: Allow floating point values for WINED3DDECLUSAGE_BLENDWEIGHT.
glWeightPointerARB() obviously accepts floating point data.
2009-02-19 12:53:38 +01:00
Francois Gouget 5b60258f0d wined3d: Make debug{fixup_channel_source,yuv_fixup}() static. 2009-02-18 12:17:38 +01:00
Stefan Dösinger 4386a827e9 wined3d: Pass the requested srgb flag to PreLoad.
Add a new wined3d-internal PreLoad function to textures and surfaces
that takes a parameter specifying wether the rgb or srgb texture
should be loaded.
2009-02-17 12:51:36 +01:00
Stefan Dösinger 68c251f327 wined3d: Add a debug function for surface locations. 2009-02-17 12:51:17 +01:00
Stefan Dösinger c585b4de99 wined3d: Duplicate GL textures for srgb switching.
This reduces the number of srgb switching reloads quite a lot. The only
situation in which a reload is needed is if the rgb copy is modified on the GL
side and the srgb copy is needed.
2009-02-17 12:48:05 +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