=============================================================================== dgVoodoo 2.45: Glide and DirectDraw/Direct3D to Direct3D11 Wrapper Released: Jul 30, 2015 Author: Dege =============================================================================== Table of contents ----------------- 0. Redistribution rights 1. Intro 2. Features 3. Requirements 4. Usage 5. Configuring 6. General tips and known issues 7. Change log =============================================================================== 0. Redistribution rights ------------------------ Files of dgVoodoo can be redistributed freely as far as they are kept together, remain unmodified and unrenamed. Namely, only the full package can be redistributed in the form as it is! If you would like to utilize them in publicly available custom solutions or packages, like game patches or anything else, then PLEASE ask me for permission, furthermore mention its original source in your package along with the following download link: http://dege.fw.hu/ Official dgVoodoo forum where you can contact me is at: http://www.vogons.org/ -- !!!! -- Very BIG THANKS must go to the community of Vogons for helping me a lot in testing during the development! Thank Guys, I couldn't have proceed so far without such a great quality assurance! -- !!!! -- 1. Intro -------- I wanted to get experience in Direct3D11 and its Shader Model 4/5. I was thinking about what to code and felt that small primitive example applications would not be enough. I wanted some other bigger project because there is no other way to truly learn something. Since I like reverse engineering, emulation and cool API implementations I began to ponder on whether Glide and its pipeline could be implemented perfectly and easily using the new shader model(s) and apparate. I got to the answer "yes" so decided to quickly rewrite dgVoodoo from scratch. It is a good project to start with. 2. Features ----------- ShaderModel 4.1 with its structured buffers, integer types and operations makes it possible to emulate Glide and DirectX 1-7 with a decent old-DirectX card perfectly. For both Glide and DirectX, dgVoodoo pushes as many emulation work to the GPU as possbile. So that, the entire internal 3Dfx GPU logic is mapped to pixel shaders for Glide emulation, and all the fixed function vertex & pixel processing pipeline is implemented by shaders for DirectX emulation (when possible). Thus, this version of dgVoodoo needs a lot more horsepower than a regular wrapper but it does not mean you need a monster GPU. Glide emulation needs more power than Direct3D. 3. Requirements --------------- - Operating system: Windows Vista/7/8/10 with DirectX11 installed. - Hardware: GPU supporting DirectX feature level 10.1. 4. Usage -------- There is no installer for dgVoodoo beacuse you can copy its dlls anywhere you want (to use). If u like it and want to use as the only global Glide wrapper on your machine then copy Glide dlls to the system folder. For DirectX emulation only a local installation is possible since the DirectX dlls CANNOT be copied to the system folder (see DirectX readme). A Glide wrapped application can start up either in windowed or full screen mode (it is controlled by setup, see later). Also, you can switch between them during the gameplay by Alt-Enter. See 'Known issues' for more. The same is true for wrapped DirectX applications, but it is a more complicated case, see DirectX readme. Glide and DirectX dlls can co-work inside a process so the same versions of them have to be used within a folder. If one of them detects the other with different version then it refuses to initialize and work. Co-work is useful for applications that use DirectDraw for some initial in-game menu and Glide for 3D rendering. 5. Configuring -------------- As different options might wanted to be used for particular applications, I kept the concept of local/global configurations. The configuration data is not stored in the dlls themself anymore. It is in a separate file named 'dgVoodoo.conf'. All of the Glide and DirectX dlls uses this file. When the Glide or DirectX wrapped application starts, dgVoodoo tries to read config data from the same folder where the application (exe) resides. If it is not found then it looks for the file in the user's application data folder. If none found then the default config is used. In dgVoodooSetup you can choose a folder where you can save the current configuration. After you chose a folder, it remains in the list permanently. By default the user's application data folder is selected. If an application tolerates losing focus without closing/minimizing itself, you can configure it dynamically: when the setup starts up it builds a list of detected running Glide/DirectX wrapped applications and insert it into the folder selector combobox. When you select such a running instance then the current state of the application is read as config and most of the options can also be changed. So, you can set resolution, msaa, brightness, etc on the spot without restarting the application (configurable items depend on emulation type). When an option changes, it takes effect at once. If the dialog gets cancelled or an other config folder/instance is selected, all the changes gets cancelled as well. You can always use the 'Apply' button to save the current config to the selected folder or running application without exiting the setup. So, the setup program is quite like a control panel. Important to note: - If the wrapped app and the setup runs on different privilege levels (admin/nonadmin) then the app won't appear in the instance list or they cannot communicate to each other. Sorry for the inconvenience. - Switching resolution or MSAA can only be performed perfectly if the application re-renders everything on each frame. If it uses or keeps previously (once-)rendered things like cockpits or similars then they will be missing as will not get re-rendered. (Glide only) A folder inserted formerly into the list can be removed. Also, list of the running instances can be refreshed. (Why still need a setup at all? Well, now it's not for choosing from millions of techical options due to weak implementation but for fancy things, see the next chapter as well as Glide and DirectX readme.) 6. General setup options ------------------------ Options on the General tab affects all wrapped APIs, so that currently Glide and DirectX. - API: OK, since the only rendering API is Direct3D11 right now, this one is pointless. - Video card (adapter): In case you have more than one, let you choose which one to use for rendering (Glide). DirectX is a multi-device capable API so you can choose which adapter(s) are to be enabled for the DirectX emulation. - Monitor (output): If you have multiple monitors then you can choose which one to use for fullscreen mode. "Default" means the primary monitor. Also, if default is selected then switching from windowed to fullscreen during playing a game selects the monitor containing the largest part of the game window. - Full Screen / Windowed: See section "Usage". - Centered/scaled full screen: If the current resolution the wrapped app using does not match any natural resolution your adapter supports then the display can be strethed out to fit all the screen or its size can be left unchanged but centered. - Progressive scanline order: Default scanline order is interlaced or progressive. It is up to the output display device which one to choose altough it chooses progressive when it is possible, I think, so that when the device is capable of displaying a given resolution with a given refresh rate with progressive order. Otherwise it might choose interlaced order with halved physical refresh rate. If this option is enabled, you can only see enumerated resolutions that are displayable with progressive order. However, if a custom resolution is defined then it may causes the output device to use lower physical resolution than the wrapper set. - Enumerate refresh rates: Enables the setup program to enumerate refresh rates for each resolution and enables the wrapper to override the default refresh rate of the application. However using other than the app default can cause heavy animation lagging or glitches! - Color adjustments: Brightness and color intensity can be finetuned here. The defaults are good in general so treat this as a cool extra. (I'm using it in some cases for making colors more vital to get a bit cartoon-like effect.) - Keep window aspect ratio: In windowed mode, when sizing the window, you can keep the aspect ratio of the current resolution. 7. General tips and known issues -------------------------------- - Forcing things (like resolution, antialiasing, texture filtering, etc) is not a healthy thing. If an application or game uses low resolution or point sampled textures or anything dissonant to the eye then it has reasons for that. It is not because the programmers were so lame but of avoiding artifacts that would otherwise get brought in (typical example is a bilinear filtered texture with colorkey based transparency). If you force anything then potentially get one of those artifacts. If you can live with it then it is ok, use the wrapper in forced mode. If not then disable all forcings and use the particular game or application in the mode it was designed for, because no general method exists to fix such type of artifacts. - Controlling antialiasing cannot be done on per-primitive basis in Direct3D 11 when feature set larger than 10.0 is used. That is why antialiased drawing is not emulated automatically in this version in any way (per-primitive or per-edge). It can only be forced globally in the setup. - Fullscreen gamma ramp may not be supported by your card. nVidia and ATI seem to handle it as expected but (e.g.) Intel does not. - When an application is being run in compatibility mode (Win98/XP etc) then the user's application data folder is different than the OS default. Therefore dgVoodoo cannot read the global config file and the default config gets applied if no local config file is present. The preferred way is creating a local config for such cases if other than the default needed. (Perhaps using the user's appdata folder is not a too good idea after all, I might change it later.) - If you have a multimonitor system then always try a game to run on the primary one for the first time. Some games lock the mouse cursor to the screen area where game window is assumed to be (the left-top corner of the desktop). If such a game is being forced onto another monitor then clicking in the game causes application focus loss because its window is not under the mouse cursor. 8. Change log ------------- 2.45: - Heavily refactored DirectX emulation code for certain planned features - Full cooperating between Glide and DirectX DirectDraw emulation: - True multidevice support, more robust DDraw emulation - OLE interface support for DirectDraw - DXTC (S3TC) block compression encoder is added, full support for possible alpha-format conversions - Two new video card types are added with slightly different properties (GeForce4 Ti 4800, ATI Radeon 8500) - DirectDraw emulation-only mode could fail, fixed - Various DirectDraw bugs/incompatibilities are fixed - Blitting bugs fixed + full support for blitting from primary surface Direct3D emulation: - New colorkeying method added and existing colorkeying related bugs are fixed - Bugs in rendering from execute buffers (points/lines), fixed - Bug in handling state blocks, fixed Glide rendering - Resolution extension support (idea and technical concept by VEG and Zeus) 2.44: DirectX emulation: - Some surface/D3D device related bugs are fixed - Mirrored blitting was broken, fixed - 24bit software surface support is added - support for DXT1-5 compressed textures is added but an S3TC encoder is still missing for the cases when a compressed texture is the blitting target - Transforming normal vectors was incompatible with MS D3D, fixed This fix includes enabling/disabling of normalizing them, default was wrong for older than DX7 interfaces - Colorkey blend capability is added - support is added for old mode-X display modes - Various other small bugs fixed that I can't remember of 2.43: DirectX emulation: - 3D support for 8 bit surfaces is added (Colin McRae Rally) - Improved surface blitting, more optimal resource consuming for 3D surfaces - First version of fast surface video memory CPU-access is added - Introducing 'lost' state into the default DX behavior, with additional automatic self-restore mechanism for buggy DX applications - 3D TL vertex rendering incompatibilites, fixed - Various small 3D/caps related bugs, fixed - Several other bugfixes that I don't want to word here Other: - Some problems related to the window procedures and message handling are fixed - Names of the wrapped running DX applications were displayed incorrectly, fixed 2.42: - Direct3D3 renderstate handling bugfixes (some of them were disabled) - Various DirectDraw bugfixes like object/structure version handling, surface blitting, basic ROP codes are added, and others - Compatibility fixings in DirectDraw surface creation functionality - Compatibility fixings in DirectDraw surface locking functionality - Compatibility fixings in Direct3D device creating - Fixing/refactoring light handling in general; now software vertex processing can handle any number of them, and also, they can be added at any index in Direct3D7 - 32 bit z-buffer support added - Minor Direct3D rendering bugs - Bad return code in an empty (but necessary) function on IDirect3DTexture, fixed - Missing multithreading guarding in some Direct3D3 methods, fixed 2.41: - Direct3D 3 support is added; so that all Direct3D interface is supported now - Bug in the resolution enumerator in DirectDraw, fixed (classic and all other resolutions are now enumerated with all bit depths.) - Resolution combo box was buggy in the setup; couldn't enumerate anything when too much resolutions were available, fixed - Logic of selecting the refresh rate when unspecified rate is requested by the application is changed - Overridable refresh rates - Bugfixings and improvement for blitting to the primary surface in DirectDraw - Bugfixings for other general surface locking/blitting functionality - Minor DrawPrimitive bug fixed (missing triangles in Diablo II with Direct3D renderer) - Bug with monochrome lighting is fixed (discovered with Jedi Knight - Mysteries of the Sith) - Bug in surface blitting, fixed (The Settlers IV) - Bug/incompatibility fixings in surface handling in: GetAttachedSurface, EnumerateSurfaces, SetSurfaceDesc and loading textures from system memory surfaces to texture surfaces in video memory - DX wrapper is now more noshutdown-proof when unexpectedly pulled out from the process memory area; LithTech engine based games now should work (tested with Blood2 and Shogo Mobile Armor Division) - Various other small bugs fixed that I came across - Introducing 'unspecified' scaling mode. If you want to apply 'scaling but keeping aspect ratio' then select it on your graphics driver control panel and select 'unspecified' mode in dgVoodoo Setup. If it does not work then your only chance is forcing it through the graphics control panel (it all seems to be a Windows issue). - Disabling 'Bilinear blit stretch' in the default configuration. I've seen a few games where it caused more 'harm' than coolness that is why I decided to disable it by default. 2.4: DirectX rendering: - New, improved version of DirectDraw. It fully supports creating and blitting to/from textures, Z-buffers and 3D-renderable surfaces with several pixel formats. Also, general API-behavioring is more accurate to the original one because of lot of bugfixings and heavy reverse engineering. - Gammacontrol interfaces is added to DirectDraw - First version of Direct3D implementation is added and (almost) fully supports DirectX5, DirectX6 and DirectX7. For more and technical details, see the DirectX readme. Direct3D interfaces are also as carefully reverse engineered as DirectDraw ones. Glide rendering: - Bug in handling utility textures, fixed (missing textures in South Park) - Bug with PALETTE6666 extension fixed (unreadable menu text in Need For Speed - Porsche 2000 with a Voodoo2 or higher) - Bug with tripebuffering fixed (missing 3D elements in The Tainted) - Adapting Glide3 to 3Dfx mini GL driver (3Dfxvgl.dll), (American McGee's Alice): - Lowering gamma bitnum to 8 (3Dfx didn't follow his own rules...) - Some init/exit code could get stuck because they can get called from DLLMain, fixed Setup: - 'Apply' button in the setup is added (I got bored to OK'ing and reopening the setup each time I want to modify the config of more folders or running instances) 2.32: - Possibility of overriding the application resfresh rate is added - Small Glide3 fix (bug with Turok 2) - Minor Glide3 shader modification (SurfDemo) - Glide lib is made thread-safe at the needed (minimal) level (means avoiding crashes at certain circumstances where the original 3Dfx driver survived beause of its architecture; a Turok 2 issue again, using background threads) 2.31: It is a slight patch version for 2.3: - Fixing Glide 3DF reader for various line ending types (Crazy Marbles) - A bug found in one of Glide state setting functions, fixed (Crazy Marbles) - Hidden/shown cursor glitch is (seems to be) fixed in windowed mode - Possibility of forcing progressive scanline order on output display is now available in the setup - Fixing some DirectDraw bugs thanks to other pending developments (what I don't want to release yet) 2.3: This won't be easy because I suspended developing for a few months, but: - First I refactored the code in order to any new driver component or renderer could be added easily - Fixed some issues with multiple video cards/monitors. Now it works OK in a multi-videocard system (not so frequent usecase but I like if something is done well) - Added first version of DirectDraw component to the driver - Minor Glide shader modifications 2.2: - Napalm build added - Glide3 fixings: erroneous clip coord space handling - Small bug related to lfb write with active pipeline, fixed - Setup got revamped a bit 2.15: - Full support for texture buffers via Glide3 extension 'TEXTUREBUFFER' All 16 bit texture formats are supported as rendering format except for paletted ones - Bad color order for delta0 color, fixed (seems I'm not in luck with RGBA order in general) - Some bugs are fixed I found through my own tests: unwritten alpha values to the aux buffer, bogus Glide3 viewport handling - More optimization in LFB lock handling to avoid slowdowns on locking patterns/usage like in King's Quest: Mask of Eternity (Thanks for the feedback & help, Andrew!!) - A lot of code changed thanks to other developments, so I hope I have not broken anything 2.14: - Unified Memory Architecture (UMA) along with TEXUMA Glide3 extension is supported - Some Voodoo hardware properties are changed according to UMA/non-UMA architecture (Now Extreme Assault works with Gulikoza's latest patch, but see Tips for more) - Optimizations for lfb read/write region (including 3Dfx watermark) - A missing thing from PCI emulation is implemented for perfect lfb access with active pixel pipeline 2.13: - Improved PCI emulation for LFB access: heavy lfb-lockers like Carma1 and Pyl SHOULD run much smoother now (see Tips for more) - Glide3 fixings: bad color order with packed RGBA, uninitialized texchroma state - General glide fixings: bug in glide setstate and clip rectangle - Missing feature "fog with iterated z" is implemented along with minor shader modifications - Support for splash screen and shameless plug: dgVoodoo needs the 3Dfx splash dlls to get it working (3DfxSpl2.dll, 3DfxSpl3.dll, all with version 1.0.0.4), however I did not include them in the core dgVoodoo pack - Minor modification for DosBox - TMUnum selector combobox is fixed, I fcked it down last time 2.12: - More shader optimizations: most critical ones are reduced to 90% in size again (So, by now, their size are 65% of the original. I hope I have not messed up anything with them.) - Optional 16 bit depth buffer (see Tips for why is that) - Some fixings in Glide3 thanks to some unexpected API-driving (scene demo Virhe) - Some bugs related to maintaining/switching/handling windowed/fullscreen state are fixed - Voodoo2 with 1 TMU is no longer selectable in the setup; A Voodoo2 always have 2 TMUs and it is the default now because shaders are optimal enough now to handle 2 TMUs 2.11: - Refactoring GPU querying to get it to work with ATI drivers (ATI does not seem to handle them correctly, my code was always fooled into infinite loop at a certain point) - Further shader optimizations: most critical ones are reduced to 90% in size - Minor cursor-issue related to losing window focus, fixed 2.1: - Potential stalling rendering (even on fast GPUs) when switching screen modes, fixed - Shader optimizations: most critical ones are reduced to ~80% in size - Ability to configure running Glide wrapped applications dynamically (see section 'Configuring') - Different exposed capabilities according to the selected card type - More Dosbox compatibility - Bug in gammaramp handling, fixed - Bug in fogtable generating code, fixed - Bug in PCI access emulation, fixed - Forced vSync is enabled by default to avoid overkilling the GPU with wild-rendering applications 2.01: - Undrawn polygons when updating TMU memory, fixed - Potentially bad drawing of strip-primitives in Glide3, fixed - Malfunctioning LFB lock with 32bit formats when PCI emulation is enabled, fixed - Fullscreen/Windowed state was not always remembered between Glide-initializings, fixed 2.0: The original version Have luck, Dege