Commit Graph

145 Commits

Author SHA1 Message Date
Francois Gouget 0edbaf7e80 Remove spaces before '\n' in traces. 2005-11-10 12:14:56 +00:00
Oliver Stieber 20366e7956 Use wined3dformat when calling wined3d. 2005-08-29 09:32:44 +00:00
Mike McCormack 1766483e4c Fix gcc 4.0 warnings. 2005-08-09 10:22:03 +00:00
Mike McCormack ebf4e53030 Fix sign warnings. 2005-07-28 10:16:54 +00:00
Francois Gouget 02c25a8981 Assorted spelling fixes. 2005-06-30 18:19:33 +00:00
Oliver Stieber 46e7c30a71 Implement swapchains. 2005-06-23 11:05:24 +00:00
Oliver Stieber e70e3ba0ff Change the way caps are sent between d3d9/d3d8 and wined3d to make it
easier for wined3d to support additional versions of Direct3D.
2005-06-17 09:59:03 +00:00
Dmitry Timoshkov 4625628e67 Make some of the OLE interface vtables const. 2005-05-27 20:17:35 +00:00
Oliver Stieber 67f2ad4563 - Volume now inherits Resource. This isn't the way Microsoft implements
the interface but it is more correct way (Microsoft even have a
  resource type of volume).
- Moved usage, format, allocatedMemory and size onto the resource
  class structure.
- Refactored Preload for classes that inherit BaseTexture, preload now
  binds the texture instead of bind texture calling preload, bindTexture
  allocated a glTexture if there isn't one.
- Added two new class static members BaseTexture_CleanUp and
  Resource_CleanUp that should be called by classes that implement
  BaseTexture or Resource.
2005-03-29 19:01:00 +00:00
Jason Edmeades 6bec623edb Correct handling of unusual vendor strings in d3d8, and check for a
stateblock before trying to release it in wined3d.
2005-02-24 10:05:06 +00:00
Alexandre Julliard f777d70a63 Only create an X window for top-level windows, not for child windows.
Get rid of the X client window too, it's no longer needed.
2005-01-31 16:34:07 +00:00
Paul Vriens 7a49e82dac - use Interlocked* functions in AddRef and Release.
- store the result of the Interlocked functions and use only this.
2005-01-24 11:31:45 +00:00
Jason Edmeades 41427857b1 Add render target support, and ensure there is a front and back buffer
created during device creation.
2005-01-09 17:37:02 +00:00
Jason Edmeades 289562eeb5 - Implement SetStreamSource
- Ensure wined3d objects maintain a reference count of at least that
  of the d3dx version.
2004-11-23 13:52:46 +00:00
Jason Edmeades b9e2bedac1 Copy and tidy up the code from dx8 create device into wined3d. Call
from wined3d and d3d8, but short term only use the code for real from
d3d9.
2004-10-08 20:52:33 +00:00
Jason Edmeades b519893e41 Move the GetDeviceCaps into the wined3d library and call from d3d9. 2004-10-06 00:05:29 +00:00
Jason Edmeades c579fa6213 Move the Check* type functions into wined3d and copy from d3d9, and
flag that they are mostly stubs.
2004-10-05 02:14:06 +00:00
Jason Edmeades c3421ea434 Move into wined3d and call from d3d9 the GetAdapterId function and
copy all the gl declarations into the more global wined3d_gl header
file.
2004-09-29 21:26:47 +00:00
Jason Edmeades ae5a436873 - Make d3d8 know about the wined3d device and start using it.
- Move some of the screen mode related functions into wined3d and add
  untested support for the new d3d9 options of providing the format to
  some of the calls.
- Move other functions from the directx interface into the common
  library and implement the calls from d3d9 as well.
- Copy across the first of the functions used to make traces more readable,
  creating utils.c to store them in. Eventually the ones in d3d8 will be
  removed but for now just duplicate the code.
