Commit Graph

1032 Commits

Author SHA1 Message Date
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
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 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 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
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 ef2d704183 wined3d: Store the format_desc itself in struct wined3d_stream_info_element. 2009-03-30 15:11:24 +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 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 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 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 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 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 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 a139683a60 wined3d: Eliminate the heightscale field from IWineD3DSurfaceImpl. 2009-03-13 11:28:45 +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 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 e4ea7976a5 wined3d: Remove an unused field. 2009-03-12 13:09:55 +01:00
Henri Verbeet 2cc43393f0 wined3d: The adapters array should be owned by IWineD3DImpl. 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 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 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 702eeb6b0c wined3d: Add separate methods for setting the primitive type. 2009-03-05 16:16:25 +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
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 c796f76483 wined3d: Add IWineD3DRendertargetView. 2009-02-24 16:57:29 +01:00
Henri Verbeet 399d992a07 wined3d: Add IWineD3DBuffer, use it in d3d10core. 2009-02-23 12:20:45 +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
Stefan Dösinger 8dcd51286d WineD3D: Put vertex shader duplication infrastructure in place. 2009-02-11 12:21:25 +01:00
Stefan Dösinger 50109aa969 wined3d: Get rid of last_was_foggy_shader & friends.
The fog settings do not depend on wether the shader writes to oFog or not,
instead they depend on the FOGVERTEXMODE and FOGTABLEMODE settings, and if a
vertex shader is bound at all.

It works the same way as with the fixed function, and having a vertex shader
is the same as using pretransformed vertices, just that the fog coord comes
from the shader instead of the specular color:

