Implement constant buffer reading

This commit is contained in:
Billy Laws 2022-09-17 13:10:01 +01:00
parent afcfe8a7fa
commit a9213debc7
2 changed files with 12 additions and 7 deletions

View File

@ -24,17 +24,22 @@ namespace skyline::gpu::interconnect::maxwell3d {
view.PurgeCaches();
}
static void FlushHostCallback() {
// TODO: here we should trigger `Execute()`, however that doesn't currently work due to Read being called mid-draw and attached objects not handling this case
Logger::Warn("GPU dirty buffer reads for attached buffers are unimplemented");
}
void ConstantBuffer::Read(CommandExecutor &executor, span<u8> dstBuffer, size_t srcOffset) {
ContextLock lock{executor.tag, view};
view.Read(lock.IsFirstUsage(), FlushHostCallback, dstBuffer, srcOffset);
}
ConstantBuffers::ConstantBuffers(DirtyManager &manager, const ConstantBufferSelectorState::EngineRegisters &constantBufferSelectorRegisters) : selectorState{manager, constantBufferSelectorRegisters} {}
void ConstantBuffers::MarkAllDirty() {
selectorState.MarkDirty(true);
}
static void FlushHostCallback() {
// TODO: here we should trigger `Execute()`, however that doesn't currently work due to Read being called mid-draw and attached objects not handling this case
Logger::Warn("GPU dirty buffer reads for attached buffers are unimplemented");
}
void ConstantBuffers::Load(InterconnectContext &ctx, span<u32> data, u32 offset) {
auto &view{*selectorState.UpdateGet(ctx).view};
auto srcCpuBuf{data.cast<u8>()};

View File

@ -30,10 +30,10 @@ namespace skyline::gpu::interconnect::maxwell3d {
struct ConstantBuffer {
BufferView view;
void Read(CommandExecutor &executor, span<u8> dstBuffer, size_t srcOffset) const;
void Read(CommandExecutor &executor, span<u8> dstBuffer, size_t srcOffset);
template<typename T>
T Read(CommandExecutor &executor, size_t srcOffset) const {
T Read(CommandExecutor &executor, size_t srcOffset) {
T object;
Read(executor, span<T>{object}.template cast<u8>(), srcOffset);
return object;