diff options
| author | 2022-01-29 13:46:06 -0500 | |
|---|---|---|
| committer | 2022-01-29 19:55:53 -0500 | |
| commit | ad58d7eae7bd34c881720ed6650c400cb549fcd6 (patch) | |
| tree | 135bb94ab1645a4080ec2e6f9914351bd315ee2a /src/shader_recompiler/backend/glsl | |
| parent | Merge pull request #7791 from german77/wall_clock (diff) | |
| download | yuzu-ad58d7eae7bd34c881720ed6650c400cb549fcd6.tar.gz yuzu-ad58d7eae7bd34c881720ed6650c400cb549fcd6.tar.xz yuzu-ad58d7eae7bd34c881720ed6650c400cb549fcd6.zip | |
shaders: Add U64->U32x2 Atomic fallback functions
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp | 96 | ||||
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_instructions.h | 31 |
2 files changed, 127 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp index dc377b053..782e0e496 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp | |||
| @@ -105,6 +105,13 @@ void EmitSharedAtomicExchange64(EmitContext& ctx, IR::Inst& inst, std::string_vi | |||
| 105 | pointer_offset, value, pointer_offset, value); | 105 | pointer_offset, value, pointer_offset, value); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | void EmitSharedAtomicExchange32x2(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | ||
| 109 | std::string_view value) { | ||
| 110 | LOG_WARNING(Shader_GLSL, "Int64 atomics not supported, fallback to non-atomic"); | ||
| 111 | ctx.AddU32x2("{}=uvec2(smem[{}>>2],smem[({}+4)>>2]);", inst, pointer_offset, pointer_offset); | ||
| 112 | ctx.Add("smem[{}>>2]={}.x;smem[({}+4)>>2]={}.y;", pointer_offset, value, pointer_offset, value); | ||
| 113 | } | ||
| 114 | |||
| 108 | void EmitStorageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | 115 | void EmitStorageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, |
| 109 | const IR::Value& offset, std::string_view value) { | 116 | const IR::Value& offset, std::string_view value) { |
| 110 | ctx.AddU32("{}=atomicAdd({}_ssbo{}[{}>>2],{});", inst, ctx.stage_name, binding.U32(), | 117 | ctx.AddU32("{}=atomicAdd({}_ssbo{}[{}>>2],{});", inst, ctx.stage_name, binding.U32(), |
| @@ -265,6 +272,51 @@ void EmitStorageAtomicExchange64(EmitContext& ctx, IR::Inst& inst, const IR::Val | |||
| 265 | ctx.stage_name, binding.U32(), ctx.var_alloc.Consume(offset), value); | 272 | ctx.stage_name, binding.U32(), ctx.var_alloc.Consume(offset), value); |
| 266 | } | 273 | } |
| 267 | 274 | ||
| 275 | void EmitStorageAtomicIAdd32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 276 | const IR::Value& offset, std::string_view value) { | ||
| 277 | throw NotImplementedException("GLSL Instrucion"); | ||
| 278 | } | ||
| 279 | |||
| 280 | void EmitStorageAtomicSMin32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 281 | const IR::Value& offset, std::string_view value) { | ||
| 282 | throw NotImplementedException("GLSL Instrucion"); | ||
| 283 | } | ||
| 284 | |||
| 285 | void EmitStorageAtomicUMin32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 286 | const IR::Value& offset, std::string_view value) { | ||
| 287 | throw NotImplementedException("GLSL Instrucion"); | ||
| 288 | } | ||
| 289 | |||
| 290 | void EmitStorageAtomicSMax32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 291 | const IR::Value& offset, std::string_view value) { | ||
| 292 | throw NotImplementedException("GLSL Instrucion"); | ||
| 293 | } | ||
| 294 | |||
| 295 | void EmitStorageAtomicUMax32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 296 | const IR::Value& offset, std::string_view value) { | ||
| 297 | throw NotImplementedException("GLSL Instrucion"); | ||
| 298 | } | ||
| 299 | |||
| 300 | void EmitStorageAtomicAnd32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 301 | const IR::Value& offset, std::string_view value) { | ||
| 302 | throw NotImplementedException("GLSL Instrucion"); | ||
| 303 | } | ||
| 304 | |||
| 305 | void EmitStorageAtomicOr32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 306 | const IR::Value& offset, std::string_view value) { | ||
| 307 | throw NotImplementedException("GLSL Instrucion"); | ||
| 308 | } | ||
| 309 | |||
| 310 | void EmitStorageAtomicXor32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 311 | const IR::Value& offset, std::string_view value) { | ||
| 312 | throw NotImplementedException("GLSL Instrucion"); | ||
| 313 | } | ||
| 314 | |||
| 315 | void EmitStorageAtomicExchange32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 316 | const IR::Value& offset, std::string_view value) { | ||
| 317 | throw NotImplementedException("GLSL Instrucion"); | ||
| 318 | } | ||
| 319 | |||
| 268 | void EmitStorageAtomicAddF32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | 320 | void EmitStorageAtomicAddF32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, |
| 269 | const IR::Value& offset, std::string_view value) { | 321 | const IR::Value& offset, std::string_view value) { |
| 270 | SsboCasFunctionF32(ctx, inst, binding, offset, value, "CasFloatAdd"); | 322 | SsboCasFunctionF32(ctx, inst, binding, offset, value, "CasFloatAdd"); |
| @@ -388,6 +440,50 @@ void EmitGlobalAtomicExchange64(EmitContext&) { | |||
| 388 | throw NotImplementedException("GLSL Instrucion"); | 440 | throw NotImplementedException("GLSL Instrucion"); |
| 389 | } | 441 | } |
| 390 | 442 | ||
| 443 | void EmitGlobalAtomicIAdd32x2(EmitContext&) { | ||
| 444 | throw NotImplementedException("GLSL Instrucion"); | ||
| 445 | } | ||
| 446 | |||
| 447 | void EmitGlobalAtomicSMin32x2(EmitContext&) { | ||
| 448 | throw NotImplementedException("GLSL Instrucion"); | ||
| 449 | } | ||
| 450 | |||
| 451 | void EmitGlobalAtomicUMin32x2(EmitContext&) { | ||
| 452 | throw NotImplementedException("GLSL Instrucion"); | ||
| 453 | } | ||
| 454 | |||
| 455 | void EmitGlobalAtomicSMax32x2(EmitContext&) { | ||
| 456 | throw NotImplementedException("GLSL Instrucion"); | ||
| 457 | } | ||
| 458 | |||
| 459 | void EmitGlobalAtomicUMax32x2(EmitContext&) { | ||
| 460 | throw NotImplementedException("GLSL Instrucion"); | ||
| 461 | } | ||
| 462 | |||
| 463 | void EmitGlobalAtomicInc32x2(EmitContext&) { | ||
| 464 | throw NotImplementedException("GLSL Instrucion"); | ||
| 465 | } | ||
| 466 | |||
| 467 | void EmitGlobalAtomicDec32x2(EmitContext&) { | ||
| 468 | throw NotImplementedException("GLSL Instrucion"); | ||
| 469 | } | ||
| 470 | |||
| 471 | void EmitGlobalAtomicAnd32x2(EmitContext&) { | ||
| 472 | throw NotImplementedException("GLSL Instrucion"); | ||
| 473 | } | ||
| 474 | |||
| 475 | void EmitGlobalAtomicOr32x2(EmitContext&) { | ||
| 476 | throw NotImplementedException("GLSL Instrucion"); | ||
| 477 | } | ||
| 478 | |||
| 479 | void EmitGlobalAtomicXor32x2(EmitContext&) { | ||
| 480 | throw NotImplementedException("GLSL Instrucion"); | ||
| 481 | } | ||
| 482 | |||
| 483 | void EmitGlobalAtomicExchange32x2(EmitContext&) { | ||
| 484 | throw NotImplementedException("GLSL Instrucion"); | ||
| 485 | } | ||
| 486 | |||
| 391 | void EmitGlobalAtomicAddF32(EmitContext&) { | 487 | void EmitGlobalAtomicAddF32(EmitContext&) { |
| 392 | throw NotImplementedException("GLSL Instrucion"); | 488 | throw NotImplementedException("GLSL Instrucion"); |
| 393 | } | 489 | } |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h index 6cabbc717..704baddc9 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h +++ b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h | |||
| @@ -442,6 +442,8 @@ void EmitSharedAtomicExchange32(EmitContext& ctx, IR::Inst& inst, std::string_vi | |||
| 442 | std::string_view value); | 442 | std::string_view value); |
| 443 | void EmitSharedAtomicExchange64(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | 443 | void EmitSharedAtomicExchange64(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, |
| 444 | std::string_view value); | 444 | std::string_view value); |
| 445 | void EmitSharedAtomicExchange32x2(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | ||
| 446 | std::string_view value); | ||
| 445 | void EmitStorageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | 447 | void EmitStorageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, |
| 446 | const IR::Value& offset, std::string_view value); | 448 | const IR::Value& offset, std::string_view value); |
| 447 | void EmitStorageAtomicSMin32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | 449 | void EmitStorageAtomicSMin32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, |
| @@ -482,6 +484,24 @@ void EmitStorageAtomicXor64(EmitContext& ctx, IR::Inst& inst, const IR::Value& b | |||
| 482 | const IR::Value& offset, std::string_view value); | 484 | const IR::Value& offset, std::string_view value); |
| 483 | void EmitStorageAtomicExchange64(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | 485 | void EmitStorageAtomicExchange64(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, |
| 484 | const IR::Value& offset, std::string_view value); | 486 | const IR::Value& offset, std::string_view value); |
| 487 | void EmitStorageAtomicIAdd32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 488 | const IR::Value& offset, std::string_view value); | ||
| 489 | void EmitStorageAtomicSMin32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 490 | const IR::Value& offset, std::string_view value); | ||
| 491 | void EmitStorageAtomicUMin32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 492 | const IR::Value& offset, std::string_view value); | ||
| 493 | void EmitStorageAtomicSMax32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 494 | const IR::Value& offset, std::string_view value); | ||
| 495 | void EmitStorageAtomicUMax32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 496 | const IR::Value& offset, std::string_view value); | ||
| 497 | void EmitStorageAtomicAnd32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 498 | const IR::Value& offset, std::string_view value); | ||
| 499 | void EmitStorageAtomicOr32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 500 | const IR::Value& offset, std::string_view value); | ||
| 501 | void EmitStorageAtomicXor32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 502 | const IR::Value& offset, std::string_view value); | ||
| 503 | void EmitStorageAtomicExchange32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | ||
| 504 | const IR::Value& offset, std::string_view value); | ||
| 485 | void EmitStorageAtomicAddF32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | 505 | void EmitStorageAtomicAddF32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, |
| 486 | const IR::Value& offset, std::string_view value); | 506 | const IR::Value& offset, std::string_view value); |
| 487 | void EmitStorageAtomicAddF16x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | 507 | void EmitStorageAtomicAddF16x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, |
| @@ -518,6 +538,17 @@ void EmitGlobalAtomicAnd64(EmitContext& ctx); | |||
| 518 | void EmitGlobalAtomicOr64(EmitContext& ctx); | 538 | void EmitGlobalAtomicOr64(EmitContext& ctx); |
| 519 | void EmitGlobalAtomicXor64(EmitContext& ctx); | 539 | void EmitGlobalAtomicXor64(EmitContext& ctx); |
| 520 | void EmitGlobalAtomicExchange64(EmitContext& ctx); | 540 | void EmitGlobalAtomicExchange64(EmitContext& ctx); |
| 541 | void EmitGlobalAtomicIAdd32x2(EmitContext& ctx); | ||
| 542 | void EmitGlobalAtomicSMin32x2(EmitContext& ctx); | ||
| 543 | void EmitGlobalAtomicUMin32x2(EmitContext& ctx); | ||
| 544 | void EmitGlobalAtomicSMax32x2(EmitContext& ctx); | ||
| 545 | void EmitGlobalAtomicUMax32x2(EmitContext& ctx); | ||
| 546 | void EmitGlobalAtomicInc32x2(EmitContext& ctx); | ||
| 547 | void EmitGlobalAtomicDec32x2(EmitContext& ctx); | ||
| 548 | void EmitGlobalAtomicAnd32x2(EmitContext& ctx); | ||
| 549 | void EmitGlobalAtomicOr32x2(EmitContext& ctx); | ||
| 550 | void EmitGlobalAtomicXor32x2(EmitContext& ctx); | ||
| 551 | void EmitGlobalAtomicExchange32x2(EmitContext& ctx); | ||
| 521 | void EmitGlobalAtomicAddF32(EmitContext& ctx); | 552 | void EmitGlobalAtomicAddF32(EmitContext& ctx); |
| 522 | void EmitGlobalAtomicAddF16x2(EmitContext& ctx); | 553 | void EmitGlobalAtomicAddF16x2(EmitContext& ctx); |
| 523 | void EmitGlobalAtomicAddF32x2(EmitContext& ctx); | 554 | void EmitGlobalAtomicAddF32x2(EmitContext& ctx); |