mirror of
https://github.com/par274/sharpemu.git
synced 2026-08-03 00:19:46 +08:00
Vulkan: fix guest storage image and render-state handling (#332)
This commit is contained in:
@@ -1576,11 +1576,37 @@ public static class Gen5ShaderTranslator
|
||||
private static bool IsMimgInstruction(string name) =>
|
||||
name.StartsWith("Image", StringComparison.Ordinal);
|
||||
|
||||
public static bool IsImageLoadOperation(string name) =>
|
||||
name.StartsWith("ImageLoad", StringComparison.Ordinal);
|
||||
|
||||
public static bool IsStorageImageOperation(string name) =>
|
||||
name.StartsWith("ImageLoad", StringComparison.Ordinal) ||
|
||||
name.StartsWith("ImageStore", StringComparison.Ordinal) ||
|
||||
name.StartsWith("ImageAtomic", StringComparison.Ordinal);
|
||||
|
||||
public static bool RequiresStorageImage(
|
||||
Gen5ImageBinding binding,
|
||||
IReadOnlyList<Gen5ImageBinding> stageBindings)
|
||||
{
|
||||
if (IsStorageImageOperation(binding.Opcode))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!IsImageLoadOperation(binding.Opcode))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// IMAGE_LOAD itself is read-only and maps naturally to OpImageFetch,
|
||||
// including for block-compressed textures which Vulkan cannot expose
|
||||
// as storage images. Keep it as storage only when the same resolved
|
||||
// descriptor is also written in this shader stage, preserving coherent
|
||||
// read/write access through one storage-image representation.
|
||||
return stageBindings.Any(candidate =>
|
||||
IsStorageImageOperation(candidate.Opcode) &&
|
||||
binding.ResourceDescriptor.SequenceEqual(candidate.ResourceDescriptor));
|
||||
}
|
||||
|
||||
public static bool IsDataShareAtomic(string name) => name switch
|
||||
{
|
||||
"DsAddU32" or "DsSubU32" or "DsIncU32" or "DsDecU32" or
|
||||
|
||||
Reference in New Issue
Block a user