mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 02:47:02 +02:00
shader: separate depth comparison and regular image descriptors
Co-authored-by: Lordix <lordix253634@gmail.com> Co-authored-by: fxpw <fxpw@outlook.com> Co-authored-by: Mac <me@itsmemac.com>
This commit is contained in:
@@ -1617,15 +1617,15 @@ void TestShaderInfoAndBindingLayout() {
|
||||
void TestImageBindingAbi() {
|
||||
using NumericClass = Libs::Graphics::Prospero::TextureNumericClass;
|
||||
|
||||
Check(ImageBindingCount == 36u &&
|
||||
Check(ImageBindingCount == 43u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::Buffers) == 0u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::Samplers) == 37u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::Gds) == 38u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::BdaPagetable) == 39u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::FaultBuffer) == 40u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::FlattenedSrt) == 41u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::ShaderData) == 42u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::Count) == 43u,
|
||||
static_cast<uint32_t>(DescriptorBindingKind::Samplers) == 44u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::Gds) == 45u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::BdaPagetable) == 46u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::FaultBuffer) == 47u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::FlattenedSrt) == 48u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::ShaderData) == 49u &&
|
||||
static_cast<uint32_t>(DescriptorBindingKind::Count) == 50u,
|
||||
"native descriptor binding anchors changed");
|
||||
|
||||
const std::array sampled_dimensions{
|
||||
@@ -1648,12 +1648,13 @@ void TestImageBindingAbi() {
|
||||
uint32_t index = 0;
|
||||
const auto CheckBinding =
|
||||
[&](ImageResourceClass resource_class, NumericClass numeric_class,
|
||||
Decoder::ImageDimension dimension, bool atomic) {
|
||||
Decoder::ImageDimension dimension, bool atomic, bool comparison = false) {
|
||||
ImageResource image;
|
||||
image.resource_class = resource_class;
|
||||
image.numeric_class = numeric_class;
|
||||
image.dimension = dimension;
|
||||
image.atomic = atomic;
|
||||
image.depth_compare = comparison;
|
||||
const auto kind = DescriptorBindingForImage(image);
|
||||
Check(kind.has_value() &&
|
||||
static_cast<uint32_t>(*kind) == FirstImageBinding + index &&
|
||||
@@ -1673,6 +1674,10 @@ void TestImageBindingAbi() {
|
||||
false);
|
||||
}
|
||||
}
|
||||
for (const auto dimension : sampled_dimensions) {
|
||||
CheckBinding(ImageResourceClass::Sampled, NumericClass::Float, dimension,
|
||||
false, true);
|
||||
}
|
||||
for (const auto numeric_class : storage_classes) {
|
||||
for (const auto dimension : storage_dimensions) {
|
||||
CheckBinding(ImageResourceClass::Storage, numeric_class, dimension,
|
||||
@@ -1699,6 +1704,10 @@ void TestImageBindingAbi() {
|
||||
image.numeric_class = NumericClass::Unsupported;
|
||||
Check(Invalid(image),
|
||||
"unsupported sampled class received a descriptor binding");
|
||||
image.numeric_class = NumericClass::Uint;
|
||||
image.depth_compare = true;
|
||||
Check(Invalid(image), "integer comparison image received a descriptor binding");
|
||||
image.depth_compare = false;
|
||||
image.numeric_class = static_cast<NumericClass>(UINT32_MAX);
|
||||
Check(Invalid(image), "invalid sampled class received a descriptor binding");
|
||||
image.numeric_class = NumericClass::Float;
|
||||
|
||||
@@ -22307,6 +22307,10 @@ TestCase ImageSampleA16CompareBiasRdna2AddressOrder() {
|
||||
code.push_back(EncodeMimg0(0x2d, 0x1));
|
||||
code.push_back(EncodeMimg1(0, 20, 0, 0, true));
|
||||
AppendStoreVgpr(&code, 0, 0);
|
||||
// Ordinary and comparison reads of one sharp require distinct SPIR-V image types.
|
||||
code.push_back(EncodeMimg0(0x27, 0x1));
|
||||
code.push_back(EncodeMimg1(1, 22, 0, 0, true));
|
||||
AppendStoreVgpr(&code, 1, 1);
|
||||
AppendEnd(&code);
|
||||
|
||||
TestCase test;
|
||||
@@ -22314,7 +22318,9 @@ TestCase ImageSampleA16CompareBiasRdna2AddressOrder() {
|
||||
test.code = code;
|
||||
test.opcodes = {O::V_MOV_B32, O::IMAGE_SAMPLE, O::BUFFER_STORE_DWORD,
|
||||
O::S_ENDPGM};
|
||||
test.required_spirv = {"OpImageSampleDrefExplicitLod", "UnpackHalf2x16"};
|
||||
test.required_spirv = {"OpTypeImage %float 2D 0", "OpTypeImage %float 2D 1",
|
||||
"OpImageSampleDrefExplicitLod", "OpImageSampleExplicitLod",
|
||||
"UnpackHalf2x16"};
|
||||
test.compile_only = true;
|
||||
return test;
|
||||
}
|
||||
@@ -28097,6 +28103,7 @@ int main(int argc, char **argv) {
|
||||
CheckSampledDepthResource();
|
||||
CheckDepthTextureEncoding(vulkan.RuntimeRenderer());
|
||||
vulkan.CheckComparisonDepthTexture();
|
||||
RunCase(nullptr, ImageSampleA16CompareBiasRdna2AddressOrder());
|
||||
return 0;
|
||||
}
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
||||
|
||||
Reference in New Issue
Block a user