示例#1
0
        private TreelistView.Node MakeFragmentNode(PixelModification mod)
        {
            bool uintTex = (texture.format.compType == FormatComponentType.UInt);
            bool sintTex = (texture.format.compType == FormatComponentType.SInt);
            bool floatTex = (!uintTex && !sintTex);

            bool depth = false;

            if (texture.format.compType == FormatComponentType.Depth ||
                (texture.format.special && texture.format.specialFormat == SpecialFormat.D16S8) ||
                (texture.format.special && texture.format.specialFormat == SpecialFormat.D24S8) ||
                (texture.format.special && texture.format.specialFormat == SpecialFormat.D32S8) ||
                (texture.format.special && texture.format.specialFormat == SpecialFormat.S8))
                depth = true;

            TreelistView.Node node = null;

            if (mod.uavWrite)
            {
                string name = "Potential UAV/Copy write";

                string preModVal = "Tex Before\n\n" + ModificationValueString(mod.preMod, texture.format, depth);
                string postModVal = "Tex After\n\n" + ModificationValueString(mod.postMod, texture.format, depth);

                if (mod.preMod.col.value.u[0] == mod.postMod.col.value.u[0] &&
                    mod.preMod.col.value.u[1] == mod.postMod.col.value.u[1] &&
                    mod.preMod.col.value.u[2] == mod.postMod.col.value.u[2] &&
                    mod.preMod.col.value.u[3] == mod.postMod.col.value.u[3])
                {
                    name += "\nNo change in tex value";
                }

                node = new TreelistView.Node(new object[] { name, preModVal, "", postModVal, "" });
            }
            else
            {
                string name = String.Format("Primitive {0}\n", mod.primitiveID);

                if (mod.shaderDiscarded)
                    name += FailureString(mod);

                ResourceFormat fmt = new ResourceFormat(floatTex ? FormatComponentType.Float : texture.format.compType, 4, 4);

                string shadOutVal;
                string postModVal = "Tex After\n\n" + ModificationValueString(mod.postMod, texture.format, depth);

                if (mod.unboundPS)
                    shadOutVal = "No Pixel\nShader\nBound";
                else
                    shadOutVal = "Shader Out\n\n" + ModificationValueString(mod.shaderOut, fmt, depth);

                if (!mod.EventPassed() && hideFailedEventsToolStripMenuItem.Checked)
                    return null;

                node = new TreelistView.Node(new object[] { name, shadOutVal, "", postModVal, "" });

                if (mod.shaderDiscarded)
                    node.DefaultBackColor = Color.FromArgb(255, 235, 235);
            }

            node.Tag = new EventTag(mod.eventID, mod.uavWrite ? uint.MaxValue : mod.primitiveID);

            if (floatTex || depth)
            {
                node.IndexedBackColor[2] = ModificationValueColor(mod.shaderOut, depth);
                node.IndexedBackColor[4] = ModificationValueColor(mod.postMod, depth);
            }

            return node;
        }