Beispiel #1
0
        public bool Compatible(GPUStateRenderTargets other)
        {
            if (MSAA != other.MSAA)
            {
                return(false);
            }
            if (SurfacePitch != other.SurfacePitch)
            {
                return(false);
            }

            if (!Color[0].Compatible(other.Color[0]))
            {
                return(false);
            }
            if (!Color[1].Compatible(other.Color[1]))
            {
                return(false);
            }
            if (!Color[2].Compatible(other.Color[2]))
            {
                return(false);
            }
            if (!Color[3].Compatible(other.Color[3]))
            {
                return(false);
            }
            if (!Depth.Compatible(Depth))
            {
                return(false);
            }

            return(true);
        }
Beispiel #2
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 #3
0
 public ParsedDrawGroup(int index, GPUStateCaptureViewport viewport, GPUStateRenderTargets renderTargets)
 {
     _Index         = index;
     _Viewport      = viewport;
     _RenderTargets = renderTargets;
     _DrawCalls     = new List <ParsedDrawCall>();
 }
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);
        }