summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glasm
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-06-02 08:02:33 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:34 +0200
commit79f2fe1a39120f498e915fa0c740b15dc0f09793 (patch)
treeee1fb2edc8193295930abbf1ad157bdaf4a682d5 /src/shader_recompiler/backend/glasm
parentbuffer_cache: Reduce uniform buffer size from shader usage (diff)
downloadyuzu-79f2fe1a39120f498e915fa0c740b15dc0f09793.tar
yuzu-79f2fe1a39120f498e915fa0c740b15dc0f09793.tar.gz
yuzu-79f2fe1a39120f498e915fa0c740b15dc0f09793.tar.bz2
yuzu-79f2fe1a39120f498e915fa0c740b15dc0f09793.tar.lz
yuzu-79f2fe1a39120f498e915fa0c740b15dc0f09793.tar.xz
yuzu-79f2fe1a39120f498e915fa0c740b15dc0f09793.tar.zst
yuzu-79f2fe1a39120f498e915fa0c740b15dc0f09793.zip
Diffstat (limited to 'src/shader_recompiler/backend/glasm')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm.cpp7
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_warp.cpp29
2 files changed, 29 insertions, 7 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
index 70ca6f621..fc01797b6 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
@@ -265,9 +265,7 @@ void SetupOptions(const IR::Program& program, const Profile& profile,
// TODO: Track the shared atomic ops
header += "OPTION NV_internal;"
"OPTION NV_shader_storage_buffer;"
- "OPTION NV_gpu_program_fp64;"
- "OPTION NV_bindless_texture;"
- "OPTION ARB_derivative_control;";
+ "OPTION NV_gpu_program_fp64;";
if (info.uses_int64_bit_atomics) {
header += "OPTION NV_shader_atomic_int64;";
}
@@ -295,6 +293,9 @@ void SetupOptions(const IR::Program& program, const Profile& profile,
if (info.uses_typeless_image_reads && profile.support_typeless_image_loads) {
header += "OPTION EXT_shader_image_load_formatted;";
}
+ if (profile.support_derivative_control) {
+ header += "OPTION ARB_derivative_control;";
+ }
if (stage == Stage::Fragment && runtime_info.force_early_z != 0) {
header += "OPTION NV_early_fragment_tests;";
}
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_warp.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_warp.cpp
index 6e30790bb..8cec5ee7e 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_warp.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_warp.cpp
@@ -5,6 +5,7 @@
#include "shader_recompiler/backend/glasm/emit_context.h"
#include "shader_recompiler/backend/glasm/emit_glasm_instructions.h"
#include "shader_recompiler/frontend/ir/value.h"
+#include "shader_recompiler/profile.h"
namespace Shader::Backend::GLASM {
@@ -111,19 +112,39 @@ void EmitFSwizzleAdd(EmitContext& ctx, IR::Inst& inst, ScalarF32 op_a, ScalarF32
}
void EmitDPdxFine(EmitContext& ctx, IR::Inst& inst, ScalarF32 p) {
- ctx.Add("DDX.FINE {}.x,{};", inst, p);
+ if (ctx.profile.support_derivative_control) {
+ ctx.Add("DDX.FINE {}.x,{};", inst, p);
+ } else {
+ // LOG_WARNING
+ ctx.Add("DDX {}.x,{};", inst, p);
+ }
}
void EmitDPdyFine(EmitContext& ctx, IR::Inst& inst, ScalarF32 p) {
- ctx.Add("DDY.FINE {}.x,{};", inst, p);
+ if (ctx.profile.support_derivative_control) {
+ ctx.Add("DDY.FINE {}.x,{};", inst, p);
+ } else {
+ // LOG_WARNING
+ ctx.Add("DDY {}.x,{};", inst, p);
+ }
}
void EmitDPdxCoarse(EmitContext& ctx, IR::Inst& inst, ScalarF32 p) {
- ctx.Add("DDX.COARSE {}.x,{};", inst, p);
+ if (ctx.profile.support_derivative_control) {
+ ctx.Add("DDX.COARSE {}.x,{};", inst, p);
+ } else {
+ // LOG_WARNING
+ ctx.Add("DDX {}.x,{};", inst, p);
+ }
}
void EmitDPdyCoarse(EmitContext& ctx, IR::Inst& inst, ScalarF32 p) {
- ctx.Add("DDY.COARSE {}.x,{};", inst, p);
+ if (ctx.profile.support_derivative_control) {
+ ctx.Add("DDY.COARSE {}.x,{};", inst, p);
+ } else {
+ // LOG_WARNING
+ ctx.Add("DDY {}.x,{};", inst, p);
+ }
}
} // namespace Shader::Backend::GLASM