mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-15 23:43:02 +00:00
Merge pull request #4080 from ogniK5377/audren-RendererInfo
audren: Implement RendererInfo
This commit is contained in:
commit
0f7822acb1
|
@ -180,11 +180,12 @@ ResultVal<std::vector<u8>> AudioRenderer::UpdateAudioRenderer(const std::vector<
|
||||||
|
|
||||||
// Copy output header
|
// Copy output header
|
||||||
UpdateDataHeader response_data{worker_params};
|
UpdateDataHeader response_data{worker_params};
|
||||||
std::vector<u8> output_params(response_data.total_size);
|
|
||||||
if (behavior_info.IsElapsedFrameCountSupported()) {
|
if (behavior_info.IsElapsedFrameCountSupported()) {
|
||||||
response_data.frame_count = 0x10;
|
response_data.render_info = sizeof(RendererInfo);
|
||||||
response_data.total_size += 0x10;
|
response_data.total_size += sizeof(RendererInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<u8> output_params(response_data.total_size);
|
||||||
std::memcpy(output_params.data(), &response_data, sizeof(UpdateDataHeader));
|
std::memcpy(output_params.data(), &response_data, sizeof(UpdateDataHeader));
|
||||||
|
|
||||||
// Copy output memory pool entries
|
// Copy output memory pool entries
|
||||||
|
@ -219,6 +220,17 @@ ResultVal<std::vector<u8>> AudioRenderer::UpdateAudioRenderer(const std::vector<
|
||||||
return Audren::ERR_INVALID_PARAMETERS;
|
return Audren::ERR_INVALID_PARAMETERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (behavior_info.IsElapsedFrameCountSupported()) {
|
||||||
|
const std::size_t renderer_info_offset{
|
||||||
|
sizeof(UpdateDataHeader) + response_data.memory_pools_size + response_data.voices_size +
|
||||||
|
response_data.effects_size + response_data.sinks_size +
|
||||||
|
response_data.performance_manager_size + response_data.behavior_size};
|
||||||
|
RendererInfo renderer_info{};
|
||||||
|
renderer_info.elasped_frame_count = elapsed_frame_count;
|
||||||
|
std::memcpy(output_params.data() + renderer_info_offset, &renderer_info,
|
||||||
|
sizeof(RendererInfo));
|
||||||
|
}
|
||||||
|
|
||||||
return MakeResult(output_params);
|
return MakeResult(output_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,6 +459,7 @@ void AudioRenderer::QueueMixedBuffer(Buffer::Tag tag) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
audio_out->QueueBuffer(stream, tag, std::move(buffer));
|
audio_out->QueueBuffer(stream, tag, std::move(buffer));
|
||||||
|
elapsed_frame_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioRenderer::ReleaseAndQueueBuffers() {
|
void AudioRenderer::ReleaseAndQueueBuffers() {
|
||||||
|
|
|
@ -196,6 +196,12 @@ struct EffectOutStatus {
|
||||||
};
|
};
|
||||||
static_assert(sizeof(EffectOutStatus) == 0x10, "EffectOutStatus is an invalid size");
|
static_assert(sizeof(EffectOutStatus) == 0x10, "EffectOutStatus is an invalid size");
|
||||||
|
|
||||||
|
struct RendererInfo {
|
||||||
|
u64_le elasped_frame_count{};
|
||||||
|
INSERT_PADDING_WORDS(2);
|
||||||
|
};
|
||||||
|
static_assert(sizeof(RendererInfo) == 0x10, "RendererInfo is an invalid size");
|
||||||
|
|
||||||
struct UpdateDataHeader {
|
struct UpdateDataHeader {
|
||||||
UpdateDataHeader() {}
|
UpdateDataHeader() {}
|
||||||
|
|
||||||
|
@ -209,7 +215,7 @@ struct UpdateDataHeader {
|
||||||
mixes_size = 0x0;
|
mixes_size = 0x0;
|
||||||
sinks_size = config.sink_count * 0x20;
|
sinks_size = config.sink_count * 0x20;
|
||||||
performance_manager_size = 0x10;
|
performance_manager_size = 0x10;
|
||||||
frame_count = 0;
|
render_info = 0;
|
||||||
total_size = sizeof(UpdateDataHeader) + behavior_size + memory_pools_size + voices_size +
|
total_size = sizeof(UpdateDataHeader) + behavior_size + memory_pools_size + voices_size +
|
||||||
effects_size + sinks_size + performance_manager_size;
|
effects_size + sinks_size + performance_manager_size;
|
||||||
}
|
}
|
||||||
|
@ -223,8 +229,8 @@ struct UpdateDataHeader {
|
||||||
u32_le mixes_size{};
|
u32_le mixes_size{};
|
||||||
u32_le sinks_size{};
|
u32_le sinks_size{};
|
||||||
u32_le performance_manager_size{};
|
u32_le performance_manager_size{};
|
||||||
INSERT_PADDING_WORDS(1);
|
u32_le splitter_size{};
|
||||||
u32_le frame_count{};
|
u32_le render_info{};
|
||||||
INSERT_PADDING_WORDS(4);
|
INSERT_PADDING_WORDS(4);
|
||||||
u32_le total_size{};
|
u32_le total_size{};
|
||||||
};
|
};
|
||||||
|
@ -258,6 +264,7 @@ private:
|
||||||
std::unique_ptr<AudioOut> audio_out;
|
std::unique_ptr<AudioOut> audio_out;
|
||||||
StreamPtr stream;
|
StreamPtr stream;
|
||||||
Core::Memory::Memory& memory;
|
Core::Memory::Memory& memory;
|
||||||
|
std::size_t elapsed_frame_count{};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace AudioCore
|
} // namespace AudioCore
|
||||||
|
|
Loading…
Reference in a new issue