summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.cpp6
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp30
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp29
3 files changed, 35 insertions, 30 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp
index fdbe2986c..484548467 100644
--- a/src/shader_recompiler/backend/glsl/emit_context.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_context.cpp
@@ -256,6 +256,12 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
256 if (runtime_info.force_early_z) { 256 if (runtime_info.force_early_z) {
257 header += "layout(early_fragment_tests)in;"; 257 header += "layout(early_fragment_tests)in;";
258 } 258 }
259 if (info.uses_sample_id) {
260 header += "in int gl_SampleID;";
261 }
262 if (info.stores_sample_mask) {
263 header += "out int gl_SampleMask[];";
264 }
259 break; 265 break;
260 case Stage::Compute: 266 case Stage::Compute:
261 stage_name = "cs"; 267 stage_name = "cs";
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
index c9a2ceb3d..0546c1c81 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
@@ -239,7 +239,6 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
239 ctx.AddF32("{}=itof(gl_FrontFacing?-1:0);", inst); 239 ctx.AddF32("{}=itof(gl_FrontFacing?-1:0);", inst);
240 break; 240 break;
241 default: 241 default:
242 fmt::print("Get attribute {}", attr);
243 throw NotImplementedException("Get attribute {}", attr); 242 throw NotImplementedException("Get attribute {}", attr);
244 } 243 }
245} 244}
@@ -397,10 +396,39 @@ void EmitSetFragColor(EmitContext& ctx, u32 index, u32 component, std::string_vi
397 ctx.Add("frag_color{}.{}={};", index, swizzle, value); 396 ctx.Add("frag_color{}.{}={};", index, swizzle, value);
398} 397}
399 398
399void EmitSetSampleMask(EmitContext& ctx, std::string_view value) {
400 ctx.Add("gl_SampleMask[0]=int({})", value);
401}
402
403void EmitSetFragDepth(EmitContext& ctx, std::string_view value) {
404 ctx.Add("gl_FragDepth={};", value);
405}
406
400void EmitLocalInvocationId(EmitContext& ctx, IR::Inst& inst) { 407void EmitLocalInvocationId(EmitContext& ctx, IR::Inst& inst) {
401 ctx.AddU32x3("{}=gl_LocalInvocationID;", inst); 408 ctx.AddU32x3("{}=gl_LocalInvocationID;", inst);
402} 409}
403 410
411void EmitWorkgroupId(EmitContext& ctx, IR::Inst& inst) {
412 ctx.AddU32x3("{}=gl_WorkGroupID;", inst);
413}
414
415void EmitInvocationId(EmitContext& ctx, IR::Inst& inst) {
416 ctx.AddU32("{}=uint(gl_InvocationID);", inst);
417}
418
419void EmitSampleId(EmitContext& ctx, IR::Inst& inst) {
420 ctx.AddU32("{}=uint(gl_SampleID);", inst);
421}
422
423void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst) {
424 ctx.AddU1("{}=gl_HelperInvocation;", inst);
425}
426
427void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
428 ctx.uses_y_direction = true;
429 ctx.AddF32("{}=gl_FrontMaterial.ambient.a;", inst);
430}
431
404void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset) { 432void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset) {
405 ctx.AddU32("{}=lmem[{}];", inst, word_offset); 433 ctx.AddU32("{}=lmem[{}];", inst, word_offset);
406} 434}
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp
index b292db9d4..f17a07955 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp
@@ -124,14 +124,6 @@ void EmitGetIndirectBranchVariable(EmitContext& ctx) {
124 NotImplemented(); 124 NotImplemented();
125} 125}
126 126
127void EmitSetSampleMask(EmitContext& ctx, std::string_view value) {
128 NotImplemented();
129}
130
131void EmitSetFragDepth(EmitContext& ctx, std::string_view value) {
132 ctx.Add("gl_FragDepth={};", value);
133}
134
135void EmitGetZFlag(EmitContext& ctx) { 127void EmitGetZFlag(EmitContext& ctx) {
136 NotImplemented(); 128 NotImplemented();
137} 129}
@@ -164,27 +156,6 @@ void EmitSetOFlag(EmitContext& ctx) {
164 NotImplemented(); 156 NotImplemented();
165} 157}
166 158
167void EmitWorkgroupId(EmitContext& ctx, IR::Inst& inst) {
168 ctx.AddU32x3("{}=gl_WorkGroupID;", inst);
169}
170
171void EmitInvocationId(EmitContext& ctx, IR::Inst& inst) {
172 ctx.AddU32("{}=uint(gl_InvocationID);", inst);
173}
174
175void EmitSampleId(EmitContext& ctx, IR::Inst& inst) {
176 NotImplemented();
177}
178
179void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst) {
180 ctx.AddU1("{}=gl_HelperInvocation;", inst);
181}
182
183void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
184 ctx.uses_y_direction = true;
185 ctx.AddF32("{}=gl_FrontMaterial.ambient.a;", inst);
186}
187
188void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) { 159void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) {
189 ctx.AddU1("{}=false;", inst); 160 ctx.AddU1("{}=false;", inst);
190} 161}