mirror of
https://github.com/azahar-emu/azahar
synced 2025-11-07 07:29:58 +01:00
Allow SPIR-V when using Shadow2D texture mapping (#1057)
This commit is contained in:
parent
ee63706887
commit
bf587885cb
@ -440,7 +440,7 @@ void PipelineCache::UseFragmentShader(const Pica::RegsInternal& regs,
|
|||||||
if (new_shader) {
|
if (new_shader) {
|
||||||
workers.QueueWork([fs_config, this, &shader]() {
|
workers.QueueWork([fs_config, this, &shader]() {
|
||||||
const bool use_spirv = Settings::values.spirv_shader_gen.GetValue();
|
const bool use_spirv = Settings::values.spirv_shader_gen.GetValue();
|
||||||
if (use_spirv && !fs_config.UsesShadowPipeline()) {
|
if (use_spirv && !fs_config.UsesSpirvIncompatibleConfig()) {
|
||||||
const std::vector code = SPIRV::GenerateFragmentShader(fs_config, profile);
|
const std::vector code = SPIRV::GenerateFragmentShader(fs_config, profile);
|
||||||
shader.module = CompileSPV(code, instance.GetDevice());
|
shader.module = CompileSPV(code, instance.GetDevice());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Citra Emulator Project
|
// Copyright Citra Emulator Project / Azahar Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
@ -174,10 +174,9 @@ struct FSConfig {
|
|||||||
framebuffer.alpha_blend.eq != Pica::FramebufferRegs::BlendEquation::Add;
|
framebuffer.alpha_blend.eq != Pica::FramebufferRegs::BlendEquation::Add;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] bool UsesShadowPipeline() const {
|
[[nodiscard]] bool UsesSpirvIncompatibleConfig() const {
|
||||||
const auto texture0_type = texture.texture0_type.Value();
|
const auto texture0_type = texture.texture0_type.Value();
|
||||||
return texture0_type == Pica::TexturingRegs::TextureConfig::Shadow2D ||
|
return texture0_type == Pica::TexturingRegs::TextureConfig::ShadowCube ||
|
||||||
texture0_type == Pica::TexturingRegs::TextureConfig::ShadowCube ||
|
|
||||||
framebuffer.shadow_rendering.Value();
|
framebuffer.shadow_rendering.Value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Citra Emulator Project
|
// Copyright Citra Emulator Project / Azahar Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
@ -755,8 +755,12 @@ Id FragmentModule::CompareShadow(Id pixel, Id z) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Id FragmentModule::SampleShadow() {
|
Id FragmentModule::SampleShadow() {
|
||||||
const Id texcoord0{OpLoad(vec_ids.Get(2), texcoord_id[0])};
|
Id texcoord0{OpLoad(vec_ids.Get(2), texcoord_id[0])};
|
||||||
const Id texcoord0_w{OpLoad(f32_id, texcoord0_w_id)};
|
const Id texcoord0_w{OpLoad(f32_id, texcoord0_w_id)};
|
||||||
|
if (!config.texture.shadow_texture_orthographic) {
|
||||||
|
const Id div{OpCompositeConstruct(vec_ids.Get(2), texcoord0_w, texcoord0_w)};
|
||||||
|
texcoord0 = OpFDiv(vec_ids.Get(2), texcoord0, div);
|
||||||
|
}
|
||||||
const Id abs_min_w{OpFMul(f32_id, OpFMin(f32_id, OpFAbs(f32_id, texcoord0_w), ConstF32(1.f)),
|
const Id abs_min_w{OpFMul(f32_id, OpFMin(f32_id, OpFAbs(f32_id, texcoord0_w), ConstF32(1.f)),
|
||||||
ConstF32(16777215.f))};
|
ConstF32(16777215.f))};
|
||||||
const Id shadow_texture_bias{GetShaderDataMember(i32_id, ConstS32(17))};
|
const Id shadow_texture_bias{GetShaderDataMember(i32_id, ConstS32(17))};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user