本文整理汇总了C#中renderdoc.ResourceId类的典型用法代码示例。如果您正苦于以下问题:C# ResourceId类的具体用法?C# ResourceId怎么用?C# ResourceId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourceId类属于renderdoc命名空间,在下文中一共展示了ResourceId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BufferFormatSpecifier
public BufferFormatSpecifier(BufferViewer viewer, ResourceId buff, string format)
{
InitializeComponent();
// WHY THE HELL do you require \r\n in text boxes?
formatText.Text = format.Replace("\r\n", "\n").Replace("\n", Environment.NewLine);
m_Viewer = viewer;
m_Buffer = buff;
}
示例2: GetTexture
public FetchTexture GetTexture(ResourceId id)
{
if (id == ResourceId.Null) return null;
for (int t = 0; t < m_Textures.Length; t++)
if (m_Textures[t].ID == id)
return m_Textures[t];
return null;
}
示例3: ViewRawBuffer
public void ViewRawBuffer(bool isBuffer, ResourceId id, string formatString)
{
if (m_Core.CurBuffers == null) return;
m_FormatText = formatString;
UInt64 len = 0;
Text = "Buffer Contents";
foreach (var b in m_Core.CurBuffers)
{
if (b.ID == id)
{
Text = b.name + " - Contents";
len = b.byteSize;
break;
}
}
Input input = new Input();
string errors = "";
FormatElement[] elems = FormatElement.ParseFormatString(formatString, len, true, out errors);
input.Strides = new uint[] { elems.Last().offset + elems.Last().ByteSize };
input.Buffers = new ResourceId[] { isBuffer ? id : ResourceId.Null, isBuffer ? ResourceId.Null : id };
input.Offsets = new ulong[] { 0 };
input.IndexBuffer = ResourceId.Null;
input.BufferFormats = elems;
input.IndexOffset = 0;
largeBufferWarning.Visible = false;
byteOffset.Enabled = false;
m_VSIn.m_Input = input;
ShowFormatSpecifier();
m_FormatSpecifier.SetErrors(errors);
ClearStoredData();
uint byteoffset = ByteOffset;
m_Core.Renderer.BeginInvoke((ReplayRenderer r) =>
{
if (IsDisposed) return;
var contents = RT_FetchBufferContents(MeshDataStage.VSIn, r, input, byteoffset);
this.BeginInvoke(new Action(() =>
{
if (IsDisposed) return;
UI_SetRowsData(MeshDataStage.VSIn, contents, 0);
UI_SetColumns(MeshDataStage.VSIn, input.BufferFormats);
}));
});
}
示例4: GetBuffer
public FetchBuffer GetBuffer(ResourceId id)
{
if (id == ResourceId.Null) return null;
for (int b = 0; b < m_Buffers.Length; b++)
if (m_Buffers[b].ID == id)
return m_Buffers[b];
return null;
}
示例5: GetUsage
public EventUsage[] GetUsage(ResourceId id)
{
IntPtr mem = CustomMarshal.Alloc(typeof(templated_array));
bool success = ReplayRenderer_GetUsage(m_Real, id, mem);
EventUsage[] ret = null;
if (success)
ret = (EventUsage[])CustomMarshal.GetTemplatedArray(mem, typeof(EventUsage), true);
CustomMarshal.Free(mem);
return ret;
}
示例6: BufferResTag
public BufferResTag(bool rw, UInt32 b, ResourceId id, ulong offs, ulong sz)
{
rwRes = rw; bindPoint = b; ID = id; offset = offs; size = sz;
}
示例7: GetCurrentMeshInput
// used for the mesh view, to get the format of the mesh input from whichever stage that
// we're looking at
private Input GetCurrentMeshInput(FetchDrawcall draw, MeshDataStage type)
{
if (!MeshView)
return null;
FormatElement[] f = null;
Input ret = new Input();
ret.Drawcall = draw;
ret.Topology = m_Core.CurPipelineState.DrawTopology;
if (type != MeshDataStage.VSIn)
{
ShaderReflection details = null;
if (type == MeshDataStage.VSOut)
details = m_Core.CurPipelineState.GetShaderReflection(ShaderStageType.Vertex);
else if (type == MeshDataStage.GSOut)
{
details = m_Core.CurPipelineState.GetShaderReflection(ShaderStageType.Geometry);
if (details == null)
details = m_Core.CurPipelineState.GetShaderReflection(ShaderStageType.Domain);
}
if (details == null)
return null;
f = new FormatElement[details.OutputSig.Length];
uint offset = 0;
for (int i = 0; i < details.OutputSig.Length; i++)
{
var sig = details.OutputSig[i];
f[i] = new FormatElement();
f[i].buffer = 0;
f[i].name = details.OutputSig[i].varName != "" ? details.OutputSig[i].varName : details.OutputSig[i].semanticIdxName;
f[i].format.compByteWidth = sizeof(float);
f[i].format.compCount = sig.compCount;
f[i].format.compType = sig.compType;
f[i].format.special = false;
f[i].format.rawType = 0;
f[i].offset = offset;
f[i].perinstance = false;
f[i].rowmajor = false;
f[i].matrixdim = 1;
offset += details.OutputSig[i].compCount * sizeof(float);
}
ret.BufferFormats = f;
ret.Strides = new uint[] { offset };
ret.Offsets = new uint[] { 0 };
ret.Buffers = null;
ret.IndexBuffer = ResourceId.Null;
return ret;
}
CommonPipelineState.VBuffer[] vbs = m_Core.CurPipelineState.GetVBuffers();
ResourceId[] bs = new ResourceId[vbs.Length];
uint[] s = new uint[vbs.Length];
uint[] o = new uint[vbs.Length];
for (int i = 0; i < vbs.Length; i++)
{
bs[i] = vbs[i].Buffer;
s[i] = vbs[i].ByteStride;
o[i] = vbs[i].ByteOffset;
}
{
var vinputs = m_Core.CurPipelineState.GetVertexInputs();
f = new FormatElement[vinputs.Length];
int i = 0;
foreach (var a in vinputs)
{
f[i] = new FormatElement(a.Name,
a.VertexBuffer,
a.RelativeByteOffset,
a.PerInstance,
false, // row major matrix
1, // matrix dimension
a.Format);
i++;
}
}
ResourceId ibuffer = ResourceId.Null;
uint ioffset = 0;
ResourceFormat ifmt = null;
m_Core.CurPipelineState.GetIBuffer(out ibuffer, out ioffset, out ifmt);
if (draw != null && (draw.flags & DrawcallFlags.UseIBuffer) == 0)
{
//.........这里部分代码省略.........
示例8: InitResourcePreview
private void InitResourcePreview(ResourcePreview prev, ResourceId id, FormatComponentType typeHint, bool force, Following follow, string bindName, string slotName)
{
if (id != ResourceId.Null || force)
{
FetchTexture tex = null;
foreach (var t in m_Core.CurTextures)
if (t.ID == id)
tex = t;
FetchBuffer buf = null;
foreach (var b in m_Core.CurBuffers)
if (b.ID == id)
buf = b;
if (tex != null)
{
string fullname = bindName;
if (tex.customName)
{
if (fullname.Length > 0)
fullname += " = ";
fullname += tex.name;
}
if (fullname.Length == 0)
fullname = tex.name;
prev.Init(fullname, tex.width, tex.height, tex.depth, tex.mips);
IntPtr handle = prev.ThumbnailHandle;
m_Core.Renderer.BeginInvoke((ReplayRenderer rep) =>
{
m_Output.AddThumbnail(handle, id, typeHint);
});
}
else if (buf != null)
{
string fullname = bindName;
if (buf.customName)
{
if (fullname.Length > 0)
fullname += " = ";
fullname += buf.name;
}
if (fullname.Length == 0)
fullname = buf.name;
prev.Init(fullname, buf.length, 0, 0, 1);
IntPtr handle = prev.ThumbnailHandle;
m_Core.Renderer.BeginInvoke((ReplayRenderer rep) =>
{
m_Output.AddThumbnail(handle, ResourceId.Null, FormatComponentType.None);
});
}
else
{
prev.Init();
IntPtr handle = prev.ThumbnailHandle;
m_Core.Renderer.BeginInvoke((ReplayRenderer rep) =>
{
m_Output.AddThumbnail(handle, ResourceId.Null, FormatComponentType.None);
});
}
prev.Tag = follow;
prev.SlotName = slotName;
prev.Visible = true;
prev.Selected = (m_Following == follow);
}
else if (m_Following == follow)
{
FetchTexture tex = null;
if(id != ResourceId.Null)
foreach (var t in m_Core.CurTextures)
if (t.ID == id)
tex = t;
IntPtr handle = prev.ThumbnailHandle;
if (id == ResourceId.Null || tex == null)
prev.Init();
else
prev.Init("Unused", tex.width, tex.height, tex.depth, tex.mips);
prev.Selected = true;
m_Core.Renderer.BeginInvoke((ReplayRenderer rep) =>
{
m_Output.AddThumbnail(handle, ResourceId.Null, FormatComponentType.None);
});
}
else
{
prev.Init();
prev.Visible = false;
}
}
示例9: GetOutputTargets
public ResourceId[] GetOutputTargets()
{
if (LogLoaded)
{
if (IsLogD3D11)
{
ResourceId[] ret = new ResourceId[m_D3D11.m_OM.RenderTargets.Length];
for (int i = 0; i < m_D3D11.m_OM.RenderTargets.Length; i++)
{
ret[i] = m_D3D11.m_OM.RenderTargets[i].Resource;
if (ret[i] == ResourceId.Null && i > m_D3D11.m_OM.UAVStartSlot)
ret[i] = m_D3D11.m_OM.UAVs[i - m_D3D11.m_OM.UAVStartSlot].Resource;
}
return ret;
}
else if (IsLogGL)
{
return m_GL.m_FB.Color;
}
}
return null;
}
示例10: GetResources
public ResourceId[] GetResources(ShaderStageType stage)
{
if (LogLoaded)
{
if (IsLogD3D11)
{
D3D11PipelineState.ShaderStage s = null;
switch (stage)
{
case ShaderStageType.Vertex: s = m_D3D11.m_VS; break;
case ShaderStageType.Domain: s = m_D3D11.m_DS; break;
case ShaderStageType.Hull: s = m_D3D11.m_HS; break;
case ShaderStageType.Geometry: s = m_D3D11.m_GS; break;
case ShaderStageType.Pixel: s = m_D3D11.m_PS; break;
case ShaderStageType.Compute: s = m_D3D11.m_CS; break;
}
ResourceId[] ret = new ResourceId[s.SRVs.Length];
for (int i = 0; i < s.SRVs.Length; i++)
ret[i] = s.SRVs[i].Resource;
return ret;
}
else if (IsLogGL)
{
ResourceId[] ret = new ResourceId[m_GL.Textures.Length];
for (int i = 0; i < m_GL.Textures.Length; i++)
ret[i] = m_GL.Textures[i].Resource;
return ret;
}
}
return null;
}
示例11: GetIBuffer
public void GetIBuffer(out ResourceId buf, out uint ByteOffset, out ResourceFormat IndexFormat)
{
if (LogLoaded)
{
if (IsLogD3D11)
{
buf = m_D3D11.m_IA.ibuffer.Buffer;
ByteOffset = m_D3D11.m_IA.ibuffer.Offset;
IndexFormat = m_D3D11.m_IA.ibuffer.Format;
return;
}
else if (IsLogGL)
{
buf = m_GL.m_VtxIn.ibuffer.Buffer;
ByteOffset = m_GL.m_VtxIn.ibuffer.Offset;
IndexFormat = m_GL.m_VtxIn.ibuffer.Format;
return;
}
}
buf = ResourceId.Null;
ByteOffset = 0;
IndexFormat = new ResourceFormat(FormatComponentType.UInt, 1, 2);
}
示例12: GetConstantBuffer
public void GetConstantBuffer(ShaderStageType stage, uint BindPoint, out ResourceId buf, out uint ByteOffset)
{
if (LogLoaded)
{
if (IsLogD3D11)
{
D3D11PipelineState.ShaderStage s = null;
switch (stage)
{
case ShaderStageType.Vertex: s = m_D3D11.m_VS; break;
case ShaderStageType.Domain: s = m_D3D11.m_DS; break;
case ShaderStageType.Hull: s = m_D3D11.m_HS; break;
case ShaderStageType.Geometry: s = m_D3D11.m_GS; break;
case ShaderStageType.Pixel: s = m_D3D11.m_PS; break;
case ShaderStageType.Compute: s = m_D3D11.m_CS; break;
}
buf = s.ConstantBuffers[BindPoint].Buffer;
ByteOffset = s.ConstantBuffers[BindPoint].VecOffset * 4 * sizeof(float);
return;
}
else if (IsLogGL)
{
buf = ResourceId.Null;
ByteOffset = 0;
return;
}
}
buf = ResourceId.Null;
ByteOffset = 0;
}
示例13: GetConstantBuffer
public void GetConstantBuffer(ShaderStageType stage, uint BufIdx, out ResourceId buf, out uint ByteOffset, out uint ByteSize)
{
if (LogLoaded)
{
if (IsLogD3D11)
{
D3D11PipelineState.ShaderStage s = null;
switch (stage)
{
case ShaderStageType.Vertex: s = m_D3D11.m_VS; break;
case ShaderStageType.Domain: s = m_D3D11.m_DS; break;
case ShaderStageType.Hull: s = m_D3D11.m_HS; break;
case ShaderStageType.Geometry: s = m_D3D11.m_GS; break;
case ShaderStageType.Pixel: s = m_D3D11.m_PS; break;
case ShaderStageType.Compute: s = m_D3D11.m_CS; break;
}
if(BufIdx < s.ConstantBuffers.Length)
{
buf = s.ConstantBuffers[BufIdx].Buffer;
ByteOffset = s.ConstantBuffers[BufIdx].VecOffset * 4 * sizeof(float);
ByteSize = s.ConstantBuffers[BufIdx].VecCount * 4 * sizeof(float);
return;
}
}
else if (IsLogGL)
{
GLPipelineState.ShaderStage s = null;
switch (stage)
{
case ShaderStageType.Vertex: s = m_GL.m_VS; break;
case ShaderStageType.Tess_Control: s = m_GL.m_TCS; break;
case ShaderStageType.Tess_Eval: s = m_GL.m_TES; break;
case ShaderStageType.Geometry: s = m_GL.m_GS; break;
case ShaderStageType.Fragment: s = m_GL.m_FS; break;
case ShaderStageType.Compute: s = m_GL.m_CS; break;
}
if(s.ShaderDetails != null && BufIdx < s.ShaderDetails.ConstantBlocks.Length)
{
if (s.ShaderDetails.ConstantBlocks[BufIdx].bindPoint >= 0)
{
int uboIdx = s.BindpointMapping.ConstantBlocks[s.ShaderDetails.ConstantBlocks[BufIdx].bindPoint].bind;
if (uboIdx >= 0 && uboIdx < m_GL.UniformBuffers.Length)
{
var b = m_GL.UniformBuffers[uboIdx];
buf = b.Resource;
ByteOffset = (uint)b.Offset;
ByteSize = (uint)b.Size;
return;
}
}
}
}
}
buf = ResourceId.Null;
ByteOffset = 0;
ByteSize = 0;
}
示例14: SetContextFilter
// setting a context filter allows replaying of deferred events. You can set the deferred
// events to replay in a context, after replaying up to a given event on the main thread
public void SetContextFilter(ILogViewerForm exclude, UInt32 frameID, UInt32 eventID,
ResourceId ctx, UInt32 firstDeferred, UInt32 lastDeferred)
{
m_FrameID = frameID;
m_EventID = eventID;
m_DeferredEvent = lastDeferred;
m_Renderer.Invoke((ReplayRenderer r) => { r.SetContextFilter(ctx, firstDeferred, lastDeferred); });
m_Renderer.Invoke((ReplayRenderer r) => {
r.SetFrameEvent(m_FrameID, m_EventID);
m_D3D11PipelineState = r.GetD3D11PipelineState();
m_GLPipelineState = r.GetGLPipelineState();
m_PipelineState.SetStates(m_APIProperties, m_D3D11PipelineState, m_GLPipelineState);
});
foreach (var logviewer in m_LogViewers)
{
if (logviewer == exclude)
continue;
Control c = (Control)logviewer;
if (c.InvokeRequired)
c.BeginInvoke(new Action(() => logviewer.OnEventSelected(frameID, eventID)));
else
logviewer.OnEventSelected(frameID, eventID);
}
}
示例15: ViewTexture
public void ViewTexture(ResourceId ID, bool focus)
{
if (this.InvokeRequired)
{
this.BeginInvoke(new Action(() => { this.ViewTexture(ID, focus); }));
return;
}
TextureViewer_Load(null, null);
if (lockedTabs.ContainsKey(ID))
{
if (!lockedTabs[ID].IsDisposed && !lockedTabs[ID].IsHidden)
{
if (focus)
Show();
lockedTabs[ID].Show();
m_Core.Renderer.BeginInvoke(RT_UpdateAndDisplay);
return;
}
lockedTabs.Remove(ID);
}
for (int i = 0; i < m_Core.CurTextures.Length; i++)
{
if (m_Core.CurTextures[i].ID == ID)
{
FetchTexture current = m_Core.CurTextures[i];
var newPanel = Helpers.WrapDockContent(dockPanel, renderToolstripContainer, current.name);
newPanel.DockState = DockState.Document;
newPanel.AllowEndUserDocking = false;
newPanel.Icon = Icon.FromHandle(global::renderdocui.Properties.Resources.page_white_link.GetHicon());
newPanel.Tag = current;
newPanel.DockHandler.TabPageContextMenuStrip = tabContextMenu;
newPanel.FormClosing += new FormClosingEventHandler(PreviewPanel_FormClosing);
newPanel.Show(m_PreviewPanel.Pane, null);
newPanel.Show();
if (focus)
Show();
lockedTabs.Add(ID, newPanel);
m_Core.Renderer.BeginInvoke(RT_UpdateAndDisplay);
return;
}
}
for (int i = 0; i < m_Core.CurBuffers.Length; i++)
{
if (m_Core.CurBuffers[i].ID == ID)
{
var viewer = new BufferViewer(m_Core, false);
viewer.ViewRawBuffer(true, 0, ulong.MaxValue, ID);
viewer.Show(DockPanel);
return;
}
}
}