mirror of
				https://github.com/Ryujinx/Ryujinx.git
				synced 2025-11-04 02:33:42 +00:00 
			
		
		
		
	Fix wrong maximum id on sampler pool in some cases
This commit is contained in:
		
							parent
							
								
									cb171f6ebf
								
							
						
					
					
						commit
						17fb11ddb9
					
				@ -123,7 +123,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Pools.
 | 
			
		||||
            if (state.QueryModified(MethodOffset.SamplerPoolState))
 | 
			
		||||
            if (state.QueryModified(MethodOffset.SamplerPoolState, MethodOffset.SamplerIndex))
 | 
			
		||||
            {
 | 
			
		||||
                UpdateSamplerPoolState(state);
 | 
			
		||||
            }
 | 
			
		||||
@ -422,11 +422,16 @@ namespace Ryujinx.Graphics.Gpu.Engine
 | 
			
		||||
 | 
			
		||||
        private void UpdateSamplerPoolState(GpuState state)
 | 
			
		||||
        {
 | 
			
		||||
            var texturePool = state.Get<PoolState>(MethodOffset.TexturePoolState);
 | 
			
		||||
            var samplerPool = state.Get<PoolState>(MethodOffset.SamplerPoolState);
 | 
			
		||||
 | 
			
		||||
            var samplerIndex = state.Get<SamplerIndex>(MethodOffset.SamplerIndex);
 | 
			
		||||
 | 
			
		||||
            _textureManager.SetGraphicsSamplerPool(samplerPool.Address.Pack(), samplerPool.MaximumId, samplerIndex);
 | 
			
		||||
            int maximumId = samplerIndex == SamplerIndex.ViaHeaderIndex
 | 
			
		||||
                ? texturePool.MaximumId
 | 
			
		||||
                : samplerPool.MaximumId;
 | 
			
		||||
 | 
			
		||||
            _textureManager.SetGraphicsSamplerPool(samplerPool.Address.Pack(), maximumId, samplerIndex);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void UpdateTexturePoolState(GpuState state)
 | 
			
		||||
 | 
			
		||||
@ -11,12 +11,15 @@ namespace Ryujinx.Graphics.Gpu.Image
 | 
			
		||||
 | 
			
		||||
        protected T[] Items;
 | 
			
		||||
 | 
			
		||||
        public int MaximumId { get; }
 | 
			
		||||
 | 
			
		||||
        public ulong Address { get; }
 | 
			
		||||
        public ulong Size    { get; }
 | 
			
		||||
 | 
			
		||||
        public Pool(GpuContext context, ulong address, int maximumId)
 | 
			
		||||
        {
 | 
			
		||||
            Context   = context;
 | 
			
		||||
            MaximumId = maximumId;
 | 
			
		||||
 | 
			
		||||
            int count = maximumId + 1;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -76,7 +76,7 @@ namespace Ryujinx.Graphics.Gpu.Image
 | 
			
		||||
 | 
			
		||||
            if (_samplerPool != null)
 | 
			
		||||
            {
 | 
			
		||||
                if (_samplerPool.Address == address)
 | 
			
		||||
                if (_samplerPool.Address == address && _samplerPool.MaximumId >= maximumId)
 | 
			
		||||
                {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@ -180,9 +180,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
 | 
			
		||||
 | 
			
		||||
        public static void DeclareLocals(CodeGenContext context, StructuredProgramInfo info)
 | 
			
		||||
        {
 | 
			
		||||
            context.AppendLine(GetVarTypeName(VariableType.S32) + " " + DefaultNames.DummyIntName + ";");
 | 
			
		||||
            context.AppendLine(GetVarTypeName(VariableType.U32) + " " + DefaultNames.DummyUintName + ";");
 | 
			
		||||
 | 
			
		||||
            foreach (AstOperand decl in info.Locals)
 | 
			
		||||
            {
 | 
			
		||||
                string name = context.OperandManager.DeclareLocal(decl);
 | 
			
		||||
 | 
			
		||||
@ -22,9 +22,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
 | 
			
		||||
        public const string LocalMemoryName  = "local_mem";
 | 
			
		||||
        public const string SharedMemoryName = "shared_mem";
 | 
			
		||||
 | 
			
		||||
        public const string DummyIntName  = "dummyInt";
 | 
			
		||||
        public const string DummyUintName = "dummyUint";
 | 
			
		||||
 | 
			
		||||
        public const string UndefinedName = "undef";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -241,6 +241,8 @@ namespace Ryujinx.Graphics.Shader.Instructions
 | 
			
		||||
 | 
			
		||||
            res = context.IAdd(res, srcC);
 | 
			
		||||
 | 
			
		||||
            // TODO: CC, X, SAT, and more?
 | 
			
		||||
 | 
			
		||||
            context.Copy(GetDest(context), res);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user