Beispiel #1
0
        private void RefreshStateDump()
        {
            string txt = "";

            txt += "<html><body>";

            var drawCall = GetSelectedDrawCall();

            if (drawCall == null)
            {
                txt += "No draw call";
            }
            else
            {
                {
                    var viewportState = new GPUStateCaptureViewport(drawCall.CapturedState);
                    viewportState.OutputInfo(ref txt);
                }

                {
                    var localState = new GPUStateRenderTargets(drawCall.CapturedState);
                    localState.OutputInfo(ref txt);
                }
            }

            // flush
            txt += "</body></html>";
            dumpAllStates.DocumentText = txt;
        }
Beispiel #2
0
 public ParsedDrawGroup(int index, GPUStateCaptureViewport viewport, GPUStateRenderTargets renderTargets)
 {
     _Index         = index;
     _Viewport      = viewport;
     _RenderTargets = renderTargets;
     _DrawCalls     = new List <ParsedDrawCall>();
 }
Beispiel #3
0
        public bool Compatible(GPUStateCaptureViewport other)
        {
            if (ScissorX1 != other.ScissorX1)
            {
                return(false);
            }
            if (ScissorY1 != other.ScissorY1)
            {
                return(false);
            }
            if (ScissorX2 != other.ScissorX2)
            {
                return(false);
            }
            if (ScissorY2 != other.ScissorY2)
            {
                return(false);
            }

            if (WindowOffsetX != other.WindowOffsetX)
            {
                return(false);
            }
            if (WindowOffsetY != other.WindowOffsetY)
            {
                return(false);
            }

            if (ViewportXYDivided != other.ViewportXYDivided)
            {
                return(false);
            }
            if (ViewportZDivided != other.ViewportZDivided)
            {
                return(false);
            }
            if (ViewportWNotDivided != other.ViewportWNotDivided)
            {
                return(false);
            }
            if (NormalizedCoordinates != other.NormalizedCoordinates)
            {
                return(false);
            }

            if (XOffset != other.XOffset)
            {
                return(false);
            }
            if (YOffset != other.YOffset)
            {
                return(false);
            }
            if (ZOffset != other.ZOffset)
            {
                return(false);
            }
            if (XScale != other.XScale)
            {
                return(false);
            }
            if (YScale != other.YScale)
            {
                return(false);
            }
            if (ZScale != other.ZScale)
            {
                return(false);
            }

            return(true);
        }
Beispiel #4
0
 public bool Compatible(GPUStateCaptureViewport viewport, GPUStateRenderTargets renderTargets)
 {
     return(_Viewport.Compatible(viewport) && _RenderTargets.Compatible(renderTargets));
 }
Beispiel #5
0
        static public ParsedData Parse(RawDumpData raw)
        {
            ParsedData ret = new ParsedData();

            var packetsMap = new Dictionary <RawPacket, ParsedPacket>();

            // create drawcall list
            ret._ShaderCache = new GPUShaderCache();
            ret._DrawCalls   = new List <ParsedDrawCall>();
            ret._DrawGroups  = new List <ParsedDrawGroup>();

            // prepare GPU state for the duration of parsing
            GPUState    parseState = new GPUState(ret._ShaderCache);
            GPUExecutor parseExec  = new GPUExecutor(parseState);

            // parse all packets
            int             packedIndex    = 1;
            int             drawCallIndex  = 1;
            int             drawGroupIndex = 1;
            ParsedDrawCall  drawCall       = null;
            ParsedDrawGroup drawGroup      = null;

            foreach (var rawPacket in raw.Packets)
            {
                // start new drawcall
                if (drawCall == null)
                {
                    drawCall = new ParsedDrawCall(drawCallIndex);
                    ret._DrawCalls.Add(drawCall);
                    drawCallIndex += 1;
                }

                // execute packet
                GPUCommandOutput executeOutput = new GPUCommandOutput();
                var executionResult            = parseExec.ExecutePacket(rawPacket, executeOutput);
                if (executionResult != GPUExecutorResult.Invalid)
                {
                    // add data
                    packetsMap[rawPacket] = ParsedPacket.Parse(rawPacket, packedIndex, drawCall, executeOutput);
                    ++packedIndex;
                }

                // restart after each drawcall
                if (packetsMap[rawPacket].Output.IsDraw())
                {
                    // capture final state at each drawcall
                    if (drawCall != null)
                    {
                        drawCall.CapturedState = new GPUStateCapture(parseState);

                        // extract the viewport/render target settings for the draw call - required to match it to the draw group
                        var stateRenderTargets = new GPUStateRenderTargets(drawCall.CapturedState);
                        var stateViewport      = new GPUStateCaptureViewport(drawCall.CapturedState);

                        // determine if we should add this draw call to current draw group
                        if ((drawGroup != null) && drawGroup.Compatible(stateViewport, stateRenderTargets))
                        {
                            drawGroup.AddDrawCall(drawCall);
                        }
                        else
                        {
                            drawGroup = new ParsedDrawGroup(drawGroupIndex++, stateViewport, stateRenderTargets);
                            drawGroup.AddDrawCall(drawCall);
                            ret._DrawGroups.Add(drawGroup);
                        }
                    }

                    // reset
                    drawCall = null;
                }
            }

            return(ret);
        }