mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-23 20:36:58 +02:00
shader: remove artificial sampled image and sampler pair limit
This commit is contained in:
@@ -495,7 +495,6 @@ struct ShaderInfo {
|
|||||||
static constexpr uint32_t MaxBufferRoots = 64;
|
static constexpr uint32_t MaxBufferRoots = 64;
|
||||||
static constexpr uint32_t MaxImages = 64;
|
static constexpr uint32_t MaxImages = 64;
|
||||||
static constexpr uint32_t MaxSamplers = 32;
|
static constexpr uint32_t MaxSamplers = 32;
|
||||||
static constexpr uint32_t MaxSampledPairs = 64;
|
|
||||||
|
|
||||||
std::vector<BufferResource> buffers;
|
std::vector<BufferResource> buffers;
|
||||||
std::vector<ImageResource> images;
|
std::vector<ImageResource> images;
|
||||||
|
|||||||
@@ -3823,9 +3823,6 @@ private:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_info.sampled_pairs.size() >= ShaderInfo::MaxSampledPairs) {
|
|
||||||
Fail(pc, "sampled image/sampler pair limit exceeded");
|
|
||||||
}
|
|
||||||
m_info.sampled_pairs.push_back({image, sampler, pc});
|
m_info.sampled_pairs.push_back({image, sampler, pc});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4929,6 +4929,38 @@ void TestImagesSamplersAndAliases() {
|
|||||||
"buffer/image descriptor alias was not linked");
|
"buffer/image descriptor alias was not linked");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestIndependentImageSamplerPairs() {
|
||||||
|
Fixture fixture(ShaderType::Pixel);
|
||||||
|
const auto address = fixture.ImageAddress();
|
||||||
|
MemoryInfo memory;
|
||||||
|
memory.kind = ResourceKind::Image;
|
||||||
|
memory.image_dimension = Decoder::ImageDimension::Dim2D;
|
||||||
|
for (uint32_t use = 0; use < 144; ++use) {
|
||||||
|
const auto pair = use % 72;
|
||||||
|
const auto pc = use * 4;
|
||||||
|
const auto image = fixture.Image(
|
||||||
|
{Value(pair / 8), Value(0u), Value(0u), Value(0u), Value(0u),
|
||||||
|
Value(0u), Value(0u), Value(0u)}, pc);
|
||||||
|
const auto sampler = fixture.Sampler(
|
||||||
|
{Value(pair % 8), Value(0u), Value(0u), Value(0u)}, pc);
|
||||||
|
fixture.Emit(ValueOpcode::ImageSampleRaw,
|
||||||
|
{image, sampler, address, Value(true)},
|
||||||
|
fixture.AddMemory(memory, pc));
|
||||||
|
}
|
||||||
|
fixture.PlanAndTrack();
|
||||||
|
|
||||||
|
Check(fixture.program.info.images.size() == 9 &&
|
||||||
|
fixture.program.info.samplers.size() == 8 &&
|
||||||
|
fixture.program.info.sampled_pairs.size() == 72,
|
||||||
|
"distinct image/sampler combinations were limited or duplicated");
|
||||||
|
for (uint32_t index = 0; index < 72; ++index) {
|
||||||
|
const auto &pair = fixture.program.info.sampled_pairs[index];
|
||||||
|
Check(pair.image == index / 8 && pair.sampler == index % 8 &&
|
||||||
|
pair.first_use_pc == index * 4,
|
||||||
|
"sampled pair lost its independent resources or first use");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TestSampleAdjustSamplerScratch() {
|
void TestSampleAdjustSamplerScratch() {
|
||||||
Fixture fixture(ShaderType::Pixel);
|
Fixture fixture(ShaderType::Pixel);
|
||||||
const auto active = fixture.Emit(
|
const auto active = fixture.Emit(
|
||||||
@@ -8255,6 +8287,7 @@ int main() {
|
|||||||
Run("scalar/vector alias", TestScalarAndVectorBufferAlias);
|
Run("scalar/vector alias", TestScalarAndVectorBufferAlias);
|
||||||
Run("runtime unsigned min", TestRuntimeUnsignedMinDescriptor);
|
Run("runtime unsigned min", TestRuntimeUnsignedMinDescriptor);
|
||||||
Run("images and samplers", TestImagesSamplersAndAliases);
|
Run("images and samplers", TestImagesSamplersAndAliases);
|
||||||
|
Run("independent image/sampler pairs", TestIndependentImageSamplerPairs);
|
||||||
Run("SampleAdjust sampler scratch", TestSampleAdjustSamplerScratch);
|
Run("SampleAdjust sampler scratch", TestSampleAdjustSamplerScratch);
|
||||||
Run("FMASK load specialization", TestFmaskLoadSpecialization);
|
Run("FMASK load specialization", TestFmaskLoadSpecialization);
|
||||||
Run("gather LOD sampler validation", TestGatherLodSamplerValidation);
|
Run("gather LOD sampler validation", TestGatherLodSamplerValidation);
|
||||||
|
|||||||
Reference in New Issue
Block a user