diff --git a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h index d725b86e..639915aa 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -1176,6 +1176,8 @@ namespace skyline::gpu::interconnect { auto &constantBuffer{pipelineStage.constantBuffers[texture.cbuf_index]}; BindlessTextureHandle handle{constantBuffer.Read(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; diff --git a/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp b/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp index a67a96b5..5bde3d22 100644 --- a/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp +++ b/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp @@ -129,6 +129,10 @@ namespace skyline::soc::gm20b::engine::maxwell3d { context.SetDepthRenderTargetArrayMode(depthTargetArrayMode); }) + ENGINE_CASE(linkedTscHandle, { + context.SetTscIndexLinked(linkedTscHandle); + }); + #define VIEWPORT_TRANSFORM_CALLBACKS(_z, index, data) \ ENGINE_ARRAY_STRUCT_CASE(viewportTransforms, index, scaleX, { \ context.SetViewportX(index, scaleX, registers.viewportTransforms[index].translateX); \ diff --git a/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.h b/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.h index 27582f41..27900fe8 100644 --- a/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.h +++ b/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.h @@ -151,6 +151,8 @@ namespace skyline::soc::gm20b::engine::maxwell3d { Register<0x48B, u32> depthTargetHeight; Register<0x48C, type::RenderTargetArrayMode> depthTargetArrayMode; + Register<0x48D, bool> linkedTscHandle; //!< If enabled, the TSC index in a bindless texture handle is ignored and the TIC index is used as the TSC index, otherwise the TSC index from the bindless texture handle is used + Register<0x4B3, u32> depthTestEnable; Register<0x4B9, u32> independentBlendEnable; Register<0x4BA, u32> depthWriteEnable;