AlpyneDreams / d8vk

Direct3D 8 to Vulkan translation for DXVK!
zlib License
488 stars 6 forks source link

Rise of Nations shadow blending glitch #157

Open imamhs opened 1 year ago

imamhs commented 1 year ago

The game starts and runs fine, graphics looks alright except there is shadow blending issues compared to WineD3D and Windows D3D. Please see attached screen-grab.

System information

Log files

info: Game: nations.exe info: DXVK: v1.7.1-2160-g10cbd551 info: Built-in extension providers: info: Win32 WSI info: OpenVR info: OpenXR info: OpenVR: could not open registry key, status 2 info: OpenVR: Failed to locate module info: Vulkan: Found vkGetInstanceProcAddr in winevulkan.dll @ 0x6fa83800 info: Enabled instance extensions: info: VK_KHR_get_surface_capabilities2 info: VK_KHR_surface info: VK_KHR_win32_surface info: D3D9: VK_FORMAT_D24_UNORM_S8_UINT -> VK_FORMAT_D32_SFLOAT_S8_UINT info: AMD Radeon RX 6600 XT (RADV NAVI23): info: Driver: 23.0.3 info: Vulkan: 1.3.238 info: Memory Heap[0]: info: Size: 7936 MiB info: Flags: 0x1 info: Memory Type[0]: Property Flags = 0x1 info: Memory Type[1]: Property Flags = 0x1 info: Memory Type[7]: Property Flags = 0xc1 info: Memory Heap[1]: info: Size: 7957 MiB info: Flags: 0x0 info: Memory Type[2]: Property Flags = 0x6 info: Memory Type[5]: Property Flags = 0xe info: Memory Type[6]: Property Flags = 0xe info: Memory Type[8]: Property Flags = 0xc6 info: Memory Type[10]: Property Flags = 0xce info: Memory Heap[2]: info: Size: 256 MiB info: Flags: 0x1 info: Memory Type[3]: Property Flags = 0x7 info: Memory Type[4]: Property Flags = 0x7 info: Memory Type[9]: Property Flags = 0xc7 info: Process set as DPI aware info: D3D9: VK_FORMAT_D24_UNORM_S8_UINT -> VK_FORMAT_D32_SFLOAT_S8_UINT info: AMD Radeon RX 6600 XT (RADV NAVI23): info: Driver: 23.0.3 info: Vulkan: 1.3.238 info: Memory Heap[0]: info: Size: 7936 MiB info: Flags: 0x1 info: Memory Type[0]: Property Flags = 0x1 info: Memory Type[1]: Property Flags = 0x1 info: Memory Type[7]: Property Flags = 0xc1 info: Memory Heap[1]: info: Size: 7957 MiB info: Flags: 0x0 info: Memory Type[2]: Property Flags = 0x6 info: Memory Type[5]: Property Flags = 0xe info: Memory Type[6]: Property Flags = 0xe info: Memory Type[8]: Property Flags = 0xc6 info: Memory Type[10]: Property Flags = 0xce info: Memory Heap[2]: info: Size: 256 MiB info: Flags: 0x1 info: Memory Type[3]: Property Flags = 0x7 info: Memory Type[4]: Property Flags = 0x7 info: Memory Type[9]: Property Flags = 0xc7 info: Process set as DPI aware info: Device properties: info: Device name: : AMD Radeon RX 6600 XT (RADV NAVI23) info: Driver version : 23.0.3 info: Enabled device extensions: info: VK_AMD_memory_overallocation_behavior info: VK_AMD_shader_fragment_mask info: VK_EXT_attachment_feedback_loop_layout info: VK_EXT_conservative_rasterization info: VK_EXT_custom_border_color info: VK_EXT_depth_clip_enable info: VK_EXT_extended_dynamic_state3 info: VK_EXT_memory_priority info: VK_EXT_non_seamless_cube_map info: VK_EXT_robustness2 info: VK_EXT_shader_module_identifier info: VK_EXT_shader_stencil_export info: VK_EXT_transform_feedback info: VK_EXT_vertex_attribute_divisor info: VK_KHR_pipeline_library 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: shaderClipDistance : 1 info: shaderCullDistance : 1 info: shaderFloat64 : 0 info: shaderInt64 : 0 info: variableMultisampleRate : 1 info: shaderResourceResidency : 0 info: shaderResourceMinLod : 0 info: sparseBinding : 0 info: sparseResidencyBuffer : 0 info: sparseResidencyImage2D : 0 info: sparseResidencyImage3D : 0 info: sparseResidency2Samples : 0 info: sparseResidency4Samples : 0 info: sparseResidency8Samples : 0 info: sparseResidency16Samples : 0 info: sparseResidencyAliased : 0 info: Vulkan 1.1 info: shaderDrawParameters : 0 info: Vulkan 1.2 info: samplerMirrorClampToEdge : 1 info: drawIndirectCount : 1 info: samplerFilterMinmax : 0 info: hostQueryReset : 1 info: timelineSemaphore : 1 info: bufferDeviceAddress : 0 info: shaderOutputViewportIndex : 1 info: shaderOutputLayer : 1 info: vulkanMemoryModel : 1 info: Vulkan 1.3 info: robustImageAccess : 0 info: pipelineCreationCacheControl : 1 info: shaderDemoteToHelperInvocation : 1 info: shaderZeroInitializeWorkgroupMemory : 0 info: synchronization2 : 1 info: dynamicRendering : 1 info: VK_AMD_shader_fragment_mask info: extension supported : 1 info: VK_EXT_attachment_feedback_loop_layout info: attachmentFeedbackLoopLayout : 1 info: VK_EXT_conservative_rasterization info: extension supported : 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_state3 info: extDynamicState3AlphaToCoverageEnable : 1 info: extDynamicState3DepthClipEnable : 1 info: extDynamicState3RasterizationSamples : 1 info: extDynamicState3SampleMask : 1 info: VK_EXT_fragment_shader_interlock info: fragmentShaderSampleInterlock : 0 info: fragmentShaderPixelInterlock : 0 info: VK_EXT_full_screen_exclusive info: extension supported : 0 info: VK_EXT_graphics_pipeline_library info: graphicsPipelineLibrary : 0 info: VK_EXT_memory_budget info: extension supported : 1 info: VK_EXT_memory_priority info: memoryPriority : 1 info: VK_EXT_non_seamless_cube_map info: nonSeamlessCubeMap : 1 info: VK_EXT_robustness2 info: robustBufferAccess2 : 1 info: robustImageAccess2 : 1 info: nullDescriptor : 1 info: VK_EXT_shader_module_identifier info: shaderModuleIdentifier : 1 info: VK_EXT_shader_stencil_export info: extension supported : 1 info: VK_EXT_swapchain_colorspace info: extension supported : 0 info: VK_EXT_hdr_metadata info: extension supported : 0 info: VK_EXT_transform_feedback info: transformFeedback : 0 info: geometryStreams : 0 info: VK_EXT_vertex_attribute_divisor info: vertexAttributeInstanceRateDivisor : 1 info: vertexAttributeInstanceRateZeroDivisor : 1 info: VK_KHR_external_memory_win32 info: extension supported : 0 info: VK_KHR_external_semaphore_win32 info: extension supported : 0 info: VK_NVX_binary_import info: extension supported : 0 info: VK_NVX_image_view_handle info: extension supported : 0 info: Queue families: info: Graphics : 0 info: Transfer : 1 info: Sparse : 0 info: DXVK: Read 50 valid state cache entries info: DXVK: Graphics pipeline libraries not supported info: D3D9DeviceEx::ResetSwapChain: info: Requested Presentation Parameters info: - Width: 1024 info: - Height: 768 info: - Format: D3D9Format::X8R8G8B8 info: - Auto Depth Stencil: true info: ^ Format: D3D9Format::D16 info: - Windowed: false info: Presenter: Actual swap chain properties: info: Format: VK_FORMAT_B8G8R8A8_UNORM info: Color space: VK_COLOR_SPACE_SRGB_NONLINEAR_KHR info: Present mode: VK_PRESENT_MODE_IMMEDIATE_KHR info: Buffer size: 1920x1080 info: Image count: 3 info: Exclusive FS: 0 info: Setting display mode: 1024x768@0 info: Setting display mode: 1024x768@0 info: Presenter: Actual swap chain properties: info: Format: VK_FORMAT_B8G8R8A8_UNORM info: Color space: VK_COLOR_SPACE_SRGB_NONLINEAR_KHR info: Present mode: VK_PRESENT_MODE_FIFO_KHR info: Buffer size: 1024x768 info: Image count: 4 info: Exclusive FS: 0 info: DXVK: Using 12 compiler threads info: Presenter: Actual swap chain properties: info: Format: VK_FORMAT_B8G8R8A8_UNORM info: Color space: VK_COLOR_SPACE_SRGB_NONLINEAR_KHR info: Present mode: VK_PRESENT_MODE_FIFO_KHR info: Buffer size: 1024x768 info: Image count: 4 info: Exclusive FS: 0 info: Presenter: Actual swap chain properties: info: Format: VK_FORMAT_B8G8R8A8_UNORM info: Color space: VK_COLOR_SPACE_SRGB_NONLINEAR_KHR info: Present mode: VK_PRESENT_MODE_FIFO_KHR info: Buffer size: 1024x768 info: Image count: 4 info: Exclusive FS: 0

