Fix various graphics issues detected by Vulkan Validation Layers on Android

This commit is contained in:
Wojtek Figat
2025-09-06 23:32:54 +02:00
parent 1f6d837117
commit 857b0c5ac3
5 changed files with 7 additions and 3 deletions

View File

@@ -10,7 +10,7 @@
/// <summary>
/// Current materials shader version.
/// </summary>
#define MATERIAL_GRAPH_VERSION 174
#define MATERIAL_GRAPH_VERSION 175
class Material;
class GPUShader;

View File

@@ -58,7 +58,7 @@ struct PipelineBarrierVulkan
FORCE_INLINE bool HasBarrier() const
{
return ImageBarriers.Count() + BufferBarriers.Count() + MemoryBarriers.Count() != 0;
return ImageBarriers.Count() + BufferBarriers.Count() + MemoryBarriers.Count() != 0 || SourceStage + DestStage != 0;
}
void Execute(const CmdBufferVulkan* cmdBuffer);

View File

@@ -44,6 +44,9 @@ static const char* GInstanceExtensions[] =
#endif
#if defined(VK_KHR_display) && 0
VK_KHR_DISPLAY_EXTENSION_NAME,
#endif
#if GPU_ENABLE_TRACY && VK_EXT_calibrated_timestamps && VK_EXT_host_query_reset
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, // Required by VK_EXT_host_query_reset (unless using Vulkan 1.1 or newer)
#endif
nullptr
};

View File

@@ -143,6 +143,7 @@ static VKAPI_ATTR VkBool32 VKAPI_PTR DebugUtilsCallback(VkDebugUtilsMessageSever
case 3: // Attachment 2 not written by fragment shader
case 5: // SPIR-V module not valid: MemoryBarrier: Vulkan specification requires Memory Semantics to have one of the following bits set: Acquire, Release, AcquireRelease or SequentiallyConsistent
case -1666394502: // After query pool creation, each query must be reset before it is used. Queries must also be reset between uses.
case 1203141749:
case 602160055: // Attachment 4 not written by fragment shader; undefined values will be written to attachment. TODO: investigate it for PS_GBuffer shader from Deferred material with USE_LIGHTMAP=1
case 7060244: // Image Operand Offset can only be used with OpImage*Gather operations
case -1539028524: // SortedIndices is null so Vulkan backend sets it to default R32_SFLOAT format which is not good for UINT format of the buffer

View File

@@ -263,7 +263,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
// Sample scene depth buffer
auto sceneDepthTexture = findOrAddSceneTexture(MaterialSceneTextures::SceneDepth);
auto depthSample = writeLocal(VariantType::Float, String::Format(TEXT("{0}.SampleLevel(SamplerLinearClamp, {1}, 0).x"), sceneDepthTexture.ShaderName, screenUVs.Value), node);
auto depthSample = writeLocal(VariantType::Float, String::Format(TEXT("{0}.SampleLevel(SamplerPointClamp, {1}, 0).x"), sceneDepthTexture.ShaderName, screenUVs.Value), node);
// Linearize raw device depth
Value sceneDepth;