2004-09-28 02:12:12 +00:00
Jason Edmeades f901144d85 Don't hide and restore the window when changing it to be a popup
style.
2004-09-21 20:04:24 +00:00
Alexandre Julliard f5f7a1822c Removed some more uses of the non-standard ICOM_THIS macro. 2004-09-08 01:50:37 +00:00
Alexandre Julliard f714b39762 Get rid of the no longer used ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
macro.
2004-08-23 19:39:48 +00:00
Alexandre Julliard 48c4bb3c31 Get rid of the non-standard ICOM_VTABLE macro. 2004-08-12 23:00:51 +00:00
Raphael Junqueira 5f395061ef - the hardware GL vendors (NVidia and ATI) can support more than 95
constants (the Mesa bug) and VRally use the 0..95 indexes so fix it
- fix normalize for some HW VertexShader inputs
- trying to fix the combination of NV_texture_combine_4 with
texture_combine_EXT (impl of D3DTOP_DISABLE, D3DTOP_MODULATE for
NV_texture_combine_4)
- if shaders disabled declare to support 0 for MaxVertexShaderConst.
2004-05-27 01:56:56 +00:00
Christian Costa 483803ff42 Added retrieval of ATI info. 2004-05-21 20:53:19 +00:00
Raphael Junqueira 40dd9692d9 - first draft of D3DCLIPSTATUS8 handling (not really used for now)
- add a new DEBUG_SINGLE_MODE #define (for debug caps needs)
- better traces for surface dumping
- much better Texture support on Utilities functions and on
  CheckDeviceType
- D3DRS_ZVISIBLE as unsupported (as seen in msdn)
2004-05-19 04:33:42 +00:00
Christian Costa 1cda8c774b Enabled pixel shaders 1.4.
Fixed handling of macros at the end of vertex shaders.
Handled NOP and PHASE instructions.
Fixed versions of several instructions.
Improved pixel shader dump traces.
Fixed write mask.
Fixed X2 and -X2 source modifiers and implements DZ and DW ones.
Implemented texcrd, texld, texm3x3pad, texm3x3tex, texm3x3spec and
texm3x3vspec instructions (and partially texbem).
Added cnd, cmp and lrp instructions.
Rewrite of the "autoparam" code so we can add more complicated
instructions (only cnd and cmp as well as simple instructions use that
code at the moment).
2004-05-18 00:45:21 +00:00
Christian Costa 0f7b0a089b Implemented pixel shaders using ARB_fragment_program extension. 2004-05-10 19:57:51 +00:00
Alexandre Julliard ac7b9451f7 Authors: Christian Costa <titan.costa@wanadoo.fr>, Jason Edmeades <us@the-edmeades.demon.co.uk>
Fixes for rendering targets.
2004-05-02 04:22:31 +00:00
Raphael Junqueira d52c5080cf - Fix compilation again using olders GL headers
(glCompressedTexImage2DARB problem).
- Fix typo on constant.
- Detection of NVidia texture_shader and register_combiners
  extensions.
- Begin to implement BUMPMAPPING using NVidia Texture shader extension
  (not really working for now).
2004-04-29 00:20:18 +00:00
Raphael Junqueira b4a37991ef - implement SetRenderState D3DRS_FOGENABLE/D3DRS_RANGEFOGENABLE
- implement SetRenderState D3DRS_RANGEFOGENABLE
- fix SetRenderState D3DRS_FOGVERTEXMODE Caps/Detection traces
- fix IDirect3D8::GetAdapterIdentifier to use FillGLCaps and provide
  more exact infos (driver versions, vendor, ...)
- split Fake GL Context creation from GetDeviceCaps for external use
- add a new channel (d3d_caps) for all IDirect3D8 Caps/detection traces
- rename fps channel to d3d_fps
- high use of runtime detected OpenGL Caps instead of defines
- update supported Caps using runtime detection
2004-04-26 20:12:28 +00:00
Raphael Junqueira b42da1c51c Fix some random crashes found on some games in the new code (live
GLX/GL drivers).
2004-04-23 21:27:30 +00:00
Raphael Junqueira 58080d4f6a - more FIXME -> TRACE
- begin vendor/card detection (versions/names)
2004-04-22 23:46:05 +00:00
Christian Costa 1811e198f7 Converted some FIXMEs into TRACEs. 2004-04-21 22:24:22 +00:00
Raphael Junqueira c87fd95f1f - fix the SetTextureStageState for D3DTADDRESS_MIRROR using dynamic GL
detection (and not build time GL headers)
- add a new debug channel for hardware vertex shaders
- hardware VS "compiler" fixes:
  -> special case for address registers (MOV must be replaced by ARL)
  -> add line numbers to trace (better to find why NVidia drivers complains)
  -> one parse to determine temporary and address registers needs
    (@todo: check GL limits)
  -> remove duplicate traces from Generic ParseProgram
