From 49d7b1c7d82e37f1bde1c4776926f8c1c149727d Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 22 Mar 2020 18:31:31 -0300 Subject: [PATCH] Implement textureQueryLevels (#1007) --- Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs | 3 +-- .../CodeGen/Glsl/Instructions/InstGenMemory.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs index c5ac06b3d3..a47c461121 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs @@ -15,11 +15,10 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl public static void Declare(CodeGenContext context, StructuredProgramInfo info) { - context.AppendLine("#version 420 core"); + context.AppendLine("#version 430 core"); context.AppendLine("#extension GL_ARB_gpu_shader_int64 : enable"); context.AppendLine("#extension GL_ARB_shader_ballot : enable"); context.AppendLine("#extension GL_ARB_shader_group_vote : enable"); - context.AppendLine("#extension GL_ARB_shader_storage_buffer_object : enable"); if (context.Config.Stage == ShaderStage.Compute) { diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs index 5687ce7e16..7482870277 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs @@ -494,7 +494,14 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions string lodExpr = GetSoureExpr(context, lod, GetSrcVarType(operation.Inst, lodSrcIndex)); - return $"textureSize({samplerName}, {lodExpr}){GetMask(texOp.Index)}"; + if (texOp.Index == 3) + { + return $"textureQueryLevels({samplerName})"; + } + else + { + return $"textureSize({samplerName}, {lodExpr}){GetMask(texOp.Index)}"; + } } private static string GetStorageBufferAccessor(string slotExpr, string offsetExpr, ShaderStage stage)