Example #1
0
        /// <summary>
        /// Creates a new instance of the HLE macro handler.
        /// </summary>
        /// <param name="context">GPU context the macro is being executed on</param>
        /// <param name="memoryManager">GPU memory manager</param>
        /// <param name="engine">3D engine where this macro is being called</param>
        /// <param name="functionName">Name of the HLE macro function to be called</param>
        public MacroHLE(GPFifoProcessor processor, MacroHLEFunctionName functionName)
        {
            _processor    = processor;
            _functionName = functionName;

            Fifo = new Queue <FifoWord>();
        }
Example #2
0
        /// <summary>
        /// Creates a new instance of the HLE macro handler.
        /// </summary>
        /// <param name="context">GPU context the macro is being executed on</param>
        /// <param name="functionName">Name of the HLE macro function to be called</param>
        public MacroHLE(GpuContext context, MacroHLEFunctionName functionName)
        {
            _context      = context;
            _functionName = functionName;

            Fifo = new Queue <FifoWord>();
        }
Example #3
0
        /// <summary>
        /// Creates a new instance of the GPU cached macro program.
        /// </summary>
        /// <param name="position">Macro code start position</param>
        public Macro(int position)
        {
            Position = position;

            _executionEngine  = null;
            _executionPending = false;
            _argument         = 0;
            _hleFunction      = MacroHLEFunctionName.None;
        }
Example #4
0
        private static bool IsMacroHLESupported(Capabilities caps, MacroHLEFunctionName name)
        {
            if (name == MacroHLEFunctionName.MultiDrawElementsIndirectCount)
            {
                return(caps.SupportsIndirectParameters);
            }

            return(false);
        }
Example #5
0
        private static bool IsMacroHLESupported(Capabilities caps, MacroHLEFunctionName name)
        {
            if (name == MacroHLEFunctionName.ClearColor ||
                name == MacroHLEFunctionName.ClearDepthStencil)
            {
                return(true);
            }
            else if (name == MacroHLEFunctionName.MultiDrawElementsIndirectCount)
            {
                return(caps.SupportsIndirectParameters);
            }

            return(false);
        }
Example #6
0
        /// <summary>
        /// Checks if there's a fast, High-level implementation of the specified Macro code available.
        /// </summary>
        /// <param name="code">Macro code to be checked</param>
        /// <param name="name">Name of the function if a implementation is available, otherwise <see cref="MacroHLEFunctionName.None"/></param>
        /// <returns>True if there is a implementation available, false otherwise</returns>
        public static bool TryGetMacroHLEFunction(ReadOnlySpan <int> code, out MacroHLEFunctionName name)
        {
            var mc = MemoryMarshal.Cast <int, byte>(code);

            for (int i = 0; i < Table.Length; i++)
            {
                ref var entry = ref Table[i];

                var hash = XXHash128.ComputeHash(mc.Slice(0, entry.Length));
                if (hash == entry.Hash)
                {
                    name = entry.Name;
                    return(true);
                }
            }
Example #7
0
 /// <summary>
 /// Creates a new table entry.
 /// </summary>
 /// <param name="name">Name of the Macro function</param>
 /// <param name="hash">Hash of the original binary Macro function code</param>
 /// <param name="length">Size (in bytes) of the original binary Macro function code</param>
 public TableEntry(MacroHLEFunctionName name, Hash128 hash, int length)
 {
     Name   = name;
     Hash   = hash;
     Length = length;
 }