summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/spirv
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/spirv')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_context.cpp2
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_memory.cpp36
2 files changed, 31 insertions, 7 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp
index 865f34291..2d29d8c14 100644
--- a/src/shader_recompiler/backend/spirv/emit_context.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_context.cpp
@@ -830,7 +830,7 @@ void EmitContext::DefineAttributeMemAccess(const Info& info) {
830} 830}
831 831
832void EmitContext::DefineGlobalMemoryFunctions(const Info& info) { 832void EmitContext::DefineGlobalMemoryFunctions(const Info& info) {
833 if (!info.uses_global_memory) { 833 if (!info.uses_global_memory || !profile.support_int64) {
834 return; 834 return;
835 } 835 }
836 using DefPtr = Id StorageDefinitions::*; 836 using DefPtr = Id StorageDefinitions::*;
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_memory.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_memory.cpp
index ccebf170d..679ee2684 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_memory.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_memory.cpp
@@ -84,15 +84,27 @@ void EmitLoadGlobalS16(EmitContext&) {
84} 84}
85 85
86Id EmitLoadGlobal32(EmitContext& ctx, Id address) { 86Id EmitLoadGlobal32(EmitContext& ctx, Id address) {
87 return ctx.OpFunctionCall(ctx.U32[1], ctx.load_global_func_u32, address); 87 if (ctx.profile.support_int64) {
88 return ctx.OpFunctionCall(ctx.U32[1], ctx.load_global_func_u32, address);
89 }
90 LOG_WARNING(Shader_SPIRV, "Int64 not supported, ignoring memory operation");
91 return ctx.Const(0u);
88} 92}
89 93
90Id EmitLoadGlobal64(EmitContext& ctx, Id address) { 94Id EmitLoadGlobal64(EmitContext& ctx, Id address) {
91 return ctx.OpFunctionCall(ctx.U32[2], ctx.load_global_func_u32x2, address); 95 if (ctx.profile.support_int64) {
96 return ctx.OpFunctionCall(ctx.U32[2], ctx.load_global_func_u32x2, address);
97 }
98 LOG_WARNING(Shader_SPIRV, "Int64 not supported, ignoring memory operation");
99 return ctx.Const(0u, 0u);
92} 100}
93 101
94Id EmitLoadGlobal128(EmitContext& ctx, Id address) { 102Id EmitLoadGlobal128(EmitContext& ctx, Id address) {
95 return ctx.OpFunctionCall(ctx.U32[4], ctx.load_global_func_u32x4, address); 103 if (ctx.profile.support_int64) {
104 return ctx.OpFunctionCall(ctx.U32[4], ctx.load_global_func_u32x4, address);
105 }
106 LOG_WARNING(Shader_SPIRV, "Int64 not supported, ignoring memory operation");
107 return ctx.Const(0u, 0u, 0u, 0u);
96} 108}
97 109
98void EmitWriteGlobalU8(EmitContext&) { 110void EmitWriteGlobalU8(EmitContext&) {
@@ -112,15 +124,27 @@ void EmitWriteGlobalS16(EmitContext&) {
112} 124}
113 125
114void EmitWriteGlobal32(EmitContext& ctx, Id address, Id value) { 126void EmitWriteGlobal32(EmitContext& ctx, Id address, Id value) {
115 ctx.OpFunctionCall(ctx.void_id, ctx.write_global_func_u32, address, value); 127 if (ctx.profile.support_int64) {
128 ctx.OpFunctionCall(ctx.void_id, ctx.write_global_func_u32, address, value);
129 return;
130 }
131 LOG_WARNING(Shader_SPIRV, "Int64 not supported, ignoring memory operation");
116} 132}
117 133
118void EmitWriteGlobal64(EmitContext& ctx, Id address, Id value) { 134void EmitWriteGlobal64(EmitContext& ctx, Id address, Id value) {
119 ctx.OpFunctionCall(ctx.void_id, ctx.write_global_func_u32x2, address, value); 135 if (ctx.profile.support_int64) {
136 ctx.OpFunctionCall(ctx.void_id, ctx.write_global_func_u32x2, address, value);
137 return;
138 }
139 LOG_WARNING(Shader_SPIRV, "Int64 not supported, ignoring memory operation");
120} 140}
121 141
122void EmitWriteGlobal128(EmitContext& ctx, Id address, Id value) { 142void EmitWriteGlobal128(EmitContext& ctx, Id address, Id value) {
123 ctx.OpFunctionCall(ctx.void_id, ctx.write_global_func_u32x4, address, value); 143 if (ctx.profile.support_int64) {
144 ctx.OpFunctionCall(ctx.void_id, ctx.write_global_func_u32x4, address, value);
145 return;
146 }
147 LOG_WARNING(Shader_SPIRV, "Int64 not supported, ignoring memory operation");
124} 148}
125 149
126Id EmitLoadStorageU8(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset) { 150Id EmitLoadStorageU8(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset) {