コード例 #1
0
        private void debugToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (events.SelectedNode == null)
            {
                return;
            }

            var node = events.SelectedNode;

            if (node.Tag is EventTag)
            {
                EventTag tag = (EventTag)node.Tag;

                m_Core.SetEventID(this, m_Core.CurFrame, tag.EID);

                ShaderDebugTrace trace = null;

                ShaderReflection shaderDetails = m_Core.CurPipelineState.GetShaderReflection(ShaderStageType.Pixel);

                m_Core.Renderer.Invoke((ReplayRenderer r) =>
                {
                    trace = r.DebugPixel((UInt32)pixel.X, (UInt32)pixel.Y, sample, tag.Primitive);
                });

                if (trace == null || trace.states.Length == 0)
                {
                    MessageBox.Show("Error debugging pixel.", "Debug Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                this.BeginInvoke(new Action(() =>
                {
                    string debugContext = String.Format("Pixel {0},{1}", pixel.X, pixel.Y);

                    ShaderViewer s = new ShaderViewer(m_Core, shaderDetails, ShaderStageType.Pixel, trace, debugContext);

                    s.Show(this.DockPanel);
                }));
            }
        }
コード例 #2
0
ファイル: TextureViewer.cs プロジェクト: Anteru/renderdoc
        private void debugPixel_Click(object sender, EventArgs e)
        {
            ShaderDebugTrace trace = null;

            ShaderReflection shaderDetails = m_Core.CurPipelineState.GetShaderReflection(ShaderStageType.Pixel);

            if(m_PickedPoint.X < 0 || m_PickedPoint.Y < 0)
                return;

            int x = m_PickedPoint.X >> (int)m_TexDisplay.mip;
            int y = m_PickedPoint.Y >> (int)m_TexDisplay.mip;

            m_Core.Renderer.Invoke((ReplayRenderer r) =>
            {
                trace = r.DebugPixel((UInt32)x, (UInt32)y, m_TexDisplay.sampleIdx, uint.MaxValue);
            });

            if (trace == null || trace.states.Length == 0)
            {
                // if we couldn't debug the pixel on this event, open up a pixel history
                pixelHistory_Click(sender, e);
                return;
            }

            this.BeginInvoke(new Action(() =>
            {
                string debugContext = String.Format("Pixel {0},{1}", x, y);

                ShaderViewer s = new ShaderViewer(m_Core, shaderDetails, ShaderStageType.Pixel, trace, debugContext);

                s.Show(this.DockPanel);
            }));
        }
