mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
shader_recompiler: Move GetDrawOffsets to fetch shader
This commit is contained in:
parent
028df5dfef
commit
995b800864
@ -58,6 +58,19 @@ struct FetchShaderData {
|
||||
}) != attributes.end();
|
||||
}
|
||||
|
||||
[[nodiscard]] std::pair<u32, u32> GetDrawOffsets(const AmdGpu::Liverpool::Regs& regs,
|
||||
const Info& info) const {
|
||||
u32 vertex_offset = regs.index_offset;
|
||||
u32 instance_offset = 0;
|
||||
if (vertex_offset == 0 && vertex_offset_sgpr != -1) {
|
||||
vertex_offset = info.user_data[vertex_offset_sgpr];
|
||||
}
|
||||
if (instance_offset_sgpr != -1) {
|
||||
instance_offset = info.user_data[instance_offset_sgpr];
|
||||
}
|
||||
return {vertex_offset, instance_offset};
|
||||
}
|
||||
|
||||
bool operator==(const FetchShaderData& other) const {
|
||||
return attributes == other.attributes && vertex_offset_sgpr == other.vertex_offset_sgpr &&
|
||||
instance_offset_sgpr == other.instance_offset_sgpr;
|
||||
|
@ -194,16 +194,7 @@ void Rasterizer::Draw(bool is_indexed, u32 index_offset) {
|
||||
BeginRendering(*pipeline, state);
|
||||
UpdateDynamicState(*pipeline);
|
||||
|
||||
u32 vertex_offset = regs.index_offset;
|
||||
u32 instance_offset = 0;
|
||||
if (fetch_shader) {
|
||||
if (vertex_offset == 0 && fetch_shader->vertex_offset_sgpr != -1) {
|
||||
vertex_offset = vs_info.user_data[fetch_shader->vertex_offset_sgpr];
|
||||
}
|
||||
if (fetch_shader->instance_offset_sgpr != -1) {
|
||||
instance_offset = vs_info.user_data[fetch_shader->instance_offset_sgpr];
|
||||
}
|
||||
}
|
||||
const auto [vertex_offset, instance_offset] = fetch_shader->GetDrawOffsets(regs, vs_info);
|
||||
|
||||
const auto cmdbuf = scheduler.CommandBuffer();
|
||||
cmdbuf.bindPipeline(vk::PipelineBindPoint::eGraphics, pipeline->Handle());
|
||||
|
Loading…
Reference in New Issue
Block a user