2004-04-19 23:04:58 +00:00
Alexandre Julliard 4f56863300 Authors: Jason Edmeades <us@the-edmeades.demon.co.uk>, Christian Costa <titan.costa@wanadoo.fr>
Added support for vertex shader (using ARB_vertex_program extension).
2004-04-15 23:58:15 +00:00
Raphael Junqueira 114c9077d6 - more Extensions work (begin to detect ATI extensions)
- try to fix D3DTADDRESS_BORDER, D3DTADDRESS_MIRROR,
  D3DTADDRESS_MIRRORONCE using OpenGL extensions
- better set_tex_op: now use Runtime Extension support (and not
  compile support)
2004-03-30 05:14:57 +00:00
Ge van Geldorp 399901e054 Rename LARGE_INTEGER and ULARGE_INTEGER members "s" to "u" to conform
with PSDK.
2004-01-23 01:51:33 +00:00
Francois Gouget 640cc3f3e1 Assorted spelling fixes. 2004-01-06 22:08:33 +00:00
Jason Edmeades 96be4449f3 Use the current window visual only. 2003-11-17 20:04:08 +00:00
Jason Edmeades 78a7c5f28e Check for advertized vertex blend support before querying device
capabilities, which silences issues about vertex blending.
2003-10-03 04:35:07 +00:00
Jason Edmeades 8b2c10bcd4 MaxActiveLights means number of concurrent lights, but any number can
be  set up. Change support for lights into a linked list and only set
up an equivalent gl light when the light is enabled.
2003-09-30 00:21:07 +00:00
Jason Edmeades de3b0dfffb The 'w' component is used more than just for the vertex, so we cannot
do the projection mapping ourselves. Also tidy up a tracepoint, and
preinitialize the shaders output as windows seems to.
2003-09-25 20:22:21 +00:00
Jason Edmeades 7ac9d258c3 GL doesn't like incorrect lengths passed into DXTN processing. 2003-09-19 00:20:19 +00:00
Jason Edmeades 74c3281bef Simple fix to handle the more common case of actually having a GL
context!
2003-09-19 00:07:16 +00:00
Alex Pasadyn ad22804e28 Enable resolution changes for D3D8 applications. 2003-09-16 20:24:49 +00:00
Alexandre Julliard e37c6e18d0 Fixed header dependencies to be fully compatible with the Windows
headers (with help from Dimitrie O. Paun).
2003-09-05 23:08:26 +00:00
Jason Edmeades d9b8dfd7da Use a dummy GL context if one is not available when GetDeviceCaps is
called.
Remove the compiler warnings introduced in the last DXTn patch.
2003-09-02 00:53:21 +00:00
Jason Edmeades beb4ac8fe1 DXT1/3/5 support was broken, but unnoticeable since we also indicated
it wasn't supported.
2003-08-15 03:50:08 +00:00
Jason Edmeades 2ec3bbccc1 glColorMaterial enable/disable setup is only done when really necessary.
If glColorMaterial is set to track current color and none is supplied,
it gets disabled.
glMaterial is reset when I think it is necessary.
Slow mode now has defaults for when fvf parms are not supplied (as per
fast mode).
Slow mode now sets up the specular color (forgot that bit previously,
I think!).
Trace now lists the front, back and stencil buffers for ease of
debugging.
2003-08-05 18:29:20 +00:00
Jason Edmeades 564f5828b0 Add fps debug channel, so we can see how the d3d code is performing and
their impact of performance changes.
SetTransform almost rewritten in a much neater way, and in
coordination with drawprim it significantly reduces the number of
times that we reload the matrixes.
2003-07-19 03:02:42 +00:00
Jason Edmeades 5593a08334 When emulating fullscreen it helps to not allocate space for menu bars
and borders. Make this window a popup window.
2003-06-13 18:53:06 +00:00
Raphael Junqueira 85aa298ad2 Fixed compilation problems. 2003-06-06 18:12:59 +00:00
Raphael Junqueira e4882b1548 - cleaning of volume.c/volumetexture.c as done previously for
surface.c/*texture.c (with add of lockable, locked and Dirty flags)
- add of dirtyRect/dirtyBox for better dirtification management (not
  used yet, but huge optimisation can be possible now)
- fix some debug traces (well it's better to use debug_d3dpool)
- fix some stupid regression on point parameters (forgot to check
  extension on fillcaps)
2003-06-04 23:05:46 +00:00
Raphael Junqueira 713013a978 - add a new private header d3dcore_gl.h that declares needed opengl
defines and the caps defines
- cleanup of device.c using the caps defines (avoid the #ifdef
  nigthmare)
- add {Set,Get}GammaRamp support
2003-06-04 23:01:49 +00:00
Raphael Junqueira 24be30657d - some cleanup and warning fixes
- split of CreateDevice gl/gxl detection code into FillGLCaps
- implementation of resolution change (using ChangeDisplaySettings)
  but desactived as ChangeDisplaySettings don't seem to work well
- begin of swap chain support (now need to split/clean
  gxlpbuffer/glxpixmap code for swap chain use)
2003-06-04 22:55:19 +00:00
Raphael Junqueira b050a3dbf1 - pixel shader program dump code
- pixel shader code split into a new "COM object" (as done before for
  vertex shader)
- some fixes on Validate* functions call types
- add pixel shader (ie fragment_program) detection on caps code
2003-06-04 22:45:57 +00:00
Raphael Junqueira 0b5e9d9feb - some cleanups
- more cubetextures fixes (now d3d8 sdk cubemap sample work almost
  perfectly)
- add a new debug function "debug_d3dpool" and use it
- add a new param (the device) for the conversions functions (because
  we need to check caps to see how to convert)
- some crashes fixed in render to surface code with no stencil-depth
  surface
- a very simple cliplane fix
- a stupid palettes fix (stupid language)
- begin of anisotropic filter support
- begin of compressed textures support
- a very useful debug functions: IDirect3DSurface8Impl_SaveSnapshot to
  dump surfaces as png ;)
- many useful surfaces debug code (using SaveSnapshot)
2003-06-04 22:12:34 +00:00
Jason Edmeades 4e3100825f Correct specular enable renderstate. 2003-06-04 22:04:44 +00:00
Jason Edmeades 84cd1925fe Opengl 1.4 added stencil wrap support as per directx (also in the
GL_EXT_stencil_wrap extension).
2003-06-04 22:01:05 +00:00
Raphael Junqueira 3cae8cfa69 - implemented render to surfaces (and render to new rendertargets)
using glx pbuffers (with a useful debug code to display rendered
  surface into window drawable)
- better cubetextures
- split utilities functions into utils.c and added more
- more readable debug again
- a better caps code (not perfect but i'll use glx code later)
- use of the new caps code
- begin of UpdateTexture
- begin of Cursor support
- cleaning most of deprecated #if 0/#endif
- correct some lockable/unlockable behavior
- correct some returns code
2003-06-04 21:55:29 +00:00
Raphael Junqueira 9489f8bdc0 - mor usefull debug functions debug_d3dusage and debug_d3ddevicetype
- fix a crash in pixel shader parser (happened with unreal2)
- currently desactive pixel shaders caps (with #define) while hw
  shaders code isn't merged
- when we have a special debug channel for shader, use it ;)
- fix again some stubs return value
- more more readable traces now (principaly IDirect3D8 capacities
  check and surface locking code) using new debug functions
- fix/cleaning the surface locking code
- now we support D3DTOP_SUBSTRACT so declare it in caps
- now support true 32bit (well X 24 bit can be used as 32 bit in caps
  code)
- first try to get D3DTSS_TCI_CAMERASPACENORMAL and
  D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR look good
- native support 32 bit support (now application can choose 16 or 32
  bit support) if current resolution is 24 bit (as we can only launch
  games in windowed mode)
- textures palettes support
- fix reflexion placement code (the sdk sample begin to work)
- fix a stupid crash when using traces in vshaderdeclaration
- more more readable traces (init/caps)
- more cubetextures fixes
2003-05-17 18:33:02 +00:00
Jason Edmeades 1e9689e487 Previous viewport fix only works for full screen applications as we
didn't change the back buffer size information until after copying the
presentation parameters, so when setting up the viewport the
backbufferwidth/height was 0. Moved the copy until after it has been
corrected.
2003-05-15 04:16:16 +00:00
Raphael Junqueira 128fd3496a Declare that we can support cube textures now (currently only creation
is done).
2003-05-14 19:32:24 +00:00
Jason Edmeades 3a812c6435 Make sure we advertize our capabilites correctly. 2003-05-13 23:50:05 +00:00
Christian Costa 6e0703d11b Mark some surface formats as not supported. 2003-05-13 23:39:14 +00:00
Raphael Junqueira 89ec35fe43 - minor COM fixes (fixes some crashes on stupid games)
- minor indentation changes
- fix SELECTARG2 behavior (with help from Lionel Ulmer)
- surface locking/unlocking (only rendering and textures surfaces
  supported now)
- beginning of Target/Front surface support
- try to get D3DTOP_SELECTARG_* working
- implemented D3DTOP_SUBTRACT: currently only if OpenGL1.3 is used, we
  have to use GL_SUBTRACT_ARB for other versions
2003-05-11 03:35:27 +00:00
Raphael Junqueira 18af8d8611 - Disable some 'classic' debug traces (avoid useless flood of traces
while debugging games).
- Fix the texture size caps using GL_MAX_TEXTURE_SIZE.
2003-05-08 17:36:00 +00:00
Jason Edmeades 8534f79124 - Move texture loading into PreLoad for 2D textures (needs doing for
the others as well), and call when needed as well.
- Change D3DFMT_R5G6B5 handling to make backdrop of Max Payne appear.
- Add code to reject attempts to use invalid texture units (Max Payne
  did this a lot).
- ValidateDevice fixme silenced as harmless but occurs frequently.
- Add trace which can be compiled in to debug vertex shaders, and
  correct fixmes and dprintf's into appropriate trace statements.
- Ensure we trace what we return when querying the device caps.
- Correct bug with negative numbers in vertex shader code.
2003-05-08 03:49:04 +00:00
Alexandre Julliard 69361e08b9 Moved x11drv.h to dlls/x11drv. 2003-04-22 04:05:08 +00:00
Jason Edmeades 53391ac33f DOT3 isn't there on earlier opengl versions. 2003-04-21 22:37:48 +00:00
Jason Edmeades 4df43cc263 When a game requests fullscreen, make its window the dimensions
requested. Ideally this should be followed by making the screen that
resolution, but this suffices for now.
2003-04-20 02:47:22 +00:00
Jason Edmeades 02f3df3988 Windows never reports 24 bit colours, and some games fail to work
unless in specific modes. Report 16bit colour for 24bit modes.
2003-04-20 02:43:05 +00:00
Jason Edmeades 5abc0654b5 Correct device capabilites including support in previous patch, as
well as making the texture operations capabilities more accurate.
2003-04-19 20:33:23 +00:00
Jason Edmeades 55e85807f8 Add DotProduct3 support if supported by opengl. 2003-04-19 20:30:58 +00:00
Christian Costa 7f1250e5cf Handle creation of a depth/stencil buffer when creating a device.
Implement IDirect3D8DeviceImpl_GetDepthStencilBuffer.
2003-04-17 02:16:07 +00:00
Christian Costa 074d293c85 Increase MaxStreams to 2 in CAPS. 2003-04-13 01:03:05 +00:00
Jason Edmeades 043680c140 Correct some capabilities, and default others to fully supported for
now.
2003-02-01 00:35:36 +00:00
Raphael Junqueira 92155f158f - Defer of IDirect3DVertexShader_SetConstant, waiting for
DrawPrimitive call.
- Beginning of VertexShader constants support into stateblock (only
  stored, not captured yet).
- Fix compiation with nivdia GL/gl.h and mesa Gl/glext headers as
  reported by Andrew John Hughes.
- One glActiveTexture/glActiveTextureARB missing.
2003-01-30 00:18:27 +00:00
Raphael Junqueira 4b0297d894 Some needed cleanups for future dx9 and d3d common layer support:
- stateblocks to IDirect3DStateBlockImpl interface and moving into
    a new file (stateblock.c)
  - shaders to IDirect3D*ShaderImpl interfaces
  - splitting vshader and vshader declaration as in dx9 into 2
    interfaces (for future common layer use)
  - vshader declaration code to a new file (vsaderdeclaration.c)
  - device calls to new interfaces (redirect stubs)
Simple texture fix for a little regression after last Jason's patches.
Some caps code using the GL/glext.h defines (GL_VERSION_*).
2003-01-28 01:12:23 +00:00
Jason Edmeades 5840a1bffc Use device max lights and clipplane support. Also change clipplane to
be affected by view matrix.
2003-01-23 22:38:51 +00:00
Raphael Junqueira 9e43683316 - beginning of vertex matrix blending using extensions (currently
alpha alpha stage as i haven't understand needed extension behavior)
- modify SetRenderState for matrix blending specific params
- by default diffuse color is white ;)
- comments most of the traces (else flood ...)
- add more urls in comments
- indent, cleanups
2003-01-14 23:12:37 +00:00
Raphael Junqueira 72fb7acf8d Beginning of more COM compliant behavior:
- AddRef/Release where needed
- use IUnknown* instead void*
- fix many GetDevice using AddRef
- fix IDirect3DSurface8Impl_GetContainer using QueryInterface
2003-01-14 23:05:39 +00:00
Jason Edmeades bcb05fd43e Add support for some of the texture address states and border colour. 2003-01-14 22:50:00 +00:00
Dimitrie O. Paun 297f3d898d Define NONAMELESS{STRUCT,UNION} explicitly in the files that need them. 2003-01-07 20:36:20 +00:00
Raphael Junqueira 559b10699f - integration with DrawPrimitive
- remove non-esthetic c++ comments into c comments block ;)
- more more debug
- indent, cleanups
- trying to use DIFFUSE and SPECULAR for vertex shader
- many fixes
- integration with Jason's texture patch
2003-01-02 17:59:01 +00:00
Jason Edmeades 13ee7cd154 Query opengl to ensure it supports multitexture, and honour the number
of supported texture units. Especially important for NVidia drivers
which only support 2 texture units.
2002-12-23 01:34:59 +00:00
Raphael Junqueira 1df8f18e46 - some fixes in CreateDevice init
- vertex shader declaration parser (with output dump) and
   interpretation (generate the FVF descriptor for program input)
 - vertex shader program parser (with output dump)
 - software vertex shader program emulation
2002-12-18 05:05:41 +00:00
Raphael Junqueira e31ae92630 - some D3D8 fixes
- beginning of shaders support (Vertex and Pixel Shaders 1.1 on
  DirectX8)
- beginning of D3DX8 support the D3D8 utility API (very basic, only
  the core header)
2002-12-17 01:15:15 +00:00
Jason Edmeades ca6bcdcc99 - Stencil mapping now works (it helps to actually allocate a stencil
buffer).
- Texture mapping corrected if no real texture bound.
- Code now detects which opengl extensions are present - to be
  extended later.
- More debug tracepoints.
2002-11-06 19:56:32 +00:00
Jason Edmeades ec7155b608 - Initialize the texture state information.
- Add dummy textures so texture operations which dont reference the
  texture can work.
- Support 2d and 3d textures properly.
- Reapply the texture state information as textures get set, as opengl
  stores the state along with the bound texture whereas directx uses the
  current state information during the draw stage.
- 3rd attempt to sort out lighting, for programs which dont set normals.
- Temporarily silence some unnecessary fixmes.
2002-10-28 19:00:23 +00:00
Jason Edmeades 99cd0de7d9 Add the basic support for volume textures / volumes (3d textures). 2002-10-21 18:21:59 +00:00
Alexandre Julliard b34fb35b31 Fixed warnings caused by conversion to -DSTRICT. 2002-10-18 23:48:57 +00:00
Jason Edmeades 9240bc3fbe Various fixes, typos corrected and clarifying trace points. 2002-10-07 18:24:28 +00:00
Jason Edmeades 26258ce06a Initial D3D8 implementation. 2002-09-27 22:46:16 +00:00