mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-22 21:09:16 +01:00
Implement Maxwell3D Bindless Texture Constant Buffer Index
The index of the constant buffer with bindless texture descriptors is now retrieved from Maxwell3D register state and passed to the shader compiler.
This commit is contained in:
parent
1c3f62b7b4
commit
c11962e8e4
@ -743,7 +743,7 @@ namespace skyline::gpu::interconnect {
|
||||
return std::nullopt;
|
||||
})};
|
||||
|
||||
shader.program = gpu.shader.ParseGraphicsShader(shader.data, shader.stage, shader.offset);
|
||||
shader.program = gpu.shader.ParseGraphicsShader(shader.stage, shader.data, shader.offset, bindlessTextureConstantBufferIndex);
|
||||
|
||||
if (shader.stage != ShaderCompiler::Stage::VertexA && shader.stage != ShaderCompiler::Stage::VertexB) {
|
||||
pipelineStage.program.emplace<std::reference_wrapper<ShaderCompiler::IR::Program>>(*shader.program);
|
||||
@ -1547,6 +1547,15 @@ namespace skyline::gpu::interconnect {
|
||||
}
|
||||
} indexBuffer{};
|
||||
|
||||
/* Textures */
|
||||
private:
|
||||
u32 bindlessTextureConstantBufferIndex{};
|
||||
|
||||
public:
|
||||
void SetBindlessTextureConstantBufferIndex(u32 index) {
|
||||
bindlessTextureConstantBufferIndex = index;
|
||||
}
|
||||
|
||||
public:
|
||||
void SetIndexBufferStartIovaHigh(u32 high) {
|
||||
indexBuffer.start.high = high;
|
||||
|
@ -85,12 +85,13 @@ namespace skyline::gpu {
|
||||
private:
|
||||
span<u8> binary;
|
||||
u32 baseOffset;
|
||||
u32 textureBufferIndex;
|
||||
|
||||
public:
|
||||
GraphicsEnvironment(span<u8> pBinary, u32 baseOffset, Shader::Stage pStage) : binary(pBinary), baseOffset(baseOffset) {
|
||||
GraphicsEnvironment(Shader::Stage pStage, span<u8> pBinary, u32 baseOffset, u32 textureBufferIndex) : binary(pBinary), baseOffset(baseOffset), textureBufferIndex(textureBufferIndex) {
|
||||
stage = pStage;
|
||||
sph = *reinterpret_cast<Shader::ProgramHeader *>(binary.data());
|
||||
start_address = baseOffset;
|
||||
stage = pStage;
|
||||
}
|
||||
|
||||
[[nodiscard]] u64 ReadInstruction(u32 address) final {
|
||||
@ -109,7 +110,7 @@ namespace skyline::gpu {
|
||||
}
|
||||
|
||||
[[nodiscard]] u32 TextureBoundBuffer() const final {
|
||||
throw exception("Not implemented");
|
||||
return textureBufferIndex;
|
||||
}
|
||||
|
||||
[[nodiscard]] u32 LocalMemorySize() const final {
|
||||
@ -164,8 +165,8 @@ namespace skyline::gpu {
|
||||
}
|
||||
};
|
||||
|
||||
Shader::IR::Program ShaderManager::ParseGraphicsShader(span<u8> binary, Shader::Stage stage, u32 baseOffset) {
|
||||
GraphicsEnvironment environment{binary, baseOffset, stage};
|
||||
Shader::IR::Program ShaderManager::ParseGraphicsShader(Shader::Stage stage, span<u8> binary, u32 baseOffset, u32 bindlessTextureConstantBufferIndex) {
|
||||
GraphicsEnvironment environment{stage, binary, baseOffset, bindlessTextureConstantBufferIndex};
|
||||
Shader::Maxwell::Flow::CFG cfg(environment, flowBlockPool, Shader::Maxwell::Location{static_cast<u32>(baseOffset + sizeof(Shader::ProgramHeader))});
|
||||
|
||||
return Shader::Maxwell::TranslateProgram(instPool, blockPool, environment, cfg, hostTranslateInfo);
|
||||
|
@ -31,7 +31,7 @@ namespace skyline::gpu {
|
||||
public:
|
||||
ShaderManager(const DeviceState &state, GPU &gpu);
|
||||
|
||||
Shader::IR::Program ParseGraphicsShader(span<u8> binary, Shader::Stage stage, u32 baseOffset);
|
||||
Shader::IR::Program ParseGraphicsShader(Shader::Stage stage, span<u8> binary, u32 baseOffset, u32 bindlessTextureConstantBufferIndex);
|
||||
|
||||
/**
|
||||
* @brief Combines the VertexA and VertexB shader programs into a single program
|
||||
|
@ -463,6 +463,10 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
||||
context.SetIndexBufferFormat(format);
|
||||
})
|
||||
|
||||
MAXWELL3D_CASE(bindlessTextureConstantBufferIndex, {
|
||||
context.SetBindlessTextureConstantBufferIndex(bindlessTextureConstantBufferIndex);
|
||||
})
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -294,6 +294,8 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
||||
Register<0x8E0, ConstantBufferSelector> constantBufferSelector;
|
||||
|
||||
Register<0x900, std::array<type::Bind, type::PipelineStageCount>> bind; //!< Binds constant buffers to pipeline stages
|
||||
|
||||
Register<0x982, u32> bindlessTextureConstantBufferIndex; //!< The index of the constant buffer containing bindless texture descriptors
|
||||
};
|
||||
static_assert(sizeof(Registers) == (RegisterCount * sizeof(u32)));
|
||||
#pragma pack(pop)
|
||||
|
Loading…
Reference in New Issue
Block a user