Implement D3D12's CreateSampler2 and new sampler parameters

This commit is contained in:
baldurk
2023-04-19 15:19:04 +01:00
parent d3edbc5dd1
commit 28dcc80892
21 changed files with 436 additions and 93 deletions
+21 -6
View File
@@ -332,7 +332,9 @@ struct Sampler
bool operator==(const Sampler &o) const
{
return bind == o.bind && tableIndex == o.tableIndex && addressU == o.addressU &&
addressV == o.addressV && addressW == o.addressW && borderColor == o.borderColor &&
addressV == o.addressV && addressW == o.addressW &&
borderColorValue.uintValue == o.borderColorValue.uintValue &&
borderColorType == o.borderColorType && unnormalized == o.unnormalized &&
compareFunction == o.compareFunction && filter == o.filter &&
maxAnisotropy == o.maxAnisotropy && maxLOD == o.maxLOD && minLOD == o.minLOD &&
mipLODBias == o.mipLODBias;
@@ -349,8 +351,12 @@ struct Sampler
return addressV < o.addressV;
if(!(addressW == o.addressW))
return addressW < o.addressW;
if(!(borderColor == o.borderColor))
return borderColor < o.borderColor;
if(!(borderColorValue.uintValue == o.borderColorValue.uintValue))
return borderColorValue.uintValue < o.borderColorValue.uintValue;
if(!(borderColorType == o.borderColorType))
return borderColorType < o.borderColorType;
if(!(unnormalized == o.unnormalized))
return unnormalized < o.unnormalized;
if(!(compareFunction == o.compareFunction))
return compareFunction < o.compareFunction;
if(!(filter == o.filter))
@@ -376,11 +382,20 @@ struct Sampler
AddressMode addressV = AddressMode::Wrap;
DOCUMENT("The :class:`AddressMode` in the W direction.");
AddressMode addressW = AddressMode::Wrap;
DOCUMENT(R"(The RGBA border color.
DOCUMENT(R"(For samplers - the RGBA border color value. Typically the float tuple inside will be used,
but the exact component type can be checked with :data:`borderColorType`.
:type: Tuple[float,float,float,float]
:type: PixelValue
)");
rdcfixedarray<float, 4> borderColor = {0.0f, 0.0f, 0.0f, 0.0f};
PixelValue borderColorValue = {};
DOCUMENT(R"(For samplers - the RGBA border color type. This determines how the data in
:data:`borderColorValue` will be interpreted.
:type: CompType
)");
CompType borderColorType = CompType::Float;
DOCUMENT("``True`` if unnormalized co-ordinates are used in this sampler.");
bool unnormalized = false;
DOCUMENT("The :class:`CompareFunction` for comparison samplers.");
CompareFunction compareFunction = CompareFunction::AlwaysTrue;
DOCUMENT(R"(The filtering mode.
+16 -6
View File
@@ -47,7 +47,8 @@ struct BindingElement
filter == o.filter && addressU == o.addressU && addressV == o.addressV &&
addressW == o.addressW && mipBias == o.mipBias && maxAnisotropy == o.maxAnisotropy &&
compareFunction == o.compareFunction && minLOD == o.minLOD && maxLOD == o.maxLOD &&
borderColor == o.borderColor && unnormalized == o.unnormalized &&
borderColorValue.uintValue == o.borderColorValue.uintValue &&
borderColorType == o.borderColorType && unnormalized == o.unnormalized &&
srgbBorder == o.srgbBorder && seamless == o.seamless;
}
bool operator<(const BindingElement &o) const
@@ -100,8 +101,10 @@ struct BindingElement
return minLOD < o.minLOD;
if(!(maxLOD == o.maxLOD))
return maxLOD < o.maxLOD;
if(!(borderColor == o.borderColor))
return borderColor < o.borderColor;
if(!(borderColorValue.uintValue == o.borderColorValue.uintValue))
return borderColorValue.uintValue < o.borderColorValue.uintValue;
if(!(borderColorType == o.borderColorType))
return borderColorType < o.borderColorType;
if(!(unnormalized == o.unnormalized))
return unnormalized < o.unnormalized;
if(!(srgbBorder == o.srgbBorder))
@@ -183,11 +186,18 @@ set's inline block data.
float minLOD = 0.0f;
DOCUMENT("For samplers - the maximum mip level that can be used.");
float maxLOD = 0.0f;
DOCUMENT(R"(For samplers - the RGBA border color.
DOCUMENT(R"(For samplers - the RGBA border color value. Typically the float tuple inside will be used,
but the exact component type can be checked with :data:`borderColorType`.
:type: Tuple[float,float,float,float]
:type: PixelValue
)");
rdcfixedarray<float, 4> borderColor = {0.0f, 0.0f, 0.0f, 0.0f};
PixelValue borderColorValue = {};
DOCUMENT(R"(For samplers - the RGBA border color type. This determines how the data in
:data:`borderColorValue` will be interpreted.
:type: CompType
)");
CompType borderColorType = CompType::Float;
DOCUMENT(R"(The swizzle applied to samplers. Primarily for ycbcr samplers applied before
conversion but for non-ycbcr samplers can be used for implementations that require sampler swizzle
information for border colors.