protonscr

[d3d9] GTA IV Shader Cache Confusion

dxvkclosed d3d9
doitsujin/dxvk#2209 · opened 2021-08-05 by Sparktimus · updated 2021-08-05 · 2 comments · github
SSparktimus 2021-08-05 github

I recently installed GTA IV along with the latest version of DXVK (version 1.9.1 as of this writing) and I've run into a bit of an issue. I downgraded my game to 1.0.8.0 so that I'm able to use .Net mods and I haven't had any issues with using DXVK with it until now. Usually the game will jump and stutter upon reinstalling and using DXVK because the shader cache needs to be rebuilt, naturally. The only problem is that each new instance of the game invalidates the previous cache which means the cache is being rebuilt time and time again and stuttering in the same places each time I load the game.

After this happened initially I switched back to 1.8.1 and found that the game runs just fine with no stuttering after the shader is built even after exiting and re-entering the game. I didn't really understand what was going on or what was different and I'm still in the dark somewhat about it, Then I checked the shader cache folder for GTA IV in its Steam directory and found that the cache file was being generated for GTAIV.exe instead of PlayGTAIV.exe which is the app that's actually running the game. I tried renaming the cache file to point to PlayGTAIV and the results are too inconsistent for me to really come to a conclusion if that worked.

It's worth noting that initially the game was generating a cache file for PlayGTAIV but it doesn't seem to actually build anything. It just turns out to be a placeholder where a cache would go, but it seems like something is either overwriting it or stopping it from being used or further written. I've already tried disabling my firewall and antivirus just to make sure nothing like that was stopping it and no dice. I'm extremely novice when it comes to thing like this and I'm not a Linus user so I was hoping someone else either had this problem or has found a workaround. Lowering my graphics settings has also yielded no results.

Software information

GTA IV Complete Edition (Downgraded to 1.0.8.0)

System information

  • GPU: NVidia GeForce GTX 1660
  • Driver: nvldumdx.dll, version 30.0.14.7141
  • Wine version: n/a
  • DXVK version: 1.9.1

