From 97b179696b456c752f70dbbf1fc7641a29a24f08 Mon Sep 17 00:00:00 2001 From: gdk Date: Sun, 13 Feb 2022 20:14:46 -0300 Subject: [PATCH] SPIR-V: Fix ImageQuerySizeLod --- .../CodeGen/Spirv/Instructions.cs | 3 ++- .../CodeGen/Spirv/SpirvGenerator.cs | 1 + .../Translation/EmitterContext.cs | 2 +- Spv.Generator/spirv.cs | 15 ++++++++------- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs b/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs index 8ac25580d..f5d9e70db 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs @@ -1539,9 +1539,10 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv var meta = new TextureMeta(texOp.CbufSlot, texOp.Handle, texOp.Format, texOp.Type); - (_, var sampledImageType, var sampledImageVariable) = context.Samplers[meta]; + (var imageType, var sampledImageType, var sampledImageVariable) = context.Samplers[meta]; var image = context.Load(sampledImageType, sampledImageVariable); + image = context.Image(imageType, image); if (texOp.Index == 3) { diff --git a/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs b/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs index c74d6d30f..203226338 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs @@ -25,6 +25,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv context.AddCapability(Capability.GroupNonUniformBallot); context.AddCapability(Capability.ImageBuffer); + context.AddCapability(Capability.ImageQuery); context.AddCapability(Capability.SampledBuffer); context.AddCapability(Capability.SubgroupBallotKHR); context.AddCapability(Capability.SubgroupVoteKHR); diff --git a/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs b/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs index 237a66aa2..3f59eee35 100644 --- a/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs +++ b/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs @@ -234,7 +234,7 @@ namespace Ryujinx.Graphics.Shader.Translation } else if (Config.Stage == ShaderStage.Fragment) { - bool supportsBgra = Config.GpuAccessor.QueryHostSupportsBgraFormat(); + bool supportsBgra = true; // Config.GpuAccessor.QueryHostSupportsBgraFormat(); if (Config.OmapDepth) { diff --git a/Spv.Generator/spirv.cs b/Spv.Generator/spirv.cs index 6152cc182..df28438bb 100644 --- a/Spv.Generator/spirv.cs +++ b/Spv.Generator/spirv.cs @@ -1,19 +1,19 @@ // Copyright (c) 2014-2020 The Khronos Group Inc. -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and/or associated documentation files (the "Materials"), // to deal in the Materials without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Materials, and to permit persons to whom the // Materials are furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Materials. -// +// // MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS // STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -// +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// // THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -27,7 +27,7 @@ // Enumeration tokens for SPIR-V, in various styles: // C, C++, C++11, JSON, Lua, Python, C#, D -// +// // - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL // - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL // - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL @@ -36,7 +36,7 @@ // - C# will use enum classes in the Specification class located in the "Spv" namespace, // e.g.: Spv.Specification.SourceLanguage.GLSL // - D will have tokens under the "spv" module, e.g: spv.SourceLanguage.GLSL -// +// // Some tokens act like mask values, which can be OR'd together, // while others are mutually exclusive. The mask-like ones have // "Mask" in their name, and a parallel enum that has the shift @@ -362,6 +362,7 @@ namespace Spv VolatileTexelKHR = 0x00000800, SignExtend = 0x00001000, ZeroExtend = 0x00002000, + Offsets = 0x00010000, } public enum FPFastMathModeShift