mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-02 22:28:45 +00:00
shader_recompiler: Avoid some asserts
This commit is contained in:
parent
f7a8ceb395
commit
9bd3553fe6
4 changed files with 12 additions and 10 deletions
|
@ -42,7 +42,7 @@ void Name(EmitContext& ctx, Id object, std::string_view format_str, Args&&... ar
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
EmitContext::EmitContext(const Profile& profile_, const RuntimeInfo& runtime_info_,
|
EmitContext::EmitContext(const Profile& profile_, const RuntimeInfo& runtime_info_,
|
||||||
const Shader::Info& info_, u32& binding_)
|
const Info& info_, u32& binding_)
|
||||||
: Sirit::Module(profile_.supported_spirv), info{info_}, runtime_info{runtime_info_},
|
: Sirit::Module(profile_.supported_spirv), info{info_}, runtime_info{runtime_info_},
|
||||||
profile{profile_}, stage{info.stage}, binding{binding_} {
|
profile{profile_}, stage{info.stage}, binding{binding_} {
|
||||||
AddCapability(spv::Capability::Shader);
|
AddCapability(spv::Capability::Shader);
|
||||||
|
@ -169,7 +169,7 @@ EmitContext::SpirvAttribute EmitContext::GetAttributeInfo(AmdGpu::NumberFormat f
|
||||||
void EmitContext::DefineBufferOffsets() {
|
void EmitContext::DefineBufferOffsets() {
|
||||||
for (auto& buffer : buffers) {
|
for (auto& buffer : buffers) {
|
||||||
const u32 binding = buffer.binding;
|
const u32 binding = buffer.binding;
|
||||||
const u32 half = Shader::PushData::BufOffsetIndex + (binding >> 4);
|
const u32 half = PushData::BufOffsetIndex + (binding >> 4);
|
||||||
const u32 comp = (binding & 0xf) >> 2;
|
const u32 comp = (binding & 0xf) >> 2;
|
||||||
const u32 offset = (binding & 0x3) << 3;
|
const u32 offset = (binding & 0x3) << 3;
|
||||||
const Id ptr{OpAccessChain(TypePointer(spv::StorageClass::PushConstant, U32[1]),
|
const Id ptr{OpAccessChain(TypePointer(spv::StorageClass::PushConstant, U32[1]),
|
||||||
|
@ -180,7 +180,7 @@ void EmitContext::DefineBufferOffsets() {
|
||||||
}
|
}
|
||||||
for (auto& tex_buffer : texture_buffers) {
|
for (auto& tex_buffer : texture_buffers) {
|
||||||
const u32 binding = tex_buffer.binding;
|
const u32 binding = tex_buffer.binding;
|
||||||
const u32 half = Shader::PushData::BufOffsetIndex + (binding >> 4);
|
const u32 half = PushData::BufOffsetIndex + (binding >> 4);
|
||||||
const u32 comp = (binding & 0xf) >> 2;
|
const u32 comp = (binding & 0xf) >> 2;
|
||||||
const u32 offset = (binding & 0x3) << 3;
|
const u32 offset = (binding & 0x3) << 3;
|
||||||
const Id ptr{OpAccessChain(TypePointer(spv::StorageClass::PushConstant, U32[1]),
|
const Id ptr{OpAccessChain(TypePointer(spv::StorageClass::PushConstant, U32[1]),
|
||||||
|
|
|
@ -36,8 +36,8 @@ struct VectorIds {
|
||||||
|
|
||||||
class EmitContext final : public Sirit::Module {
|
class EmitContext final : public Sirit::Module {
|
||||||
public:
|
public:
|
||||||
explicit EmitContext(const Profile& profile, const RuntimeInfo& runtime_info,
|
explicit EmitContext(const Profile& profile, const RuntimeInfo& runtime_info, const Info& info,
|
||||||
const Shader::Info& info, u32& binding);
|
u32& binding);
|
||||||
~EmitContext();
|
~EmitContext();
|
||||||
|
|
||||||
Id Def(const IR::Value& value);
|
Id Def(const IR::Value& value);
|
||||||
|
|
|
@ -113,14 +113,16 @@ struct RuntimeInfo {
|
||||||
RuntimeInfo(Stage stage_) : stage{stage_} {}
|
RuntimeInfo(Stage stage_) : stage{stage_} {}
|
||||||
|
|
||||||
bool operator==(const RuntimeInfo& other) const noexcept {
|
bool operator==(const RuntimeInfo& other) const noexcept {
|
||||||
if (stage == Stage::Fragment) {
|
switch (stage) {
|
||||||
|
case Stage::Fragment:
|
||||||
return fs_info == other.fs_info;
|
return fs_info == other.fs_info;
|
||||||
} else if (stage == Stage::Vertex) {
|
case Stage::Vertex:
|
||||||
return vs_info == other.vs_info;
|
return vs_info == other.vs_info;
|
||||||
} else if (stage == Stage::Compute) {
|
case Stage::Compute:
|
||||||
return cs_info == other.cs_info;
|
return cs_info == other.cs_info;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ Shader::RuntimeInfo BuildRuntimeInfo(Shader::Stage stage, const GraphicsPipeline
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
break;
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue