mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-25 07:56:33 +00:00
Add wrapper struct TextureSwizzle4 to be more swig-friendly
* Swig doesn't like having fixed C arrays of enums, so wrap it in a struct to make it more clear.
This commit is contained in:
@@ -708,6 +708,16 @@ void D3D12PipelineStateViewer::addResourceRow(const D3D12ViewTag &view,
|
||||
format = tex->format.Name();
|
||||
typeName = ToQStr(tex->type);
|
||||
|
||||
if(r.swizzle.red != TextureSwizzle::Red || r.swizzle.green != TextureSwizzle::Green ||
|
||||
r.swizzle.blue != TextureSwizzle::Blue || r.swizzle.alpha != TextureSwizzle::Alpha)
|
||||
{
|
||||
format += tr(" swizzle[%1%2%3%4]")
|
||||
.arg(ToQStr(r.swizzle.red))
|
||||
.arg(ToQStr(r.swizzle.green))
|
||||
.arg(ToQStr(r.swizzle.blue))
|
||||
.arg(ToQStr(r.swizzle.alpha));
|
||||
}
|
||||
|
||||
if(tex->type == TextureType::Texture2DMS || tex->type == TextureType::Texture2DMSArray)
|
||||
{
|
||||
typeName += QFormatStr(" %1x").arg(tex->msSamp);
|
||||
@@ -2241,14 +2251,14 @@ QVariantList D3D12PipelineStateViewer::exportViewHTML(const D3D12Pipe::View &vie
|
||||
viewType = ToQStr(view.type);
|
||||
typeName = ToQStr(tex->type);
|
||||
|
||||
if(view.swizzle[0] != TextureSwizzle::Red || view.swizzle[1] != TextureSwizzle::Green ||
|
||||
view.swizzle[2] != TextureSwizzle::Blue || view.swizzle[3] != TextureSwizzle::Alpha)
|
||||
if(view.swizzle.red != TextureSwizzle::Red || view.swizzle.green != TextureSwizzle::Green ||
|
||||
view.swizzle.blue != TextureSwizzle::Blue || view.swizzle.alpha != TextureSwizzle::Alpha)
|
||||
{
|
||||
format += tr(" swizzle[%1%2%3%4]")
|
||||
.arg(ToQStr(view.swizzle[0]))
|
||||
.arg(ToQStr(view.swizzle[1]))
|
||||
.arg(ToQStr(view.swizzle[2]))
|
||||
.arg(ToQStr(view.swizzle[3]));
|
||||
.arg(ToQStr(view.swizzle.red))
|
||||
.arg(ToQStr(view.swizzle.green))
|
||||
.arg(ToQStr(view.swizzle.blue))
|
||||
.arg(ToQStr(view.swizzle.alpha));
|
||||
}
|
||||
|
||||
if(tex->mips > 1)
|
||||
|
||||
@@ -754,14 +754,14 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, RDLabel
|
||||
else if(r.depthReadChannel == 1)
|
||||
format += tr(" Stencil-Read");
|
||||
}
|
||||
else if(r.swizzle[0] != TextureSwizzle::Red || r.swizzle[1] != TextureSwizzle::Green ||
|
||||
r.swizzle[2] != TextureSwizzle::Blue || r.swizzle[3] != TextureSwizzle::Alpha)
|
||||
else if(r.swizzle.red != TextureSwizzle::Red || r.swizzle.green != TextureSwizzle::Green ||
|
||||
r.swizzle.blue != TextureSwizzle::Blue || r.swizzle.alpha != TextureSwizzle::Alpha)
|
||||
{
|
||||
format += tr(" swizzle[%1%2%3%4]")
|
||||
.arg(ToQStr(r.swizzle[0]))
|
||||
.arg(ToQStr(r.swizzle[1]))
|
||||
.arg(ToQStr(r.swizzle[2]))
|
||||
.arg(ToQStr(r.swizzle[3]));
|
||||
.arg(ToQStr(r.swizzle.red))
|
||||
.arg(ToQStr(r.swizzle.green))
|
||||
.arg(ToQStr(r.swizzle.blue))
|
||||
.arg(ToQStr(r.swizzle.alpha));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1838,14 +1838,15 @@ void GLPipelineStateViewer::setState()
|
||||
format += lit(" (GL_FRAMEBUFFER_SRGB = 0)");
|
||||
}
|
||||
|
||||
if(r && (r->swizzle[0] != TextureSwizzle::Red || r->swizzle[1] != TextureSwizzle::Green ||
|
||||
r->swizzle[2] != TextureSwizzle::Blue || r->swizzle[3] != TextureSwizzle::Alpha))
|
||||
if(r &&
|
||||
(r->swizzle.red != TextureSwizzle::Red || r->swizzle.green != TextureSwizzle::Green ||
|
||||
r->swizzle.blue != TextureSwizzle::Blue || r->swizzle.alpha != TextureSwizzle::Alpha))
|
||||
{
|
||||
format += tr(" swizzle[%1%2%3%4]")
|
||||
.arg(ToQStr(r->swizzle[0]))
|
||||
.arg(ToQStr(r->swizzle[1]))
|
||||
.arg(ToQStr(r->swizzle[2]))
|
||||
.arg(ToQStr(r->swizzle[3]));
|
||||
.arg(ToQStr(r->swizzle.red))
|
||||
.arg(ToQStr(r->swizzle.green))
|
||||
.arg(ToQStr(r->swizzle.blue))
|
||||
.arg(ToQStr(r->swizzle.alpha));
|
||||
}
|
||||
|
||||
QString slotname = QString::number(i);
|
||||
@@ -2658,14 +2659,14 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Shad
|
||||
else if(r.depthReadChannel == 1)
|
||||
format += tr(" Stencil-Read");
|
||||
}
|
||||
else if(r.swizzle[0] != TextureSwizzle::Red || r.swizzle[1] != TextureSwizzle::Green ||
|
||||
r.swizzle[2] != TextureSwizzle::Blue || r.swizzle[3] != TextureSwizzle::Alpha)
|
||||
else if(r.swizzle.red != TextureSwizzle::Red || r.swizzle.green != TextureSwizzle::Green ||
|
||||
r.swizzle.blue != TextureSwizzle::Blue || r.swizzle.alpha != TextureSwizzle::Alpha)
|
||||
{
|
||||
format += QFormatStr(" swizzle[%1%2%3%4]")
|
||||
.arg(ToQStr(r.swizzle[0]))
|
||||
.arg(ToQStr(r.swizzle[1]))
|
||||
.arg(ToQStr(r.swizzle[2]))
|
||||
.arg(ToQStr(r.swizzle[3]));
|
||||
.arg(ToQStr(r.swizzle.red))
|
||||
.arg(ToQStr(r.swizzle.green))
|
||||
.arg(ToQStr(r.swizzle.blue))
|
||||
.arg(ToQStr(r.swizzle.alpha));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -845,16 +845,16 @@ QVariantList VulkanPipelineStateViewer::makeSampler(const QString &bindset, cons
|
||||
{
|
||||
obj += lit(" ") + ToQStr(descriptor.ycbcrSampler);
|
||||
|
||||
if(descriptor.ycbcrSwizzle[0] != TextureSwizzle::Red ||
|
||||
descriptor.ycbcrSwizzle[1] != TextureSwizzle::Green ||
|
||||
descriptor.ycbcrSwizzle[2] != TextureSwizzle::Blue ||
|
||||
descriptor.ycbcrSwizzle[3] != TextureSwizzle::Alpha)
|
||||
if(descriptor.ycbcrSwizzle.red != TextureSwizzle::Red ||
|
||||
descriptor.ycbcrSwizzle.green != TextureSwizzle::Green ||
|
||||
descriptor.ycbcrSwizzle.blue != TextureSwizzle::Blue ||
|
||||
descriptor.ycbcrSwizzle.alpha != TextureSwizzle::Alpha)
|
||||
{
|
||||
obj += tr(" swizzle[%1%2%3%4]")
|
||||
.arg(ToQStr(descriptor.swizzle[0]))
|
||||
.arg(ToQStr(descriptor.swizzle[1]))
|
||||
.arg(ToQStr(descriptor.swizzle[2]))
|
||||
.arg(ToQStr(descriptor.swizzle[3]));
|
||||
.arg(ToQStr(descriptor.swizzle.red))
|
||||
.arg(ToQStr(descriptor.swizzle.green))
|
||||
.arg(ToQStr(descriptor.swizzle.blue))
|
||||
.arg(ToQStr(descriptor.swizzle.alpha));
|
||||
}
|
||||
|
||||
filter +=
|
||||
@@ -1237,16 +1237,16 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails,
|
||||
else
|
||||
dim = QFormatStr("%1x%2").arg(w).arg(h);
|
||||
|
||||
if(descriptorBind->swizzle[0] != TextureSwizzle::Red ||
|
||||
descriptorBind->swizzle[1] != TextureSwizzle::Green ||
|
||||
descriptorBind->swizzle[2] != TextureSwizzle::Blue ||
|
||||
descriptorBind->swizzle[3] != TextureSwizzle::Alpha)
|
||||
if(descriptorBind->swizzle.red != TextureSwizzle::Red ||
|
||||
descriptorBind->swizzle.green != TextureSwizzle::Green ||
|
||||
descriptorBind->swizzle.blue != TextureSwizzle::Blue ||
|
||||
descriptorBind->swizzle.alpha != TextureSwizzle::Alpha)
|
||||
{
|
||||
format += tr(" swizzle[%1%2%3%4]")
|
||||
.arg(ToQStr(descriptorBind->swizzle[0]))
|
||||
.arg(ToQStr(descriptorBind->swizzle[1]))
|
||||
.arg(ToQStr(descriptorBind->swizzle[2]))
|
||||
.arg(ToQStr(descriptorBind->swizzle[3]));
|
||||
.arg(ToQStr(descriptorBind->swizzle.red))
|
||||
.arg(ToQStr(descriptorBind->swizzle.green))
|
||||
.arg(ToQStr(descriptorBind->swizzle.blue))
|
||||
.arg(ToQStr(descriptorBind->swizzle.alpha));
|
||||
}
|
||||
|
||||
if(restype == TextureType::Texture1DArray || restype == TextureType::Texture2DArray ||
|
||||
@@ -2334,14 +2334,14 @@ void VulkanPipelineStateViewer::setState()
|
||||
typeName = ToQStr(tex->type);
|
||||
}
|
||||
|
||||
if(p.swizzle[0] != TextureSwizzle::Red || p.swizzle[1] != TextureSwizzle::Green ||
|
||||
p.swizzle[2] != TextureSwizzle::Blue || p.swizzle[3] != TextureSwizzle::Alpha)
|
||||
if(p.swizzle.red != TextureSwizzle::Red || p.swizzle.green != TextureSwizzle::Green ||
|
||||
p.swizzle.blue != TextureSwizzle::Blue || p.swizzle.alpha != TextureSwizzle::Alpha)
|
||||
{
|
||||
format += tr(" swizzle[%1%2%3%4]")
|
||||
.arg(ToQStr(p.swizzle[0]))
|
||||
.arg(ToQStr(p.swizzle[1]))
|
||||
.arg(ToQStr(p.swizzle[2]))
|
||||
.arg(ToQStr(p.swizzle[3]));
|
||||
.arg(ToQStr(p.swizzle.red))
|
||||
.arg(ToQStr(p.swizzle.green))
|
||||
.arg(ToQStr(p.swizzle.blue))
|
||||
.arg(ToQStr(p.swizzle.alpha));
|
||||
}
|
||||
|
||||
QString slotname;
|
||||
|
||||
@@ -194,8 +194,7 @@ struct View
|
||||
bool operator==(const View &o) const
|
||||
{
|
||||
return bind == o.bind && tableIndex == o.tableIndex && resourceId == o.resourceId &&
|
||||
type == o.type && viewFormat == o.viewFormat && swizzle[0] == o.swizzle[0] &&
|
||||
swizzle[1] == o.swizzle[1] && swizzle[2] == o.swizzle[2] && swizzle[3] == o.swizzle[3] &&
|
||||
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 &&
|
||||
@@ -214,14 +213,8 @@ struct View
|
||||
return type < o.type;
|
||||
if(!(viewFormat == o.viewFormat))
|
||||
return viewFormat < o.viewFormat;
|
||||
if(!(swizzle[0] == o.swizzle[0]))
|
||||
return swizzle[0] < o.swizzle[0];
|
||||
if(!(swizzle[1] == o.swizzle[1]))
|
||||
return swizzle[1] < o.swizzle[1];
|
||||
if(!(swizzle[2] == o.swizzle[2]))
|
||||
return swizzle[2] < o.swizzle[2];
|
||||
if(!(swizzle[3] == o.swizzle[3]))
|
||||
return swizzle[3] < o.swizzle[3];
|
||||
if(!(swizzle == o.swizzle))
|
||||
return swizzle < o.swizzle;
|
||||
if(!(bufferFlags == o.bufferFlags))
|
||||
return bufferFlags < o.bufferFlags;
|
||||
if(!(bufferStructCount == o.bufferStructCount))
|
||||
@@ -258,9 +251,8 @@ struct View
|
||||
DOCUMENT("The :class:`ResourceFormat` that the view uses.");
|
||||
ResourceFormat viewFormat;
|
||||
|
||||
DOCUMENT("Four :class:`TextureSwizzle` elements indicating the swizzle applied to this texture.");
|
||||
TextureSwizzle swizzle[4] = {TextureSwizzle::Red, TextureSwizzle::Green, TextureSwizzle::Blue,
|
||||
TextureSwizzle::Alpha};
|
||||
DOCUMENT("A :class:`TextureSwizzle4` indicating the swizzle applied to this texture.");
|
||||
TextureSwizzle4 swizzle;
|
||||
DOCUMENT("The :class:`D3DBufferViewFlags` set for the buffer.");
|
||||
D3DBufferViewFlags bufferFlags = D3DBufferViewFlags::NoFlags;
|
||||
DOCUMENT("If the view has a hidden counter, this stores the current value of the counter.");
|
||||
|
||||
@@ -424,6 +424,43 @@ struct TextureFilter
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(TextureFilter);
|
||||
|
||||
DOCUMENT("The four components of a texture swizzle.");
|
||||
struct TextureSwizzle4
|
||||
{
|
||||
DOCUMENT("");
|
||||
TextureSwizzle4() = default;
|
||||
TextureSwizzle4(const TextureSwizzle4 &) = default;
|
||||
TextureSwizzle4 &operator=(const TextureSwizzle4 &) = default;
|
||||
|
||||
bool operator==(const TextureSwizzle4 &o) const
|
||||
{
|
||||
return red == o.red && green == o.green && blue == o.blue && alpha == o.alpha;
|
||||
}
|
||||
bool operator<(const TextureSwizzle4 &o) const
|
||||
{
|
||||
if(!(red == o.red))
|
||||
return red < o.red;
|
||||
if(!(green == o.green))
|
||||
return green < o.green;
|
||||
if(!(blue == o.blue))
|
||||
return blue < o.blue;
|
||||
if(!(alpha == o.alpha))
|
||||
return alpha < o.alpha;
|
||||
return false;
|
||||
}
|
||||
|
||||
DOCUMENT("The red channel's :class:`TextureSwizzle`.");
|
||||
TextureSwizzle red;
|
||||
DOCUMENT("The green channel's :class:`TextureSwizzle`.");
|
||||
TextureSwizzle green;
|
||||
DOCUMENT("The blue channel's :class:`TextureSwizzle`.");
|
||||
TextureSwizzle blue;
|
||||
DOCUMENT("The alpha channel's :class:`TextureSwizzle`.");
|
||||
TextureSwizzle alpha;
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(TextureSwizzle4);
|
||||
|
||||
DOCUMENT("A description of any type of resource.");
|
||||
struct ResourceDescription
|
||||
{
|
||||
|
||||
@@ -218,9 +218,7 @@ struct Texture
|
||||
bool operator==(const Texture &o) const
|
||||
{
|
||||
return resourceId == o.resourceId && firstMip == o.firstMip && numMips == o.numMips &&
|
||||
type == o.type && swizzle[0] == o.swizzle[0] && swizzle[1] == o.swizzle[1] &&
|
||||
swizzle[2] == o.swizzle[2] && swizzle[3] == o.swizzle[3] &&
|
||||
depthReadChannel == o.depthReadChannel;
|
||||
type == o.type && swizzle == o.swizzle && depthReadChannel == o.depthReadChannel;
|
||||
}
|
||||
bool operator<(const Texture &o) const
|
||||
{
|
||||
@@ -232,14 +230,8 @@ struct Texture
|
||||
return numMips < o.numMips;
|
||||
if(!(type == o.type))
|
||||
return type < o.type;
|
||||
if(!(swizzle[0] == o.swizzle[0]))
|
||||
return swizzle[0] < o.swizzle[0];
|
||||
if(!(swizzle[1] == o.swizzle[1]))
|
||||
return swizzle[1] < o.swizzle[1];
|
||||
if(!(swizzle[2] == o.swizzle[2]))
|
||||
return swizzle[2] < o.swizzle[2];
|
||||
if(!(swizzle[3] == o.swizzle[3]))
|
||||
return swizzle[3] < o.swizzle[3];
|
||||
if(!(swizzle == o.swizzle))
|
||||
return swizzle < o.swizzle;
|
||||
if(!(depthReadChannel == o.depthReadChannel))
|
||||
return depthReadChannel < o.depthReadChannel;
|
||||
return false;
|
||||
@@ -253,9 +245,8 @@ struct Texture
|
||||
DOCUMENT("The :class:`TextureType` of the texture.");
|
||||
TextureType type = TextureType::Unknown;
|
||||
|
||||
DOCUMENT("Four :class:`TextureSwizzle` elements indicating the swizzle applied to this texture.");
|
||||
TextureSwizzle swizzle[4] = {TextureSwizzle::Red, TextureSwizzle::Green, TextureSwizzle::Blue,
|
||||
TextureSwizzle::Alpha};
|
||||
DOCUMENT("A :class:`TextureSwizzle4` indicating the swizzle applied to this texture.");
|
||||
TextureSwizzle4 swizzle;
|
||||
DOCUMENT(R"(The channel to read from in a depth-stencil texture.
|
||||
|
||||
``-1`` for non depth-stencil textures.
|
||||
@@ -601,8 +592,7 @@ struct Attachment
|
||||
bool operator==(const Attachment &o) const
|
||||
{
|
||||
return resourceId == o.resourceId && slice == o.slice && mipLevel == o.mipLevel &&
|
||||
swizzle[0] == o.swizzle[0] && swizzle[1] == o.swizzle[1] && swizzle[2] == o.swizzle[2] &&
|
||||
swizzle[3] == o.swizzle[3];
|
||||
swizzle == o.swizzle;
|
||||
}
|
||||
bool operator<(const Attachment &o) const
|
||||
{
|
||||
@@ -612,14 +602,8 @@ struct Attachment
|
||||
return slice < o.slice;
|
||||
if(!(mipLevel == o.mipLevel))
|
||||
return mipLevel < o.mipLevel;
|
||||
if(!(swizzle[0] == o.swizzle[0]))
|
||||
return swizzle[0] < o.swizzle[0];
|
||||
if(!(swizzle[1] == o.swizzle[1]))
|
||||
return swizzle[1] < o.swizzle[1];
|
||||
if(!(swizzle[2] == o.swizzle[2]))
|
||||
return swizzle[2] < o.swizzle[2];
|
||||
if(!(swizzle[3] == o.swizzle[3]))
|
||||
return swizzle[3] < o.swizzle[3];
|
||||
if(!(swizzle == o.swizzle))
|
||||
return swizzle < o.swizzle;
|
||||
return false;
|
||||
}
|
||||
DOCUMENT("The :class:`ResourceId` of the texture bound to this attachment.");
|
||||
@@ -628,9 +612,8 @@ struct Attachment
|
||||
uint32_t slice = 0;
|
||||
DOCUMENT("The mip of the texture that's used in the attachment.");
|
||||
uint32_t mipLevel = 0;
|
||||
DOCUMENT("Four :class:`TextureSwizzle` elements indicating the swizzle applied to this texture.");
|
||||
TextureSwizzle swizzle[4] = {TextureSwizzle::Red, TextureSwizzle::Green, TextureSwizzle::Blue,
|
||||
TextureSwizzle::Alpha};
|
||||
DOCUMENT("A :class:`TextureSwizzle4` indicating the swizzle applied to this texture.");
|
||||
TextureSwizzle4 swizzle;
|
||||
};
|
||||
|
||||
DOCUMENT("Describes the contents of a framebuffer object.");
|
||||
|
||||
@@ -41,8 +41,7 @@ struct BindingElement
|
||||
return dynamicallyUsed == o.dynamicallyUsed && viewResourceId == o.viewResourceId &&
|
||||
resourceResourceId == o.resourceResourceId && samplerResourceId == o.samplerResourceId &&
|
||||
immutableSampler == o.immutableSampler && viewFormat == o.viewFormat &&
|
||||
swizzle[0] == o.swizzle[0] && swizzle[1] == o.swizzle[1] && swizzle[2] == o.swizzle[2] &&
|
||||
swizzle[3] == o.swizzle[3] && firstMip == o.firstMip && firstSlice == o.firstSlice &&
|
||||
swizzle == o.swizzle && firstMip == o.firstMip && firstSlice == o.firstSlice &&
|
||||
numMips == o.numMips && numSlices == o.numSlices && byteOffset == o.byteOffset &&
|
||||
byteSize == o.byteSize && filter == o.filter && addressU == o.addressU &&
|
||||
addressV == o.addressV && addressW == o.addressW && mipBias == o.mipBias &&
|
||||
@@ -65,14 +64,8 @@ struct BindingElement
|
||||
return immutableSampler < o.immutableSampler;
|
||||
if(!(viewFormat == o.viewFormat))
|
||||
return viewFormat < o.viewFormat;
|
||||
if(!(swizzle[0] == o.swizzle[0]))
|
||||
return swizzle[0] < o.swizzle[0];
|
||||
if(!(swizzle[1] == o.swizzle[1]))
|
||||
return swizzle[1] < o.swizzle[1];
|
||||
if(!(swizzle[2] == o.swizzle[2]))
|
||||
return swizzle[2] < o.swizzle[2];
|
||||
if(!(swizzle[3] == o.swizzle[3]))
|
||||
return swizzle[3] < o.swizzle[3];
|
||||
if(!(swizzle == o.swizzle))
|
||||
return swizzle < o.swizzle;
|
||||
if(!(firstMip == o.firstMip))
|
||||
return firstMip < o.firstMip;
|
||||
if(!(firstSlice == o.firstSlice))
|
||||
@@ -136,9 +129,8 @@ since single descriptors may only be dynamically skipped by control flow.
|
||||
|
||||
DOCUMENT("The :class:`ResourceFormat` that the view uses.");
|
||||
ResourceFormat viewFormat;
|
||||
DOCUMENT("Four :class:`TextureSwizzle` elements indicating the swizzle applied to this texture.");
|
||||
TextureSwizzle swizzle[4] = {TextureSwizzle::Red, TextureSwizzle::Green, TextureSwizzle::Blue,
|
||||
TextureSwizzle::Alpha};
|
||||
DOCUMENT("A :class:`TextureSwizzle4` indicating the swizzle applied to this texture.");
|
||||
TextureSwizzle4 swizzle;
|
||||
|
||||
DOCUMENT("For textures - the first mip level used in the view.");
|
||||
uint32_t firstMip = 0;
|
||||
@@ -187,10 +179,10 @@ this sampler.
|
||||
YcbcrConversion ycbcrModel;
|
||||
DOCUMENT("For ycbcr samplers - the :class:`YcbcrRange` used for conversion.");
|
||||
YcbcrRange ycbcrRange;
|
||||
DOCUMENT(R"(For ycbcr samplers - Four :class:`TextureSwizzle` elements indicating the swizzle
|
||||
applied before conversion.
|
||||
DOCUMENT(R"(For ycbcr samplers - A :class:`TextureSwizzle4` indicating the swizzle applied before
|
||||
conversion.
|
||||
)");
|
||||
TextureSwizzle ycbcrSwizzle[4];
|
||||
TextureSwizzle4 ycbcrSwizzle;
|
||||
DOCUMENT("For ycbcr samplers - the :class:`ChromaSampleLocation` X-axis chroma offset.");
|
||||
ChromaSampleLocation xChromaOffset;
|
||||
DOCUMENT("For ycbcr samplers - the :class:`ChromaSampleLocation` Y-axis chroma offset.");
|
||||
@@ -887,8 +879,7 @@ struct Attachment
|
||||
bool operator==(const Attachment &o) const
|
||||
{
|
||||
return viewResourceId == o.viewResourceId && imageResourceId == o.imageResourceId &&
|
||||
viewFormat == o.viewFormat && swizzle[0] == o.swizzle[0] && swizzle[1] == o.swizzle[1] &&
|
||||
swizzle[2] == o.swizzle[2] && swizzle[3] == o.swizzle[3] && firstMip == o.firstMip &&
|
||||
viewFormat == o.viewFormat && swizzle == o.swizzle && firstMip == o.firstMip &&
|
||||
firstSlice == o.firstSlice && numMips == o.numMips && numSlices == o.numSlices;
|
||||
}
|
||||
bool operator<(const Attachment &o) const
|
||||
@@ -899,14 +890,8 @@ struct Attachment
|
||||
return imageResourceId < o.imageResourceId;
|
||||
if(!(viewFormat == o.viewFormat))
|
||||
return viewFormat < o.viewFormat;
|
||||
if(!(swizzle[0] == o.swizzle[0]))
|
||||
return swizzle[0] < o.swizzle[0];
|
||||
if(!(swizzle[1] == o.swizzle[1]))
|
||||
return swizzle[1] < o.swizzle[1];
|
||||
if(!(swizzle[2] == o.swizzle[2]))
|
||||
return swizzle[2] < o.swizzle[2];
|
||||
if(!(swizzle[3] == o.swizzle[3]))
|
||||
return swizzle[3] < o.swizzle[3];
|
||||
if(!(swizzle == o.swizzle))
|
||||
return swizzle < o.swizzle;
|
||||
if(!(firstMip == o.firstMip))
|
||||
return firstMip < o.firstMip;
|
||||
if(!(firstSlice == o.firstSlice))
|
||||
@@ -924,9 +909,8 @@ struct Attachment
|
||||
|
||||
DOCUMENT("The :class:`ResourceFormat` that the view uses.");
|
||||
ResourceFormat viewFormat;
|
||||
DOCUMENT("Four :class:`TextureSwizzle` elements indicating the swizzle applied to this texture.");
|
||||
TextureSwizzle swizzle[4] = {TextureSwizzle::Red, TextureSwizzle::Green, TextureSwizzle::Blue,
|
||||
TextureSwizzle::Alpha};
|
||||
DOCUMENT("A :class:`TextureSwizzle4` indicating the swizzle applied to this texture.");
|
||||
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.");
|
||||
|
||||
@@ -735,13 +735,13 @@ void D3D12Replay::FillResourceView(D3D12Pipe::View &view, const D3D12Descriptor
|
||||
|
||||
view.type = MakeTextureDim(srv.ViewDimension);
|
||||
|
||||
view.swizzle[0] =
|
||||
view.swizzle.red =
|
||||
(TextureSwizzle)D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(0, srv.Shader4ComponentMapping);
|
||||
view.swizzle[1] =
|
||||
view.swizzle.green =
|
||||
(TextureSwizzle)D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(1, srv.Shader4ComponentMapping);
|
||||
view.swizzle[2] =
|
||||
view.swizzle.blue =
|
||||
(TextureSwizzle)D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(2, srv.Shader4ComponentMapping);
|
||||
view.swizzle[3] =
|
||||
view.swizzle.alpha =
|
||||
(TextureSwizzle)D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(3, srv.Shader4ComponentMapping);
|
||||
|
||||
if(srv.ViewDimension == D3D12_SRV_DIMENSION_BUFFER)
|
||||
|
||||
@@ -1751,6 +1751,20 @@ BlendOperation MakeBlendOp(GLenum op)
|
||||
return BlendOperation::Add;
|
||||
}
|
||||
|
||||
TextureSwizzle MakeSwizzle(GLenum s)
|
||||
{
|
||||
switch(s)
|
||||
{
|
||||
default:
|
||||
case GL_ZERO: return TextureSwizzle::Zero;
|
||||
case GL_ONE: return TextureSwizzle::One;
|
||||
case eGL_RED: return TextureSwizzle::Red;
|
||||
case eGL_GREEN: return TextureSwizzle::Green;
|
||||
case eGL_BLUE: return TextureSwizzle::Blue;
|
||||
case eGL_ALPHA: return TextureSwizzle::Alpha;
|
||||
}
|
||||
}
|
||||
|
||||
ResourceFormat MakeResourceFormat(GLenum target, GLenum fmt)
|
||||
{
|
||||
ResourceFormat ret;
|
||||
|
||||
@@ -576,6 +576,7 @@ StencilOperation MakeStencilOp(GLenum op);
|
||||
LogicOperation MakeLogicOp(GLenum op);
|
||||
BlendMultiplier MakeBlendMultiplier(GLenum blend);
|
||||
BlendOperation MakeBlendOp(GLenum op);
|
||||
TextureSwizzle MakeSwizzle(GLenum s);
|
||||
|
||||
void ClearGLErrors();
|
||||
|
||||
|
||||
@@ -1257,10 +1257,10 @@ void GLReplay::SavePipelineState(uint32_t eventId)
|
||||
pipe.textures[unit].numMips = 1;
|
||||
pipe.textures[unit].type = TextureType::Unknown;
|
||||
pipe.textures[unit].depthReadChannel = -1;
|
||||
pipe.textures[unit].swizzle[0] = TextureSwizzle::Red;
|
||||
pipe.textures[unit].swizzle[1] = TextureSwizzle::Green;
|
||||
pipe.textures[unit].swizzle[2] = TextureSwizzle::Blue;
|
||||
pipe.textures[unit].swizzle[3] = TextureSwizzle::Alpha;
|
||||
pipe.textures[unit].swizzle.red = TextureSwizzle::Red;
|
||||
pipe.textures[unit].swizzle.green = TextureSwizzle::Green;
|
||||
pipe.textures[unit].swizzle.blue = TextureSwizzle::Blue;
|
||||
pipe.textures[unit].swizzle.alpha = TextureSwizzle::Alpha;
|
||||
|
||||
RDCEraseEl(pipe.samplers[unit].borderColor);
|
||||
pipe.samplers[unit].addressS = AddressMode::Wrap;
|
||||
@@ -1310,24 +1310,15 @@ void GLReplay::SavePipelineState(uint32_t eventId)
|
||||
pipe.textures[unit].depthReadChannel = 1;
|
||||
}
|
||||
|
||||
GLint swizzles[4] = {eGL_RED, eGL_GREEN, eGL_BLUE, eGL_ALPHA};
|
||||
GLenum swizzles[4] = {eGL_RED, eGL_GREEN, eGL_BLUE, eGL_ALPHA};
|
||||
if(target != eGL_TEXTURE_BUFFER &&
|
||||
(HasExt[ARB_texture_swizzle] || HasExt[EXT_texture_swizzle]))
|
||||
GetTextureSwizzle(tex, target, (GLenum *)swizzles);
|
||||
GetTextureSwizzle(tex, target, swizzles);
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
switch(swizzles[i])
|
||||
{
|
||||
default:
|
||||
case GL_ZERO: pipe.textures[unit].swizzle[i] = TextureSwizzle::Zero; break;
|
||||
case GL_ONE: pipe.textures[unit].swizzle[i] = TextureSwizzle::One; break;
|
||||
case eGL_RED: pipe.textures[unit].swizzle[i] = TextureSwizzle::Red; break;
|
||||
case eGL_GREEN: pipe.textures[unit].swizzle[i] = TextureSwizzle::Green; break;
|
||||
case eGL_BLUE: pipe.textures[unit].swizzle[i] = TextureSwizzle::Blue; break;
|
||||
case eGL_ALPHA: pipe.textures[unit].swizzle[i] = TextureSwizzle::Alpha; break;
|
||||
}
|
||||
}
|
||||
pipe.textures[unit].swizzle.red = MakeSwizzle(swizzles[0]);
|
||||
pipe.textures[unit].swizzle.green = MakeSwizzle(swizzles[1]);
|
||||
pipe.textures[unit].swizzle.blue = MakeSwizzle(swizzles[2]);
|
||||
pipe.textures[unit].swizzle.alpha = MakeSwizzle(swizzles[3]);
|
||||
|
||||
GLuint samp = 0;
|
||||
if(HasExt[ARB_sampler_objects])
|
||||
@@ -1751,39 +1742,18 @@ void GLReplay::SavePipelineState(uint32_t eventId)
|
||||
(GLint *)&pipe.framebuffer.drawFBO.colorAttachments[i].mipLevel,
|
||||
(GLint *)&pipe.framebuffer.drawFBO.colorAttachments[i].slice);
|
||||
|
||||
GLint swizzles[4] = {eGL_RED, eGL_GREEN, eGL_BLUE, eGL_ALPHA};
|
||||
GLenum swizzles[4] = {eGL_RED, eGL_GREEN, eGL_BLUE, eGL_ALPHA};
|
||||
if(!rbCol[i] && id != ResourceId() &&
|
||||
(HasExt[ARB_texture_swizzle] || HasExt[EXT_texture_swizzle]))
|
||||
{
|
||||
GLenum target = m_pDriver->m_Textures[id].curType;
|
||||
GetTextureSwizzle(curCol[i], target, (GLenum *)swizzles);
|
||||
GetTextureSwizzle(curCol[i], target, swizzles);
|
||||
}
|
||||
|
||||
for(int s = 0; s < 4; s++)
|
||||
{
|
||||
switch(swizzles[s])
|
||||
{
|
||||
default:
|
||||
case GL_ZERO:
|
||||
pipe.framebuffer.drawFBO.colorAttachments[i].swizzle[s] = TextureSwizzle::Zero;
|
||||
break;
|
||||
case GL_ONE:
|
||||
pipe.framebuffer.drawFBO.colorAttachments[i].swizzle[s] = TextureSwizzle::One;
|
||||
break;
|
||||
case eGL_RED:
|
||||
pipe.framebuffer.drawFBO.colorAttachments[i].swizzle[s] = TextureSwizzle::Red;
|
||||
break;
|
||||
case eGL_GREEN:
|
||||
pipe.framebuffer.drawFBO.colorAttachments[i].swizzle[s] = TextureSwizzle::Green;
|
||||
break;
|
||||
case eGL_BLUE:
|
||||
pipe.framebuffer.drawFBO.colorAttachments[i].swizzle[s] = TextureSwizzle::Blue;
|
||||
break;
|
||||
case eGL_ALPHA:
|
||||
pipe.framebuffer.drawFBO.colorAttachments[i].swizzle[s] = TextureSwizzle::Alpha;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pipe.framebuffer.drawFBO.colorAttachments[i].swizzle.red = MakeSwizzle(swizzles[0]);
|
||||
pipe.framebuffer.drawFBO.colorAttachments[i].swizzle.green = MakeSwizzle(swizzles[1]);
|
||||
pipe.framebuffer.drawFBO.colorAttachments[i].swizzle.blue = MakeSwizzle(swizzles[2]);
|
||||
pipe.framebuffer.drawFBO.colorAttachments[i].swizzle.alpha = MakeSwizzle(swizzles[3]);
|
||||
}
|
||||
|
||||
pipe.framebuffer.drawFBO.depthAttachment.resourceId = rm->GetOriginalID(
|
||||
|
||||
@@ -1015,29 +1015,29 @@ void VulkanReplay::SetDriverInformation(const VkPhysicalDeviceProperties &props)
|
||||
memcpy(m_DriverInfo.version, versionString.c_str(), versionString.size());
|
||||
}
|
||||
|
||||
static void Convert(TextureSwizzle dst[4], VkComponentMapping src)
|
||||
static TextureSwizzle Convert(VkComponentSwizzle src, int i)
|
||||
{
|
||||
VkComponentSwizzle srcComps[4] = {
|
||||
src.r, src.g, src.b, src.a,
|
||||
};
|
||||
for(int i = 0; i < 4; i++)
|
||||
switch(src)
|
||||
{
|
||||
switch(srcComps[i])
|
||||
{
|
||||
default:
|
||||
RDCWARN("Unexpected component swizzle value %d", (int)srcComps[i]);
|
||||
DELIBERATE_FALLTHROUGH();
|
||||
case VK_COMPONENT_SWIZZLE_IDENTITY: break;
|
||||
case VK_COMPONENT_SWIZZLE_ZERO: dst[i] = TextureSwizzle::Zero; break;
|
||||
case VK_COMPONENT_SWIZZLE_ONE: dst[i] = TextureSwizzle::One; break;
|
||||
case VK_COMPONENT_SWIZZLE_R: dst[i] = TextureSwizzle::Red; break;
|
||||
case VK_COMPONENT_SWIZZLE_G: dst[i] = TextureSwizzle::Green; break;
|
||||
case VK_COMPONENT_SWIZZLE_B: dst[i] = TextureSwizzle::Blue; break;
|
||||
case VK_COMPONENT_SWIZZLE_A: dst[i] = TextureSwizzle::Alpha; break;
|
||||
}
|
||||
|
||||
dst[i] = TextureSwizzle(uint32_t(TextureSwizzle::Red) + i);
|
||||
default: RDCWARN("Unexpected component swizzle value %d", (int)src); DELIBERATE_FALLTHROUGH();
|
||||
case VK_COMPONENT_SWIZZLE_IDENTITY: break;
|
||||
case VK_COMPONENT_SWIZZLE_ZERO: return TextureSwizzle::Zero; break;
|
||||
case VK_COMPONENT_SWIZZLE_ONE: return TextureSwizzle::One; break;
|
||||
case VK_COMPONENT_SWIZZLE_R: return TextureSwizzle::Red; break;
|
||||
case VK_COMPONENT_SWIZZLE_G: return TextureSwizzle::Green; break;
|
||||
case VK_COMPONENT_SWIZZLE_B: return TextureSwizzle::Blue; break;
|
||||
case VK_COMPONENT_SWIZZLE_A: return TextureSwizzle::Alpha; break;
|
||||
}
|
||||
|
||||
return TextureSwizzle(uint32_t(TextureSwizzle::Red) + i);
|
||||
}
|
||||
|
||||
static void Convert(TextureSwizzle4 dst, VkComponentMapping src)
|
||||
{
|
||||
dst.red = Convert(src.r, 0);
|
||||
dst.green = Convert(src.g, 1);
|
||||
dst.blue = Convert(src.b, 2);
|
||||
dst.alpha = Convert(src.a, 3);
|
||||
}
|
||||
|
||||
void VulkanReplay::SavePipelineState(uint32_t eventId)
|
||||
|
||||
@@ -429,6 +429,17 @@ void DoSerialise(SerialiserType &ser, TextureFilter &el)
|
||||
SIZE_CHECK(16);
|
||||
}
|
||||
|
||||
template <typename SerialiserType>
|
||||
void DoSerialise(SerialiserType &ser, TextureSwizzle4 &el)
|
||||
{
|
||||
SERIALISE_MEMBER(red);
|
||||
SERIALISE_MEMBER(green);
|
||||
SERIALISE_MEMBER(blue);
|
||||
SERIALISE_MEMBER(alpha);
|
||||
|
||||
SIZE_CHECK(16);
|
||||
}
|
||||
|
||||
template <typename SerialiserType>
|
||||
void DoSerialise(SerialiserType &ser, ResourceDescription &el)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user