Log files

  • d3d9.log: info:
    Game: GTAIV.exe
    info: DXVK: v1.9.1
    info: Found config file: dxvk.conf
    info: Found built-in config:
    info: Effective configuration:
    info: d3d9.customVendorId = 1002
    info: dxgi.emulateUMA = True
    info: Built-in extension providers:
    info: Win32 WSI
    info: OpenVR
    info: OpenXR
    info: OpenVR: could not open registry key, status 2
    warn: OpenVR: Failed to locate module
    info: Enabled instance extensions:
    info: VK_KHR_get_surface_capabilities2
    info: VK_KHR_surface
    info: VK_KHR_win32_surface
    warn: D3D9: VK_FORMAT_D16_UNORM_S8_UINT -> VK_FORMAT_D24_UNORM_S8_UINT
    info: NVIDIA GeForce GTX 1660:
    info: Driver: 471.41.0
    info: Vulkan: 1.2.175
    info: Memory Heap[0]:
    info: Size: 5991 MiB
    info: Flags: 0x1
    info: Memory Type[1]: Property Flags = 0x1
    info: Memory Heap[1]:
    info: Size: 5087 MiB
    info: Flags: 0x0
    info: Memory Type[0]: Property Flags = 0x0
    info: Memory Type[2]: Property Flags = 0x6
    info: Memory Type[3]: Property Flags = 0xe
    info: Memory Heap[2]:
    info: Size: 214 MiB
    info: Flags: 0x1
    info: Memory Type[4]: Property Flags = 0x7
    info: Process set as DPI aware
    info: Device properties:
    info: Device name: : NVIDIA GeForce GTX 1660
    info: Driver version : 471.41.0
    info: Enabled device extensions:
    info: VK_EXT_4444_formats
    info: VK_EXT_conservative_rasterization
    info: VK_EXT_custom_border_color
    info: VK_EXT_depth_clip_enable
    info: VK_EXT_extended_dynamic_state
    info: VK_EXT_full_screen_exclusive
    info: VK_EXT_host_query_reset
    info: VK_EXT_memory_priority
    info: VK_EXT_robustness2
    info: VK_EXT_shader_demote_to_helper_invocation
    info: VK_EXT_shader_viewport_index_layer
    info: VK_EXT_transform_feedback
    info: VK_EXT_vertex_attribute_divisor
    info: VK_KHR_create_renderpass2
    info: VK_KHR_depth_stencil_resolve
    info: VK_KHR_draw_indirect_count
    info: VK_KHR_driver_properties
    info: VK_KHR_image_format_list
    info: VK_KHR_sampler_mirror_clamp_to_edge
    info: VK_KHR_shader_float_controls
    info: VK_KHR_swapchain
    info: Device features:
    info: robustBufferAccess : 1
    info: fullDrawIndexUint32 : 1
    info: imageCubeArray : 1
    info: independentBlend : 1
    info: geometryShader : 1
    info: tessellationShader : 0
    info: sampleRateShading : 1
    info: dualSrcBlend : 0
    info: logicOp : 0
    info: multiDrawIndirect : 0
    info: drawIndirectFirstInstance : 0
    info: depthClamp : 1
    info: depthBiasClamp : 1
    info: fillModeNonSolid : 1
    info: depthBounds : 1
    info: multiViewport : 1
    info: samplerAnisotropy : 1
    info: textureCompressionBC : 1
    info: occlusionQueryPrecise : 1
    info: pipelineStatisticsQuery : 1
    info: vertexPipelineStoresAndAtomics : 1
    info: fragmentStoresAndAtomics : 0
    info: shaderImageGatherExtended : 0
    info: shaderStorageImageExtendedFormats : 0
    info: shaderStorageImageReadWithoutFormat : 0
    info: shaderStorageImageWriteWithoutFormat : 1
    info: shaderClipDistance : 1
    info: shaderCullDistance : 1
    info: shaderFloat64 : 0
    info: shaderInt64 : 0
    info: variableMultisampleRate : 0
    info: VK_EXT_4444_formats
    info: formatA4R4G4B4 : 1
    info: formatA4B4G4R4 : 1
    info: VK_EXT_custom_border_color
    info: customBorderColors : 1
    info: customBorderColorWithoutFormat : 1
    info: VK_EXT_depth_clip_enable
    info: depthClipEnable : 1
    info: VK_EXT_extended_dynamic_state
    info: extendedDynamicState : 1
    info: VK_EXT_host_query_reset
    info: hostQueryReset : 1
    info: VK_EXT_memory_priority
    info: memoryPriority : 1
    info: VK_EXT_robustness2
    info: robustBufferAccess2 : 1
    info: robustImageAccess2 : 0
    info: nullDescriptor : 1
    info: VK_EXT_shader_demote_to_helper_invocation
    info: shaderDemoteToHelperInvocation : 1
    info: VK_EXT_transform_feedback
    info: transformFeedback : 0
    info: geometryStreams : 0
    info: VK_EXT_vertex_attribute_divisor
    info: vertexAttributeInstanceRateDivisor : 1
    info: vertexAttributeInstanceRateZeroDivisor : 1
    info: Queue families:
    info: Graphics : 0
    info: Transfer : 1
    warn: DXVK: Updating state cache version to v10
    info: DXVK: Read 265 valid state cache entries
    warn: DXVK: Creating new state cache file
    info: DXVK: Using 2 compiler threads
    info: D3D9DeviceEx::ResetSwapChain:
    info: Requested Presentation Parameters
    info: - Width: 1920
    info: - Height: 1080
    info: - Format: D3D9Format::A8R8G8B8
    info: - Auto Depth Stencil: false
    info: ^ Format: D3D9Format::D24S8
    info: - Windowed: false
    info: Presenter: Actual swap chain properties:
    info: Format: VK_FORMAT_B8G8R8A8_UNORM
    info: Present mode: VK_PRESENT_MODE_IMMEDIATE_KHR
    info: Buffer size: 1920x1061
    info: Image count: 3
    info: Exclusive FS: 0
    info: Setting display mode: 1920x1080@0
    warn: D3D9DeviceEx::QueryInterface: Unknown interface query
    warn: db6f6ddb-ac77-4e88-8253-819df9bbf140
    warn: D3D9DeviceEx::QueryInterface: Unknown interface query
    warn: 9b7e4c0f-342c-4106-a19f-4f2704f689f0
    warn: ConvertFormat: Unknown format encountered: 1396921934
    info: Game: GTAIV.exe
    info: DXVK: v1.9.1
    info: Found config file: dxvk.conf
    info: Found built-in config:
    info: Effective configuration:
    info: d3d9.customVendorId = 1002
    info: dxgi.emulateUMA = True
    info: Built-in extension providers:
    info: Win32 WSI
    info: OpenVR
    info: OpenXR
    info: OpenVR: could not open registry key, status 2
    warn: OpenVR: Failed to locate module
    info: Enabled instance extensions:
    info: VK_KHR_get_surface_capabilities2
    info: VK_KHR_surface
    info: VK_KHR_win32_surface
    warn: D3D9: VK_FORMAT_D16_UNORM_S8_UINT -> VK_FORMAT_D24_UNORM_S8_UINT
    info: NVIDIA GeForce GTX 1660:
    info: Driver: 471.41.0
    info: Vulkan: 1.2.175
    info: Memory Heap[0]:
    info: Size: 5991 MiB
    info: Flags: 0x1
    info: Memory Type[1]: Property Flags = 0x1
    info: Memory Heap[1]:
    info: Size: 5087 MiB
    info: Flags: 0x0
    info: Memory Type[0]: Property Flags = 0x0
    info: Memory Type[2]: Property Flags = 0x6
    info: Memory Type[3]: Property Flags = 0xe
    info: Memory Heap[2]:
    info: Size: 214 MiB
    info: Flags: 0x1
    info: Memory Type[4]: Property Flags = 0x7
    info: Process set as DPI aware
    info: D3D9DeviceEx::ResetSwapChain:
    info: Requested Presentation Parameters
    info: - Width: 1920
    info: - Height: 1080
    info: - Format: D3D9Format::A8R8G8B8
    info: - Auto Depth Stencil: false
    info: ^ Format: D3D9Format::D24S8
    info: - Windowed: false
    info: Setting display mode: 1920x1080@60
    info: Presenter: Actual swap chain properties:
    info: Format: VK_FORMAT_B8G8R8A8_UNORM
    info: Present mode: VK_PRESENT_MODE_IMMEDIATE_KHR
    info: Buffer size: 1920x1080
    info: Image count: 3
    info: Exclusive FS: 0
    info: Presenter: Actual swap chain properties:
    info: Format: VK_FORMAT_B8G8R8A8_UNORM
    info: Present mode: VK_PRESENT_MODE_IMMEDIATE_KHR
    info: Buffer size: 160x28
    info: Image count: 3
    info: Exclusive FS: 0
    info: D3D9DeviceEx::ResetSwapChain:
    info: Requested Presentation Parameters
    info: - Width: 1920
    info: - Height: 1080
    info: - Format: D3D9Format::A8R8G8B8
    info: - Auto Depth Stencil: false
    info: ^ Format: D3D9Format::D24S8
    info: - Windowed: false
    info: Presenter: Actual swap chain properties:
    info: Format: VK_FORMAT_B8G8R8A8_UNORM
    info: Present mode: VK_PRESENT_MODE_IMMEDIATE_KHR
    info: Buffer size: 1920x1080
    info: Image count: 3
    info: Exclusive FS: 0
    info: Setting display mode: 1920x1080@60
    info: Presenter: Actual swap chain properties:
    info: Format: VK_FORMAT_B8G8R8A8_UNORM
    info: Present mode: VK_PRESENT_MODE_IMMEDIATE_KHR
    info: Buffer size: 1920x1080
    info: Image count: 3
    info: Exclusive FS: 0
    info: Presenter: Actual swap chain properties:
    info: Format: VK_FORMAT_B8G8R8A8_UNORM
    info: Present mode: VK_PRESENT_MODE_IMMEDIATE_KHR
    info: Buffer size: 160x28
    info: Image count: 3
    info: Exclusive FS: 0
    info: D3D9DeviceEx::ResetSwapChain:
    info: Requested Presentation Parameters
    info: - Width: 160
    info: - Height: 28
    info: - Format: D3D9Format::A8R8G8B8
    info: - Auto Depth Stencil: false
    info: ^ Format: D3D9Format::D24S8
    info: - Windowed: false
    info: Setting display mode: 160x28@60
    info: Presenter: Actual swap chain properties:
    info: Format: VK_FORMAT_B8G8R8A8_UNORM
    info: Present mode: VK_PRESENT_MODE_IMMEDIATE_KHR
    info: Buffer size: 1920x1080
    info: Image count: 3
    info: Exclusive FS: 0
    info: D3D9DeviceEx::ResetSwapChain:
    info: Requested Presentation Parameters
    info: - Width: 1920
    info: - Height: 1080
    info: - Format: D3D9Format::A8R8G8B8
    info: - Auto Depth Stencil: false
    info: ^ Format: D3D9Format::D24S8
    info: - Windowed: false
    info: Setting display mode: 1920x1080@60
    info: Presenter: Actual swap chain properties:
    info: Format: VK_FORMAT_B8G8R8A8_UNORM
    info: Present mode: VK_PRESENT_MODE_IMMEDIATE_KHR
    info: Buffer size: 160x28
    info: Image count: 3
    info: Exclusive FS: 0
    info: D3D9DeviceEx::ResetSwapChain:
    info: Requested Presentation Parameters
    info: - Width: 160
    info: - Height: 28
    info: - Format: D3D9Format::A8R8G8B8
    info: - Auto Depth Stencil: false
    info: ^ Format: D3D9Format::D24S8
    info: - Windowed: false
    info: Setting display mode: 160x28@60
    info: Presenter: Actual swap chain properties:
    info: Format: VK_FORMAT_B8G8R8A8_UNORM
    info: Present mode: VK_PRESENT_MODE_IMMEDIATE_KHR
    info: Buffer size: 1920x1080
    info: Image count: 3
    info: Exclusive FS: 0
    info: D3D9DeviceEx::ResetSwapChain:
    info: Requested Presentation Parameters
    info: - Width: 1920
    info: - Height: 1080
    info: - Format: D3D9Format::A8R8G8B8
    info: - Auto Depth Stencil: false
    info: ^ Format: D3D9Format::D24S8
    info: - Windowed: false
    info: Setting display mode: 1920x1080@60
    warn: D3D9DeviceEx::SetRenderState: Unhandled render state D3DRS_ADAPTIVETESS_Z
    warn: D3D9DeviceEx::SetRenderState: Unhandled render state D3DRS_ADAPTIVETESS_W
    info: D3D9DeviceEx::ResetSwapChain:
    info: Requested Presentation Parameters
    info: - Width: 1920
    info: - Height: 1080
    info: - Format: D3D9Format::A8R8G8B8
    info: - Auto Depth Stencil: false
    info: ^ Format: D3D9Format::D24S8
    info: - Windowed: false
    info: Setting display mode: 1920x1080@60
    info: Presenter: Actual swap chain properties:
    info: Format: VK_FORMAT_B8G8R8A8_UNORM
    info: Present mode: VK_PRESENT_MODE_FIFO_KHR
    info: Buffer size: 1920x1080
    info: Image count: 3
    info: Exclusive FS: 0
    info: Presenter: Actual swap chain properties:
    info: Format: VK_FORMAT_B8G8R8A8_UNORM
    info: Present mode: VK_PRESENT_MODE_FIFO_KHR
    info: Buffer size: 160x28
    info: Image count: 3
    info: Exclusive FS: 0
    info: D3D9DeviceEx::ResetSwapChain:
    info: Requested Presentation Parameters
    info: - Width: 160
    info: - Height: 28
    info: - Format: D3D9Format::A8R8G8B8
    info: - Auto Depth Stencil: false
    info: ^ Format: D3D9Format::D24S8
    info: - Windowed: false
    info: Setting display mode: 160x28@60
    info: Presenter: Actual swap chain properties:
    info: Format: VK_FORMAT_B8G8R8A8_UNORM
    info: Present mode: VK_PRESENT_MODE_FIFO_KHR
    info: Buffer size: 1920x1080
    info: Image count: 3
    info: Exclusive FS: 0
    info: D3D9DeviceEx::ResetSwapChain:
    info: Requested Presentation Parameters
    info: - Width: 1920
    info: - Height: 1080
    info: - Format: D3D9Format::A8R8G8B8
    info: - Auto Depth Stencil: false
    info: ^ Format: D3D9Format::D24S8
    info: - Windowed: false
    info: Setting display mode: 1920x1080@60
