; =================================================================================
; VK3DVision - A Vulkan Stereo3D driver made by Helifax for Stereo3D in Vulkan API. 
; www.http://3dsurroundgaming.com/
; PLEASE READ COMMENTS BELOW, to understand what the options DO!
; NOTE: Variables and names are CASE-SENSITIVE!!!
; =================================================================================

[General]
;============================================================================================= 
; Enable Shader Tracking and development mode
; WARNING: This mode will affect performance! Only use it when debugging graphics issues/shaders!
; WARNING: This mode will require a lot more RAM, as NO RESOURCES are DESTROYED!
;============================================================================================= 
DevelopmentMode = false

;=============================================================================================
; Show UI and Stats / Keys UI at startup?
;=============================================================================================
;ShowStartupUi = true

;============================================================================================= 
; Logger levels: Info, Error, Warn, Debug, Time_Sync, Shader_Binding, Shader_tracer
;============================================================================================= 
LoggerLevel = 3

;============================================================================================= 
; Generate a Minidump if an exception is encountered
; Usefull for me to debug crashes or other issues
;============================================================================================= 
Minidump = false

;============================================================================================= 
; VK3DVision will enable Stereo Rendering only for these processes.
; Up to 10 process names can be added.
;============================================================================================= 
ProcessName1 = "DOOMEternalx64vk.exe"

