소스 검색

shader: Implement FragDepth

FernandoS27 5 년 전
부모
커밋
f5672777c8
2개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 0
      src/shader_recompiler/backend/spirv/emit_context.cpp
  2. 1 1
      src/shader_recompiler/frontend/maxwell/translate/impl/exit_program.cpp

+ 6 - 0
src/shader_recompiler/backend/spirv/emit_context.cpp

@@ -359,6 +359,12 @@ void EmitContext::DefineOutputs(const Info& info) {
             Decorate(frag_color[i], spv::Decoration::Location, static_cast<u32>(i));
             Name(frag_color[i], fmt::format("frag_color{}", i));
         }
+        if (!info.stores_frag_depth) {
+            return;
+        }
+        frag_depth = DefineOutput(*this, F32[1]);
+        Decorate(frag_depth, spv::Decoration::BuiltIn, static_cast<u32>(spv::BuiltIn::FragDepth));
+        Name(frag_depth, "frag_depth");
     }
 }
 

+ 1 - 1
src/shader_recompiler/frontend/maxwell/translate/impl/exit_program.cpp

@@ -25,7 +25,7 @@ void ExitFragment(TranslatorVisitor& v) {
         throw NotImplementedException("Sample mask");
     }
     if (sph.ps.omap.depth != 0) {
-        throw NotImplementedException("Fragment depth");
+        v.ir.SetFragDepth(v.F(src_reg + 1));
     }
 }
 } // Anonymous namespace