diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp index 244954dd..6b658735 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp @@ -184,11 +184,17 @@ namespace skyline::gpu::interconnect::maxwell3d { if (!packedState.shaderHashes[i]) continue; - auto program{ctx.gpu.shader.ParseGraphicsShader(packedState.postVtgShaderAttributeSkipMask, - ConvertCompilerShaderStage(static_cast(i)), - shaderBinaries[i].binary, shaderBinaries[i].baseOffset, - packedState.bindlessTextureConstantBufferSlotSelect, - [](int, int){ return 0; }, [](u32){return Shader::TextureType::Color2D;})}; + auto program{ctx.gpu.shader.ParseGraphicsShader( + packedState.postVtgShaderAttributeSkipMask, + ConvertCompilerShaderStage(static_cast(i)), + shaderBinaries[i].binary, shaderBinaries[i].baseOffset, + packedState.bindlessTextureConstantBufferSlotSelect, + [&](u32 index, u32 offset) { + size_t shaderStage{i > 0 ? (i - 1) : 0}; + return constantBuffers[shaderStage][index].Read(ctx.executor, offset); + }, [&](u32 index) { + return textures.GetTextureType(ctx, index); + })}; if (i == stageIdx(PipelineStage::Vertex) && packedState.shaderHashes[stageIdx(PipelineStage::VertexCullBeforeFetch)]) { ignoreVertexCullBeforeFetch = true; programs[i] = ctx.gpu.shader.CombineVertexShaders(programs[stageIdx(PipelineStage::VertexCullBeforeFetch)], program, shaderBinaries[i].binary); diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/textures.cpp b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/textures.cpp index dcb40691..c4962c0c 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/textures.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/textures.cpp @@ -318,4 +318,27 @@ namespace skyline::gpu::interconnect::maxwell3d { textureHeaderCache[index] = {textureHeader, texture.get(), ctx.executor.executionNumber}; return texture.get(); } + + Shader::TextureType Textures::GetTextureType(InterconnectContext &ctx, u32 index) { + auto textureHeaders{texturePool.UpdateGet(ctx).textureHeaders}; + switch (textureHeaders[index].textureType) { + case TextureImageControl::TextureType::e1D: + return Shader::TextureType::Color1D; + case TextureImageControl::TextureType::e1DArray: + return Shader::TextureType::ColorArray1D; + case TextureImageControl::TextureType::e1DBuffer: + return Shader::TextureType::Buffer; + case TextureImageControl::TextureType::e2DNoMipmap: + case TextureImageControl::TextureType::e2D: + return Shader::TextureType::Color2D; + case TextureImageControl::TextureType::e2DArray: + return Shader::TextureType::ColorArray2D; + case TextureImageControl::TextureType::e3D: + return Shader::TextureType::Color3D; + case TextureImageControl::TextureType::eCube: + return Shader::TextureType::ColorCube; + case TextureImageControl::TextureType::eCubeArray: + return Shader::TextureType::ColorArrayCube; + } + } } \ No newline at end of file diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/textures.h b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/textures.h index 26202f13..1508d812 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/textures.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/textures.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include "common.h" #include "tic.h"