FOGTABLEMODE != NONE: The Z coord is used, oFog is ignored
FOGTABLEMODE == NONE, with VS: oFog is used
FOGTABLEMODE == NONE, no VS, XYZ: Z is used
FOGTABLEMODE == NONE, no VS, XYZRHW: diffuse color is used
2009-01-20 12:45:40 +01:00
Stefan Dösinger 3c3272dc41 wined3d: Don't single-allocate new gl shaders. 2009-01-20 12:45:09 +01:00
Henri Verbeet a966293f59 wined3d: Add an IWineD3DDeviceParent interface.
Other than being a bit nicer than passing function pointers all over the
place, this helps dxgi/d3d10. While the swapchain itself is created in dxgi,
its surfaces are constructed in d3d10core, which makes it impractical for dxgi
to pass the appropriate function pointers.
2009-01-16 13:29:32 +01:00
Henri Verbeet 9440dfedf4 wined3d: Remove AddDirtyRect() from the public interface. 2009-01-14 13:51:00 +01:00
Henri Verbeet fd90021666 wined3d: Remove AddDirtyBox() from the public interface.
This is an internal wined3d function.
2009-01-14 13:51:00 +01:00
Henri Verbeet e4cfbdd4f7 wined3d: Get rid of D3DCREATERESOURCEOBJECTINSTANCE. 2009-01-13 15:20:28 +01:00
Henri Verbeet 894edc49cc wined3d: Get rid of D3DCREATESHADEROBJECTINSTANCE. 2009-01-12 13:22:02 +01:00
Henri Verbeet 87627c811e wined3d: Get rid of D3DINITIALIZEBASETEXTURE. 2009-01-12 13:21:56 +01:00
Stefan Dösinger 1deafcb5a7 wined3d: Split the remains of state_fog. 2009-01-12 13:02:49 +01:00
Stefan Dösinger 2dd18635c9 wined3d: Move fogdensity and fogcolor to the fragment pipeline. 2009-01-12 13:02:29 +01:00
Allan Tong 29dd286d79 wined3d: Add code to cleanup device multistate_funcs. 2009-01-10 17:43:11 +01:00
Henri Verbeet b1812c690c wined3d: Add support for EXT_vertex_array_bgra.
This allows us to skip BGRA->RGBA color conversion for vertex attributes if
this extension is present.
2009-01-08 13:21:51 +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 cc447eac55 wined3d: Move position_transformed out of u.s in struct WineDirect3DVertexStridedData. 2009-01-08 13:21:31 +01:00
Henri Verbeet 5f8c62e45d wined3d: Remove a redundant parameter to drawPrimitive().
startIdx should be the first index to draw, either from the vertex
array or the index array, depending on if the draw is indexed or
not. Having both at the same time wouldn't make sense.
2009-01-07 12:22:12 +01:00
Henri Verbeet bddf5e76ea wined3d: Convert textureState to a bitmap in struct SAVEDSTATES. 2009-01-06 12:45:52 +01:00
Henri Verbeet a8697d90e4 wined3d: Renumber WINED3DTEXTURESTAGESTATETYPE enum elements.
Saves some space by not having unused entries is the arrays tracking these
states.
2009-01-06 12:45:43 +01:00
Henri Verbeet fd33f0f97f wined3d: Convert samplerState to a bitmap in struct SAVEDSTATES. 2009-01-05 12:41:17 +01:00
Henri Verbeet c33b38117e wined3d: Convert renderState to a bitmap in struct SAVEDSTATES. 2009-01-05 12:41:08 +01:00
Henri Verbeet fc39831e4c wined3d: Convert transform to a bitmap in struct SAVEDSTATES. 2009-01-05 12:40:57 +01:00
Henri Verbeet 9a889f6b0b wined3d: Convert textures to a bitmap in struct SAVEDSTATES. 2009-01-03 14:55:31 +01:00
Henri Verbeet 3b5c75d991 wined3d: Convert clipplane to a bitmap in struct SAVEDSTATES. 2009-01-02 11:53:04 +01:00
Henri Verbeet 52a900d4e8 wined3d: Convert streamSource and streamFreq to bitmaps in struct SAVEDSTATES. 2009-01-02 11:52:34 +01:00
Henri Verbeet 457037f4de wined3d: Fix the value of HIGHEST_TRANSFORMSTATE.
The highest transform state should be 511.
2009-01-02 11:52:02 +01:00
Henri Verbeet 3920d42f71 wined3d: Convert some BOOLs to bitfields in struct SAVEDSTATES. 2008-12-31 12:26:57 +01:00
Henri Verbeet 29a0d06518 wined3d: Convert some BOOLs to bitfields in struct IWineD3DDeviceImpl.
Also fills a 3 byte hole.
2008-12-31 12:26:33 +01:00
Henri Verbeet 3f12f59aa4 wined3d: Convert some BOOLs to bitfields in struct WineD3DContext.
Also happens to fill two 3 byte holes.
2008-12-31 12:26:23 +01:00
Henri Verbeet 813c7ed202 wined3d: Remove an unused field from the device. 2008-12-31 12:26:02 +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 6f5af4047f wined3d: Get rid of the glname field in struct SHADER_OPCODE.
It's only used for shader_hw_map2gl() and vshader_hw_rsq_rcp(), and we
can handle those the same way we handle the GLSL equivalents.
2008-12-30 11:36:35 +01:00
Maarten Lankhorst 4eca43e702 winex11.drv/wined3d: Fix tsx11 calling convention. 2008-12-23 12:51:44 +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 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 4adb342327 wined3d: Remove GetFVF() and SetFVF() from IWineD3DDevice. 2008-12-17 14:02:03 +01:00
Stefan Dösinger 31da3c0578 wined3d: Emulate GL_EXT_fog_coord. 2008-12-16 14:34:11 +01:00
Stefan Dösinger 0dc0444c14 wined3d: Reinstall the G16R16F format surface load fixup.
We cannot remove this because we still have to load the surface as
RGB. The shader may take care of setting the blue channel to 1.0 now,
but we still get the red and green channels loaded incorrectly if we
don't insert a blue channel before loading.
2008-12-16 14:32:11 +01:00
Stefan Dösinger 199a3468bf wined3d: Fake GL_ARB_multitexture. 2008-12-16 14:31:25 +01:00
Henri Verbeet f3743fb402 wined3d: Shaders will never have a NULL function. 2008-12-16 12:52:04 +01:00
Henri Verbeet 8553665cb1 wined3d: Move the shader version to reg_maps. 2008-12-15 14:00:26 +01:00
Henri Verbeet 7d29aecd6f wined3d: Use a simpler way to calculate the number of texture levels.
It's probably slightly faster too.
2008-12-12 11:40:39 +01:00
Henri Verbeet 70ed814b95 wined3d: Get rid of the textureDimensions field in the state block. 2008-12-12 11:40:32 +01:00
Henri Verbeet f36c377d0e wined3d: We only care is a sampler is sampled at all in device_map_vsamplers(), not the specific type. 2008-12-12 11:40:26 +01:00
Henri Verbeet fb475c7c29 wined3d: Don't reparse the entire shader just to update the sampler types. 2008-12-12 11:40:20 +01:00
Stefan Dösinger f2f90b6965 wined3d: Fix ARG_UNUSED and use it properly.
That bug was uncovered by Henri's change of the bitfield sizes.
2008-12-11 14:07:31 +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 8124f5e14a wined3d: shader_trace_init() shouldn't have side effects.
This moves setting baseShader.hex_version and baseShader.functionLength to
shader_get_registers_used(), where it's more appropriate.
2008-12-11 12:14:50 +01:00
Henri Verbeet 4aa00e8a21 wined3d: Rename texture_stage_op.color_correction to texture_stage_op.color_fixup.
This is consistent with other uses of struct color_fixup_desc.
2008-12-10 10:50:24 +01:00
Henri Verbeet 50a87e23e7 wined3d: Fix the IWineD3DVertexShader and IWineD3DPixelShader IUnknown methods.
IWineD3DVertexShader isn't supposed to implement IWineD3DPixelShader.
2008-12-09 11:27:32 +01:00
Henri Verbeet 4997bee1bf wined3d: Add functions to initialize and free shader buffers. 2008-12-09 11:27:13 +01:00
Henri Verbeet 5ad3bbabda wined3d: Avoid disabling numbered arrays if we're going to enable them afterwards anyway. 2008-12-08 12:28:31 +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 74acbf9c16 wined3d: Get rid of vcheckGLcall.
Everywhere it's used a regular checkGLcall will do just as well.
2008-12-04 12:00:29 +01:00
Stefan Dösinger e04556bb16 wined3d: Fix D3DFMT_R32F, R16F, G16R16F, ... in the pixel shader.
This allows us to drop the load time conversion and the clear
readback hack and replaces it with a color fixup in the fixed
function pipeline replacement.
2008-12-04 12:00:15 +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 b451048eb7 wined3d: Move GlPixelFormatDesc to wined3d_private.h where it belongs.
Also remove the silly typedef.
2008-12-04 11:59:06 +01:00
Alexandre Julliard 6800d3dbb7 wined3d: Fix some macros definitions to make them proper C statements. 2008-12-03 10:03:45 +01:00
Henri Verbeet 5284fce1ac wined3d: Disable checkGLcall when WINE_NO_DEBUG_MSGS is specified. 2008-12-03 09:49: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
Henri Verbeet 0ae60765de wined3d: Make functions static where possible. 2008-12-03 09:47:35 +01:00
Henri Verbeet 2acf8d7947 wined3d: Rename resource functions to reflect that they're not COM functions. 2008-12-03 09:47:26 +01:00
Henri Verbeet 4d60b6633c wined3d: Rename basetexture functions to reflect that they're not COM functions. 2008-12-03 09:47:16 +01:00
Henri Verbeet 92b93172df wined3d: Remove some unused code. 2008-12-02 14:04:40 +01:00
Henri Verbeet 5532c990b6 wined3d: Const correctness fixes. 2008-12-02 14:04:15 +01:00
Henri Verbeet 7c0cb8c0c3 wined3d: Const correctness fixes for state.c. 2008-12-02 14:04:08 +01:00
Henri Verbeet 50ebf26894 wined3d: Const correctness fixes for directx.c. 2008-12-01 12:45:10 +01:00
Henri Verbeet c7880e8916 wined3d: Make minMipLookup_noFilter and magLookup_noFilter const.
Note that minMipLookup and magLookup aren't particularly safe to use,
they're global arrays initialized from IWineD3DImpl_FillGLCaps(). The same
goes for the other global dynamic lookup tables.
2008-11-28 12:53:57 +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
Henri Verbeet 49b55f677e wined3d: Don't call IWineD3DSurfaceImpl_GetData() from surface_gdi.c. 2008-11-25 13:37:45 +01:00
Henri Verbeet b4f0b5bdd0 wined3d: Const correctness fixes. 2008-11-25 13:37:39 +01:00
Henri Verbeet a6917b143d wined3d: Use IDL to generate wined3d.h. 2008-11-25 13:37:22 +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
Roderick Colenbrander 273357264a wined3d: Add registry key for overriding the pci vendor id. 2008-11-24 14:52:32 +01:00
Roderick Colenbrander 52d59718c7 wined3d: Add registry key for overriding pci device id. 2008-11-24 14:52:25 +01:00
Henri Verbeet ba78f072e2 wined3d: Remove some unused code. 2008-11-20 14:25:11 +01:00
Henri Verbeet 8899f3412b wined3d: wined3d_gl.h should be internal to wined3d. 2008-11-20 14:24:56 +01:00
Stefan Dösinger 5c79a9f437 wined3d: Rename the fragment ffp desc structures.
This reflects the fact that they describe the fragment pipeline.
The vertex pipeline will use its own structures.
2008-11-20 12:17:45 +01:00
Henri Verbeet 57401fcab2 wined3d: Pass the texture type to the shader depth blt function. 2008-10-28 12:33:18 +01:00
Henri Verbeet 4034a29f19 wined3d: Move depth_blt to surface.c. 2008-10-28 12:33:13 +01:00
Kjell Rune Skaaraas ed96dd72e3 wined3d: Implement IWineD3DResourceImpl_GetPriority and IWineD3DResourceImpl_SetPriority for resource management. 2008-10-08 14:17:03 +02:00
Henri Verbeet 3a7fcec4d7 wined3d: Handle texture coordinates the same way we handle other vertex attributes. 2008-09-25 11:53:10 +02:00
Henri Verbeet eaf2474003 wined3d: Split SetGlTextureDesc() up.
This creates a function for setting the texture name and one for
setting the texture target. The idea is that the texture target should
get set right after the surface is created, and won't change, while
generating a texture name can wait.
2008-09-25 11:52:42 +02:00
Henri Verbeet 5ba40c3d58 wined3d: Make some more GLSL functions private to the backend. 2008-09-24 12:53:23 +02:00
Henri Verbeet a0940051eb wined3d: Make some more ARB program functions private to the backend. 2008-09-24 12:53:16 +02:00
Henri Verbeet daef052daa wined3d: atifs_shader_backend doesn't exist anymore. 2008-09-24 12:53:10 +02:00
Henri Verbeet 2e76954097 wined3d: Move part of the shader instruction table to the backend. 2008-09-24 12:53:05 +02:00
Henri Verbeet ca28930113 wined3d: Merge pshader_hw_map2gl() and vshader_hw_map2gl().
This isn't the prettiest way to merge those functions, but it's a start.
2008-09-23 12:25:27 +02:00
Henri Verbeet 9d192c6251 wined3d: Skip copying the depth stencil if it's discarded.
This gives a small performance improvement for applications that are
smart enough to set the D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL flag, or
to create depth stencils with Discard set to TRUE.
2008-09-23 12:25:18 +02:00
Henri Verbeet d95ae08ad4 wined3d: Get rid of the wantsDepthStencilBuffer in IWineD3DSwapChainImpl. 2008-09-23 12:25:04 +02:00
Henri Verbeet f84680e66c wined3d: Don't try to draw with unsupported attribute data types. 2008-09-22 12:20:34 +02:00
Henri Verbeet 76de76e508 wined3d: Destroy FBO entries in the context. 2008-09-22 12:20:24 +02:00
Henri Verbeet 45820046e8 wined3d: Create a FBO for each combination of render targets and depth stencil.
The main reason for this change is crappy performance for reconfiguring FBOs.
2008-09-19 11:30:00 +02:00
Henri Verbeet a269236649 wined3d: Move FBO handling functions to context.c. 2008-09-19 11:29:13 +02:00
Henri Verbeet ee49230cd2 Make some ARB program structs and functions private to the backend. 2008-09-16 22:33:42 +02:00
Henri Verbeet c2178eb64f wined3d: Make some GLSL structs and functions private to the backend. 2008-09-16 22:33:35 +02:00
Stefan Dösinger 421b6558c1 wined3d: Pack the ffp_desc structure better. 2008-09-05 11:22:55 +02:00
Henri Verbeet 81effcf30d wined3d: Set the viewport to the texture size in depth_blt(). 2008-09-05 10:50:55 +02:00
Stefan Dösinger 3b48660f43 wined3d: Implement YV12 support for emulated overlays.
This is the prefered format of many codecs, and for some codecs this
is the only supported output format. As usual I try to handle all the
conversion in the GPU and keep the CPU involvement minimal to gain the
full performance of PBO transfers.
2008-09-02 14:55:50 +02:00
Henri Verbeet b4f43e372e wined3d: Remove useless hash_table_t typedef. 2008-08-29 12:26:55 +02:00
Stefan Dösinger af8d268a39 wined3d: Handle projected textures properly in arbfp and atifs.
GL_ARB_fragment_program and GL_ATI_fragment_shader can disable
projected textures properly, and they can also handle
D3DTTFF_PROJECTED | D3DTTFF_COUNT3 properly.
2008-08-28 11:24:49 +02:00
Stefan Dösinger 750973cec5 wined3d: Remove BaseTexture::UnBindTexture. 2008-08-28 11:24:49 +02:00