mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-10 16:09:09 +00:00
Refactor handling of resources/binding to be much more flexible
* This will handle the new vulkan binding model with multiple descriptor sets and arrays of objects in each binding. It also makes a few tidy ups and improvements to other APIs in presentation - will e.g. now show thumbnails for vertex and other stages.
This commit is contained in:
1 parent
6051f0c500
commit
5c309d9d34
10 files changed
+776
-661
No files matched your search
@@ -963,7 +963,7 @@ ShaderReflection *MakeShaderReflection(DXBC::DXBCFile *dxbc)
|
||||
{
|
||||
ConstantBlock &cb = ret->ConstantBlocks[i];
|
||||
cb.name = dxbc->m_CBuffers[i].name;
|
||||
cb.bufferBacked = true;
|
||||
cb.bufferBacked = dxbc->m_CBuffers[i].descriptor.type == DXBC::CBuffer::Descriptor::TYPE_CBUFFER;
|
||||
cb.bindPoint = (uint32_t)i;
|
||||
|
||||
create_array_uninit(cb.variables, dxbc->m_CBuffers[i].variables.size());
|
||||
|
||||
@@ -501,6 +501,13 @@ D3D11PipelineState D3D11Replay::MakePipelineState()
|
||||
|
||||
ResourceId id = GetIDForResource(src.Shader);
|
||||
|
||||
WrappedShader *shad = (WrappedShader*)(WrappedID3D11Shader<ID3D11VertexShader> *)src.Shader;
|
||||
|
||||
ShaderReflection *refl = NULL;
|
||||
|
||||
if(shad != NULL)
|
||||
refl = shad->GetDetails();
|
||||
|
||||
dst.Shader = rm->GetOriginalID(id);
|
||||
dst.ShaderDetails = NULL;
|
||||
|
||||
@@ -530,7 +537,7 @@ D3D11PipelineState D3D11Replay::MakePipelineState()
|
||||
{
|
||||
dst.BindpointMapping.ConstantBlocks[s].bindset = 0;
|
||||
dst.BindpointMapping.ConstantBlocks[s].bind = s;
|
||||
dst.BindpointMapping.ConstantBlocks[s].used = true;
|
||||
dst.BindpointMapping.ConstantBlocks[s].used = false;
|
||||
dst.BindpointMapping.ConstantBlocks[i].arraySize = 1;
|
||||
}
|
||||
|
||||
@@ -539,7 +546,7 @@ D3D11PipelineState D3D11Replay::MakePipelineState()
|
||||
{
|
||||
dst.BindpointMapping.ReadOnlyResources[s].bindset = 0;
|
||||
dst.BindpointMapping.ReadOnlyResources[s].bind = s;
|
||||
dst.BindpointMapping.ReadOnlyResources[s].used = true;
|
||||
dst.BindpointMapping.ReadOnlyResources[s].used = false;
|
||||
dst.BindpointMapping.ReadOnlyResources[i].arraySize = 1;
|
||||
}
|
||||
|
||||
@@ -548,10 +555,25 @@ D3D11PipelineState D3D11Replay::MakePipelineState()
|
||||
{
|
||||
dst.BindpointMapping.ReadWriteResources[s].bindset = 0;
|
||||
dst.BindpointMapping.ReadWriteResources[s].bind = s;
|
||||
dst.BindpointMapping.ReadWriteResources[s].used = true;
|
||||
dst.BindpointMapping.ReadWriteResources[s].used = false;
|
||||
dst.BindpointMapping.ReadWriteResources[i].arraySize = 1;
|
||||
}
|
||||
|
||||
// mark resources as used if they are referenced by the shader
|
||||
if(refl)
|
||||
{
|
||||
for(int32_t i=0; i < refl->ConstantBlocks.count; i++)
|
||||
if(refl->ConstantBlocks[i].bufferBacked)
|
||||
dst.BindpointMapping.ConstantBlocks[refl->ConstantBlocks[i].bindPoint].used = true;
|
||||
|
||||
for(int32_t i=0; i < refl->ReadOnlyResources.count; i++)
|
||||
if(!refl->ReadOnlyResources[i].IsSampler)
|
||||
dst.BindpointMapping.ReadOnlyResources[refl->ReadOnlyResources[i].bindPoint].used = true;
|
||||
|
||||
for(int32_t i=0; i < refl->ReadWriteResources.count; i++)
|
||||
dst.BindpointMapping.ReadWriteResources[refl->ReadWriteResources[i].bindPoint].used = true;
|
||||
}
|
||||
|
||||
create_array_uninit(dst.ConstantBuffers, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
|
||||
for(size_t s=0; s < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; s++)
|
||||
{
|
||||
|
||||
@@ -2142,6 +2142,14 @@ struct bindpair
|
||||
if(map.bindset != o.map.bindset)
|
||||
return map.bindset < o.map.bindset;
|
||||
|
||||
// sort -1 to the end
|
||||
if(map.bind == -1 && o.map.bind == -1) // equal
|
||||
return false;
|
||||
if(map.bind == -1) // -1 not less than anything
|
||||
return false;
|
||||
if(o.map.bind == -1) // anything less than -1
|
||||
return true;
|
||||
|
||||
return map.bind < o.map.bind;
|
||||
}
|
||||
};
|
||||
@@ -2271,6 +2279,10 @@ void SPVModule::MakeReflection(ShaderReflection *reflection, ShaderBindpointMapp
|
||||
cblock.bufferBacked = true;
|
||||
|
||||
BindpointMap bindmap = {0};
|
||||
// set can be implicitly 0, but the binding must be set explicitly.
|
||||
// If no binding is found, we set -1 and sort to the end of the resources
|
||||
// list as it's not bound anywhere (most likely, declared but not used)
|
||||
bindmap.bind = -1;
|
||||
|
||||
for(size_t d=0; d < inst->decorations.size(); d++)
|
||||
{
|
||||
@@ -2301,6 +2313,10 @@ void SPVModule::MakeReflection(ShaderReflection *reflection, ShaderBindpointMapp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// should never have elements that have no binding declared but
|
||||
// are used
|
||||
RDCASSERT(!bindmap.used || bindmap.bind >= 0);
|
||||
|
||||
cblocks.push_back(cblockpair(bindmap, cblock));
|
||||
}
|
||||
@@ -2350,6 +2366,10 @@ void SPVModule::MakeReflection(ShaderReflection *reflection, ShaderBindpointMapp
|
||||
res.variableType.descriptor.rowMajorStorage = false;
|
||||
|
||||
BindpointMap bindmap = {0};
|
||||
// set can be implicitly 0, but the binding must be set explicitly.
|
||||
// If no binding is found, we set -1 and sort to the end of the resources
|
||||
// list as it's not bound anywhere (most likely, declared but not used)
|
||||
bindmap.bind = -1;
|
||||
|
||||
for(size_t d=0; d < inst->decorations.size(); d++)
|
||||
{
|
||||
@@ -2378,6 +2398,10 @@ void SPVModule::MakeReflection(ShaderReflection *reflection, ShaderBindpointMapp
|
||||
}
|
||||
}
|
||||
|
||||
// should never have elements that have no binding declared but
|
||||
// are used
|
||||
RDCASSERT(!bindmap.used || bindmap.bind >= 0);
|
||||
|
||||
resources.push_back(shaderrespair(bindmap, res));
|
||||
}
|
||||
}
|
||||
@@ -2402,6 +2426,11 @@ void SPVModule::MakeReflection(ShaderReflection *reflection, ShaderBindpointMapp
|
||||
for(size_t i=0; i < cblocks.size(); i++)
|
||||
{
|
||||
mapping->ConstantBlocks[i] = cblocks[i].map;
|
||||
// fix up any bind points marked with -1. They were sorted to the end
|
||||
// but from here on we want to just be able to index with the bind point
|
||||
// without any special casing.
|
||||
if(mapping->ConstantBlocks[i].bind == -1)
|
||||
mapping->ConstantBlocks[i].bind = 0;
|
||||
reflection->ConstantBlocks[i] = cblocks[i].bindres;
|
||||
reflection->ConstantBlocks[i].bindPoint = (int32_t)i;
|
||||
}
|
||||
@@ -2409,6 +2438,11 @@ void SPVModule::MakeReflection(ShaderReflection *reflection, ShaderBindpointMapp
|
||||
for(size_t i=0; i < resources.size(); i++)
|
||||
{
|
||||
mapping->ReadOnlyResources[i] = resources[i].map;
|
||||
// fix up any bind points marked with -1. They were sorted to the end
|
||||
// but from here on we want to just be able to index with the bind point
|
||||
// without any special casing.
|
||||
if(mapping->ReadOnlyResources[i].bind == -1)
|
||||
mapping->ReadOnlyResources[i].bind = 0;
|
||||
reflection->ReadOnlyResources[i] = resources[i].bindres;
|
||||
reflection->ReadOnlyResources[i].bindPoint = (int32_t)i;
|
||||
}
|
||||
|
||||
@@ -2927,24 +2927,48 @@ void VulkanReplay::SavePipelineState()
|
||||
layoutBind.descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT ||
|
||||
layoutBind.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)
|
||||
{
|
||||
ResourceId viewid = rm->GetNonDispWrapper(info[a].imageView)->id;
|
||||
VkImageView view = info[a].imageView;
|
||||
|
||||
dst.bindings[b].binds[a].view = rm->GetOriginalID(viewid);
|
||||
dst.bindings[b].binds[a].res = rm->GetOriginalID(c.m_ImageView[viewid].image);
|
||||
dst.bindings[b].binds[a].baseMip = c.m_ImageView[viewid].range.baseMipLevel;
|
||||
dst.bindings[b].binds[a].baseLayer = c.m_ImageView[viewid].range.baseArrayLayer;
|
||||
if(view != VK_NULL_HANDLE)
|
||||
{
|
||||
ResourceId viewid = rm->GetNonDispWrapper(view)->id;
|
||||
|
||||
dst.bindings[b].binds[a].view = rm->GetOriginalID(viewid);
|
||||
dst.bindings[b].binds[a].res = rm->GetOriginalID(c.m_ImageView[viewid].image);
|
||||
dst.bindings[b].binds[a].baseMip = c.m_ImageView[viewid].range.baseMipLevel;
|
||||
dst.bindings[b].binds[a].baseLayer = c.m_ImageView[viewid].range.baseArrayLayer;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst.bindings[b].binds[a].view = ResourceId();
|
||||
dst.bindings[b].binds[a].res = ResourceId();
|
||||
dst.bindings[b].binds[a].baseMip = 0;
|
||||
dst.bindings[b].binds[a].baseLayer = 0;
|
||||
}
|
||||
}
|
||||
if(layoutBind.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER ||
|
||||
layoutBind.descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER)
|
||||
{
|
||||
ResourceId viewid = rm->GetNonDispWrapper(info[a].bufferView)->id;
|
||||
VkBufferView view = info[a].bufferView;
|
||||
|
||||
if(view != VK_NULL_HANDLE)
|
||||
{
|
||||
ResourceId viewid = rm->GetNonDispWrapper(view)->id;
|
||||
|
||||
dst.bindings[b].binds[a].view = rm->GetOriginalID(viewid);
|
||||
dst.bindings[b].binds[a].res = rm->GetOriginalID(c.m_BufferView[viewid].buffer);
|
||||
dst.bindings[b].binds[a].offset = c.m_BufferView[viewid].offset;
|
||||
if(dynamicOffset)
|
||||
dst.bindings[b].binds[a].offset += *(uint32_t *)&info[a].imageLayout;
|
||||
dst.bindings[b].binds[a].size = c.m_BufferView[viewid].size;
|
||||
dst.bindings[b].binds[a].view = rm->GetOriginalID(viewid);
|
||||
dst.bindings[b].binds[a].res = rm->GetOriginalID(c.m_BufferView[viewid].buffer);
|
||||
dst.bindings[b].binds[a].offset = c.m_BufferView[viewid].offset;
|
||||
if(dynamicOffset)
|
||||
dst.bindings[b].binds[a].offset += *(uint32_t *)&info[a].imageLayout;
|
||||
dst.bindings[b].binds[a].size = c.m_BufferView[viewid].size;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst.bindings[b].binds[a].view = ResourceId();
|
||||
dst.bindings[b].binds[a].res = ResourceId();
|
||||
dst.bindings[b].binds[a].offset = 0;
|
||||
dst.bindings[b].binds[a].size = 0;
|
||||
}
|
||||
}
|
||||
if(layoutBind.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER ||
|
||||
layoutBind.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC ||
|
||||
@@ -2952,10 +2976,14 @@ void VulkanReplay::SavePipelineState()
|
||||
layoutBind.descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)
|
||||
{
|
||||
dst.bindings[b].binds[a].view = ResourceId();
|
||||
dst.bindings[b].binds[a].res = rm->GetOriginalID(rm->GetNonDispWrapper(info[a].bufferInfo.buffer)->id);
|
||||
|
||||
if(info[a].bufferInfo.buffer != VK_NULL_HANDLE)
|
||||
dst.bindings[b].binds[a].res = rm->GetOriginalID(rm->GetNonDispWrapper(info[a].bufferInfo.buffer)->id);
|
||||
|
||||
dst.bindings[b].binds[a].offset = info[a].bufferInfo.offset;
|
||||
if(dynamicOffset)
|
||||
dst.bindings[b].binds[a].offset += *(uint32_t *)&info[a].imageLayout;
|
||||
|
||||
dst.bindings[b].binds[a].size = info[a].bufferInfo.range;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,37 @@ using renderdoc;
|
||||
|
||||
namespace renderdocui.Code
|
||||
{
|
||||
public class BoundResource
|
||||
{
|
||||
public BoundResource()
|
||||
{ Id = ResourceId.Null; HighestMip = -1; FirstSlice = -1; }
|
||||
public BoundResource(ResourceId id)
|
||||
{ Id = id; HighestMip = -1; FirstSlice = -1; }
|
||||
|
||||
public ResourceId Id;
|
||||
public int HighestMip;
|
||||
public int FirstSlice;
|
||||
};
|
||||
|
||||
public struct BoundVBuffer
|
||||
{
|
||||
public ResourceId Buffer;
|
||||
public ulong ByteOffset;
|
||||
public uint ByteStride;
|
||||
};
|
||||
|
||||
public struct VertexInputAttribute
|
||||
{
|
||||
public string Name;
|
||||
public int VertexBuffer;
|
||||
public uint RelativeByteOffset;
|
||||
public bool PerInstance;
|
||||
public int InstanceRate;
|
||||
public ResourceFormat Format;
|
||||
public object[] GenericValue;
|
||||
public bool Used;
|
||||
};
|
||||
|
||||
public class CommonPipelineState
|
||||
{
|
||||
private D3D11PipelineState m_D3D11 = null;
|
||||
@@ -419,20 +450,13 @@ namespace renderdocui.Code
|
||||
return uint.MaxValue;
|
||||
}
|
||||
|
||||
public struct VBuffer
|
||||
{
|
||||
public ResourceId Buffer;
|
||||
public ulong ByteOffset;
|
||||
public uint ByteStride;
|
||||
};
|
||||
|
||||
public VBuffer[] GetVBuffers()
|
||||
public BoundVBuffer[] GetVBuffers()
|
||||
{
|
||||
if (LogLoaded)
|
||||
{
|
||||
if (IsLogD3D11)
|
||||
{
|
||||
VBuffer[] ret = new VBuffer[m_D3D11.m_IA.vbuffers.Length];
|
||||
BoundVBuffer[] ret = new BoundVBuffer[m_D3D11.m_IA.vbuffers.Length];
|
||||
for (int i = 0; i < m_D3D11.m_IA.vbuffers.Length; i++)
|
||||
{
|
||||
ret[i].Buffer = m_D3D11.m_IA.vbuffers[i].Buffer;
|
||||
@@ -444,7 +468,7 @@ namespace renderdocui.Code
|
||||
}
|
||||
else if (IsLogGL)
|
||||
{
|
||||
VBuffer[] ret = new VBuffer[m_GL.m_VtxIn.vbuffers.Length];
|
||||
BoundVBuffer[] ret = new BoundVBuffer[m_GL.m_VtxIn.vbuffers.Length];
|
||||
for (int i = 0; i < m_GL.m_VtxIn.vbuffers.Length; i++)
|
||||
{
|
||||
ret[i].Buffer = m_GL.m_VtxIn.vbuffers[i].Buffer;
|
||||
@@ -456,7 +480,7 @@ namespace renderdocui.Code
|
||||
}
|
||||
else if (IsLogVK)
|
||||
{
|
||||
VBuffer[] ret = new VBuffer[m_Vulkan.VI.binds.Length];
|
||||
BoundVBuffer[] ret = new BoundVBuffer[m_Vulkan.VI.binds.Length];
|
||||
for (int i = 0; i < m_Vulkan.VI.binds.Length; i++)
|
||||
{
|
||||
ret[i].Buffer = i < m_Vulkan.VI.vbuffers.Length ? m_Vulkan.VI.vbuffers[i].buffer : ResourceId.Null;
|
||||
@@ -471,18 +495,6 @@ namespace renderdocui.Code
|
||||
return null;
|
||||
}
|
||||
|
||||
public struct VertexInputAttribute
|
||||
{
|
||||
public string Name;
|
||||
public int VertexBuffer;
|
||||
public uint RelativeByteOffset;
|
||||
public bool PerInstance;
|
||||
public int InstanceRate;
|
||||
public ResourceFormat Format;
|
||||
public object[] GenericValue;
|
||||
public bool Used;
|
||||
};
|
||||
|
||||
public VertexInputAttribute[] GetVertexInputs()
|
||||
{
|
||||
if (LogLoaded)
|
||||
@@ -759,8 +771,10 @@ namespace renderdocui.Code
|
||||
ByteSize = 0;
|
||||
}
|
||||
|
||||
public ResourceId[] GetResources(ShaderStageType stage)
|
||||
public Dictionary<BindpointMap, BoundResource[]> GetReadOnlyResources(ShaderStageType stage)
|
||||
{
|
||||
var ret = new Dictionary<BindpointMap, BoundResource[]>();
|
||||
|
||||
if (LogLoaded)
|
||||
{
|
||||
if (IsLogD3D11)
|
||||
@@ -777,17 +791,33 @@ namespace renderdocui.Code
|
||||
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;
|
||||
{
|
||||
var key = new BindpointMap(0, i);
|
||||
var val = new BoundResource();
|
||||
|
||||
val.Id = s.SRVs[i].Resource;
|
||||
val.HighestMip = (int)s.SRVs[i].HighestMip;
|
||||
val.FirstSlice = (int)s.SRVs[i].FirstArraySlice;
|
||||
|
||||
ret.Add(key, new BoundResource[] { val });
|
||||
}
|
||||
|
||||
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;
|
||||
{
|
||||
var key = new BindpointMap(0, i);
|
||||
var val = new BoundResource();
|
||||
|
||||
val.Id = m_GL.Textures[i].Resource;
|
||||
val.HighestMip = (int)m_GL.Textures[i].HighestMip;
|
||||
val.FirstSlice = (int)m_GL.Textures[i].FirstSlice;
|
||||
|
||||
ret.Add(key, new BoundResource[] { val });
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -797,68 +827,96 @@ namespace renderdocui.Code
|
||||
|
||||
if (stage == ShaderStageType.Compute)
|
||||
descsets = m_Vulkan.compute.DescSets;
|
||||
|
||||
List<ResourceId> ret = new List<ResourceId>();
|
||||
|
||||
ShaderStageBits mask = (ShaderStageBits)(1 << (int)stage);
|
||||
foreach(var descset in m_Vulkan.graphics.DescSets)
|
||||
|
||||
for (int set = 0; set < m_Vulkan.graphics.DescSets.Length; set++)
|
||||
{
|
||||
foreach (var bind in descset.bindings)
|
||||
var descset = m_Vulkan.graphics.DescSets[set];
|
||||
for (int slot = 0; slot < descset.bindings.Length; slot++)
|
||||
{
|
||||
var bind = descset.bindings[slot];
|
||||
if ((bind.type == ShaderBindType.ImageSampler ||
|
||||
bind.type == ShaderBindType.InputAttachment ||
|
||||
bind.type == ShaderBindType.ReadOnlyBuffer ||
|
||||
bind.type == ShaderBindType.ReadOnlyImage ||
|
||||
bind.type == ShaderBindType.ReadOnlyTBuffer
|
||||
) && (bind.stageFlags & mask) == mask)
|
||||
{
|
||||
// VKTODOMED handle bind.arraySize
|
||||
ret.Add(bind.binds[0].res);
|
||||
}
|
||||
else
|
||||
{
|
||||
// texture viewer currently expects binds to match up to resource list
|
||||
// so we need to pad with empty elements
|
||||
ret.Add(ResourceId.Null);
|
||||
var key = new BindpointMap(set, slot);
|
||||
var val = new BoundResource[bind.arraySize];
|
||||
|
||||
for (UInt32 i = 0; i < bind.arraySize; i++)
|
||||
{
|
||||
val[i] = new BoundResource();
|
||||
val[i].Id = bind.binds[i].res;
|
||||
val[i].HighestMip = (int)bind.binds[i].baseMip;
|
||||
val[i].FirstSlice = (int)bind.binds[i].baseLayer;
|
||||
}
|
||||
|
||||
ret.Add(key, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret.ToArray();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return new ResourceId[0];
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ResourceId[] GetReadWriteResources(ShaderStageType stage)
|
||||
public Dictionary<BindpointMap, BoundResource[]> GetReadWriteResources(ShaderStageType stage)
|
||||
{
|
||||
var ret = new Dictionary<BindpointMap, BoundResource[]>();
|
||||
|
||||
if (LogLoaded)
|
||||
{
|
||||
if (IsLogD3D11)
|
||||
{
|
||||
if (stage == ShaderStageType.Compute)
|
||||
{
|
||||
ResourceId[] ret = new ResourceId[m_D3D11.m_CS.UAVs.Length];
|
||||
for (int i = 0; i < m_D3D11.m_CS.UAVs.Length; i++)
|
||||
ret[i] = m_D3D11.m_CS.UAVs[i].Resource;
|
||||
{
|
||||
var key = new BindpointMap(0, i);
|
||||
var val = new BoundResource();
|
||||
|
||||
return ret;
|
||||
val.Id = m_D3D11.m_CS.UAVs[i].Resource;
|
||||
val.HighestMip = (int)m_D3D11.m_CS.UAVs[i].HighestMip;
|
||||
val.FirstSlice = (int)m_D3D11.m_CS.UAVs[i].FirstArraySlice;
|
||||
|
||||
ret.Add(key, new BoundResource[] { val });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ResourceId[] ret = new ResourceId[m_D3D11.m_OM.UAVs.Length];
|
||||
for (int i = 0; i < m_D3D11.m_OM.UAVs.Length; i++)
|
||||
ret[i] = m_D3D11.m_OM.UAVs[i].Resource;
|
||||
{
|
||||
var key = new BindpointMap(0, i);
|
||||
var val = new BoundResource();
|
||||
|
||||
return ret;
|
||||
val.Id = m_D3D11.m_OM.UAVs[i].Resource;
|
||||
val.HighestMip = (int)m_D3D11.m_OM.UAVs[i].HighestMip;
|
||||
val.FirstSlice = (int)m_D3D11.m_OM.UAVs[i].FirstArraySlice;
|
||||
|
||||
ret.Add(key, new BoundResource[] { val });
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
else if (IsLogGL)
|
||||
{
|
||||
ResourceId[] ret = new ResourceId[m_GL.Images.Length];
|
||||
for (int i = 0; i < m_GL.Images.Length; i++)
|
||||
ret[i] = m_GL.Images[i].Resource;
|
||||
{
|
||||
var key = new BindpointMap(0, i);
|
||||
var val = new BoundResource();
|
||||
|
||||
val.Id = m_GL.Images[i].Resource;
|
||||
val.HighestMip = (int)m_GL.Images[i].Level;
|
||||
val.FirstSlice = (int)m_GL.Images[i].Layer;
|
||||
|
||||
ret.Add(key, new BoundResource[] { val });
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -869,109 +927,115 @@ namespace renderdocui.Code
|
||||
if (stage == ShaderStageType.Compute)
|
||||
descsets = m_Vulkan.compute.DescSets;
|
||||
|
||||
List<ResourceId> ret = new List<ResourceId>();
|
||||
|
||||
ShaderStageBits mask = (ShaderStageBits)(1 << (int)stage);
|
||||
foreach (var descset in m_Vulkan.graphics.DescSets)
|
||||
for (int set = 0; set < m_Vulkan.graphics.DescSets.Length; set++)
|
||||
{
|
||||
foreach (var bind in descset.bindings)
|
||||
var descset = m_Vulkan.graphics.DescSets[set];
|
||||
for (int slot = 0; slot < descset.bindings.Length; slot++)
|
||||
{
|
||||
var bind = descset.bindings[slot];
|
||||
|
||||
if ((bind.type == ShaderBindType.ReadWriteBuffer ||
|
||||
bind.type == ShaderBindType.ReadWriteImage ||
|
||||
bind.type == ShaderBindType.ReadWriteTBuffer
|
||||
) && (bind.stageFlags & mask) == mask)
|
||||
{
|
||||
// VKTODOMED handle bind.arraySize
|
||||
ret.Add(bind.binds[0].res);
|
||||
}
|
||||
else
|
||||
{
|
||||
// texture viewer currently expects binds to match up to resource list
|
||||
// so we need to pad with empty elements
|
||||
ret.Add(ResourceId.Null);
|
||||
var key = new BindpointMap(set, slot);
|
||||
var val = new BoundResource[bind.arraySize];
|
||||
|
||||
for (UInt32 i = 0; i < bind.arraySize; i++)
|
||||
{
|
||||
val[i] = new BoundResource();
|
||||
val[i].Id = bind.binds[i].res;
|
||||
val[i].HighestMip = (int)bind.binds[i].baseMip;
|
||||
val[i].FirstSlice = (int)bind.binds[i].baseLayer;
|
||||
}
|
||||
|
||||
ret.Add(key, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret.ToArray();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return new ResourceId[0];
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ResourceId GetDepthTarget()
|
||||
public BoundResource GetDepthTarget()
|
||||
{
|
||||
if (LogLoaded)
|
||||
{
|
||||
if (IsLogD3D11)
|
||||
{
|
||||
return m_D3D11.m_OM.DepthTarget.Resource;
|
||||
var ret = new BoundResource();
|
||||
ret.Id = m_D3D11.m_OM.DepthTarget.Resource;
|
||||
ret.HighestMip = (int)m_D3D11.m_OM.DepthTarget.HighestMip;
|
||||
ret.FirstSlice = (int)m_D3D11.m_OM.DepthTarget.FirstArraySlice;
|
||||
return ret;
|
||||
}
|
||||
else if (IsLogGL)
|
||||
{
|
||||
return m_GL.m_FB.m_DrawFBO.Depth.Obj;
|
||||
var ret = new BoundResource();
|
||||
ret.Id = m_GL.m_FB.m_DrawFBO.Depth.Obj;
|
||||
ret.HighestMip = (int)m_GL.m_FB.m_DrawFBO.Depth.Mip;
|
||||
ret.FirstSlice = (int)m_GL.m_FB.m_DrawFBO.Depth.Layer;
|
||||
return ret;
|
||||
}
|
||||
else if (IsLogVK)
|
||||
{
|
||||
var rp = m_Vulkan.Pass.renderpass;
|
||||
var fb = m_Vulkan.Pass.framebuffer;
|
||||
|
||||
return rp.depthstencilAttachment >= 0 && rp.depthstencilAttachment < fb.attachments.Length
|
||||
? fb.attachments[rp.depthstencilAttachment].img
|
||||
: ResourceId.Null;
|
||||
if (rp.depthstencilAttachment >= 0 && rp.depthstencilAttachment < fb.attachments.Length)
|
||||
{
|
||||
var ret = new BoundResource();
|
||||
ret.Id = fb.attachments[rp.depthstencilAttachment].img;
|
||||
ret.HighestMip = (int)fb.attachments[rp.depthstencilAttachment].baseMip;
|
||||
ret.FirstSlice = (int)fb.attachments[rp.depthstencilAttachment].baseArray;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return new BoundResource();
|
||||
}
|
||||
}
|
||||
|
||||
return ResourceId.Null;
|
||||
return new BoundResource();
|
||||
}
|
||||
|
||||
public ResourceId GetStencilTarget()
|
||||
public BoundResource[] GetOutputTargets()
|
||||
{
|
||||
if (LogLoaded)
|
||||
{
|
||||
if (IsLogD3D11)
|
||||
{
|
||||
return m_D3D11.m_OM.DepthTarget.Resource;
|
||||
}
|
||||
else if (IsLogGL)
|
||||
{
|
||||
return m_GL.m_FB.m_DrawFBO.Stencil.Obj;
|
||||
}
|
||||
else if (IsLogVK)
|
||||
{
|
||||
var rp = m_Vulkan.Pass.renderpass;
|
||||
var fb = m_Vulkan.Pass.framebuffer;
|
||||
|
||||
return rp.depthstencilAttachment >= 0 && rp.depthstencilAttachment < fb.attachments.Length
|
||||
? fb.attachments[rp.depthstencilAttachment].img
|
||||
: ResourceId.Null;
|
||||
}
|
||||
}
|
||||
|
||||
return ResourceId.Null;
|
||||
}
|
||||
|
||||
public ResourceId[] GetOutputTargets()
|
||||
{
|
||||
if (LogLoaded)
|
||||
{
|
||||
if (IsLogD3D11)
|
||||
{
|
||||
ResourceId[] ret = new ResourceId[m_D3D11.m_OM.RenderTargets.Length];
|
||||
BoundResource[] ret = new BoundResource[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;
|
||||
{
|
||||
ret[i] = new BoundResource();
|
||||
ret[i].Id = m_D3D11.m_OM.RenderTargets[i].Resource;
|
||||
ret[i].HighestMip = (int)m_D3D11.m_OM.RenderTargets[i].HighestMip;
|
||||
ret[i].FirstSlice = (int)m_D3D11.m_OM.RenderTargets[i].FirstArraySlice;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
else if (IsLogGL)
|
||||
{
|
||||
ResourceId[] ret = new ResourceId[m_GL.m_FB.m_DrawFBO.DrawBuffers.Length];
|
||||
for(int i=0; i < m_GL.m_FB.m_DrawFBO.DrawBuffers.Length; i++)
|
||||
BoundResource[] ret = new BoundResource[m_GL.m_FB.m_DrawFBO.DrawBuffers.Length];
|
||||
for (int i = 0; i < m_GL.m_FB.m_DrawFBO.DrawBuffers.Length; i++)
|
||||
{
|
||||
ret[i] = new BoundResource();
|
||||
|
||||
int db = m_GL.m_FB.m_DrawFBO.DrawBuffers[i];
|
||||
if(db >= 0)
|
||||
ret[i] = m_GL.m_FB.m_DrawFBO.Color[db].Obj;
|
||||
|
||||
if (db >= 0)
|
||||
{
|
||||
ret[i].Id = m_GL.m_FB.m_DrawFBO.Color[db].Obj;
|
||||
ret[i].HighestMip = (int)m_GL.m_FB.m_DrawFBO.Color[db].Mip;
|
||||
ret[i].FirstSlice = (int)m_GL.m_FB.m_DrawFBO.Color[db].Layer;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -980,17 +1044,25 @@ namespace renderdocui.Code
|
||||
{
|
||||
var rp = m_Vulkan.Pass.renderpass;
|
||||
var fb = m_Vulkan.Pass.framebuffer;
|
||||
ResourceId[] ret = new ResourceId[rp.colorAttachments.Length];
|
||||
|
||||
BoundResource[] ret = new BoundResource[rp.colorAttachments.Length];
|
||||
for (int i = 0; i < rp.colorAttachments.Length; i++)
|
||||
ret[i] = rp.colorAttachments[i] < fb.attachments.Length
|
||||
? fb.attachments[rp.colorAttachments[i]].img
|
||||
: ResourceId.Null;
|
||||
{
|
||||
ret[i] = new BoundResource();
|
||||
|
||||
if(rp.colorAttachments[i] < fb.attachments.Length)
|
||||
{
|
||||
ret[i].Id = fb.attachments[rp.colorAttachments[i]].img;
|
||||
ret[i].HighestMip = (int)fb.attachments[rp.colorAttachments[i]].baseMip;
|
||||
ret[i].FirstSlice = (int)fb.attachments[rp.colorAttachments[i]].baseArray;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return new ResourceId[0];
|
||||
return new BoundResource[0];
|
||||
}
|
||||
|
||||
// Still to add:
|
||||
|
||||
@@ -455,6 +455,38 @@ namespace renderdoc
|
||||
public Int32 bind;
|
||||
public bool used;
|
||||
public UInt32 arraySize;
|
||||
|
||||
public BindpointMap()
|
||||
{
|
||||
}
|
||||
|
||||
public BindpointMap(Int32 set, Int32 slot)
|
||||
{
|
||||
bindset = set;
|
||||
bind = slot;
|
||||
used = false;
|
||||
arraySize = 1;
|
||||
}
|
||||
|
||||
public override bool Equals(Object obj)
|
||||
{
|
||||
return obj is BindpointMap && this == (BindpointMap)obj;
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = bindset.GetHashCode() * 17;
|
||||
hash = hash * 17 + bind.GetHashCode();
|
||||
return hash;
|
||||
}
|
||||
public static bool operator ==(BindpointMap x, BindpointMap y)
|
||||
{
|
||||
return x.bindset == y.bindset &&
|
||||
x.bind == y.bind;
|
||||
}
|
||||
public static bool operator !=(BindpointMap x, BindpointMap y)
|
||||
{
|
||||
return !(x == y);
|
||||
}
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
||||
@@ -818,7 +818,7 @@ namespace renderdocui.Windows
|
||||
return ret;
|
||||
}
|
||||
|
||||
CommonPipelineState.VBuffer[] vbs = m_Core.CurPipelineState.GetVBuffers();
|
||||
BoundVBuffer[] vbs = m_Core.CurPipelineState.GetVBuffers();
|
||||
|
||||
ResourceId[] bs = new ResourceId[vbs.Length];
|
||||
uint[] s = new uint[vbs.Length];
|
||||
@@ -2678,19 +2678,19 @@ namespace renderdocui.Windows
|
||||
m_MeshDisplay.aspect = 1.0f;
|
||||
|
||||
// take a guess for the aspect ratio, for if the user hasn't overridden it
|
||||
ResourceId depth = m_Core.CurPipelineState.GetDepthTarget();
|
||||
ResourceId[] targets = m_Core.CurPipelineState.GetOutputTargets();
|
||||
BoundResource depth = m_Core.CurPipelineState.GetDepthTarget();
|
||||
BoundResource[] targets = m_Core.CurPipelineState.GetOutputTargets();
|
||||
|
||||
if (depth != ResourceId.Null || (targets != null && targets.Length > 0))
|
||||
if (depth.Id != ResourceId.Null || (targets != null && targets.Length > 0))
|
||||
{
|
||||
foreach (var t in m_Core.CurTextures)
|
||||
{
|
||||
if (depth != ResourceId.Null && t.ID == depth)
|
||||
if (depth.Id != ResourceId.Null && t.ID == depth.Id)
|
||||
{
|
||||
m_MeshDisplay.aspect = (float)t.width / (float)t.height;
|
||||
break;
|
||||
}
|
||||
if (depth == ResourceId.Null && targets != null && targets.Length > 0 && t.ID == targets[0])
|
||||
if (depth.Id == ResourceId.Null && targets != null && targets.Length > 0 && t.ID == targets[0].Id)
|
||||
{
|
||||
m_MeshDisplay.aspect = (float)t.width / (float)t.height;
|
||||
break;
|
||||
|
||||
@@ -390,10 +390,12 @@ namespace renderdocui.Windows.PipelineState
|
||||
var descriptorBind = slotBinds[idx];
|
||||
|
||||
if (bindMap.arraySize > 1)
|
||||
{
|
||||
slotname = String.Format("{0}: {1}[{2}]", bindMap.bind, shaderRes.name, idx);
|
||||
|
||||
if (shaderRes.name.Length > 0)
|
||||
slotname += ": " + shaderRes.name;
|
||||
if (shaderRes.name.Length > 0)
|
||||
slotname += ": " + shaderRes.name;
|
||||
}
|
||||
|
||||
bool isbuf = false;
|
||||
UInt32 w = 1, h = 1, d = 1;
|
||||
|
||||
+25
-25
@@ -140,8 +140,8 @@
|
||||
this.closeTab = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.closeOtherTabs = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.closeTabsToRight = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.texPanel = new renderdocui.Controls.ThumbnailStrip();
|
||||
this.rtPanel = new renderdocui.Controls.ThumbnailStrip();
|
||||
this.roPanel = new renderdocui.Controls.ThumbnailStrip();
|
||||
this.rwPanel = new renderdocui.Controls.ThumbnailStrip();
|
||||
this.rangeHistogram = new renderdocui.Controls.RangeHistogram();
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.pixelContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
@@ -1246,28 +1246,28 @@
|
||||
//
|
||||
// texPanel
|
||||
//
|
||||
this.texPanel.AutoScroll = true;
|
||||
this.texPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.texPanel.Location = new System.Drawing.Point(461, 373);
|
||||
this.texPanel.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.texPanel.MinimumSize = new System.Drawing.Size(2, 60);
|
||||
this.texPanel.Name = "texPanel";
|
||||
this.texPanel.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.texPanel.Size = new System.Drawing.Size(200, 60);
|
||||
this.texPanel.TabIndex = 3;
|
||||
this.texPanel.MouseClick += new System.Windows.Forms.MouseEventHandler(this.thumbsLayout_MouseClick);
|
||||
this.roPanel.AutoScroll = true;
|
||||
this.roPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.roPanel.Location = new System.Drawing.Point(461, 373);
|
||||
this.roPanel.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.roPanel.MinimumSize = new System.Drawing.Size(2, 60);
|
||||
this.roPanel.Name = "texPanel";
|
||||
this.roPanel.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.roPanel.Size = new System.Drawing.Size(200, 60);
|
||||
this.roPanel.TabIndex = 3;
|
||||
this.roPanel.MouseClick += new System.Windows.Forms.MouseEventHandler(this.thumbsLayout_MouseClick);
|
||||
//
|
||||
// rtPanel
|
||||
//
|
||||
this.rtPanel.AutoScroll = true;
|
||||
this.rtPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.rtPanel.Location = new System.Drawing.Point(242, 373);
|
||||
this.rtPanel.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.rtPanel.MinimumSize = new System.Drawing.Size(2, 60);
|
||||
this.rtPanel.Name = "rtPanel";
|
||||
this.rtPanel.Size = new System.Drawing.Size(200, 60);
|
||||
this.rtPanel.TabIndex = 2;
|
||||
this.rtPanel.MouseClick += new System.Windows.Forms.MouseEventHandler(this.thumbsLayout_MouseClick);
|
||||
this.rwPanel.AutoScroll = true;
|
||||
this.rwPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.rwPanel.Location = new System.Drawing.Point(242, 373);
|
||||
this.rwPanel.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.rwPanel.MinimumSize = new System.Drawing.Size(2, 60);
|
||||
this.rwPanel.Name = "rtPanel";
|
||||
this.rwPanel.Size = new System.Drawing.Size(200, 60);
|
||||
this.rwPanel.TabIndex = 2;
|
||||
this.rwPanel.MouseClick += new System.Windows.Forms.MouseEventHandler(this.thumbsLayout_MouseClick);
|
||||
//
|
||||
// rangeHistogram
|
||||
//
|
||||
@@ -1310,8 +1310,8 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1128, 492);
|
||||
this.Controls.Add(this.texlistContainer);
|
||||
this.Controls.Add(this.texPanel);
|
||||
this.Controls.Add(this.rtPanel);
|
||||
this.Controls.Add(this.roPanel);
|
||||
this.Controls.Add(this.rwPanel);
|
||||
this.Controls.Add(this.pixelContextPanel);
|
||||
this.Controls.Add(this.renderToolstripContainer);
|
||||
this.Controls.Add(this.rangeHistogram);
|
||||
@@ -1386,8 +1386,8 @@
|
||||
private Controls.NoScrollPanel renderContainer;
|
||||
private Controls.NoScrollPanel render;
|
||||
private Controls.TextureListBox textureList;
|
||||
private Controls.ThumbnailStrip rtPanel;
|
||||
private Controls.ThumbnailStrip texPanel;
|
||||
private Controls.ThumbnailStrip rwPanel;
|
||||
private Controls.ThumbnailStrip roPanel;
|
||||
private System.Windows.Forms.ToolStrip zoomStrip;
|
||||
private System.Windows.Forms.ToolStripLabel toolStripLabel4;
|
||||
private System.Windows.Forms.ToolStripButton fitToWindow;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user