mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-05 14:45:07 +01:00
Implement ReadCbufValue and ReadTextureType hades callbacks
Used for bindless and BRX instruction emulation.
This commit is contained in:
parent
2163f8cde6
commit
4c2db0ba01
@ -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<PipelineStage>(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<PipelineStage>(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<int>(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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <tsl/robin_map.h>
|
||||
#include <shader_compiler/runtime_info.h>
|
||||
#include "common.h"
|
||||
#include "tic.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user