Screenshot of the glitch (d8vk, shadow squares instead of smooth blending): d8vk

Screenshot of the normal rendering as in WineD3D: WineD3D

WinterSnowfall commented 1 year ago

It's fixed by d3d8.managedBufferPlacement = False. I'll include it in my regression PR :).

RiseOfNations

Thanks for the report! I didn't test this again because it doesn't launch in newer versions of Wine, but I rolled back to confirm. Nevermind, I had forgotten to disable esync.

P.S.: Does it look properly in WineD3D for you? Because in my case it looks as broken as it is with d8vk now, same fog of war and terrain glitches. Albeit I use Wine Staging.

imamhs commented 1 year ago

Thank you!

I confirm it appears to render correctly with vanilla WineD3D 8.6.

With d8vk-v1.0 and d3d8.managedBufferPlacement = False in dxvk.conf the glitch is present and also there is new ground texture glitch as you said it is regression in latest d8vk. Please see below:

glitch

mrdeathjr28 commented 1 year ago

Thank you!

I confirm it appears to render correctly with vanilla WineD3D 8.6.

With d8vk-v1.0 and d3d8.managedBufferPlacement = False in dxvk.conf the glitch is present and also there is new ground texture glitch as you said it is regression in latest d8vk. Please see below:

glitch

In my case pass same thing and game launch ok with wine staging 8.7 for now (cinematics stay in black but is completly different issue)