;============================================================================================= 
; Specify the viewing mode:
;
; 3D Displays:
; MONO - standard 2D rendering. (Obviously - Default rendering)
; SBS_LEFT - Side-by-side, left image first. No Nvidia 3D Vision Driver is required!
; SBS_RIGHT - Side-by-side, right image first. No Nvidia 3D Vision Driver is required!
; TB_LEFT - Top-Bottom, left image at topsas. No Nvidia 3D Vision Driver is required!
; TB_RIGHT - Top-Bottom, right image at top. No Nvidia 3D Vision Driver is required!
; FULL_SBS - Full Width Side-by-side, left image first. Useful for video recording! This will make a 2 * Width window based on the size of the Deskop. Use ShadowPlay (Geforce experience to record).
; 3DVision - Uses DX9 to render. Works on driver ABOVE 452.06. Requires Nvidia 3D Vision Driver! DO NOT USE ANY OVERLAYS or Performance will be severly affected!
;
; Virtual Reality:
; HelixVisionVR - requires HelixVision (https://store.steampowered.com/app/1127310/HelixVision/).
; OpenVR - Native Virtual Reality Renderer.
; - Best performance.
; - Curved Screen with ability to modify VR Screen Size, VR Screen Height, VR Screen Distance.
; - Full VR Controller mapping to XBOX Controller (via ViGEm) and configurable from SteamVR! (Valve Index & Vive Wands and Quest 2 controllers)
; OpenVRDirect - Used only for custom made VR Mods. DO NOT USE on regular Stereo3D Game fixes as it will not work correctly!
;============================================================================================= 
Stereo3DViewMode = OpenVRDirect

;============================================================================================= 
; Async Redering mode.
;
; For OpenVRDirect it should be FALSE, otherwise stuttering will occur!
; For OpenVR (Cinema), leave it true.
;============================================================================================= 
OpenVR_AsyncRendering = false

;============================================================================================= 
; Present the image in the game window? or just in VR?
;
; Default is true.
; If you experience performance issues, or if you get stuttering or want a bit more performance in VR, turn it false.
; Works both in OpenVR and OpenVRDirect.
;============================================================================================= 
OpenVR_GameWindowRendering = true

;============================================================================================= 
; Synchronise with Screen Refresh rate.
; Should always keep this ON. Disabling it, will allow for higher FPS but will introduce screen tearing and the image might feel "floaty"!
;============================================================================================= 
Vsync = false

;============================================================================================= 
; Frames Per Second Limit (MAX FPS Limiter).
; 0 - No FPS Limit.
;============================================================================================= 
FPSLimit = 0

;============================================================================================= 
; Works only in SBS/TB modes. (3DVision - not supported due to fullscreen exclusivity, OpenVR, HelixVision don't require it)
; Upscales from the in-game selected resolution to the Desktop resolution.
;============================================================================================= 
Upscaler = false

[OpenVRDirect]
;============================================================================================= 
; Resolution factor.
;
; 1.0 -  100% SteamVR Resolution. 
; 0.80 - 80% SteamVR Resolution.
; etc
;
;============================================================================================= 
OpenVR_ResolutionFactor = 1.0

;============================================================================================= 
; Camera Offsets
;
; By default 90% of FPS games puts the camera "between" the shoulders.
; These offsets are used to position the camera in a normal human position (with a neck & head ^_^)
;============================================================================================= 
OpenVR_Camera_Offset_Up = 0.1
OpenVR_Camera_Offset_Forward = -0.1
OpenVR_Camera_Offset_Right = 0.055

; Disable Keyboard & Mouse controls. Only Console Controller is Enabled or VR controllers via XBOX Emulation.
; Default is true.
OpenVR_DisableInput = false

[Single_Frame_Stereo]
;============================================================================================= 
;
; IMPORTANT: 
; This mode only works with games using Forward Rendering. Deferred Rendering is currently not supported!
; If starting a new fix, use Default Sequential Frame Stereo instead! (The resulted fix can be later ported to SingleFrameStereo)
; Changes the Rendering mechanism from using 2 Sequential Frames to produce a Stereo3D image - TO - Single-Frame Stereo where Stereo3D image is produced from one single frame.
;
; Limitations:
; Texture3D & Buffers used as samplers/input/outputs in shaders are not duplicated. (99% of the time you don't need it anyway)
; Not all GLSL shader functions are covered to support SingleFrameStereo. However they can be added via injection mechanism.
; Vk3DVision will attempt to stereorize all GLSL functions it finds. However, this does not 100% work. Some shaders will fail to compile and can be found in "ShaderFail" folder:
; - Use an offline GLSL compiler like GLSLC (https://github.com/google/shaderc) to fix them.
; - Once fixed, put them in ShaderSwap folder.
; Some Compute Shader Dispatches must be hunted down and made to run 1 time for both eyes
; Some RenderPasses if Stereo will freeze the renderer. They need to be either creator or executed Mono instead of Stereo. (Use the filter mechanism found in a section below)
;============================================================================================= 
SingleFrameStereo = true

;============================================================================================= 
; Prints the HASH of all RenderPasses that are used for rendering a frame.
; VERY USEFULL if you try to find the Renderpass that hangs the engine.
PrintRenderpassUsage = false

;============================================================================================= 
; Will Create a new folder called "RenderPassUsage" in VK3DVision folder.
; Will Create a new file for each frame that will contain all the Renderpasses that were recorded that frame.
; Take these hashes and put them under [DebugRenderPass] section to help  you identify the RenderPass that is not working the way it should.
; This is for DEBUGGING only!!!
DumpRenderPassUsagePerFrame = false

[RenderPass1]
;============================================================================================= 
; !!! ONLY FOR SingleFrameStereo!!!
; Support for up to 1000 RenderPasses.
; Some RenderPasses don't need to run FOR EACH EYE, but one time per FRAME.
; Define the behaviour of the renderpasses that need to be mono!
; To find Renderpasses that are used for a frame as well as the other information in this section,
; Use "PrintRenderpassUsage" and check the LOG.
; To change the execution of this RenderPass during Game-play you can use a [Key] section to bind it.
; See [Key] Section and "Renderpass" option.
;============================================================================================= 

; RenderPass Hash
hash = 0x0
; Value of -1 means it will be ignored.
; To match the Swapchain Size, pass "2147483647" (INT_MAX)
offset_x = -1
offset_y = -1
width = -1
height = -1
; Possible operations:
; equal (==)
; not_equal (!=)
; smaller (<)
; greater (>)
offset_x_operation = equal
offset_y_operation = equal
width_operation = equal
height_operation = equal
; Clear Count value sent as part of the RenderPassInfo.
ClearCount = -1
; Execution Mode. 
; Normally you want Stereo, but in some games you only want the renderpass to be "Mono" when you use the associated key! So you can start with a stereo execution and toggle it to "mono" when required.
; Supported modes: Stereo, Mono
Execution = Mono
; Creation Mode
; A Stereo renderpass can be executed Mono, but not the other way around.
; Supported modes: stereo, mono
Creation = Stereo

[Stereo_Injection]
;============================================================================================= 
; Enables Stereoscopic 3D Injection.
; Enables Shader Swapping with custom ones.
; In SingleStereoPass it does automatic shader injection. See [Single_Frame_Stereo] for info.
;============================================================================================= 
Stereo = true

;============================================================================================= 
; Enable the Usage of ShaderCache
; Default is disabled (false)
; The ShaderCache can help by reducing stutters if the game creates a lot of shaders in the background, like Detroit: Become Human
; Development Mode: 
; Shader Cache is not used, but shaders can be added to the cache (including the edited ones if ShaderCache is enabled).
; Normal Mode:
; The shader cache is loaded and used and new shaders are added to the cache, both from injection and from ShaderSwap.
;
; If the ShaderCache is disabled, it will not be loaded nor shaders will be added to the cache both in Normal and Development Mode.
;============================================================================================= 
ShaderCache = true

;============================================================================================= 
; Enable Shader Optimizations.
; !!! Shader Creation time will take significantly longer! However, ShaderCache size will drop by aprox. 50%.
;============================================================================================= 
ShaderCacheOptimization = true

;============================================================================================= 
; GL Shader Language Version
; 450 - supports all features up to RTX
; 460 - is required for RTX and Vulkan 1.1 or 1.2
;============================================================================================= 
ShaderVersion = 460

; How should stereo view be generated? By offseting both eyes or just one?
; Possible values:
; LEFT, RIGHT, MONO
DominantEye = MONO

;============================================================================================= 
; Separation & Convergence values that will be used (These will also be used for Nvidia 3D Vision. Values from NvPanel and profile WILL BE IGNORED!)
; Values from 0(%) to 1000(%).
;============================================================================================= 
; Depth that is going to be used in all modes
; Use CTRL+F3/F4 to increase/decrease it.
Separation = 100

; Convergence that is going to be used in all modes 
; Use CTRL+F5/F6 to increase/decrease it.
Convergence = 1.00

; Requires "Vk3DFrameSync.dll" which is a PER-GAME module.
; Ignored if SingleFrameStereo is enabled, uless a special override is enabled.
; If module not found, it doesn't do anything.
; Specify the "mode" index in which the sync will be done!
; (The module must be coded with the "mode" in mind for this to work)
FrameSync = 0

;=============================================================================================
; Uniform Buffer Layout Binding in shaders (to send data from CPU to the GPU)
; A value of "-1" Means AUTOMATIC binding mode is enabled!
; WARNING: This overrides the automatic mechanism in place! ONLY use if, it that fails or want manual control!
;
; If disabled:
; The binding needs to be adjusted per game/app
;
; SEE LOG if a CLASH is detected!
; Not adjusting them correctly will CRASH the VULKAN DRIVER!
; KEEP IT AS LOW AS POSSIBLE to AVOID wasting MEMORY and Severly Degrade Performance!
;  See: https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#descriptorsets-sets
;=============================================================================================
UniformLayoutBinding = -1 

;============================================================================================= 
; Print the values used by DescriptorSets for the "UniformLayoutBinding" above.
; Check the LOG to see what values are used and adjust "UniformLayoutBinding" accordingly so there IS NO CLASH!
; (Any manually fixed shaders will not work if this value is changed after the shader was modified!!! You will need to adjust the exported shaders with the correct Layout Slot!)
;============================================================================================= 
PrintLayoutBinding = false

;============================================================================================= 
; Part of a STRING that is FOUND in all the shaders. The Uniform Buffer will be inserted after this line.
; Support for 10 Slots: UniformInjection1 - UniformInjection9
;============================================================================================= 
UniformInjection1 = "layout"
    
;============================================================================================= 
; Part of a STRING that is FOUND in all the SHADERS.
; Support for 99 Slots: ShaderInjectionPoint1 - ShaderInjectionPoint99
;============================================================================================= 
ShaderInjectionPoint1 = "gl_Position.y = -gl_Position.y"

;============================================================================================= 
; Stereo Correction String
; VIEW is the index of the eye: 0 - LEFT / 1 - RIGHT
;============================================================================================= 
ShaderStereoString1 = "gl_Position.x += vk3d_params[VIEW].stereo.x * (gl_Position.w - vk3d_params[VIEW].stereo.y);\n"

;============================================================================================= 
; Options:
; - insert: Will insert the "ShaderStereoString1" after all matches for "ShaderInjectionPoint1". 
; - replace: Will replace the string in "ShaderInjectionPoint1" with "ShaderStereoString1".
;============================================================================================= 
ShaderOperation1 = insert

;============================================================================================= 
; Supported Shader Types:
; Vertex
; Fragment
; Compute
;============================================================================================= 
ShaderType1 = Vertex

;============================================================================================= 
; Regular String Fin -> Replace/Insert or Regex based Search?
;
; This is very Experimental and in early stages.
; 
; An Basic Example:
;
; // This is a Regex Search pattern
; ShaderInjectionPoint3 = "TEXTURE_LOD\(g_rb2DTextures\[(\w+)\.g_cbLightArray1"
; // This is a String. Vk3DVision will add the capture groups where indicated.
; ShaderStereoString3 = "TEXTURE_LOD2D(g_rb2DTextures[$1.g_cbLightArray1"		
;
; The \ character (escape char) means "\(" is literal char "("
; "()" - Regex capture group
; "\w+" - Anything as long as they are characters
; "(\w+)" - First Capture Group. There can be many more
; "$1" - Replaces $1 with what was found in the 1st Capture Group, etc.
;
; A Complex Example:
;
; ; DO NOT BREAK the original code pattern on MULTIPLE lines, unless the actual Shader code is on MULTIPLE lines! (Even THEN, make sure that spaces are included. MULTILINE PARSING doesn't take this into account! Better to stick with the C semantic and "\n")
;ShaderInjectionPoint6 = "vec4 (\w+) = texture\(g_rb3DPassTextures\[0u\], vec3\((\w+).x, (\w+).g_cbPass._EyeData._vFogSubCrop.y - (\w+).y, \(log\(\(-interp_vfVsPosition.z\) \* (\w+).g_cbPass._vFogSetup.x\) \* (\w+).g_cbPass._vFogSetup.y\) \* (\w+).g_cbPass._vFogSetup.z\)\);"
;
; IF using MULTILINE, DO NOT ADD "\n". Multi-line parser will automatically do it for you! Add "\n" only on the LAST line - if you want a new line!!
;ShaderStereoString6 = "vec3 pos = vec3($2.x, $3.g_cbPass._EyeData._vFogSubCrop.y - $4.y, (log((-interp_vfVsPosition.z) * $5.g_cbPass._vFogSetup.x) * $6.g_cbPass._vFogSetup.y) * $7.g_cbPass._vFogSetup.z);
;                      if (VIEW == 1)\npos.x -= vk3d_params[VIEW].stereo.x;
;                      vec4 $1 = texture(g_rb3DPassTextures[0u], pos);\n"
;============================================================================================= 
Regex1 = false

[Experimental]
;============================================================================================= 
; Enable Bink Video Syncrhonization
;============================================================================================= 
SyncBink = false

[Params]
;============================================================================================= 
; Values that are sent as a vec4 PER FRAME to all shaders. Can be used for custom operations.
; Currently only ONE Vec4 is sent to shaders!
;============================================================================================= 
x = 0.01 ; UI DEPTH
y = 0.0  ; Internal usage - DO NOT CHANGE!
z = 0.0
w = 0.0

[Tools]
;============================================================================================= 
; This is a tool to convert the hashes of a fix made with Vk3DVision PRIOR v.2.0.0
; In V1 Mode, a shader hash was calculated on the binary supplied by the game.
; If the shader binary is recompiled (from the same source code), the hash will be different. A game update might do this!
; In V2 Mode, the hash is calculated on the Source Code of the Shader Binary, after decompilation.
; How to Use:
; Enable the option below. This will make Vk3DVision work in V1 Hash ode.
; Make sure your shaders are in "Vk3DVision/ShaderSwap".
; Start the game and play the game to load all the shaders.
; If a shader is swapped by Vk3DVision it will output the V2 Hash variant in "Vk3DVision/ShaderSwap2"
; All found shaders will be moved from "Vk3DVision/ShaderSwap" to "Vk3DVision/ShaderSwap2" with updated hashes.
; Once all hashes have been coverted, disable the option below and Rename "ShaderSwap2" to "ShaderSwap"
; Start the game again and Vk3DVision will use V2 Hash Mode.
;============================================================================================= 
ConvertHashV1ToV2 = false

;============================================================================================= 
; Enable computation of Hashes using V1 method.
; This SHOULD always be FALSE for new fixes.
; Can be used to enable Legacy compat mode with fixes made with VK3DVision v.1.0.x
;============================================================================================= 
EnableHashV1 = false

;============================================================================================= 
; Convert all shaders from ShaderSwap folder from using static Uniform Layout Bindings to 
; optimal per shader Uniform Binding.
; Should be used to convert fixes made with Vk3DVision before v.3.2.x
;============================================================================================= 
ConvertToDynamicUniforms = false

;============================================================================================= 
; Attempt and convert all Shaders in ShaderSwap folder from Vk3DVision 3.x or older to new 4.x Syntax.
;============================================================================================= 
ConvertShadersToV2 = false

;============================================================================================= 
; Attempt and convert all Shaders in ShaderSwap folder from Sequential Frame Stereo3D (Default) to Single-Frame Stereo.
; This tool WILL NOT GUARANTEE that the fix can be ported straight away!
; It is meant to "recover" some of the shader work done in Frame Sequential Stereo3D!
;============================================================================================= 
ConvertShadersToSingleFrameStereo = false

; Shortcut Keys
;============================================================================================= 
; From [Key1] to [Key50]. Key numbers MUST BE SEQUENTIAL!
; type = once, hold, toggle
; Supports: convergence, separation values
; For Keyboard Keys see: https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
;=============================================================================================
; For Xbox Controller, use these values:
;=============================================================================================
; XBOX_DPAD_UP
; XBOX_DPAD_DOWN
; XBOX_DPAD_LEFT
; XBOX_DPAD_RIGHT
; XBOX_START
; XBOX_BACK
; XBOX_LEFT_THUMB
; XBOX_RIGHT_THUMB
; XBOX_LEFT_SHOULDER
; XBOX_RIGHT_SHOULDER
; XBOX_LEFT_TRIGGER
; XBOX_RIGHT_TRIGGER
; XBOX_A
; XBOX_B
; XBOX_X
; XBOX_Y
;=============================================================================================

;[Key1]
;key = 0x70
;type = toggle
;z = 0.30
;Description = "Custom Weapon Depth"

;[Key2]
;key = 0x14
;type = toggle
;y = 0
;z = 0
;Description = "UI Menus"


; VALID ONLY IN SINGLE-FRAME STEREO!
; This section is auto-generated by Vk3DVision. See Compute Dispatch section on how to generate it.
; The following Compute Shaders will be executed ONE TIME per frame (instead of 2X):
[ComputeDispatch]
Hash1 = cd70ae2521b3ba9d
Hash2 = 6842f3d7c85d7c5
Hash3 = dce9b17abbc879c8
Hash4 = 6589921c688ead5b
Hash5 = 3c3ae4f600206197
Hash6 = 1c6dff3f15b7d1a2

; This section is auto-generated by Vk3DVision. See Scissor Clipping section on how to generate it.
; Scissor Clipping will be extended for the following shaders:
[ScissorClipping]
