Implement linked TIC/TSC handle in Maxwell3D

Maxwell3D has a register for linking the TIC/TSC index in bindless texture handles, this is used by games to implement bindless combined texture-sampler handles.
This commit is contained in:
PixelyIon
2022-05-06 14:58:20 +05:30
parent 23a091100d
commit 98c730a644
3 changed files with 14 additions and 0 deletions

View File

@ -1176,6 +1176,8 @@ namespace skyline::gpu::interconnect {
auto &constantBuffer{pipelineStage.constantBuffers[texture.cbuf_index]};
BindlessTextureHandle handle{constantBuffer.Read<u32>(executor, texture.cbuf_offset)};
if (tscIndexLinked)
handle.samplerIndex = handle.textureIndex;
auto sampler{GetSampler(handle.samplerIndex)};
auto textureView{GetPoolTextureView(handle.textureIndex)};
@ -2292,6 +2294,8 @@ namespace skyline::gpu::interconnect {
/* Samplers */
private:
bool tscIndexLinked{}; //!< If the TSC index in bindless texture handles is the same as the TIC index or if it's independent from the TIC index
struct Sampler : public vk::raii::Sampler, public FenceCycleDependency {
using vk::raii::Sampler::Sampler;
};
@ -2319,6 +2323,10 @@ namespace skyline::gpu::interconnect {
samplerPool.samplerControls = nullptr;
}
void SetTscIndexLinked(bool isTscIndexLinked) {
tscIndexLinked = isTscIndexLinked;
}
private:
vk::Filter ConvertSamplerFilter(TextureSamplerControl::Filter filter) {
using TscFilter = TextureSamplerControl::Filter;