ronold

WinterSnowfall commented 1 year ago

With d8vk-v1.0 and d3d8.managedBufferPlacement = False in dxvk.conf the glitch is present and also there is new ground texture glitch as you said it is regression in latest d8vk.

Not really sure what you mean here. d3d8.managedBufferPlacement = False fixed all glitches in my case. It should look good once you add that. Let me add it to my PR and you can test with that.

mrdeathjr28 commented 1 year ago

tested with d3d8.managedBufferPlacement = False and appears this:

ronolda

WinterSnowfall commented 1 year ago

image

This is what I am seeing with the latest builds on my PR, on Nvidia: https://github.com/AlpyneDreams/d8vk/actions/runs/4950102988

Everything appears correct. I'm not ruling out a problem in Mesa, but I can't reproduce any fog of war or terrain glitch any more.

The game has always worked correctly for me, even with d8vk 0.10. Using d3d8.managedBufferPlacement = False lets the game do its own buffer placement, which should be the most compatible if a game behaves correctly with buffers.

Could you please retest with the above artifacts one more time?

WinterSnowfall commented 1 year ago

image

Here is a screenshot of my PR on (almost) latest ANV (Laptop with an Intel Xe iGPU).

imamhs commented 1 year ago

image

Here is a screenshot of my PR on (almost) latest ANV (Laptop with an Intel Xe iGPU).