KK0bin maintainer 2021-08-05 github

First of all, caching actual shaders is the job of the driver. We have 0 influence on that.

DXVK does however create a different cache, that allows it to compile shaders at a more convenient time (usually during loading screens). That's called the state cache.

Your logs (which are for GTAIV.exe with DXVK 1.9.1 btw) show it working just fine: info: DXVK: Read 265 valid state cache entries. Downgrading DXVK will invalidate that state cache.

Are you sure the actual exe of the game is PlayGTAIV.exe? I think that was some kind of launcher.

There isn't really anything we can do here. As I said, the logs you posted only show it working just fine.

SSparktimus 2021-08-05 github

First of all, caching actual shaders is the job of the driver. We have 0 influence on that.

DXVK does however create a different cache, that allows it to compile shaders at a more convenient time (usually during loading screens). That's called the state cache.

Your logs (which are for GTAIV.exe with DXVK 1.9.1 btw) show it working just fine: info: DXVK: Read 265 valid state cache entries. Downgrading DXVK will invalidate that state cache.

Are you sure the actual exe of the game is PlayGTAIV.exe? I think that was some kind of launcher.

There isn't really anything we can do here. As I said, the logs you posted only show it working just fine.

Actually you're right. I think I know what's happening now. Since the game isn't actually communicating with Steam itself, it's probably not actually looking in that folder for the cache at all, but instead the actual install folder. Sorry if what I posted wasn't too helpful, but I think I've figured it out now. Closing this, and thanks for your help c:

DLLs