示例#1
0
        public bool Setup(RawMemoryBlock _block, ResourceViewParamReader paramReader)
        {
            // load source data
            var words = _block.LoadAllDataAs32BE();

            if (words == null)
            {
                return(false);
            }

            // source memory block
            _MemoryBlock = _block;

            // shader type
            var isPixelShader = (paramReader.Param(0) == "pixelshader");

            // decompile shader
            _Shader = GPUShader.Decompile(isPixelShader, words);
            if (_Shader == null)
            {
                return(false);
            }

            // valid shader
            ShowCode();
            return(true);
        }
示例#2
0
        public GPUShader DecompileShader(bool pixel, RawMemoryBlock block)
        {
            // local search
            foreach (var entry in _Entries)
            {
                if (entry._Pixel == pixel && entry._RawMemory == block)
                {
                    return(entry._Shader);
                }
            }

            // convert memory
            GPUShader shader = null;
            {
                var words = block.LoadAllDataAs32BE();

                try
                {
                    shader = GPUShader.Decompile(pixel, words);
                }
                catch (Exception)
                {
                }
            }

            // create new entry
            GPUShaderCacheEntry newEntry = new GPUShaderCacheEntry();

            newEntry._Pixel     = pixel;
            newEntry._RawMemory = block;
            newEntry._Shader    = shader;
            _Entries.Add(newEntry);

            return(shader);
        }