Which Wine version are you using? I have tried both amdvlk and radv vulkan drivers still the same issue with the latest builds (https://github.com/AlpyneDreams/d8vk/actions/runs/4950102988)

WinterSnowfall commented 1 year ago

Which Wine version are you using?

8.7 Staging. Unfortunately I don't have an AMD GPU to check against.

dungeon007 commented 1 year ago

Maybe app have vendor specific rendering paths... just a guess. Something like with Age of Mythology, so it actually render differently if different GPUs/drivers detected

imamhs commented 1 year ago

Only way to now verify this is a Mesa3D and driver specific issue to test on another machine with a nvidia card

WinterSnowfall commented 1 year ago

Could be some other factors at play here as well. But it's weird it appears to work fine both on Nvidia and Intel in my case.

mrdeathjr28 commented 1 year ago

Sadly Xe based gpu are different than pre xe gpus

However add trace:

https://drive.google.com/file/d/1Y7ZIJ2kYvkEpn3WLrVikuPy8GF8ulYYM/view?usp=sharing

imamhs commented 1 year ago

Which Wine version are you using?

8.7 Staging. Unfortunately I don't have an AMD GPU to check against.

Are you using 64bit version of d8vk (d3d8.dll)? I tried to run the game using 64 bit Wine prefix where Wine avoids using 32 bit d8vk (d3d8.dll)

mrdeathjr28 commented 1 year ago

Which Wine version are you using?

8.7 Staging. Unfortunately I don't have an AMD GPU to check against.

Are you using 64bit version of d8vk (d3d8.dll)? I tried to run the game using 64 bit Wine prefix where Wine avoids using 32 bit d8vk (d3d8.dll)

In my case works but on staging with all packages installed aka:

wine-staging-i386_8.7~lunar-1_i386.deb

wine-staging-amd64_8.7~lunar-1_amd64.deb

wine-staging_8.7~lunar-1_amd64.deb

winehq-staging_8.7~lunar-1_amd64.deb

Last package allows use 32bit apps also 64bit in same prefix without troubles and d8vk is a 32bit library because DX8 games are 32bit

WinterSnowfall commented 1 year ago

Are you using 64bit version of d8vk (d3d8.dll)?

As mrdeathjr28 said, there is no such thing. The d3d8.dll packaged by d8vk is 32-bit only.

I tried to run the game using 64 bit Wine prefix where Wine avoids using 32 bit d8vk (d3d8.dll)

I have the game in a 64-bit prefix and it works perfectly with d8vk. You can either use the install script or manually replace Wine's dll in syswow64 and add a Wine native dll override for d3d8.

On a side-note, Wine will always load what the application requests, regardless of what type of prefix you are in, just like Windows. In case of 32-bit applications, it will load 32-bit dlls. The fact that Wine now uses thunks to end up into 64-bit code is transparent to the end application (from its standpoint 32-bit dlls have been loaded). This has not changed.

dungeon007 commented 1 year ago

Tried demo and indeed i could reproduce an issue on AMD. Happen also with d3d8to9 + d3d9 dxvk. WINED3D, DGV2, NINE are fine there. Going back to dxvk 1.8.1 and not a bug, with dxvk 1.9 bug starts to appear... so these "Improved texture and buffer uploads in D3D9." again. Sort of reminds me on Supreme Ruler 2020 flickering behavior, guessing that might need some sort of integer value like there, to guard it, instead of just true/false.

WinterSnowfall commented 1 year ago

Tried demo and indeed i could reproduce an issue on AMD.

Thank you for retesting. Were you able to give it a go on anything other than AMD, to confirm if this is maybe only AMD specific?

dungeon007 commented 1 year ago

No, curretly. But i also tried forcing different vendors with NINE and DGV2, but it do not look like to be vendor isssue. It does not happen using anything else, even DGV2/DX11/DXVK looks fine... only shows up on DXVK D3D9 part, since 1.9.

WinterSnowfall commented 1 year ago

Alright, no worries. It's still very surprising that I can't reproduce this in any way with my PR that sets d3d8.managedBufferPlacement = False. I have also tried switching vendors to AMD and it still looks good.