Switch from specific Attachment structs to using Descriptor for outputs

This commit is contained in:
baldurk
2024-04-10 18:58:52 +01:00
parent 6194d5a5a0
commit 0284d551ea
23 changed files with 365 additions and 1218 deletions
-4
View File
@@ -415,7 +415,6 @@ TEMPLATE_ARRAY_INSTANTIATE(rdcarray, SamplerDescriptor)
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, DescriptorAccess)
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, DescriptorLogicalLocation)
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, UsedDescriptor)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, Attachment)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, DynamicOffset)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, DescriptorSet)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, ImageData)
@@ -429,14 +428,11 @@ TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, ViewportScissor)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, Layout)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, StreamOutBind)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, VertexBuffer)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D11Pipe, View)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, Layout)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, ResourceData)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, ResourceState)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, StreamOutBind)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, VertexBuffer)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, D3D12Pipe, View)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, Attachment)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, VertexBuffer)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, VertexAttribute)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, GLPipe, TextureCompleteness)
@@ -2212,11 +2212,11 @@ void GLPipelineStateViewer::setState()
for(int db : state.framebuffer.drawFBO.drawBuffers)
{
ResourceId p;
const GLPipe::Attachment *r = NULL;
const Descriptor *r = NULL;
if(db >= 0 && db < state.framebuffer.drawFBO.colorAttachments.count())
{
p = state.framebuffer.drawFBO.colorAttachments[db].resourceId;
p = state.framebuffer.drawFBO.colorAttachments[db].resource;
r = &state.framebuffer.drawFBO.colorAttachments[db];
}
@@ -2286,7 +2286,7 @@ void GLPipelineStateViewer::setState()
if(tex)
{
if(r)
setViewDetails(node, tex, r->mipLevel, 1, r->slice, r->numSlices);
setViewDetails(node, tex, r->firstMip, 1, r->firstSlice, r->numSlices);
node->setTag(QVariant::fromValue(p));
}
@@ -2306,18 +2306,18 @@ void GLPipelineStateViewer::setState()
}
ResourceId dsObjects[] = {
state.framebuffer.drawFBO.depthAttachment.resourceId,
state.framebuffer.drawFBO.stencilAttachment.resourceId,
state.framebuffer.drawFBO.depthAttachment.resource,
state.framebuffer.drawFBO.stencilAttachment.resource,
};
uint32_t dsMips[] = {
state.framebuffer.drawFBO.depthAttachment.mipLevel,
state.framebuffer.drawFBO.stencilAttachment.mipLevel,
state.framebuffer.drawFBO.depthAttachment.firstMip,
state.framebuffer.drawFBO.stencilAttachment.firstMip,
};
uint32_t dsSlice[] = {
state.framebuffer.drawFBO.depthAttachment.slice,
state.framebuffer.drawFBO.stencilAttachment.slice,
state.framebuffer.drawFBO.depthAttachment.firstSlice,
state.framebuffer.drawFBO.stencilAttachment.firstSlice,
};
uint32_t dsNumSlices[] = {
@@ -2365,9 +2365,9 @@ void GLPipelineStateViewer::setState()
bool depthstencil = false;
if(state.framebuffer.drawFBO.depthAttachment.resourceId ==
state.framebuffer.drawFBO.stencilAttachment.resourceId &&
state.framebuffer.drawFBO.depthAttachment.resourceId != ResourceId())
if(state.framebuffer.drawFBO.depthAttachment.resource ==
state.framebuffer.drawFBO.stencilAttachment.resource &&
state.framebuffer.drawFBO.depthAttachment.resource != ResourceId())
{
depthstencil = true;
slot = tr("Depth-Stencil");
@@ -3727,22 +3727,22 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Fram
QList<QVariantList> rows;
QList<const GLPipe::Attachment *> atts;
for(const GLPipe::Attachment &att : fb.drawFBO.colorAttachments)
QList<const Descriptor *> atts;
for(const Descriptor &att : fb.drawFBO.colorAttachments)
atts.push_back(&att);
atts.push_back(&fb.drawFBO.depthAttachment);
atts.push_back(&fb.drawFBO.stencilAttachment);
int i = 0;
for(const GLPipe::Attachment *att : atts)
for(const Descriptor *att : atts)
{
const GLPipe::Attachment &a = *att;
const Descriptor &a = *att;
TextureDescription *tex = m_Ctx.GetTexture(a.resourceId);
TextureDescription *tex = m_Ctx.GetTexture(a.resource);
QString name = m_Ctx.GetResourceName(a.resourceId);
QString name = m_Ctx.GetResourceName(a.resource);
if(a.resourceId == ResourceId())
if(a.resource == ResourceId())
name = tr("Empty");
QString slotname = QString::number(i);
@@ -3752,7 +3752,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Fram
else if(i == atts.count() - 1)
slotname = tr("Stencil");
rows.push_back({slotname, name, a.mipLevel, a.slice});
rows.push_back({slotname, name, a.firstMip, a.firstSlice});
i++;
}
@@ -3788,22 +3788,22 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Fram
QList<QVariantList> rows;
QList<const GLPipe::Attachment *> atts;
for(const GLPipe::Attachment &att : fb.readFBO.colorAttachments)
QList<const Descriptor *> atts;
for(const Descriptor &att : fb.readFBO.colorAttachments)
atts.push_back(&att);
atts.push_back(&fb.readFBO.depthAttachment);
atts.push_back(&fb.readFBO.stencilAttachment);
int i = 0;
for(const GLPipe::Attachment *att : atts)
for(const Descriptor *att : atts)
{
const GLPipe::Attachment &a = *att;
const Descriptor &a = *att;
TextureDescription *tex = m_Ctx.GetTexture(a.resourceId);
TextureDescription *tex = m_Ctx.GetTexture(a.resource);
QString name = m_Ctx.GetResourceName(a.resourceId);
QString name = m_Ctx.GetResourceName(a.resource);
if(a.resourceId == ResourceId())
if(a.resource == ResourceId())
name = tr("Empty");
QString slotname = QString::number(i);
@@ -3813,7 +3813,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Fram
else if(i == atts.count() - 1)
slotname = tr("Stencil");
rows.push_back({slotname, name, a.mipLevel, a.slice});
rows.push_back({slotname, name, a.firstMip, a.firstSlice});
i++;
}
@@ -2491,7 +2491,7 @@ void VulkanPipelineStateViewer::setState()
bool filledSlot = false;
if(usedSlot && attIdx < fb.attachments.count())
filledSlot = fb.attachments[attIdx].imageResourceId != ResourceId();
filledSlot = fb.attachments[attIdx].resource != ResourceId();
if(showNode(usedSlot, filledSlot))
{
@@ -2525,15 +2525,15 @@ void VulkanPipelineStateViewer::setState()
if(filledSlot)
{
const VKPipe::Attachment &p = fb.attachments[attIdx];
const Descriptor &p = fb.attachments[attIdx];
slotname = lit("Depth");
if(p.viewFormat.type == ResourceFormatType::D16S8 ||
p.viewFormat.type == ResourceFormatType::D24S8 ||
p.viewFormat.type == ResourceFormatType::D32S8)
if(p.format.type == ResourceFormatType::D16S8 ||
p.format.type == ResourceFormatType::D24S8 ||
p.format.type == ResourceFormatType::D32S8)
slotname = lit("Depth/Stencil");
else if(p.viewFormat.type == ResourceFormatType::S8)
else if(p.format.type == ResourceFormatType::S8)
slotname = lit("Stencil");
}
}
@@ -2554,7 +2554,7 @@ void VulkanPipelineStateViewer::setState()
if(filledSlot)
{
const VKPipe::Attachment &p = fb.attachments[attIdx];
const Descriptor &p = fb.attachments[attIdx];
QString format;
QString typeName;
@@ -2562,9 +2562,9 @@ void VulkanPipelineStateViewer::setState()
QString samples;
bool tooltipOffsets = false;
if(p.imageResourceId != ResourceId())
if(p.resource != ResourceId())
{
format = p.viewFormat.Name();
format = p.format.Name();
typeName = tr("Unknown");
}
else
@@ -2575,7 +2575,7 @@ void VulkanPipelineStateViewer::setState()
samples = lit("-");
}
TextureDescription *tex = m_Ctx.GetTexture(p.imageResourceId);
TextureDescription *tex = m_Ctx.GetTexture(p.resource);
if(tex)
{
dimensions += tr("%1x%2").arg(tex->width).arg(tex->height);
@@ -2624,7 +2624,7 @@ void VulkanPipelineStateViewer::setState()
shadingRateTexelSize = state.currentPass.renderpass.shadingRateTexelSize;
}
QString resName = ToQStr(p.imageResourceId);
QString resName = ToQStr(p.resource);
if(shadingRateTexelSize.first > 0)
resName +=
@@ -2669,29 +2669,19 @@ void VulkanPipelineStateViewer::setState()
{slotname, resName, typeName, dimensions, format, samples, QString()});
if(tex)
node->setTag(
QVariant::fromValue(VulkanTextureTag(p.imageResourceId, p.viewFormat.compType)));
node->setTag(QVariant::fromValue(VulkanTextureTag(p.resource, p.format.compType)));
if(p.imageResourceId == ResourceId())
if(p.resource == ResourceId())
setEmptyRow(node);
else if(!usedSlot)
setInactiveRow(node);
Descriptor desc;
desc.resource = p.imageResourceId;
desc.firstMip = p.firstMip;
desc.numMips = p.numMips;
desc.firstSlice = p.firstSlice;
desc.numSlices = p.numSlices;
bool hasViewDetails = setViewDetails(
node, desc, tex, QString(),
node, p, tex, QString(),
a.type == AttType::Resolve || a.type == AttType::DepthResolve, tooltipOffsets);
if(hasViewDetails)
node->setText(
1,
tr("%1 viewed by %2").arg(ToQStr(p.imageResourceId)).arg(ToQStr(p.viewResourceId)));
node->setText(1, tr("%1 viewed by %2").arg(ToQStr(p.resource)).arg(ToQStr(p.view)));
}
else
{
@@ -3971,11 +3961,11 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe::
QList<QVariantList> rows;
int i = 0;
for(const VKPipe::Attachment &a : pass.framebuffer.attachments)
for(const Descriptor &a : pass.framebuffer.attachments)
{
TextureDescription *tex = m_Ctx.GetTexture(a.imageResourceId);
TextureDescription *tex = m_Ctx.GetTexture(a.resource);
QString name = m_Ctx.GetResourceName(a.imageResourceId);
QString name = m_Ctx.GetResourceName(a.resource);
rows.push_back({i, name, tex->width, tex->height, tex->depth, tex->arraysize, a.firstMip,
a.numMips, a.firstSlice, a.numSlices,
+4 -103
View File
@@ -201,104 +201,6 @@ struct InputAssembly
Topology topology = Topology::Unknown;
};
DOCUMENT("Describes the details of a D3D11 resource view - any one of UAV, SRV, RTV or DSV.");
struct View
{
DOCUMENT("");
View() = default;
View(const View &) = default;
View &operator=(const View &) = default;
bool operator==(const View &o) const
{
return viewResourceId == o.viewResourceId && resourceResourceId == o.resourceResourceId &&
counterResourceId == o.counterResourceId && type == o.type && viewFormat == o.viewFormat &&
structured == o.structured && bufferStructCount == o.bufferStructCount &&
elementByteSize == o.elementByteSize && firstElement == o.firstElement &&
numElements == o.numElements && bufferFlags == o.bufferFlags && firstMip == o.firstMip &&
numMips == o.numMips && numSlices == o.numSlices && firstSlice == o.firstSlice;
}
bool operator<(const View &o) const
{
if(!(viewResourceId == o.viewResourceId))
return viewResourceId < o.viewResourceId;
if(!(resourceResourceId == o.resourceResourceId))
return resourceResourceId < o.resourceResourceId;
if(!(counterResourceId == o.counterResourceId))
return counterResourceId < o.counterResourceId;
if(!(type == o.type))
return type < o.type;
if(!(viewFormat == o.viewFormat))
return viewFormat < o.viewFormat;
if(!(structured == o.structured))
return structured < o.structured;
if(!(bufferStructCount == o.bufferStructCount))
return bufferStructCount < o.bufferStructCount;
if(!(elementByteSize == o.elementByteSize))
return elementByteSize < o.elementByteSize;
if(!(firstElement == o.firstElement))
return firstElement < o.firstElement;
if(!(numElements == o.numElements))
return numElements < o.numElements;
if(!(bufferFlags == o.bufferFlags))
return bufferFlags < o.bufferFlags;
if(!(firstMip == o.firstMip))
return firstMip < o.firstMip;
if(!(numMips == o.numMips))
return numMips < o.numMips;
if(!(numSlices == o.numSlices))
return numSlices < o.numSlices;
if(!(firstSlice == o.firstSlice))
return firstSlice < o.firstSlice;
return false;
}
DOCUMENT("The :class:`ResourceId` of the view itself.");
ResourceId viewResourceId;
DOCUMENT("The :class:`ResourceId` of the underlying resource the view refers to.");
ResourceId resourceResourceId;
DOCUMENT("The :class:`ResourceId` of the resource where the hidden buffer counter is stored.");
ResourceId counterResourceId;
DOCUMENT("The :class:`TextureType` of the view type.");
TextureType type;
DOCUMENT(R"(The format cast that the view uses.
:type: ResourceFormat
)");
ResourceFormat viewFormat;
DOCUMENT("``True`` if this view describes a structured buffer.");
bool structured = false;
DOCUMENT("If the view has a hidden counter, this stores the current value of the counter.");
uint32_t bufferStructCount = 0;
DOCUMENT(R"(The byte size of a single element in the view. Either the byte size of
:data:`viewFormat`, or the structured buffer element size, as appropriate.
)");
uint32_t elementByteSize = 0;
DOCUMENT("Valid for buffers - the first element to be used in the view.");
uint32_t firstElement = 0;
DOCUMENT("Valid for buffers - the number of elements to be used in the view.");
uint32_t numElements = 1;
DOCUMENT("Valid for buffers - the flags for additional view properties.");
D3DBufferViewFlags bufferFlags = D3DBufferViewFlags::NoFlags;
DOCUMENT("Valid for textures - the first mip that is available through the view.");
uint32_t firstMip = 0;
DOCUMENT("Valid for textures - the number of mip levels in the view.");
uint32_t numMips = 0;
DOCUMENT("Valid for texture arrays or 3D textures - the first slice available through the view.");
uint32_t firstSlice = 0;
DOCUMENT("Valid for texture arrays or 3D textures - the number of slices in the view.");
uint32_t numSlices = 1;
};
DOCUMENT("Describes a D3D11 shader stage.");
struct Shader
{
@@ -543,18 +445,18 @@ struct OutputMerger
DOCUMENT(R"(The bound render targets.
:type: List[D3D11View]
:type: List[Descriptor]
)");
rdcarray<View> renderTargets;
rdcarray<Descriptor> renderTargets;
DOCUMENT("Which slot in the output targets is the first UAV.");
uint32_t uavStartSlot = 0;
DOCUMENT(R"(The currently bound depth-stencil target.
:type: D3D11View
:type: Descriptor
)");
View depthTarget;
Descriptor depthTarget;
DOCUMENT("``True`` if depth access to the depth-stencil target is read-only.");
bool depthReadOnly = false;
DOCUMENT("``True`` if stencil access to the depth-stencil target is read-only.");
@@ -674,7 +576,6 @@ DECLARE_REFLECTION_STRUCT(D3D11Pipe::Layout);
DECLARE_REFLECTION_STRUCT(D3D11Pipe::VertexBuffer);
DECLARE_REFLECTION_STRUCT(D3D11Pipe::IndexBuffer);
DECLARE_REFLECTION_STRUCT(D3D11Pipe::InputAssembly);
DECLARE_REFLECTION_STRUCT(D3D11Pipe::View);
DECLARE_REFLECTION_STRUCT(D3D11Pipe::Shader);
DECLARE_REFLECTION_STRUCT(D3D11Pipe::StreamOutBind);
DECLARE_REFLECTION_STRUCT(D3D11Pipe::StreamOut);
+4 -120
View File
@@ -202,121 +202,6 @@ If the value is 0, strip cutting is disabled.
Topology topology = Topology::Unknown;
};
DOCUMENT("Describes the details of a D3D12 resource view - any one of UAV, SRV, RTV or DSV.");
struct View
{
DOCUMENT("");
View() = default;
View(uint32_t binding) : bind(binding) {}
View(const View &) = default;
View &operator=(const View &) = default;
bool operator==(const View &o) const
{
return bind == o.bind && tableIndex == o.tableIndex && resourceId == o.resourceId &&
type == o.type && viewFormat == o.viewFormat && swizzle == o.swizzle &&
bufferFlags == o.bufferFlags && bufferStructCount == o.bufferStructCount &&
elementByteSize == o.elementByteSize && firstElement == o.firstElement &&
numElements == o.numElements && counterResourceId == o.counterResourceId &&
counterByteOffset == o.counterByteOffset && firstMip == o.firstMip &&
numMips == o.numMips && numSlices == o.numSlices && firstSlice == o.firstSlice;
}
bool operator<(const View &o) const
{
if(!(bind == o.bind))
return bind < o.bind;
if(!(tableIndex == o.tableIndex))
return tableIndex < o.tableIndex;
if(!(resourceId == o.resourceId))
return resourceId < o.resourceId;
if(!(type == o.type))
return type < o.type;
if(!(viewFormat == o.viewFormat))
return viewFormat < o.viewFormat;
if(!(swizzle == o.swizzle))
return swizzle < o.swizzle;
if(!(bufferFlags == o.bufferFlags))
return bufferFlags < o.bufferFlags;
if(!(bufferStructCount == o.bufferStructCount))
return bufferStructCount < o.bufferStructCount;
if(!(elementByteSize == o.elementByteSize))
return elementByteSize < o.elementByteSize;
if(!(firstElement == o.firstElement))
return firstElement < o.firstElement;
if(!(numElements == o.numElements))
return numElements < o.numElements;
if(!(counterResourceId == o.counterResourceId))
return counterResourceId < o.counterResourceId;
if(!(counterByteOffset == o.counterByteOffset))
return counterByteOffset < o.counterByteOffset;
if(!(firstMip == o.firstMip))
return firstMip < o.firstMip;
if(!(numMips == o.numMips))
return numMips < o.numMips;
if(!(numSlices == o.numSlices))
return numSlices < o.numSlices;
if(!(firstSlice == o.firstSlice))
return firstSlice < o.firstSlice;
return false;
}
DOCUMENT("The shader register that this view is bound to.");
uint32_t bind = ~0U;
DOCUMENT("The index in the the parent descriptor table where this descriptor came from.");
uint32_t tableIndex = ~0U;
DOCUMENT("The :class:`ResourceId` of the underlying resource the view refers to.");
ResourceId resourceId;
DOCUMENT("The :class:`ResourceId` of the resource where the hidden buffer counter is stored.");
ResourceId counterResourceId;
DOCUMENT("The byte offset in :data:`counterResourceId` where the counter is stored.");
uint32_t counterByteOffset = 0;
DOCUMENT("The :class:`TextureType` of the view type.");
TextureType type;
DOCUMENT(R"(The format cast that the view uses.
:type: ResourceFormat
)");
ResourceFormat viewFormat;
DOCUMENT(R"(The swizzle applied to a texture by the view.
:type: TextureSwizzle4
)");
TextureSwizzle4 swizzle;
DOCUMENT(R"(``True`` if this binding element is dynamically used.
If set to ``False`` this means that the binding was available to the shader but during execution it
was not referenced. The data gathered for setting this variable is conservative, meaning that only
accesses through arrays will have this calculated to reduce the required feedback bandwidth - single
non-arrayed descriptors may have this value set to ``True`` even if the shader did not use them,
since single descriptors may only be dynamically skipped by control flow.
)");
bool dynamicallyUsed = true;
DOCUMENT("The :class:`D3DBufferViewFlags` set for the buffer.");
D3DBufferViewFlags bufferFlags = D3DBufferViewFlags::NoFlags;
DOCUMENT("Valid for textures - the highest mip that is available through the view.");
uint8_t firstMip = 0;
DOCUMENT("Valid for textures - the number of mip levels in the view.");
uint8_t numMips = 1;
DOCUMENT("Valid for texture arrays or 3D textures - the first slice available through the view.");
uint16_t firstSlice = 0;
DOCUMENT("Valid for texture arrays or 3D textures - the number of slices in the view.");
uint16_t numSlices = 1;
DOCUMENT("If the view has a hidden counter, this stores the current value of the counter.");
uint32_t bufferStructCount = 0;
DOCUMENT(R"(The byte size of a single element in the view. Either the byte size of
:data:`viewFormat`, or the structured buffer element size, as appropriate.
)");
uint32_t elementByteSize = 0;
DOCUMENT("Valid for buffers - the first element to be used in the view.");
uint64_t firstElement = 0;
DOCUMENT("Valid for buffers - the number of elements to be used in the view.");
uint32_t numElements = 1;
DOCUMENT("The minimum mip-level clamp applied when sampling this texture.");
float minLODClamp = 0.0f;
};
DOCUMENT("Describes a D3D12 shader stage.");
struct Shader
{
@@ -596,15 +481,15 @@ struct OM
DOCUMENT(R"(The bound render targets.
:type: List[D3D12View]
:type: List[Descriptor]
)");
rdcarray<View> renderTargets;
rdcarray<Descriptor> renderTargets;
DOCUMENT(R"(The currently bound depth-stencil target.
:type: D3D12View
:type: Descriptor
)");
View depthTarget = D3D12Pipe::View(0);
Descriptor depthTarget;
DOCUMENT("``True`` if depth access to the depth-stencil target is read-only.");
bool depthReadOnly = false;
DOCUMENT("``True`` if stenncil access to the depth-stencil target is read-only.");
@@ -764,7 +649,6 @@ DECLARE_REFLECTION_STRUCT(D3D12Pipe::Layout);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::VertexBuffer);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::IndexBuffer);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::InputAssembly);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::View);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::Shader);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::StreamOutBind);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::StreamOut);
+6 -47
View File
@@ -473,46 +473,6 @@ struct StencilState
StencilFace backFace;
};
DOCUMENT("Describes the state of a framebuffer attachment.");
struct Attachment
{
DOCUMENT("");
Attachment() = default;
Attachment(const Attachment &) = default;
Attachment &operator=(const Attachment &) = default;
bool operator==(const Attachment &o) const
{
return resourceId == o.resourceId && slice == o.slice && numSlices == o.numSlices &&
mipLevel == o.mipLevel && swizzle == o.swizzle;
}
bool operator<(const Attachment &o) const
{
if(!(resourceId == o.resourceId))
return resourceId < o.resourceId;
if(!(slice == o.slice))
return slice < o.slice;
if(!(mipLevel == o.mipLevel))
return mipLevel < o.mipLevel;
if(!(swizzle == o.swizzle))
return swizzle < o.swizzle;
return false;
}
DOCUMENT("The :class:`ResourceId` of the texture bound to this attachment.");
ResourceId resourceId;
DOCUMENT("The slice of the texture that's used in the attachment.");
uint32_t slice = 0;
DOCUMENT("The number of slices of the texture that are used in the attachment.");
uint32_t numSlices = 1;
DOCUMENT("The mip of the texture that's used in the attachment.");
uint32_t mipLevel = 0;
DOCUMENT(R"(The swizzle applied to the texture.
:type: TextureSwizzle4
)");
TextureSwizzle4 swizzle;
};
DOCUMENT("Describes the contents of a framebuffer object.");
struct FBO
{
@@ -525,19 +485,19 @@ struct FBO
ResourceId resourceId;
DOCUMENT(R"(The framebuffer color attachments.
:type: List[GLAttachment]
:type: List[Descriptor]
)");
rdcarray<Attachment> colorAttachments;
rdcarray<Descriptor> colorAttachments;
DOCUMENT(R"(The framebuffer depth attachment.
:type: GLAttachment
:type: Descriptor
)");
Attachment depthAttachment;
Descriptor depthAttachment;
DOCUMENT(R"(The framebuffer stencil attachment.
:type: GLAttachment
:type: Descriptor
)");
Attachment stencilAttachment;
Descriptor stencilAttachment;
DOCUMENT(R"(The draw buffer indices into the :data:`colorAttachments` attachment list.
@@ -753,7 +713,6 @@ DECLARE_REFLECTION_STRUCT(GLPipe::RasterizerState);
DECLARE_REFLECTION_STRUCT(GLPipe::Rasterizer);
DECLARE_REFLECTION_STRUCT(GLPipe::DepthState);
DECLARE_REFLECTION_STRUCT(GLPipe::StencilState);
DECLARE_REFLECTION_STRUCT(GLPipe::Attachment);
DECLARE_REFLECTION_STRUCT(GLPipe::FBO);
DECLARE_REFLECTION_STRUCT(GLPipe::BlendState);
DECLARE_REFLECTION_STRUCT(GLPipe::FrameBuffer);
+10 -112
View File
@@ -1079,40 +1079,15 @@ Descriptor PipeState::GetDepthTarget() const
{
if(IsCaptureD3D11())
{
const D3D11Pipe::View &depthTarget = m_D3D11->outputMerger.depthTarget;
ret.resource = depthTarget.resourceResourceId;
ret.view = depthTarget.viewResourceId;
ret.firstMip = depthTarget.firstMip & 0xff;
ret.numMips = depthTarget.numMips & 0xff;
ret.firstSlice = depthTarget.firstSlice & 0xffff;
ret.numSlices = depthTarget.numSlices & 0xffff;
ret.format = depthTarget.viewFormat;
ret.textureType = depthTarget.type;
return m_D3D11->outputMerger.depthTarget;
}
else if(IsCaptureD3D12())
{
const D3D12Pipe::View &depthTarget = m_D3D12->outputMerger.depthTarget;
ret.resource = depthTarget.resourceId;
ret.firstMip = depthTarget.firstMip & 0xff;
ret.numMips = depthTarget.numMips & 0xff;
ret.firstSlice = depthTarget.firstSlice & 0xffff;
ret.numSlices = depthTarget.numSlices & 0xffff;
ret.format = depthTarget.viewFormat;
ret.textureType = depthTarget.type;
return m_D3D12->outputMerger.depthTarget;
}
else if(IsCaptureGL())
{
const GLPipe::Attachment &depthAttachment = m_GL->framebuffer.drawFBO.depthAttachment;
ret.resource = depthAttachment.resourceId;
ret.firstMip = depthAttachment.mipLevel & 0xff;
ret.numMips = 1;
ret.firstSlice = depthAttachment.slice & 0xffff;
ret.numSlices = depthAttachment.numSlices & 0xffff;
ret.swizzle = depthAttachment.swizzle;
ret.textureType = ret.numSlices > 1 ? TextureType::Texture2DArray : TextureType::Texture2D;
return m_GL->framebuffer.drawFBO.depthAttachment;
}
else if(IsCaptureVK())
{
@@ -1121,17 +1096,7 @@ Descriptor PipeState::GetDepthTarget() const
if(rp.depthstencilAttachment >= 0 && rp.depthstencilAttachment < fb.attachments.count())
{
const VKPipe::Attachment &depthAttachment = fb.attachments[rp.depthstencilAttachment];
ret.resource = depthAttachment.imageResourceId;
ret.view = depthAttachment.viewResourceId;
ret.firstMip = depthAttachment.firstMip & 0xff;
ret.numMips = depthAttachment.numMips & 0xff;
ret.firstSlice = depthAttachment.firstSlice & 0xffff;
ret.numSlices = depthAttachment.numSlices & 0xffff;
ret.format = depthAttachment.viewFormat;
ret.swizzle = depthAttachment.swizzle;
ret.textureType = ret.numSlices > 1 ? TextureType::Texture2DArray : TextureType::Texture2D;
return fb.attachments[rp.depthstencilAttachment];
}
}
}
@@ -1154,18 +1119,7 @@ Descriptor PipeState::GetDepthResolveTarget() const
if(rp.depthstencilResolveAttachment >= 0 &&
rp.depthstencilResolveAttachment < fb.attachments.count())
{
const VKPipe::Attachment &depthResolveAttachment =
fb.attachments[rp.depthstencilResolveAttachment];
ret.resource = depthResolveAttachment.imageResourceId;
ret.view = depthResolveAttachment.viewResourceId;
ret.firstMip = depthResolveAttachment.firstMip & 0xff;
ret.numMips = depthResolveAttachment.numMips & 0xff;
ret.firstSlice = depthResolveAttachment.firstSlice & 0xffff;
ret.numSlices = depthResolveAttachment.numSlices & 0xffff;
ret.format = depthResolveAttachment.viewFormat;
ret.swizzle = depthResolveAttachment.swizzle;
ret.textureType = ret.numSlices > 1 ? TextureType::Texture2DArray : TextureType::Texture2D;
return fb.attachments[rp.depthstencilResolveAttachment];
}
}
}
@@ -1181,36 +1135,11 @@ rdcarray<Descriptor> PipeState::GetOutputTargets() const
{
if(IsCaptureD3D11())
{
ret.resize(m_D3D11->outputMerger.renderTargets.count());
for(int i = 0; i < m_D3D11->outputMerger.renderTargets.count(); i++)
{
const D3D11Pipe::View &rt = m_D3D11->outputMerger.renderTargets[i];
ret[i].resource = rt.resourceResourceId;
ret[i].view = rt.viewResourceId;
ret[i].firstMip = rt.firstMip & 0xff;
ret[i].numMips = rt.numMips & 0xff;
ret[i].firstSlice = rt.firstSlice & 0xffff;
ret[i].numSlices = rt.numSlices & 0xffff;
ret[i].format = rt.viewFormat;
ret[i].textureType = rt.type;
}
return m_D3D11->outputMerger.renderTargets;
}
else if(IsCaptureD3D12())
{
ret.resize(m_D3D12->outputMerger.renderTargets.count());
for(int i = 0; i < m_D3D12->outputMerger.renderTargets.count(); i++)
{
const D3D12Pipe::View &rt = m_D3D12->outputMerger.renderTargets[i];
ret[i].resource = rt.resourceId;
ret[i].firstMip = rt.firstMip & 0xff;
ret[i].numMips = rt.numMips & 0xff;
ret[i].firstSlice = rt.firstSlice & 0xffff;
ret[i].numSlices = rt.numSlices & 0xffff;
ret[i].format = rt.viewFormat;
ret[i].textureType = rt.type;
}
return m_D3D12->outputMerger.renderTargets;
}
else if(IsCaptureGL())
{
@@ -1221,16 +1150,7 @@ rdcarray<Descriptor> PipeState::GetOutputTargets() const
if(db >= 0)
{
const GLPipe::Attachment &col = m_GL->framebuffer.drawFBO.colorAttachments[db];
ret[i].resource = col.resourceId;
ret[i].firstMip = col.mipLevel & 0xff;
ret[i].numMips = 1;
ret[i].firstSlice = col.slice & 0xffff;
ret[i].numSlices = col.numSlices & 0xffff;
ret[i].swizzle = col.swizzle;
ret[i].textureType =
ret[i].numSlices > 1 ? TextureType::Texture2DArray : TextureType::Texture2D;
ret[i] = m_GL->framebuffer.drawFBO.colorAttachments[db];
}
}
}
@@ -1246,18 +1166,7 @@ rdcarray<Descriptor> PipeState::GetOutputTargets() const
{
if(rp.colorAttachments[i] < (uint32_t)fb.attachments.count())
{
const VKPipe::Attachment &col = fb.attachments[rp.colorAttachments[i]];
ret[idx].resource = col.imageResourceId;
ret[idx].view = col.viewResourceId;
ret[idx].firstMip = col.firstMip & 0xff;
ret[idx].numMips = col.numMips & 0xff;
ret[idx].firstSlice = col.firstSlice & 0xffff;
ret[idx].numSlices = col.numSlices & 0xffff;
ret[idx].format = col.viewFormat;
ret[idx].swizzle = col.swizzle;
ret[idx].textureType =
ret[idx].numSlices > 1 ? TextureType::Texture2DArray : TextureType::Texture2D;
ret[idx] = fb.attachments[rp.colorAttachments[i]];
}
idx++;
@@ -1267,18 +1176,7 @@ rdcarray<Descriptor> PipeState::GetOutputTargets() const
{
if(rp.resolveAttachments[i] < (uint32_t)fb.attachments.count())
{
const VKPipe::Attachment &resolve = fb.attachments[rp.resolveAttachments[i]];
ret[idx].resource = resolve.imageResourceId;
ret[idx].view = resolve.viewResourceId;
ret[idx].firstMip = resolve.firstMip & 0xff;
ret[idx].numMips = resolve.numMips & 0xff;
ret[idx].firstSlice = resolve.firstSlice & 0xffff;
ret[idx].numSlices = resolve.numSlices & 0xffff;
ret[idx].format = resolve.viewFormat;
ret[idx].swizzle = resolve.swizzle;
ret[idx].textureType =
ret[idx].numSlices > 1 ? TextureType::Texture2DArray : TextureType::Texture2D;
ret[idx] = fb.attachments[rp.resolveAttachments[i]];
}
idx++;
-14
View File
@@ -1137,20 +1137,6 @@ rdcstr DoStringise(const ReplayOptimisationLevel &el)
END_ENUM_STRINGISE();
}
template <>
rdcstr DoStringise(const D3DBufferViewFlags &el)
{
BEGIN_BITFIELD_STRINGISE(D3DBufferViewFlags);
{
STRINGISE_BITFIELD_CLASS_VALUE_NAMED(NoFlags, "");
STRINGISE_BITFIELD_CLASS_BIT(Raw);
STRINGISE_BITFIELD_CLASS_BIT(Append);
STRINGISE_BITFIELD_CLASS_BIT(Counter);
}
END_BITFIELD_STRINGISE();
}
template <>
rdcstr DoStringise(const DescriptorFlags &el)
{
-29
View File
@@ -4597,35 +4597,6 @@ enum class BufferCategory : uint32_t
BITMASK_OPERATORS(BufferCategory);
DECLARE_REFLECTION_ENUM(BufferCategory);
DOCUMENT(R"(A set of flags for D3D buffer view properties.
.. data:: NoFlags
The buffer will not be used for any of the uses below.
.. data:: Raw
The buffer is used as a raw (byte-addressed) buffer.
.. data:: Append
The buffer is used as a append/consume view.
.. data:: Counter
The buffer is used with a structured buffer with associated hidden counter.
)");
enum class D3DBufferViewFlags : uint8_t
{
NoFlags = 0x0,
Raw = 0x1,
Append = 0x2,
Counter = 0x4,
};
BITMASK_OPERATORS(D3DBufferViewFlags);
DECLARE_REFLECTION_ENUM(D3DBufferViewFlags);
DOCUMENT(R"(A set of flags for descriptor properties.
.. data:: NoFlags
+2 -62
View File
@@ -858,65 +858,6 @@ If the subpass is not internally multisampled, tileOnlyMSAASampleCount is set to
uint32_t tileOnlyMSAASampleCount = 0;
};
DOCUMENT("Describes a single attachment in a framebuffer object.");
struct Attachment
{
DOCUMENT("");
Attachment() = default;
Attachment(const Attachment &) = default;
Attachment &operator=(const Attachment &) = default;
bool operator==(const Attachment &o) const
{
return viewResourceId == o.viewResourceId && imageResourceId == o.imageResourceId &&
viewFormat == o.viewFormat && swizzle == o.swizzle && firstMip == o.firstMip &&
firstSlice == o.firstSlice && numMips == o.numMips && numSlices == o.numSlices;
}
bool operator<(const Attachment &o) const
{
if(!(viewResourceId == o.viewResourceId))
return viewResourceId < o.viewResourceId;
if(!(imageResourceId == o.imageResourceId))
return imageResourceId < o.imageResourceId;
if(!(viewFormat == o.viewFormat))
return viewFormat < o.viewFormat;
if(!(swizzle == o.swizzle))
return swizzle < o.swizzle;
if(!(firstMip == o.firstMip))
return firstMip < o.firstMip;
if(!(firstSlice == o.firstSlice))
return firstSlice < o.firstSlice;
if(!(numMips == o.numMips))
return numMips < o.numMips;
if(!(numSlices == o.numSlices))
return numSlices < o.numSlices;
return false;
}
DOCUMENT("The :class:`ResourceId` of the image view itself.");
ResourceId viewResourceId;
DOCUMENT("The :class:`ResourceId` of the underlying image that the view refers to.");
ResourceId imageResourceId;
DOCUMENT(R"(The format cast that the view uses.
:type: ResourceFormat
)");
ResourceFormat viewFormat;
DOCUMENT(R"(The swizzle applied to the texture by the view.
:type: TextureSwizzle4
)");
TextureSwizzle4 swizzle;
DOCUMENT("The first mip level used in the attachment.");
uint32_t firstMip = 0;
DOCUMENT("For 3D textures and texture arrays, the first slice used in the attachment.");
uint32_t firstSlice = 0;
DOCUMENT("The number of mip levels in the attachment.");
uint32_t numMips = 1;
DOCUMENT("For 3D textures and texture arrays, the number of array slices in the attachment.");
uint32_t numSlices = 1;
};
DOCUMENT("Describes a framebuffer object and its attachments.");
struct Framebuffer
{
@@ -930,9 +871,9 @@ struct Framebuffer
DOCUMENT(R"(The attachments of this framebuffer.
:type: List[VKAttachment]
:type: List[Descriptor]
)");
rdcarray<Attachment> attachments;
rdcarray<Descriptor> attachments;
DOCUMENT("The width of this framebuffer in pixels.");
uint32_t width = 0;
@@ -1229,7 +1170,6 @@ DECLARE_REFLECTION_STRUCT(VKPipe::MultiSample);
DECLARE_REFLECTION_STRUCT(VKPipe::ColorBlendState);
DECLARE_REFLECTION_STRUCT(VKPipe::DepthStencil);
DECLARE_REFLECTION_STRUCT(VKPipe::RenderPass);
DECLARE_REFLECTION_STRUCT(VKPipe::Attachment);
DECLARE_REFLECTION_STRUCT(VKPipe::Framebuffer);
DECLARE_REFLECTION_STRUCT(VKPipe::RenderArea);
DECLARE_REFLECTION_STRUCT(VKPipe::CurrentPass);
+2 -2
View File
@@ -237,8 +237,8 @@ public:
VKPipe::State *vk)
{
d3d11->outputMerger.renderTargets.resize(1);
d3d11->outputMerger.renderTargets[0].resourceResourceId = m_TextureID;
d3d11->outputMerger.renderTargets[0].viewFormat = m_TexDetails.format;
d3d11->outputMerger.renderTargets[0].resource = m_TextureID;
d3d11->outputMerger.renderTargets[0].format = m_TexDetails.format;
}
// other operations are dropped/ignored, to avoid confusion
+74 -74
View File
@@ -965,11 +965,11 @@ void D3D11Replay::SavePipelineState(uint32_t eventId)
ret.outputMerger.renderTargets.resize(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT);
for(size_t i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
D3D11Pipe::View &view = ret.outputMerger.renderTargets[i];
Descriptor &descriptor = ret.outputMerger.renderTargets[i];
view.viewResourceId = rm->GetOriginalID(GetIDForDeviceChild(rs->OM.RenderTargets[i]));
descriptor.view = rm->GetOriginalID(GetIDForDeviceChild(rs->OM.RenderTargets[i]));
if(view.viewResourceId != ResourceId())
if(descriptor.view != ResourceId())
{
D3D11_RENDER_TARGET_VIEW_DESC desc;
rs->OM.RenderTargets[i]->GetDesc(&desc);
@@ -977,87 +977,87 @@ void D3D11Replay::SavePipelineState(uint32_t eventId)
ID3D11Resource *res = NULL;
rs->OM.RenderTargets[i]->GetResource(&res);
view.structured = false;
view.bufferStructCount = 0;
view.elementByteSize =
descriptor.bufferStructCount = 0;
descriptor.elementByteSize =
desc.Format == DXGI_FORMAT_UNKNOWN ? 1 : GetByteSize(1, 1, 1, desc.Format, 0);
view.resourceResourceId = rm->GetOriginalID(GetIDForDeviceChild(res));
descriptor.resource = rm->GetOriginalID(GetIDForDeviceChild(res));
view.viewFormat = MakeResourceFormat(desc.Format);
view.type = MakeTextureDim(desc.ViewDimension);
descriptor.type = DescriptorType::ReadWriteImage;
descriptor.format = MakeResourceFormat(desc.Format);
descriptor.textureType = MakeTextureDim(desc.ViewDimension);
if(desc.ViewDimension == D3D11_RTV_DIMENSION_BUFFER)
{
view.firstElement = desc.Buffer.FirstElement;
view.numElements = desc.Buffer.NumElements;
descriptor.byteOffset = desc.Buffer.FirstElement * descriptor.elementByteSize;
descriptor.byteSize = desc.Buffer.NumElements * descriptor.elementByteSize;
}
else if(desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE1D)
{
view.numSlices = 1;
view.firstSlice = 0;
view.firstMip = desc.Texture1D.MipSlice;
view.numMips = 1;
descriptor.numSlices = 1;
descriptor.firstSlice = 0;
descriptor.firstMip = desc.Texture1D.MipSlice & 0xff;
descriptor.numMips = 1;
}
else if(desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE1DARRAY)
{
view.numSlices = desc.Texture1DArray.ArraySize;
view.firstSlice = desc.Texture1DArray.FirstArraySlice;
view.firstMip = desc.Texture1DArray.MipSlice;
view.numMips = 1;
descriptor.numSlices = desc.Texture1DArray.ArraySize & 0xffff;
descriptor.firstSlice = desc.Texture1DArray.FirstArraySlice & 0xffff;
descriptor.firstMip = desc.Texture1DArray.MipSlice & 0xff;
descriptor.numMips = 1;
}
else if(desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2D)
{
view.numSlices = 1;
view.firstSlice = 0;
view.firstMip = desc.Texture2D.MipSlice;
view.numMips = 1;
descriptor.numSlices = 1;
descriptor.firstSlice = 0;
descriptor.firstMip = desc.Texture2D.MipSlice & 0xff;
descriptor.numMips = 1;
}
else if(desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2DARRAY)
{
view.numSlices = desc.Texture2DArray.ArraySize;
view.firstSlice = desc.Texture2DArray.FirstArraySlice;
view.firstMip = desc.Texture2DArray.MipSlice;
view.numMips = 1;
descriptor.numSlices = desc.Texture2DArray.ArraySize & 0xffff;
descriptor.firstSlice = desc.Texture2DArray.FirstArraySlice & 0xffff;
descriptor.firstMip = desc.Texture2DArray.MipSlice & 0xff;
descriptor.numMips = 1;
}
else if(desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2DMS)
{
view.firstMip = 0;
view.numMips = 1;
view.firstSlice = 0;
view.numSlices = 1;
descriptor.firstMip = 0;
descriptor.numMips = 1;
descriptor.firstSlice = 0;
descriptor.numSlices = 1;
}
else if(desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY)
{
view.numSlices = desc.Texture2DMSArray.ArraySize;
view.firstSlice = desc.Texture2DMSArray.FirstArraySlice;
view.firstMip = 0;
view.numMips = 1;
descriptor.numSlices = desc.Texture2DMSArray.ArraySize & 0xffff;
descriptor.firstSlice = desc.Texture2DMSArray.FirstArraySlice & 0xffff;
descriptor.firstMip = 0;
descriptor.numMips = 1;
}
else if(desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE3D)
{
view.numSlices = desc.Texture3D.WSize;
view.firstSlice = desc.Texture3D.FirstWSlice;
view.firstMip = desc.Texture3D.MipSlice;
view.numMips = 1;
descriptor.numSlices = desc.Texture3D.WSize & 0xffff;
descriptor.firstSlice = desc.Texture3D.FirstWSlice & 0xffff;
descriptor.firstMip = desc.Texture3D.MipSlice & 0xff;
descriptor.numMips = 1;
}
SAFE_RELEASE(res);
}
else
{
view = D3D11Pipe::View();
descriptor = Descriptor();
}
}
ret.outputMerger.uavStartSlot = rs->OM.UAVStartSlot;
{
D3D11Pipe::View &view = ret.outputMerger.depthTarget;
Descriptor &descriptor = ret.outputMerger.depthTarget;
view.viewResourceId = rm->GetOriginalID(GetIDForDeviceChild(rs->OM.DepthView));
descriptor.view = rm->GetOriginalID(GetIDForDeviceChild(rs->OM.DepthView));
if(view.viewResourceId != ResourceId())
if(descriptor.view != ResourceId())
{
D3D11_DEPTH_STENCIL_VIEW_DESC desc;
rs->OM.DepthView->GetDesc(&desc);
@@ -1065,9 +1065,8 @@ void D3D11Replay::SavePipelineState(uint32_t eventId)
ID3D11Resource *res = NULL;
rs->OM.DepthView->GetResource(&res);
view.structured = false;
view.bufferStructCount = 0;
view.elementByteSize =
descriptor.bufferStructCount = 0;
descriptor.elementByteSize =
desc.Format == DXGI_FORMAT_UNKNOWN ? 1 : GetByteSize(1, 1, 1, desc.Format, 0);
ret.outputMerger.depthReadOnly = false;
@@ -1078,59 +1077,60 @@ void D3D11Replay::SavePipelineState(uint32_t eventId)
if(desc.Flags & D3D11_DSV_READ_ONLY_STENCIL)
ret.outputMerger.stencilReadOnly = true;
view.resourceResourceId = rm->GetOriginalID(GetIDForDeviceChild(res));
descriptor.resource = rm->GetOriginalID(GetIDForDeviceChild(res));
view.viewFormat = MakeResourceFormat(desc.Format);
view.type = MakeTextureDim(desc.ViewDimension);
descriptor.type = DescriptorType::ReadWriteImage;
descriptor.format = MakeResourceFormat(desc.Format);
descriptor.textureType = MakeTextureDim(desc.ViewDimension);
if(desc.ViewDimension == D3D11_DSV_DIMENSION_TEXTURE1D)
{
view.numSlices = 1;
view.firstSlice = 0;
view.firstMip = desc.Texture1D.MipSlice;
view.numMips = 1;
descriptor.numSlices = 1;
descriptor.firstSlice = 0;
descriptor.firstMip = desc.Texture1D.MipSlice & 0xff;
descriptor.numMips = 1;
}
else if(desc.ViewDimension == D3D11_DSV_DIMENSION_TEXTURE1DARRAY)
{
view.numSlices = desc.Texture1DArray.ArraySize;
view.firstSlice = desc.Texture1DArray.FirstArraySlice;
view.firstMip = desc.Texture1DArray.MipSlice;
view.numMips = 1;
descriptor.numSlices = desc.Texture1DArray.ArraySize & 0xffff;
descriptor.firstSlice = desc.Texture1DArray.FirstArraySlice & 0xffff;
descriptor.firstMip = desc.Texture1DArray.MipSlice & 0xff;
descriptor.numMips = 1;
}
else if(desc.ViewDimension == D3D11_DSV_DIMENSION_TEXTURE2D)
{
view.numSlices = 1;
view.firstSlice = 0;
view.firstMip = desc.Texture2D.MipSlice;
view.numMips = 1;
descriptor.numSlices = 1;
descriptor.firstSlice = 0;
descriptor.firstMip = desc.Texture2D.MipSlice & 0xff;
descriptor.numMips = 1;
}
else if(desc.ViewDimension == D3D11_DSV_DIMENSION_TEXTURE2DARRAY)
{
view.numSlices = desc.Texture2DArray.ArraySize;
view.firstSlice = desc.Texture2DArray.FirstArraySlice;
view.firstMip = desc.Texture2DArray.MipSlice;
view.numMips = 1;
descriptor.numSlices = desc.Texture2DArray.ArraySize & 0xffff;
descriptor.firstSlice = desc.Texture2DArray.FirstArraySlice & 0xffff;
descriptor.firstMip = desc.Texture2DArray.MipSlice & 0xff;
descriptor.numMips = 1;
}
else if(desc.ViewDimension == D3D11_DSV_DIMENSION_TEXTURE2DMS)
{
view.firstMip = 0;
view.numMips = 1;
view.firstSlice = 0;
view.numSlices = 1;
descriptor.firstMip = 0;
descriptor.numMips = 1;
descriptor.firstSlice = 0;
descriptor.numSlices = 1;
}
else if(desc.ViewDimension == D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY)
{
view.numSlices = desc.Texture2DMSArray.ArraySize;
view.firstSlice = desc.Texture2DMSArray.FirstArraySlice;
view.firstMip = 0;
view.numMips = 1;
descriptor.numSlices = desc.Texture2DMSArray.ArraySize & 0xffff;
descriptor.firstSlice = desc.Texture2DMSArray.FirstArraySlice & 0xffff;
descriptor.firstMip = 0;
descriptor.numMips = 1;
}
SAFE_RELEASE(res);
}
else
{
view = D3D11Pipe::View();
descriptor = Descriptor();
}
}
-20
View File
@@ -660,26 +660,6 @@ TextureFilter MakeFilter(D3D12_FILTER filter)
return ret;
}
D3DBufferViewFlags MakeBufferFlags(D3D12_BUFFER_SRV_FLAGS flags)
{
D3DBufferViewFlags ret = D3DBufferViewFlags::NoFlags;
if(flags & D3D12_BUFFER_SRV_FLAG_RAW)
ret |= D3DBufferViewFlags::Raw;
return ret;
}
D3DBufferViewFlags MakeBufferFlags(D3D12_BUFFER_UAV_FLAGS flags)
{
D3DBufferViewFlags ret = D3DBufferViewFlags::NoFlags;
if(flags & D3D12_BUFFER_UAV_FLAG_RAW)
ret |= D3DBufferViewFlags::Raw;
return ret;
}
DescriptorFlags MakeDescriptorFlags(D3D12_BUFFER_SRV_FLAGS flags)
{
DescriptorFlags ret = DescriptorFlags::NoFlags;
-2
View File
@@ -118,8 +118,6 @@ TextureType MakeTextureDim(D3D12_UAV_DIMENSION dim);
AddressMode MakeAddressMode(D3D12_TEXTURE_ADDRESS_MODE addr);
CompareFunction MakeCompareFunc(D3D12_COMPARISON_FUNC func);
TextureFilter MakeFilter(D3D12_FILTER filter);
D3DBufferViewFlags MakeBufferFlags(D3D12_BUFFER_SRV_FLAGS flags);
D3DBufferViewFlags MakeBufferFlags(D3D12_BUFFER_UAV_FLAGS flags);
DescriptorFlags MakeDescriptorFlags(D3D12_BUFFER_SRV_FLAGS flags);
DescriptorFlags MakeDescriptorFlags(D3D12_BUFFER_UAV_FLAGS flags);
LogicOperation MakeLogicOp(D3D12_LOGIC_OP op);
+6 -5
View File
@@ -982,21 +982,22 @@ RenderOutputSubresource D3D12Replay::GetRenderOutputSubresource(ResourceId id)
{
const D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
D3D12Pipe::View view;
Descriptor descriptor;
for(size_t i = 0; i < rs.rts.size(); i++)
{
if(id == rs.rts[i].GetResResourceId())
{
FillResourceView(view, &rs.rts[i]);
return RenderOutputSubresource(view.firstMip, view.firstSlice, view.numSlices);
FillDescriptor(descriptor, &rs.rts[i]);
return RenderOutputSubresource(descriptor.firstMip, descriptor.firstSlice,
descriptor.numSlices);
}
}
if(id == rs.dsv.GetResResourceId() && rs.dsv.GetResResourceId() != ResourceId())
{
FillResourceView(view, &rs.dsv);
return RenderOutputSubresource(view.firstMip, view.firstSlice, view.numSlices);
FillDescriptor(descriptor, &rs.dsv);
return RenderOutputSubresource(descriptor.firstMip, descriptor.firstSlice, descriptor.numSlices);
}
return RenderOutputSubresource(~0U, ~0U, 0);
+100 -316
View File
@@ -695,316 +695,6 @@ rdcarray<EventUsage> D3D12Replay::GetUsage(ResourceId id)
return m_pDevice->GetQueue()->GetUsage(id);
}
void D3D12Replay::FillResourceView(D3D12Pipe::View &view, const D3D12Descriptor *desc)
{
D3D12ResourceManager *rm = m_pDevice->GetResourceManager();
if(desc->GetType() == D3D12DescriptorType::Sampler || desc->GetType() == D3D12DescriptorType::CBV)
{
return;
}
if(desc->GetHeap()->HasValidViewCache(desc->GetHeapIndex()))
{
desc->GetHeap()->GetFromViewCache(desc->GetHeapIndex(), view);
return;
}
view.resourceId = rm->GetOriginalID(desc->GetResResourceId());
if(view.resourceId == ResourceId())
{
desc->GetHeap()->SetToViewCache(desc->GetHeapIndex(), view);
return;
}
D3D12_RESOURCE_DESC res;
{
ID3D12Resource *r = rm->GetCurrentAs<ID3D12Resource>(desc->GetResResourceId());
res = r->GetDesc();
}
{
DXGI_FORMAT fmt = DXGI_FORMAT_UNKNOWN;
if(desc->GetType() == D3D12DescriptorType::RTV)
{
const D3D12_RENDER_TARGET_VIEW_DESC &rtv = desc->GetRTV();
fmt = rtv.Format;
view.type = MakeTextureDim(rtv.ViewDimension);
if(rtv.ViewDimension == D3D12_RTV_DIMENSION_BUFFER)
{
view.firstElement = rtv.Buffer.FirstElement;
view.numElements = rtv.Buffer.NumElements;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE1D)
{
view.firstMip = rtv.Texture1D.MipSlice & 0xff;
view.numMips = 1;
view.firstSlice = 0;
view.numSlices = 1;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE1DARRAY)
{
view.firstMip = rtv.Texture1DArray.MipSlice & 0xff;
view.numMips = 1;
view.numSlices = rtv.Texture1DArray.ArraySize & 0xffff;
view.firstSlice = rtv.Texture1DArray.FirstArraySlice & 0xffff;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2D)
{
view.firstMip = rtv.Texture2D.MipSlice & 0xff;
view.numMips = 1;
view.firstSlice = 0;
view.numSlices = 1;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2DARRAY)
{
view.numSlices = rtv.Texture2DArray.ArraySize & 0xffff;
view.firstSlice = rtv.Texture2DArray.FirstArraySlice & 0xffff;
view.firstMip = rtv.Texture2DArray.MipSlice & 0xff;
view.numMips = 1;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2DMS)
{
view.firstMip = 0;
view.numMips = 1;
view.firstSlice = 0;
view.numSlices = 1;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY)
{
view.firstMip = 0;
view.numMips = 1;
view.numSlices = rtv.Texture2DMSArray.ArraySize & 0xffff;
view.firstSlice = rtv.Texture2DMSArray.FirstArraySlice & 0xffff;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE3D)
{
view.numSlices = rtv.Texture3D.WSize & 0xffff;
view.firstSlice = rtv.Texture3D.FirstWSlice & 0xffff;
view.firstMip = rtv.Texture3D.MipSlice & 0xff;
view.numMips = 1;
}
}
else if(desc->GetType() == D3D12DescriptorType::DSV)
{
const D3D12_DEPTH_STENCIL_VIEW_DESC &dsv = desc->GetDSV();
fmt = dsv.Format;
view.type = MakeTextureDim(dsv.ViewDimension);
if(dsv.ViewDimension == D3D12_DSV_DIMENSION_TEXTURE1D)
{
view.firstMip = dsv.Texture1D.MipSlice & 0xff;
}
else if(dsv.ViewDimension == D3D12_DSV_DIMENSION_TEXTURE1DARRAY)
{
view.numSlices = dsv.Texture1DArray.ArraySize & 0xffff;
view.firstSlice = dsv.Texture1DArray.FirstArraySlice & 0xffff;
view.firstMip = dsv.Texture1DArray.MipSlice & 0xff;
}
else if(dsv.ViewDimension == D3D12_DSV_DIMENSION_TEXTURE2D)
{
view.firstMip = dsv.Texture2D.MipSlice & 0xff;
}
else if(dsv.ViewDimension == D3D12_DSV_DIMENSION_TEXTURE2DARRAY)
{
view.numSlices = dsv.Texture2DArray.ArraySize & 0xffff;
view.firstSlice = dsv.Texture2DArray.FirstArraySlice & 0xffff;
view.firstMip = dsv.Texture2DArray.MipSlice & 0xff;
}
else if(dsv.ViewDimension == D3D12_DSV_DIMENSION_TEXTURE2DMS)
{
}
else if(dsv.ViewDimension == D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY)
{
view.numSlices = dsv.Texture2DMSArray.ArraySize & 0xffff;
view.firstSlice = dsv.Texture2DMSArray.FirstArraySlice & 0xffff;
}
}
else if(desc->GetType() == D3D12DescriptorType::SRV)
{
D3D12_SHADER_RESOURCE_VIEW_DESC srv = desc->GetSRV();
if(srv.ViewDimension == D3D12_SRV_DIMENSION_UNKNOWN)
srv = MakeSRVDesc(res);
fmt = srv.Format;
view.type = MakeTextureDim(srv.ViewDimension);
view.swizzle.red =
(TextureSwizzle)D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(0, srv.Shader4ComponentMapping);
view.swizzle.green =
(TextureSwizzle)D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(1, srv.Shader4ComponentMapping);
view.swizzle.blue =
(TextureSwizzle)D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(2, srv.Shader4ComponentMapping);
view.swizzle.alpha =
(TextureSwizzle)D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(3, srv.Shader4ComponentMapping);
if(srv.ViewDimension == D3D12_SRV_DIMENSION_BUFFER)
{
view.firstElement = srv.Buffer.FirstElement;
view.numElements = srv.Buffer.NumElements;
view.bufferFlags = MakeBufferFlags(srv.Buffer.Flags);
if(srv.Buffer.StructureByteStride > 0)
view.elementByteSize = srv.Buffer.StructureByteStride;
}
else if(srv.ViewDimension == D3D12_SRV_DIMENSION_TEXTURE1D)
{
view.firstMip = srv.Texture1D.MostDetailedMip & 0xff;
view.numMips = srv.Texture1D.MipLevels & 0xff;
view.minLODClamp = srv.Texture1D.ResourceMinLODClamp;
}
else if(srv.ViewDimension == D3D12_SRV_DIMENSION_TEXTURE1DARRAY)
{
view.numSlices = srv.Texture1DArray.ArraySize & 0xffff;
view.firstSlice = srv.Texture1DArray.FirstArraySlice & 0xffff;
view.firstMip = srv.Texture1DArray.MostDetailedMip & 0xff;
view.numMips = srv.Texture1DArray.MipLevels & 0xff;
view.minLODClamp = srv.Texture1DArray.ResourceMinLODClamp;
}
else if(srv.ViewDimension == D3D12_SRV_DIMENSION_TEXTURE2D)
{
view.firstMip = srv.Texture2D.MostDetailedMip & 0xff;
view.numMips = srv.Texture2D.MipLevels & 0xff;
view.minLODClamp = srv.Texture2D.ResourceMinLODClamp;
}
else if(srv.ViewDimension == D3D12_SRV_DIMENSION_TEXTURE2DARRAY)
{
view.numSlices = srv.Texture2DArray.ArraySize & 0xffff;
view.firstSlice = srv.Texture2DArray.FirstArraySlice & 0xffff;
view.firstMip = srv.Texture2DArray.MostDetailedMip & 0xff;
view.numMips = srv.Texture2DArray.MipLevels & 0xff;
view.minLODClamp = srv.Texture2DArray.ResourceMinLODClamp;
}
else if(srv.ViewDimension == D3D12_SRV_DIMENSION_TEXTURE2DMS)
{
}
else if(srv.ViewDimension == D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY)
{
view.numSlices = srv.Texture2DMSArray.ArraySize & 0xffff;
view.firstSlice = srv.Texture2DMSArray.FirstArraySlice & 0xffff;
}
else if(srv.ViewDimension == D3D12_SRV_DIMENSION_TEXTURE3D)
{
view.firstMip = srv.Texture3D.MostDetailedMip & 0xff;
view.numMips = srv.Texture3D.MipLevels & 0xff;
view.minLODClamp = srv.Texture3D.ResourceMinLODClamp;
}
else if(srv.ViewDimension == D3D12_SRV_DIMENSION_TEXTURECUBE)
{
view.numSlices = 6;
view.firstMip = srv.TextureCube.MostDetailedMip & 0xff;
view.numMips = srv.TextureCube.MipLevels & 0xff;
view.minLODClamp = srv.TextureCube.ResourceMinLODClamp;
}
else if(srv.ViewDimension == D3D12_SRV_DIMENSION_TEXTURECUBEARRAY)
{
view.numSlices = (srv.TextureCubeArray.NumCubes * 6) & 0xffff;
view.firstSlice = srv.TextureCubeArray.First2DArrayFace & 0xffff;
view.firstMip = srv.TextureCubeArray.MostDetailedMip & 0xff;
view.numMips = srv.TextureCubeArray.MipLevels & 0xff;
view.minLODClamp = srv.TextureCube.ResourceMinLODClamp;
}
}
else if(desc->GetType() == D3D12DescriptorType::UAV)
{
D3D12_UNORDERED_ACCESS_VIEW_DESC uav = desc->GetUAV();
if(uav.ViewDimension == D3D12_UAV_DIMENSION_UNKNOWN)
uav = MakeUAVDesc(res);
fmt = uav.Format;
view.counterResourceId = rm->GetOriginalID(desc->GetCounterResourceId());
view.type = MakeTextureDim(uav.ViewDimension);
if(uav.ViewDimension == D3D12_UAV_DIMENSION_BUFFER)
{
view.firstElement = uav.Buffer.FirstElement;
view.numElements = uav.Buffer.NumElements;
view.bufferFlags = MakeBufferFlags(uav.Buffer.Flags);
if(uav.Buffer.StructureByteStride > 0)
view.elementByteSize = uav.Buffer.StructureByteStride;
view.counterByteOffset = uav.Buffer.CounterOffsetInBytes & 0xffffffff;
RDCASSERT(uav.Buffer.CounterOffsetInBytes < 0xffffffff);
if(view.counterResourceId != ResourceId())
{
bytebuf counterVal;
GetDebugManager()->GetBufferData(
rm->GetCurrentAs<ID3D12Resource>(desc->GetCounterResourceId()),
uav.Buffer.CounterOffsetInBytes, 4, counterVal);
uint32_t *val = (uint32_t *)&counterVal[0];
view.bufferStructCount = *val;
}
}
else if(uav.ViewDimension == D3D12_UAV_DIMENSION_TEXTURE1D)
{
view.firstMip = uav.Texture1D.MipSlice & 0xff;
}
else if(uav.ViewDimension == D3D12_UAV_DIMENSION_TEXTURE1DARRAY)
{
view.numSlices = uav.Texture1DArray.ArraySize & 0xffff;
view.firstSlice = uav.Texture1DArray.FirstArraySlice & 0xffff;
view.firstMip = uav.Texture1DArray.MipSlice & 0xff;
}
else if(uav.ViewDimension == D3D12_UAV_DIMENSION_TEXTURE2D)
{
view.firstMip = uav.Texture2D.MipSlice & 0xff;
}
else if(uav.ViewDimension == D3D12_UAV_DIMENSION_TEXTURE2DARRAY)
{
view.numSlices = uav.Texture2DArray.ArraySize & 0xffff;
view.firstSlice = uav.Texture2DArray.FirstArraySlice & 0xffff;
view.firstMip = uav.Texture2DArray.MipSlice & 0xff;
}
else if(uav.ViewDimension == D3D12_UAV_DIMENSION_TEXTURE2DMS)
{
}
else if(uav.ViewDimension == D3D12_UAV_DIMENSION_TEXTURE2DMSARRAY)
{
view.numSlices = uav.Texture2DMSArray.ArraySize & 0xffff;
view.firstSlice = uav.Texture2DMSArray.FirstArraySlice & 0xffff;
}
else if(uav.ViewDimension == D3D12_UAV_DIMENSION_TEXTURE3D)
{
view.numSlices = uav.Texture3D.WSize & 0xffff;
view.firstSlice = uav.Texture3D.FirstWSlice & 0xffff;
view.firstMip = uav.Texture3D.MipSlice & 0xff;
}
}
if(fmt == DXGI_FORMAT_UNKNOWN)
fmt = res.Format;
if(view.elementByteSize == 0)
view.elementByteSize = fmt == DXGI_FORMAT_UNKNOWN ? 1 : GetByteSize(1, 1, 1, fmt, 0);
if(res.MipLevels == 0 && res.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER)
res.MipLevels = (uint16_t)CalcNumMips(
(uint32_t)res.Width, res.Height,
res.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? res.DepthOrArraySize : 1);
view.numMips = RDCMIN(view.numMips, uint8_t(res.MipLevels & 0xff));
view.numSlices = RDCMIN(view.numSlices, res.DepthOrArraySize);
view.viewFormat = MakeResourceFormat(fmt);
}
desc->GetHeap()->SetToViewCache(desc->GetHeapIndex(), view);
}
void D3D12Replay::FillDescriptor(Descriptor &dst, const D3D12Descriptor *src)
{
D3D12ResourceManager *rm = m_pDevice->GetResourceManager();
@@ -1212,6 +902,102 @@ void D3D12Replay::FillDescriptor(Descriptor &dst, const D3D12Descriptor *src)
dst.firstMip = uav.Texture3D.MipSlice & 0xff;
}
}
else if(src->GetType() == D3D12DescriptorType::RTV)
{
D3D12_RENDER_TARGET_VIEW_DESC rtv = src->GetRTV();
if(rtv.ViewDimension == D3D12_RTV_DIMENSION_BUFFER)
dst.type = rtv.Format != DXGI_FORMAT_UNKNOWN ? DescriptorType::ReadWriteTypedBuffer
: DescriptorType::ReadWriteBuffer;
else
dst.type = DescriptorType::ReadWriteImage;
fmt = rtv.Format;
dst.secondary = rm->GetOriginalID(src->GetCounterResourceId());
dst.textureType = MakeTextureDim(rtv.ViewDimension);
if(rtv.ViewDimension == D3D12_RTV_DIMENSION_BUFFER)
{
firstElement = rtv.Buffer.FirstElement;
numElements = rtv.Buffer.NumElements;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE1D)
{
dst.firstMip = rtv.Texture1D.MipSlice & 0xff;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE1DARRAY)
{
dst.numSlices = rtv.Texture1DArray.ArraySize & 0xffff;
dst.firstSlice = rtv.Texture1DArray.FirstArraySlice & 0xffff;
dst.firstMip = rtv.Texture1DArray.MipSlice & 0xff;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2D)
{
dst.firstMip = rtv.Texture2D.MipSlice & 0xff;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2DARRAY)
{
dst.numSlices = rtv.Texture2DArray.ArraySize & 0xffff;
dst.firstSlice = rtv.Texture2DArray.FirstArraySlice & 0xffff;
dst.firstMip = rtv.Texture2DArray.MipSlice & 0xff;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2DMS)
{
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY)
{
dst.numSlices = rtv.Texture2DMSArray.ArraySize & 0xffff;
dst.firstSlice = rtv.Texture2DMSArray.FirstArraySlice & 0xffff;
}
else if(rtv.ViewDimension == D3D12_RTV_DIMENSION_TEXTURE3D)
{
dst.numSlices = rtv.Texture3D.WSize & 0xffff;
dst.firstSlice = rtv.Texture3D.FirstWSlice & 0xffff;
dst.firstMip = rtv.Texture3D.MipSlice & 0xff;
}
}
else if(src->GetType() == D3D12DescriptorType::DSV)
{
D3D12_DEPTH_STENCIL_VIEW_DESC dsv = src->GetDSV();
dst.type = DescriptorType::ReadWriteImage;
fmt = dsv.Format;
dst.secondary = rm->GetOriginalID(src->GetCounterResourceId());
dst.textureType = MakeTextureDim(dsv.ViewDimension);
if(dsv.ViewDimension == D3D12_DSV_DIMENSION_TEXTURE1D)
{
dst.firstMip = dsv.Texture1D.MipSlice & 0xff;
}
else if(dsv.ViewDimension == D3D12_DSV_DIMENSION_TEXTURE1DARRAY)
{
dst.numSlices = dsv.Texture1DArray.ArraySize & 0xffff;
dst.firstSlice = dsv.Texture1DArray.FirstArraySlice & 0xffff;
dst.firstMip = dsv.Texture1DArray.MipSlice & 0xff;
}
else if(dsv.ViewDimension == D3D12_DSV_DIMENSION_TEXTURE2D)
{
dst.firstMip = dsv.Texture2D.MipSlice & 0xff;
}
else if(dsv.ViewDimension == D3D12_DSV_DIMENSION_TEXTURE2DARRAY)
{
dst.numSlices = dsv.Texture2DArray.ArraySize & 0xffff;
dst.firstSlice = dsv.Texture2DArray.FirstArraySlice & 0xffff;
dst.firstMip = dsv.Texture2DArray.MipSlice & 0xff;
}
else if(dsv.ViewDimension == D3D12_DSV_DIMENSION_TEXTURE2DMS)
{
}
else if(dsv.ViewDimension == D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY)
{
dst.numSlices = dsv.Texture2DMSArray.ArraySize & 0xffff;
dst.firstSlice = dsv.Texture2DMSArray.FirstArraySlice & 0xffff;
}
}
if(fmt == DXGI_FORMAT_UNKNOWN)
fmt = res.Format;
@@ -1566,16 +1352,14 @@ void D3D12Replay::SavePipelineState(uint32_t eventId)
if(desc.GetResResourceId() != ResourceId())
{
state.outputMerger.renderTargets.push_back(D3D12Pipe::View((uint32_t)i));
D3D12Pipe::View &view = state.outputMerger.renderTargets.back();
FillResourceView(view, &desc);
state.outputMerger.renderTargets.push_back(Descriptor());
FillDescriptor(state.outputMerger.renderTargets.back(), &desc);
}
}
if(rs.dsv.GetResResourceId() != ResourceId())
{
FillResourceView(state.outputMerger.depthTarget, &rs.dsv);
FillDescriptor(state.outputMerger.depthTarget, &rs.dsv);
state.outputMerger.depthReadOnly = false;
state.outputMerger.stencilReadOnly = false;
@@ -1587,7 +1371,7 @@ void D3D12Replay::SavePipelineState(uint32_t eventId)
}
else
{
state.outputMerger.depthTarget = D3D12Pipe::View(0);
state.outputMerger.depthTarget = Descriptor();
state.outputMerger.depthReadOnly = false;
state.outputMerger.stencilReadOnly = false;
-1
View File
@@ -268,7 +268,6 @@ public:
bool dxil);
private:
void FillResourceView(D3D12Pipe::View &view, const D3D12Descriptor *desc);
void FillDescriptor(Descriptor &dst, const D3D12Descriptor *src);
void FillSamplerDescriptor(SamplerDescriptor &dst, const D3D12_SAMPLER_DESC2 &src);
+10 -71
View File
@@ -487,82 +487,24 @@ rdcarray<ID3D12Resource *> WrappedID3D12Resource::AddRefBuffersBeforeCapture(D3D
return ret;
}
bool WrappedID3D12DescriptorHeap::HasValidViewCache(uint32_t index)
{
if(!mutableViewBitmask)
return false;
// don't cache mutable views. In theory we could but we'd need to know which ones were modified
// mid-frame, to mark the cache as stale when initial contents are re-applied. This optimisation
// is aimed at the assumption of a huge number of descriptors that don't change so we just don't
// cache ones that change mid-frame
if((mutableViewBitmask[index / 64] & (1ULL << (index % 64))) != 0)
return false;
EnsureViewCache();
// anything that's not mutable is valid once it's been set at least once. Since we
// zero-initialise, we use bind as a flag (it isn't retrieved from the cache since it depends on
// the binding)
return cachedViews[index].bind == 1;
}
void WrappedID3D12DescriptorHeap::MarkMutableIndex(uint32_t index)
{
if(!mutableViewBitmask)
if(!mutableDescriptorBitmask)
return;
mutableViewBitmask[index / 64] |= (1ULL << (index % 64));
}
void WrappedID3D12DescriptorHeap::GetFromViewCache(uint32_t index, D3D12Pipe::View &view)
{
if(!mutableViewBitmask)
return;
EnsureViewCache();
bool dynamicallyUsed = view.dynamicallyUsed;
uint32_t bind = view.bind;
uint32_t tableIndex = view.tableIndex;
view = cachedViews[index];
view.dynamicallyUsed = dynamicallyUsed;
view.bind = bind;
view.tableIndex = tableIndex;
}
void WrappedID3D12DescriptorHeap::SetToViewCache(uint32_t index, const D3D12Pipe::View &view)
{
if(!mutableViewBitmask)
return;
EnsureViewCache();
cachedViews[index] = view;
// we re-use bind as the indicator that this view is valid
cachedViews[index].bind = 1;
}
void WrappedID3D12DescriptorHeap::EnsureViewCache()
{
if(!cachedViews)
{
D3D12_DESCRIPTOR_HEAP_DESC desc = GetDesc();
cachedViews = new D3D12Pipe::View[desc.NumDescriptors];
RDCEraseMem(cachedViews, sizeof(D3D12Pipe::View) * desc.NumDescriptors);
}
mutableDescriptorBitmask[index / 64] |= (1ULL << (index % 64));
}
bool WrappedID3D12DescriptorHeap::HasValidDescriptorCache(uint32_t index)
{
if(!mutableViewBitmask)
if(!mutableDescriptorBitmask)
return false;
// don't cache mutable views. In theory we could but we'd need to know which ones were modified
// mid-frame, to mark the cache as stale when initial contents are re-applied. This optimisation
// is aimed at the assumption of a huge number of descriptors that don't change so we just don't
// cache ones that change mid-frame
if((mutableViewBitmask[index / 64] & (1ULL << (index % 64))) != 0)
if((mutableDescriptorBitmask[index / 64] & (1ULL << (index % 64))) != 0)
return false;
EnsureDescriptorCache();
@@ -575,7 +517,7 @@ bool WrappedID3D12DescriptorHeap::HasValidDescriptorCache(uint32_t index)
void WrappedID3D12DescriptorHeap::GetFromDescriptorCache(uint32_t index, Descriptor &view)
{
if(!mutableViewBitmask)
if(!mutableDescriptorBitmask)
return;
EnsureDescriptorCache();
@@ -595,7 +537,7 @@ void WrappedID3D12DescriptorHeap::EnsureDescriptorCache()
void WrappedID3D12DescriptorHeap::SetToDescriptorCache(uint32_t index, const Descriptor &view)
{
if(!mutableViewBitmask)
if(!mutableDescriptorBitmask)
return;
EnsureDescriptorCache();
@@ -628,17 +570,15 @@ WrappedID3D12DescriptorHeap::WrappedID3D12DescriptorHeap(ID3D12DescriptorHeap *r
{
size_t bitmaskSize = AlignUp(desc.NumDescriptors, 64U) / 64;
cachedViews = NULL;
cachedDescriptors = NULL;
mutableViewBitmask = new uint64_t[bitmaskSize];
RDCEraseMem(mutableViewBitmask, sizeof(uint64_t) * bitmaskSize);
mutableDescriptorBitmask = new uint64_t[bitmaskSize];
RDCEraseMem(mutableDescriptorBitmask, sizeof(uint64_t) * bitmaskSize);
}
else
{
cachedViews = NULL;
cachedDescriptors = NULL;
mutableViewBitmask = NULL;
mutableDescriptorBitmask = NULL;
}
}
@@ -646,9 +586,8 @@ WrappedID3D12DescriptorHeap::~WrappedID3D12DescriptorHeap()
{
Shutdown();
SAFE_DELETE_ARRAY(descriptors);
SAFE_DELETE_ARRAY(cachedViews);
SAFE_DELETE_ARRAY(cachedDescriptors);
SAFE_DELETE_ARRAY(mutableViewBitmask);
SAFE_DELETE_ARRAY(mutableDescriptorBitmask);
}
void WrappedID3D12PipelineState::ShaderEntry::BuildReflection()
+1 -7
View File
@@ -399,9 +399,8 @@ class WrappedID3D12DescriptorHeap : public WrappedDeviceChild12<ID3D12Descriptor
D3D12Descriptor *descriptors;
D3D12Pipe::View *cachedViews;
Descriptor *cachedDescriptors;
uint64_t *mutableViewBitmask;
uint64_t *mutableDescriptorBitmask;
public:
ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12DescriptorHeap);
@@ -420,11 +419,6 @@ public:
void MarkMutableIndex(uint32_t index);
void EnsureViewCache();
bool HasValidViewCache(uint32_t index);
void GetFromViewCache(uint32_t index, D3D12Pipe::View &view);
void SetToViewCache(uint32_t index, const D3D12Pipe::View &view);
void EnsureDescriptorCache();
bool HasValidDescriptorCache(uint32_t index);
void GetFromDescriptorCache(uint32_t index, Descriptor &view);
+36 -34
View File
@@ -1686,14 +1686,14 @@ void GLReplay::SavePipelineState(uint32_t eventId)
ResourceId id =
rm->GetResID(rbCol[i] ? RenderbufferRes(ctx, curCol[i]) : TextureRes(ctx, curCol[i]));
pipe.framebuffer.drawFBO.colorAttachments[i].resourceId = rm->GetOriginalID(id);
pipe.framebuffer.drawFBO.colorAttachments[i].resource = rm->GetOriginalID(id);
GLenum attachment = GLenum(eGL_COLOR_ATTACHMENT0 + i);
if(pipe.framebuffer.drawFBO.colorAttachments[i].resourceId != ResourceId() && !rbCol[i])
if(pipe.framebuffer.drawFBO.colorAttachments[i].resource != ResourceId() && !rbCol[i])
GetFramebufferMipAndLayer(curDrawFBO, attachment,
(GLint *)&pipe.framebuffer.drawFBO.colorAttachments[i].mipLevel,
(GLint *)&pipe.framebuffer.drawFBO.colorAttachments[i].slice);
(GLint *)&pipe.framebuffer.drawFBO.colorAttachments[i].firstMip,
(GLint *)&pipe.framebuffer.drawFBO.colorAttachments[i].firstSlice);
pipe.framebuffer.drawFBO.colorAttachments[i].numSlices = 1;
@@ -1708,7 +1708,8 @@ void GLReplay::SavePipelineState(uint32_t eventId)
if(layered)
{
pipe.framebuffer.drawFBO.colorAttachments[i].numSlices = m_pDriver->m_Textures[id].depth;
pipe.framebuffer.drawFBO.colorAttachments[i].numSlices =
m_pDriver->m_Textures[id].depth & 0xffff;
}
}
else
@@ -1725,8 +1726,8 @@ void GLReplay::SavePipelineState(uint32_t eventId)
if(numViews > 1)
{
pipe.framebuffer.drawFBO.colorAttachments[i].numSlices = numViews;
pipe.framebuffer.drawFBO.colorAttachments[i].slice = startView;
pipe.framebuffer.drawFBO.colorAttachments[i].numSlices = numViews & 0xffff;
pipe.framebuffer.drawFBO.colorAttachments[i].firstSlice = startView & 0xffff;
}
}
}
@@ -1748,19 +1749,19 @@ void GLReplay::SavePipelineState(uint32_t eventId)
ResourceId id =
rm->GetResID(rbDepth ? RenderbufferRes(ctx, curDepth) : TextureRes(ctx, curDepth));
pipe.framebuffer.drawFBO.depthAttachment.resourceId = rm->GetOriginalID(id);
pipe.framebuffer.drawFBO.stencilAttachment.resourceId = rm->GetOriginalID(
pipe.framebuffer.drawFBO.depthAttachment.resource = rm->GetOriginalID(id);
pipe.framebuffer.drawFBO.stencilAttachment.resource = rm->GetOriginalID(
rm->GetResID(rbStencil ? RenderbufferRes(ctx, curStencil) : TextureRes(ctx, curStencil)));
if(pipe.framebuffer.drawFBO.depthAttachment.resourceId != ResourceId() && !rbDepth)
if(pipe.framebuffer.drawFBO.depthAttachment.resource != ResourceId() && !rbDepth)
GetFramebufferMipAndLayer(curDrawFBO, eGL_DEPTH_ATTACHMENT,
(GLint *)&pipe.framebuffer.drawFBO.depthAttachment.mipLevel,
(GLint *)&pipe.framebuffer.drawFBO.depthAttachment.slice);
&pipe.framebuffer.drawFBO.depthAttachment.firstMip,
&pipe.framebuffer.drawFBO.depthAttachment.firstSlice);
if(pipe.framebuffer.drawFBO.stencilAttachment.resourceId != ResourceId() && !rbStencil)
if(pipe.framebuffer.drawFBO.stencilAttachment.resource != ResourceId() && !rbStencil)
GetFramebufferMipAndLayer(curDrawFBO, eGL_STENCIL_ATTACHMENT,
(GLint *)&pipe.framebuffer.drawFBO.stencilAttachment.mipLevel,
(GLint *)&pipe.framebuffer.drawFBO.stencilAttachment.slice);
&pipe.framebuffer.drawFBO.stencilAttachment.firstMip,
&pipe.framebuffer.drawFBO.stencilAttachment.firstSlice);
pipe.framebuffer.drawFBO.depthAttachment.numSlices = 1;
pipe.framebuffer.drawFBO.stencilAttachment.numSlices = 1;
@@ -1776,7 +1777,8 @@ void GLReplay::SavePipelineState(uint32_t eventId)
if(layered)
{
pipe.framebuffer.drawFBO.depthAttachment.numSlices = m_pDriver->m_Textures[id].depth;
pipe.framebuffer.drawFBO.depthAttachment.numSlices =
m_pDriver->m_Textures[id].depth & 0xffff;
}
}
else
@@ -1794,17 +1796,17 @@ void GLReplay::SavePipelineState(uint32_t eventId)
if(numViews > 1)
{
pipe.framebuffer.drawFBO.depthAttachment.numSlices = numViews;
pipe.framebuffer.drawFBO.depthAttachment.slice = startView;
pipe.framebuffer.drawFBO.depthAttachment.numSlices = numViews & 0xffff;
pipe.framebuffer.drawFBO.depthAttachment.firstSlice = startView & 0xffff;
}
}
}
if(pipe.framebuffer.drawFBO.stencilAttachment.resourceId ==
pipe.framebuffer.drawFBO.depthAttachment.resourceId)
if(pipe.framebuffer.drawFBO.stencilAttachment.resource ==
pipe.framebuffer.drawFBO.depthAttachment.resource)
{
pipe.framebuffer.drawFBO.stencilAttachment.slice =
pipe.framebuffer.drawFBO.depthAttachment.slice;
pipe.framebuffer.drawFBO.stencilAttachment.firstSlice =
pipe.framebuffer.drawFBO.depthAttachment.firstSlice;
pipe.framebuffer.drawFBO.stencilAttachment.numSlices =
pipe.framebuffer.drawFBO.depthAttachment.numSlices;
}
@@ -1858,29 +1860,29 @@ void GLReplay::SavePipelineState(uint32_t eventId)
pipe.framebuffer.readFBO.colorAttachments.resize(numCols);
for(GLint i = 0; i < numCols; i++)
{
pipe.framebuffer.readFBO.colorAttachments[i].resourceId = rm->GetOriginalID(
pipe.framebuffer.readFBO.colorAttachments[i].resource = rm->GetOriginalID(
rm->GetResID(rbCol[i] ? RenderbufferRes(ctx, curCol[i]) : TextureRes(ctx, curCol[i])));
if(pipe.framebuffer.readFBO.colorAttachments[i].resourceId != ResourceId() && !rbCol[i])
if(pipe.framebuffer.readFBO.colorAttachments[i].resource != ResourceId() && !rbCol[i])
GetFramebufferMipAndLayer(curReadFBO, GLenum(eGL_COLOR_ATTACHMENT0 + i),
(GLint *)&pipe.framebuffer.readFBO.colorAttachments[i].mipLevel,
(GLint *)&pipe.framebuffer.readFBO.colorAttachments[i].slice);
&pipe.framebuffer.readFBO.colorAttachments[i].firstMip,
&pipe.framebuffer.readFBO.colorAttachments[i].firstSlice);
}
pipe.framebuffer.readFBO.depthAttachment.resourceId = rm->GetOriginalID(
pipe.framebuffer.readFBO.depthAttachment.resource = rm->GetOriginalID(
rm->GetResID(rbDepth ? RenderbufferRes(ctx, curDepth) : TextureRes(ctx, curDepth)));
pipe.framebuffer.readFBO.stencilAttachment.resourceId = rm->GetOriginalID(
pipe.framebuffer.readFBO.stencilAttachment.resource = rm->GetOriginalID(
rm->GetResID(rbStencil ? RenderbufferRes(ctx, curStencil) : TextureRes(ctx, curStencil)));
if(pipe.framebuffer.readFBO.depthAttachment.resourceId != ResourceId() && !rbDepth)
if(pipe.framebuffer.readFBO.depthAttachment.resource != ResourceId() && !rbDepth)
GetFramebufferMipAndLayer(curReadFBO, eGL_DEPTH_ATTACHMENT,
(GLint *)&pipe.framebuffer.readFBO.depthAttachment.mipLevel,
(GLint *)&pipe.framebuffer.readFBO.depthAttachment.slice);
&pipe.framebuffer.readFBO.depthAttachment.firstMip,
&pipe.framebuffer.readFBO.depthAttachment.firstSlice);
if(pipe.framebuffer.readFBO.stencilAttachment.resourceId != ResourceId() && !rbStencil)
if(pipe.framebuffer.readFBO.stencilAttachment.resource != ResourceId() && !rbStencil)
GetFramebufferMipAndLayer(curReadFBO, eGL_STENCIL_ATTACHMENT,
(GLint *)&pipe.framebuffer.readFBO.stencilAttachment.mipLevel,
(GLint *)&pipe.framebuffer.readFBO.stencilAttachment.slice);
&pipe.framebuffer.readFBO.stencilAttachment.firstMip,
&pipe.framebuffer.readFBO.stencilAttachment.firstSlice);
pipe.framebuffer.readFBO.drawBuffers.resize(numCols);
for(GLint i = 0; i < numCols; i++)
+10
View File
@@ -34,6 +34,16 @@ size_t GetByteSize(GLsizei w, GLsizei h, GLsizei d, GLenum format, GLenum type);
GLenum GetBaseFormat(GLenum internalFormat);
GLenum GetDataType(GLenum internalFormat);
void GetFramebufferMipAndLayer(GLuint framebuffer, GLenum attachment, GLint *mip, GLint *layer);
inline void GetFramebufferMipAndLayer(GLuint framebuffer, GLenum attachment, uint8_t *mip,
uint16_t *layer)
{
GLint outMip = 0, outLayer = 0;
GetFramebufferMipAndLayer(framebuffer, attachment, &outMip, &outLayer);
*mip = outMip & 0xff;
*layer = outLayer & 0xff;
}
void GetTextureSwizzle(GLuint tex, GLenum target, GLenum *swizzleRGBA);
void SetTextureSwizzle(GLuint tex, GLenum target, const GLenum *swizzleRGBA);
+47 -46
View File
@@ -1743,22 +1743,22 @@ void VulkanReplay::SavePipelineState(uint32_t eventId)
if(viewid != ResourceId())
{
fbState.attachments.back().viewResourceId = rm->GetOriginalID(viewid);
ret.currentPass.framebuffer.attachments[attIdx].imageResourceId =
fbState.attachments.back().view = rm->GetOriginalID(viewid);
ret.currentPass.framebuffer.attachments[attIdx].resource =
rm->GetOriginalID(c.m_ImageView[viewid].image);
fbState.attachments.back().viewFormat = MakeResourceFormat(c.m_ImageView[viewid].format);
fbState.attachments.back().firstMip = c.m_ImageView[viewid].range.baseMipLevel;
fbState.attachments.back().firstSlice = c.m_ImageView[viewid].range.baseArrayLayer;
fbState.attachments.back().numMips = c.m_ImageView[viewid].range.levelCount;
fbState.attachments.back().numSlices = c.m_ImageView[viewid].range.layerCount;
fbState.attachments.back().format = MakeResourceFormat(c.m_ImageView[viewid].format);
fbState.attachments.back().firstMip = c.m_ImageView[viewid].range.baseMipLevel & 0xff;
fbState.attachments.back().firstSlice = c.m_ImageView[viewid].range.baseArrayLayer & 0xffff;
fbState.attachments.back().numMips = c.m_ImageView[viewid].range.levelCount & 0xff;
fbState.attachments.back().numSlices = c.m_ImageView[viewid].range.layerCount & 0xffff;
Convert(fbState.attachments.back().swizzle, c.m_ImageView[viewid].componentMapping);
}
else
{
fbState.attachments.back().viewResourceId = ResourceId();
fbState.attachments.back().imageResourceId = ResourceId();
fbState.attachments.back().view = ResourceId();
fbState.attachments.back().resource = ResourceId();
fbState.attachments.back().firstMip = 0;
fbState.attachments.back().firstSlice = 0;
@@ -1774,15 +1774,15 @@ void VulkanReplay::SavePipelineState(uint32_t eventId)
viewid = GetResID(dyn.color[i].resolveImageView);
fbState.attachments.back().viewResourceId = rm->GetOriginalID(viewid);
ret.currentPass.framebuffer.attachments[attIdx].imageResourceId =
fbState.attachments.back().view = rm->GetOriginalID(viewid);
ret.currentPass.framebuffer.attachments[attIdx].resource =
rm->GetOriginalID(c.m_ImageView[viewid].image);
fbState.attachments.back().viewFormat = MakeResourceFormat(c.m_ImageView[viewid].format);
fbState.attachments.back().firstMip = c.m_ImageView[viewid].range.baseMipLevel;
fbState.attachments.back().firstSlice = c.m_ImageView[viewid].range.baseArrayLayer;
fbState.attachments.back().numMips = c.m_ImageView[viewid].range.levelCount;
fbState.attachments.back().numSlices = c.m_ImageView[viewid].range.layerCount;
fbState.attachments.back().format = MakeResourceFormat(c.m_ImageView[viewid].format);
fbState.attachments.back().firstMip = c.m_ImageView[viewid].range.baseMipLevel & 0xff;
fbState.attachments.back().firstSlice = c.m_ImageView[viewid].range.baseArrayLayer & 0xffff;
fbState.attachments.back().numMips = c.m_ImageView[viewid].range.levelCount & 0xff;
fbState.attachments.back().numSlices = c.m_ImageView[viewid].range.layerCount & 0xffff;
Convert(fbState.attachments.back().swizzle, c.m_ImageView[viewid].componentMapping);
@@ -1798,15 +1798,15 @@ void VulkanReplay::SavePipelineState(uint32_t eventId)
if(dyn.depth.imageView == VK_NULL_HANDLE)
viewid = GetResID(dyn.stencil.imageView);
fbState.attachments.back().viewResourceId = rm->GetOriginalID(viewid);
ret.currentPass.framebuffer.attachments[attIdx].imageResourceId =
fbState.attachments.back().view = rm->GetOriginalID(viewid);
ret.currentPass.framebuffer.attachments[attIdx].resource =
rm->GetOriginalID(c.m_ImageView[viewid].image);
fbState.attachments.back().viewFormat = MakeResourceFormat(c.m_ImageView[viewid].format);
fbState.attachments.back().firstMip = c.m_ImageView[viewid].range.baseMipLevel;
fbState.attachments.back().firstSlice = c.m_ImageView[viewid].range.baseArrayLayer;
fbState.attachments.back().numMips = c.m_ImageView[viewid].range.levelCount;
fbState.attachments.back().numSlices = c.m_ImageView[viewid].range.layerCount;
fbState.attachments.back().format = MakeResourceFormat(c.m_ImageView[viewid].format);
fbState.attachments.back().firstMip = c.m_ImageView[viewid].range.baseMipLevel & 0xff;
fbState.attachments.back().firstSlice = c.m_ImageView[viewid].range.baseArrayLayer & 0xffff;
fbState.attachments.back().numMips = c.m_ImageView[viewid].range.levelCount & 0xff;
fbState.attachments.back().numSlices = c.m_ImageView[viewid].range.layerCount & 0xffff;
Convert(fbState.attachments.back().swizzle, c.m_ImageView[viewid].componentMapping);
@@ -1823,15 +1823,15 @@ void VulkanReplay::SavePipelineState(uint32_t eventId)
ResourceId viewid = GetResID(dyn.fragmentDensityView);
fbState.attachments.back().viewResourceId = rm->GetOriginalID(viewid);
ret.currentPass.framebuffer.attachments[attIdx].imageResourceId =
fbState.attachments.back().view = rm->GetOriginalID(viewid);
ret.currentPass.framebuffer.attachments[attIdx].resource =
rm->GetOriginalID(c.m_ImageView[viewid].image);
fbState.attachments.back().viewFormat = MakeResourceFormat(c.m_ImageView[viewid].format);
fbState.attachments.back().firstMip = c.m_ImageView[viewid].range.baseMipLevel;
fbState.attachments.back().firstSlice = c.m_ImageView[viewid].range.baseArrayLayer;
fbState.attachments.back().numMips = c.m_ImageView[viewid].range.levelCount;
fbState.attachments.back().numSlices = c.m_ImageView[viewid].range.layerCount;
fbState.attachments.back().format = MakeResourceFormat(c.m_ImageView[viewid].format);
fbState.attachments.back().firstMip = c.m_ImageView[viewid].range.baseMipLevel & 0xff;
fbState.attachments.back().firstSlice = c.m_ImageView[viewid].range.baseArrayLayer & 0xffff;
fbState.attachments.back().numMips = c.m_ImageView[viewid].range.levelCount & 0xff;
fbState.attachments.back().numSlices = c.m_ImageView[viewid].range.layerCount & 0xffff;
Convert(fbState.attachments.back().swizzle, c.m_ImageView[viewid].componentMapping);
@@ -1848,15 +1848,15 @@ void VulkanReplay::SavePipelineState(uint32_t eventId)
ResourceId viewid = GetResID(dyn.shadingRateView);
fbState.attachments.back().viewResourceId = rm->GetOriginalID(viewid);
ret.currentPass.framebuffer.attachments[attIdx].imageResourceId =
fbState.attachments.back().view = rm->GetOriginalID(viewid);
ret.currentPass.framebuffer.attachments[attIdx].resource =
rm->GetOriginalID(c.m_ImageView[viewid].image);
fbState.attachments.back().viewFormat = MakeResourceFormat(c.m_ImageView[viewid].format);
fbState.attachments.back().firstMip = c.m_ImageView[viewid].range.baseMipLevel;
fbState.attachments.back().firstSlice = c.m_ImageView[viewid].range.baseArrayLayer;
fbState.attachments.back().numMips = c.m_ImageView[viewid].range.levelCount;
fbState.attachments.back().numSlices = c.m_ImageView[viewid].range.layerCount;
fbState.attachments.back().format = MakeResourceFormat(c.m_ImageView[viewid].format);
fbState.attachments.back().firstMip = c.m_ImageView[viewid].range.baseMipLevel & 0xff;
fbState.attachments.back().firstSlice = c.m_ImageView[viewid].range.baseArrayLayer & 0xffff;
fbState.attachments.back().numMips = c.m_ImageView[viewid].range.levelCount & 0xff;
fbState.attachments.back().numSlices = c.m_ImageView[viewid].range.layerCount & 0xffff;
Convert(fbState.attachments.back().swizzle, c.m_ImageView[viewid].componentMapping);
@@ -1926,27 +1926,28 @@ void VulkanReplay::SavePipelineState(uint32_t eventId)
if(viewid != ResourceId())
{
ret.currentPass.framebuffer.attachments[i].viewResourceId = rm->GetOriginalID(viewid);
ret.currentPass.framebuffer.attachments[i].imageResourceId =
ret.currentPass.framebuffer.attachments[i].view = rm->GetOriginalID(viewid);
ret.currentPass.framebuffer.attachments[i].resource =
rm->GetOriginalID(c.m_ImageView[viewid].image);
ret.currentPass.framebuffer.attachments[i].viewFormat =
ret.currentPass.framebuffer.attachments[i].format =
MakeResourceFormat(c.m_ImageView[viewid].format);
ret.currentPass.framebuffer.attachments[i].firstMip =
c.m_ImageView[viewid].range.baseMipLevel;
c.m_ImageView[viewid].range.baseMipLevel & 0xff;
ret.currentPass.framebuffer.attachments[i].firstSlice =
c.m_ImageView[viewid].range.baseArrayLayer;
ret.currentPass.framebuffer.attachments[i].numMips = c.m_ImageView[viewid].range.levelCount;
c.m_ImageView[viewid].range.baseArrayLayer & 0xffff;
ret.currentPass.framebuffer.attachments[i].numMips =
c.m_ImageView[viewid].range.levelCount & 0xff;
ret.currentPass.framebuffer.attachments[i].numSlices =
c.m_ImageView[viewid].range.layerCount;
c.m_ImageView[viewid].range.layerCount & 0xffff;
Convert(ret.currentPass.framebuffer.attachments[i].swizzle,
c.m_ImageView[viewid].componentMapping);
}
else
{
ret.currentPass.framebuffer.attachments[i].viewResourceId = ResourceId();
ret.currentPass.framebuffer.attachments[i].imageResourceId = ResourceId();
ret.currentPass.framebuffer.attachments[i].view = ResourceId();
ret.currentPass.framebuffer.attachments[i].resource = ResourceId();
ret.currentPass.framebuffer.attachments[i].firstMip = 0;
ret.currentPass.framebuffer.attachments[i].firstSlice = 0;
+7 -93
View File
@@ -1265,30 +1265,6 @@ void DoSerialise(SerialiserType &ser, D3D11Pipe::InputAssembly &el)
SIZE_CHECK(88);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, D3D11Pipe::View &el)
{
SERIALISE_MEMBER(viewResourceId);
SERIALISE_MEMBER(resourceResourceId);
SERIALISE_MEMBER(counterResourceId);
SERIALISE_MEMBER(type);
SERIALISE_MEMBER(viewFormat);
SERIALISE_MEMBER(structured);
SERIALISE_MEMBER(bufferStructCount);
SERIALISE_MEMBER(elementByteSize);
SERIALISE_MEMBER(firstElement);
SERIALISE_MEMBER(numElements);
SERIALISE_MEMBER(bufferFlags);
SERIALISE_MEMBER(firstMip);
SERIALISE_MEMBER(numMips);
SERIALISE_MEMBER(firstSlice);
SERIALISE_MEMBER(numSlices);
SIZE_CHECK(72);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, D3D11Pipe::Shader &el)
{
@@ -1387,7 +1363,7 @@ void DoSerialise(SerialiserType &ser, D3D11Pipe::OutputMerger &el)
SERIALISE_MEMBER(depthReadOnly);
SERIALISE_MEMBER(stencilReadOnly);
SIZE_CHECK(248);
SIZE_CHECK(256);
}
template <typename SerialiserType>
@@ -1423,7 +1399,7 @@ void DoSerialise(SerialiserType &ser, D3D11Pipe::State &el)
SERIALISE_MEMBER(predication);
SIZE_CHECK(784);
SIZE_CHECK(792);
}
#pragma endregion D3D11 pipeline state
@@ -1479,35 +1455,6 @@ void DoSerialise(SerialiserType &ser, D3D12Pipe::InputAssembly &el)
SIZE_CHECK(80);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, D3D12Pipe::View &el)
{
SERIALISE_MEMBER(bind);
SERIALISE_MEMBER(tableIndex);
SERIALISE_MEMBER(resourceId);
SERIALISE_MEMBER(type);
SERIALISE_MEMBER(viewFormat);
SERIALISE_MEMBER(swizzle);
SERIALISE_MEMBER(dynamicallyUsed);
SERIALISE_MEMBER(bufferFlags);
SERIALISE_MEMBER(bufferStructCount);
SERIALISE_MEMBER(elementByteSize);
SERIALISE_MEMBER(firstElement);
SERIALISE_MEMBER(numElements);
SERIALISE_MEMBER(counterResourceId);
SERIALISE_MEMBER(counterByteOffset);
SERIALISE_MEMBER(firstMip);
SERIALISE_MEMBER(numMips);
SERIALISE_MEMBER(firstSlice);
SERIALISE_MEMBER(numSlices);
SERIALISE_MEMBER(minLODClamp);
SIZE_CHECK(72);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, D3D12Pipe::Shader &el)
{
@@ -1612,7 +1559,7 @@ void DoSerialise(SerialiserType &ser, D3D12Pipe::OM &el)
SERIALISE_MEMBER(multiSampleCount);
SERIALISE_MEMBER(multiSampleQuality);
SIZE_CHECK(232);
SIZE_CHECK(240);
}
template <typename SerialiserType>
@@ -1658,7 +1605,7 @@ void DoSerialise(SerialiserType &ser, D3D12Pipe::State &el)
SERIALISE_MEMBER(resourceStates);
SIZE_CHECK(720);
SIZE_CHECK(728);
}
#pragma endregion D3D12 pipeline state
@@ -1821,18 +1768,6 @@ void DoSerialise(SerialiserType &ser, GLPipe::StencilState &el)
SIZE_CHECK(60);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, GLPipe::Attachment &el)
{
SERIALISE_MEMBER(resourceId);
SERIALISE_MEMBER(slice);
SERIALISE_MEMBER(numSlices);
SERIALISE_MEMBER(mipLevel);
SERIALISE_MEMBER(swizzle);
SIZE_CHECK(24);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, GLPipe::FBO &el)
{
@@ -1843,7 +1778,7 @@ void DoSerialise(SerialiserType &ser, GLPipe::FBO &el)
SERIALISE_MEMBER(drawBuffers);
SERIALISE_MEMBER(readBuffer);
SIZE_CHECK(112);
SIZE_CHECK(224);
}
template <typename SerialiserType>
@@ -1864,7 +1799,7 @@ void DoSerialise(SerialiserType &ser, GLPipe::FrameBuffer &el)
SERIALISE_MEMBER(readFBO);
SERIALISE_MEMBER(blendState);
SIZE_CHECK(272);
SIZE_CHECK(496);
}
template <typename SerialiserType>
@@ -1911,7 +1846,7 @@ void DoSerialise(SerialiserType &ser, GLPipe::State &el)
SERIALISE_MEMBER(hints);
SIZE_CHECK(1128);
SIZE_CHECK(1352);
}
#pragma endregion OpenGL pipeline state
@@ -2188,23 +2123,6 @@ void DoSerialise(SerialiserType &ser, VKPipe::RenderPass &el)
SIZE_CHECK(168);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, VKPipe::Attachment &el)
{
SERIALISE_MEMBER(viewResourceId);
SERIALISE_MEMBER(imageResourceId);
SERIALISE_MEMBER(viewFormat);
SERIALISE_MEMBER(swizzle);
SERIALISE_MEMBER(firstMip);
SERIALISE_MEMBER(firstSlice);
SERIALISE_MEMBER(numMips);
SERIALISE_MEMBER(numSlices);
SIZE_CHECK(48);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, VKPipe::Framebuffer &el)
{
@@ -2379,14 +2297,12 @@ INSTANTIATE_SERIALISE_TYPE(DescriptorAccess)
INSTANTIATE_SERIALISE_TYPE(DescriptorLogicalLocation)
INSTANTIATE_SERIALISE_TYPE(D3D11Pipe::Layout)
INSTANTIATE_SERIALISE_TYPE(D3D11Pipe::InputAssembly)
INSTANTIATE_SERIALISE_TYPE(D3D11Pipe::View)
INSTANTIATE_SERIALISE_TYPE(D3D11Pipe::Shader)
INSTANTIATE_SERIALISE_TYPE(D3D11Pipe::Rasterizer)
INSTANTIATE_SERIALISE_TYPE(D3D11Pipe::OutputMerger)
INSTANTIATE_SERIALISE_TYPE(D3D11Pipe::State)
INSTANTIATE_SERIALISE_TYPE(D3D12Pipe::Layout)
INSTANTIATE_SERIALISE_TYPE(D3D12Pipe::InputAssembly)
INSTANTIATE_SERIALISE_TYPE(D3D12Pipe::View)
INSTANTIATE_SERIALISE_TYPE(D3D12Pipe::Shader)
INSTANTIATE_SERIALISE_TYPE(D3D12Pipe::Rasterizer)
INSTANTIATE_SERIALISE_TYPE(D3D12Pipe::OM)
@@ -2400,7 +2316,6 @@ INSTANTIATE_SERIALISE_TYPE(GLPipe::Rasterizer)
INSTANTIATE_SERIALISE_TYPE(GLPipe::DepthState)
INSTANTIATE_SERIALISE_TYPE(GLPipe::StencilState)
INSTANTIATE_SERIALISE_TYPE(GLPipe::BlendState)
INSTANTIATE_SERIALISE_TYPE(GLPipe::Attachment)
INSTANTIATE_SERIALISE_TYPE(GLPipe::FrameBuffer)
INSTANTIATE_SERIALISE_TYPE(GLPipe::State)
INSTANTIATE_SERIALISE_TYPE(VKPipe::DescriptorSet)
@@ -2410,7 +2325,6 @@ INSTANTIATE_SERIALISE_TYPE(VKPipe::VertexInput)
INSTANTIATE_SERIALISE_TYPE(VKPipe::Shader)
INSTANTIATE_SERIALISE_TYPE(VKPipe::ViewState)
INSTANTIATE_SERIALISE_TYPE(VKPipe::ColorBlendState)
INSTANTIATE_SERIALISE_TYPE(VKPipe::Attachment)
INSTANTIATE_SERIALISE_TYPE(VKPipe::DepthStencil)
INSTANTIATE_SERIALISE_TYPE(VKPipe::CurrentPass)
INSTANTIATE_SERIALISE_TYPE(VKPipe::ImageLayout)