コード例 #3
0
ファイル: TextureViewer.cs プロジェクト: Anteru/renderdoc
        private void customEdit_Click(object sender, EventArgs e)
        {
            var filename = customShader.Text;
            var key = filename.ToUpperInvariant();

            string src = "";

            try
            {
                src = File.ReadAllText(Path.Combine(Core.ConfigDirectory, filename + m_Core.APIProps.ShaderExtension));
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("Couldn't open file for shader " + filename + Environment.NewLine + ex.ToString(), "Cannot open shader",
                                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var files = new Dictionary<string, string>();
            files.Add(filename, src);
            ShaderViewer s = new ShaderViewer(m_Core, true, "Custom Shader", files,

            // Save Callback
            (ShaderViewer viewer, Dictionary<string, string> updatedfiles) =>
            {
                foreach (var f in updatedfiles)
                {
                    var path = Path.Combine(Core.ConfigDirectory, f.Key + m_Core.APIProps.ShaderExtension);
                    try
                    {
                        File.WriteAllText(path, f.Value);
                    }
                    catch (System.Exception ex)
                    {
                        MessageBox.Show("Couldn't save file for shader " + filename + Environment.NewLine + ex.ToString(), "Cannot save shader",
                                                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            },

            // Close Callback
            () =>
            {
                m_CustomShaderEditor.Remove(key);
            });

            m_CustomShaderEditor[key] = s;

            s.Show(this.DockPanel);
        }
コード例 #4
0
ファイル: BufferViewer.cs プロジェクト: Zorro666/renderdoc
        private void debugVertex_Click(object sender, EventArgs e)
        {
            if (!m_Core.LogLoaded) return;

            ShaderReflection shaderDetails = null;
            ShaderDebugTrace trace = null;

            shaderDetails = m_Core.CurPipelineState.GetShaderReflection(ShaderStageType.Vertex);

            UIState ui = GetUIState(MeshDataStage.VSIn);

            if (ui.m_GridView.SelectedRows.Count == 0)
            {
                MessageBox.Show("You must select a vertex to debug", "No Vertex Selected",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            int row = ui.m_GridView.SelectedRows[0].Index;

            if (row >= ui.m_Rows.Length || ui.m_Rows[row].Length <= 1) return;

            UInt32 idx = 0;

            if (ui.m_Rows[row][1] is UInt32)
            {
                idx = (UInt32)ui.m_Rows[row][1];
            }

            var draw = m_Core.CurDrawcall;

            m_Core.Renderer.Invoke((ReplayRenderer r) =>
            {
                trace = r.DebugVertex((UInt32)row, m_MeshDisplay.curInstance, idx, draw.instanceOffset, draw.vertexOffset);
            });

            this.BeginInvoke(new Action(() =>
            {
                string debugContext = String.Format("Vertex {0}", row);
                if (draw.numInstances > 1)
                    debugContext += String.Format(", Instance {0}", m_MeshDisplay.curInstance);

                ShaderViewer s = new ShaderViewer(m_Core, shaderDetails, ShaderStageType.Vertex, trace, debugContext);

                s.Show(this.DockPanel);
            }));
        }
コード例 #5
0
ファイル: PixelHistoryView.cs プロジェクト: Anteru/renderdoc
        private void debugToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (events.SelectedNode == null) return;

            var node = events.SelectedNode;

            if (node.Tag is EventTag)
            {
                EventTag tag = (EventTag)node.Tag;

                m_Core.SetEventID(this, tag.EID);

                ShaderDebugTrace trace = null;

                ShaderReflection shaderDetails = m_Core.CurPipelineState.GetShaderReflection(ShaderStageType.Pixel);

                m_Core.Renderer.Invoke((ReplayRenderer r) =>
                {
                    trace = r.DebugPixel((UInt32)pixel.X, (UInt32)pixel.Y, sample, tag.Primitive);
                });

                if (trace == null || trace.states.Length == 0)
                {
                    MessageBox.Show("Error debugging pixel.", "Debug Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                this.BeginInvoke(new Action(() =>
                {
                    string debugContext = String.Format("Pixel {0},{1}", pixel.X, pixel.Y);

                    ShaderViewer s = new ShaderViewer(m_Core, shaderDetails, ShaderStageType.Pixel, trace, debugContext);

                    s.Show(this.DockPanel);
                }));
            }
        }
コード例 #6
0
ファイル: TextureViewer.cs プロジェクト: n1nj4n/renderdoc
        private void debugPixel_Click(object sender, EventArgs e)
        {
            ShaderDebugTrace trace = null;

            ShaderReflection shaderDetails = m_Core.CurPipelineState.GetShaderReflection(ShaderStageType.Pixel);

            m_Core.Renderer.Invoke((ReplayRenderer r) =>
            {
                trace = r.PSGetDebugStates((UInt32)m_PickedPoint.X, (UInt32)m_PickedPoint.Y);
            });

            if (trace == null || trace.states.Length == 0)
            {
                MessageBox.Show("Couldn't find pixel to debug.\nEnsure the relevant drawcall is selected for this pixel.", "No Pixel Found",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            this.BeginInvoke(new Action(() =>
            {
                ShaderViewer s = new ShaderViewer(m_Core, shaderDetails, ShaderStageType.Pixel, trace);

                s.Show(this.DockPanel);
            }));
        }
コード例 #7
0
ファイル: TextureViewer.cs プロジェクト: n1nj4n/renderdoc
        private void customEdit_Click(object sender, EventArgs e)
        {
            var filename = customShader.Text;

            var files = new Dictionary<string, string>();
            files.Add(filename, File.ReadAllText(Path.Combine(Core.ConfigDirectory, filename + ".hlsl")));
            ShaderViewer s = new ShaderViewer(m_Core, true, "Custom Shader", files,

            // Save Callback
            (ShaderViewer viewer, Dictionary<string, string> updatedfiles) =>
            {
                foreach (var f in updatedfiles)
                {
                    var path = Path.Combine(Core.ConfigDirectory, f.Key + ".hlsl");
                    File.WriteAllText(path, f.Value);
                }
            },

            // Close Callback
            () =>
            {
                m_CustomShaderEditor.Remove(filename);
            });

            m_CustomShaderEditor[customShader.Text] = s;

            s.Show(this.DockPanel);
        }
コード例 #8
0
ファイル: TextureViewer.cs プロジェクト: debaetsd/renderdoc
        private void debugPixel_Click(object sender, EventArgs e)
        {
            ShaderDebugTrace trace = null;

            ShaderReflection shaderDetails = m_Core.CurPipelineState.GetShaderReflection(ShaderStageType.Pixel);

            if(m_PickedPoint.X < 0 || m_PickedPoint.Y < 0)
                return;

            int x = m_PickedPoint.X >> (int)m_TexDisplay.mip;
            int y = m_PickedPoint.Y >> (int)m_TexDisplay.mip;

            m_Core.Renderer.Invoke((ReplayRenderer r) =>
            {
                trace = r.DebugPixel((UInt32)x, (UInt32)y, m_TexDisplay.sampleIdx, uint.MaxValue);
            });

            if (trace == null || trace.states.Length == 0)
            {
                MessageBox.Show("Couldn't find pixel to debug.\nEnsure the relevant drawcall is selected for this pixel.", "No Pixel Found",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            this.BeginInvoke(new Action(() =>
            {
                string debugContext = String.Format("Pixel {0},{1}", x, y);

                ShaderViewer s = new ShaderViewer(m_Core, shaderDetails, ShaderStageType.Pixel, trace, debugContext);

                s.Show(this.DockPanel);
            }));
        }