summaryrefslogtreecommitdiff
path: root/src/shader_recompiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp80
-rw-r--r--src/shader_recompiler/backend/glsl/glsl_emit_context.h2
-rw-r--r--src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp8
3 files changed, 48 insertions, 42 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp
index 911181c43..376a05827 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp
@@ -398,162 +398,162 @@ void EmitStorageAtomicMaxF32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value
398} 398}
399 399
400void EmitGlobalAtomicIAdd32(EmitContext&) { 400void EmitGlobalAtomicIAdd32(EmitContext&) {
401 throw NotImplementedException("GLSL Instrucion"); 401 throw NotImplementedException("GLSL Instruction");
402} 402}
403 403
404void EmitGlobalAtomicSMin32(EmitContext&) { 404void EmitGlobalAtomicSMin32(EmitContext&) {
405 throw NotImplementedException("GLSL Instrucion"); 405 throw NotImplementedException("GLSL Instruction");
406} 406}
407 407
408void EmitGlobalAtomicUMin32(EmitContext&) { 408void EmitGlobalAtomicUMin32(EmitContext&) {
409 throw NotImplementedException("GLSL Instrucion"); 409 throw NotImplementedException("GLSL Instruction");
410} 410}
411 411
412void EmitGlobalAtomicSMax32(EmitContext&) { 412void EmitGlobalAtomicSMax32(EmitContext&) {
413 throw NotImplementedException("GLSL Instrucion"); 413 throw NotImplementedException("GLSL Instruction");
414} 414}
415 415
416void EmitGlobalAtomicUMax32(EmitContext&) { 416void EmitGlobalAtomicUMax32(EmitContext&) {
417 throw NotImplementedException("GLSL Instrucion"); 417 throw NotImplementedException("GLSL Instruction");
418} 418}
419 419
420void EmitGlobalAtomicInc32(EmitContext&) { 420void EmitGlobalAtomicInc32(EmitContext&) {
421 throw NotImplementedException("GLSL Instrucion"); 421 throw NotImplementedException("GLSL Instruction");
422} 422}
423 423
424void EmitGlobalAtomicDec32(EmitContext&) { 424void EmitGlobalAtomicDec32(EmitContext&) {
425 throw NotImplementedException("GLSL Instrucion"); 425 throw NotImplementedException("GLSL Instruction");
426} 426}
427 427
428void EmitGlobalAtomicAnd32(EmitContext&) { 428void EmitGlobalAtomicAnd32(EmitContext&) {
429 throw NotImplementedException("GLSL Instrucion"); 429 throw NotImplementedException("GLSL Instruction");
430} 430}
431 431
432void EmitGlobalAtomicOr32(EmitContext&) { 432void EmitGlobalAtomicOr32(EmitContext&) {
433 throw NotImplementedException("GLSL Instrucion"); 433 throw NotImplementedException("GLSL Instruction");
434} 434}
435 435
436void EmitGlobalAtomicXor32(EmitContext&) { 436void EmitGlobalAtomicXor32(EmitContext&) {
437 throw NotImplementedException("GLSL Instrucion"); 437 throw NotImplementedException("GLSL Instruction");
438} 438}
439 439
440void EmitGlobalAtomicExchange32(EmitContext&) { 440void EmitGlobalAtomicExchange32(EmitContext&) {
441 throw NotImplementedException("GLSL Instrucion"); 441 throw NotImplementedException("GLSL Instruction");
442} 442}
443 443
444void EmitGlobalAtomicIAdd64(EmitContext&) { 444void EmitGlobalAtomicIAdd64(EmitContext&) {
445 throw NotImplementedException("GLSL Instrucion"); 445 throw NotImplementedException("GLSL Instruction");
446} 446}
447 447
448void EmitGlobalAtomicSMin64(EmitContext&) { 448void EmitGlobalAtomicSMin64(EmitContext&) {
449 throw NotImplementedException("GLSL Instrucion"); 449 throw NotImplementedException("GLSL Instruction");
450} 450}
451 451
452void EmitGlobalAtomicUMin64(EmitContext&) { 452void EmitGlobalAtomicUMin64(EmitContext&) {
453 throw NotImplementedException("GLSL Instrucion"); 453 throw NotImplementedException("GLSL Instruction");
454} 454}
455 455
456void EmitGlobalAtomicSMax64(EmitContext&) { 456void EmitGlobalAtomicSMax64(EmitContext&) {
457 throw NotImplementedException("GLSL Instrucion"); 457 throw NotImplementedException("GLSL Instruction");
458} 458}
459 459
460void EmitGlobalAtomicUMax64(EmitContext&) { 460void EmitGlobalAtomicUMax64(EmitContext&) {
461 throw NotImplementedException("GLSL Instrucion"); 461 throw NotImplementedException("GLSL Instruction");
462} 462}
463 463
464void EmitGlobalAtomicInc64(EmitContext&) { 464void EmitGlobalAtomicInc64(EmitContext&) {
465 throw NotImplementedException("GLSL Instrucion"); 465 throw NotImplementedException("GLSL Instruction");
466} 466}
467 467
468void EmitGlobalAtomicDec64(EmitContext&) { 468void EmitGlobalAtomicDec64(EmitContext&) {
469 throw NotImplementedException("GLSL Instrucion"); 469 throw NotImplementedException("GLSL Instruction");
470} 470}
471 471
472void EmitGlobalAtomicAnd64(EmitContext&) { 472void EmitGlobalAtomicAnd64(EmitContext&) {
473 throw NotImplementedException("GLSL Instrucion"); 473 throw NotImplementedException("GLSL Instruction");
474} 474}
475 475
476void EmitGlobalAtomicOr64(EmitContext&) { 476void EmitGlobalAtomicOr64(EmitContext&) {
477 throw NotImplementedException("GLSL Instrucion"); 477 throw NotImplementedException("GLSL Instruction");
478} 478}
479 479
480void EmitGlobalAtomicXor64(EmitContext&) { 480void EmitGlobalAtomicXor64(EmitContext&) {
481 throw NotImplementedException("GLSL Instrucion"); 481 throw NotImplementedException("GLSL Instruction");
482} 482}
483 483
484void EmitGlobalAtomicExchange64(EmitContext&) { 484void EmitGlobalAtomicExchange64(EmitContext&) {
485 throw NotImplementedException("GLSL Instrucion"); 485 throw NotImplementedException("GLSL Instruction");
486} 486}
487 487
488void EmitGlobalAtomicIAdd32x2(EmitContext&) { 488void EmitGlobalAtomicIAdd32x2(EmitContext&) {
489 throw NotImplementedException("GLSL Instrucion"); 489 throw NotImplementedException("GLSL Instruction");
490} 490}
491 491
492void EmitGlobalAtomicSMin32x2(EmitContext&) { 492void EmitGlobalAtomicSMin32x2(EmitContext&) {
493 throw NotImplementedException("GLSL Instrucion"); 493 throw NotImplementedException("GLSL Instruction");
494} 494}
495 495
496void EmitGlobalAtomicUMin32x2(EmitContext&) { 496void EmitGlobalAtomicUMin32x2(EmitContext&) {
497 throw NotImplementedException("GLSL Instrucion"); 497 throw NotImplementedException("GLSL Instruction");
498} 498}
499 499
500void EmitGlobalAtomicSMax32x2(EmitContext&) { 500void EmitGlobalAtomicSMax32x2(EmitContext&) {
501 throw NotImplementedException("GLSL Instrucion"); 501 throw NotImplementedException("GLSL Instruction");
502} 502}
503 503
504void EmitGlobalAtomicUMax32x2(EmitContext&) { 504void EmitGlobalAtomicUMax32x2(EmitContext&) {
505 throw NotImplementedException("GLSL Instrucion"); 505 throw NotImplementedException("GLSL Instruction");
506} 506}
507 507
508void EmitGlobalAtomicInc32x2(EmitContext&) { 508void EmitGlobalAtomicInc32x2(EmitContext&) {
509 throw NotImplementedException("GLSL Instrucion"); 509 throw NotImplementedException("GLSL Instruction");
510} 510}
511 511
512void EmitGlobalAtomicDec32x2(EmitContext&) { 512void EmitGlobalAtomicDec32x2(EmitContext&) {
513 throw NotImplementedException("GLSL Instrucion"); 513 throw NotImplementedException("GLSL Instruction");
514} 514}
515 515
516void EmitGlobalAtomicAnd32x2(EmitContext&) { 516void EmitGlobalAtomicAnd32x2(EmitContext&) {
517 throw NotImplementedException("GLSL Instrucion"); 517 throw NotImplementedException("GLSL Instruction");
518} 518}
519 519
520void EmitGlobalAtomicOr32x2(EmitContext&) { 520void EmitGlobalAtomicOr32x2(EmitContext&) {
521 throw NotImplementedException("GLSL Instrucion"); 521 throw NotImplementedException("GLSL Instruction");
522} 522}
523 523
524void EmitGlobalAtomicXor32x2(EmitContext&) { 524void EmitGlobalAtomicXor32x2(EmitContext&) {
525 throw NotImplementedException("GLSL Instrucion"); 525 throw NotImplementedException("GLSL Instruction");
526} 526}
527 527
528void EmitGlobalAtomicExchange32x2(EmitContext&) { 528void EmitGlobalAtomicExchange32x2(EmitContext&) {
529 throw NotImplementedException("GLSL Instrucion"); 529 throw NotImplementedException("GLSL Instruction");
530} 530}
531 531
532void EmitGlobalAtomicAddF32(EmitContext&) { 532void EmitGlobalAtomicAddF32(EmitContext&) {
533 throw NotImplementedException("GLSL Instrucion"); 533 throw NotImplementedException("GLSL Instruction");
534} 534}
535 535
536void EmitGlobalAtomicAddF16x2(EmitContext&) { 536void EmitGlobalAtomicAddF16x2(EmitContext&) {
537 throw NotImplementedException("GLSL Instrucion"); 537 throw NotImplementedException("GLSL Instruction");
538} 538}
539 539
540void EmitGlobalAtomicAddF32x2(EmitContext&) { 540void EmitGlobalAtomicAddF32x2(EmitContext&) {
541 throw NotImplementedException("GLSL Instrucion"); 541 throw NotImplementedException("GLSL Instruction");
542} 542}
543 543
544void EmitGlobalAtomicMinF16x2(EmitContext&) { 544void EmitGlobalAtomicMinF16x2(EmitContext&) {
545 throw NotImplementedException("GLSL Instrucion"); 545 throw NotImplementedException("GLSL Instruction");
546} 546}
547 547
548void EmitGlobalAtomicMinF32x2(EmitContext&) { 548void EmitGlobalAtomicMinF32x2(EmitContext&) {
549 throw NotImplementedException("GLSL Instrucion"); 549 throw NotImplementedException("GLSL Instruction");
550} 550}
551 551
552void EmitGlobalAtomicMaxF16x2(EmitContext&) { 552void EmitGlobalAtomicMaxF16x2(EmitContext&) {
553 throw NotImplementedException("GLSL Instrucion"); 553 throw NotImplementedException("GLSL Instruction");
554} 554}
555 555
556void EmitGlobalAtomicMaxF32x2(EmitContext&) { 556void EmitGlobalAtomicMaxF32x2(EmitContext&) {
557 throw NotImplementedException("GLSL Instrucion"); 557 throw NotImplementedException("GLSL Instruction");
558} 558}
559} // namespace Shader::Backend::GLSL 559} // namespace Shader::Backend::GLSL
diff --git a/src/shader_recompiler/backend/glsl/glsl_emit_context.h b/src/shader_recompiler/backend/glsl/glsl_emit_context.h
index dfd10ac28..7587f7bab 100644
--- a/src/shader_recompiler/backend/glsl/glsl_emit_context.h
+++ b/src/shader_recompiler/backend/glsl/glsl_emit_context.h
@@ -49,7 +49,7 @@ public:
49 void Add(const char* format_str, IR::Inst& inst, Args&&... args) { 49 void Add(const char* format_str, IR::Inst& inst, Args&&... args) {
50 const auto var_def{var_alloc.AddDefine(inst, type)}; 50 const auto var_def{var_alloc.AddDefine(inst, type)};
51 if (var_def.empty()) { 51 if (var_def.empty()) {
52 // skip assigment. 52 // skip assignment.
53 code += fmt::format(fmt::runtime(format_str + 3), std::forward<Args>(args)...); 53 code += fmt::format(fmt::runtime(format_str + 3), std::forward<Args>(args)...);
54 } else { 54 } else {
55 code += fmt::format(fmt::runtime(format_str), var_def, std::forward<Args>(args)...); 55 code += fmt::format(fmt::runtime(format_str), var_def, std::forward<Args>(args)...);
diff --git a/src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp b/src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp
index 336338e62..d1e59f22e 100644
--- a/src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp
+++ b/src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp
@@ -35,6 +35,7 @@ struct Bias {
35 u32 index; 35 u32 index;
36 u32 offset_begin; 36 u32 offset_begin;
37 u32 offset_end; 37 u32 offset_end;
38 u32 alignment;
38}; 39};
39 40
40using boost::container::flat_set; 41using boost::container::flat_set;
@@ -349,7 +350,8 @@ std::optional<StorageBufferAddr> Track(const IR::Value& value, const Bias* bias)
349 .index = index.U32(), 350 .index = index.U32(),
350 .offset = offset.U32(), 351 .offset = offset.U32(),
351 }; 352 };
352 if (!Common::IsAligned(storage_buffer.offset, 16)) { 353 const u32 alignment{bias ? bias->alignment : 8U};
354 if (!Common::IsAligned(storage_buffer.offset, alignment)) {
353 // The SSBO pointer has to be aligned 355 // The SSBO pointer has to be aligned
354 return std::nullopt; 356 return std::nullopt;
355 } 357 }
@@ -371,6 +373,7 @@ void CollectStorageBuffers(IR::Block& block, IR::Inst& inst, StorageInfo& info)
371 .index = 0, 373 .index = 0,
372 .offset_begin = 0x110, 374 .offset_begin = 0x110,
373 .offset_end = 0x610, 375 .offset_end = 0x610,
376 .alignment = 16,
374 }; 377 };
375 // Track the low address of the instruction 378 // Track the low address of the instruction
376 const std::optional<LowAddrInfo> low_addr_info{TrackLowAddress(&inst)}; 379 const std::optional<LowAddrInfo> low_addr_info{TrackLowAddress(&inst)};
@@ -386,8 +389,11 @@ void CollectStorageBuffers(IR::Block& block, IR::Inst& inst, StorageInfo& info)
386 storage_buffer = Track(low_addr, nullptr); 389 storage_buffer = Track(low_addr, nullptr);
387 if (!storage_buffer) { 390 if (!storage_buffer) {
388 // If that also fails, use NVN fallbacks 391 // If that also fails, use NVN fallbacks
392 LOG_WARNING(Shader, "Storage buffer failed to track, using global memory fallbacks");
389 return; 393 return;
390 } 394 }
395 LOG_WARNING(Shader, "Storage buffer tracked without bias, index {} offset {}",
396 storage_buffer->index, storage_buffer->offset);
391 } 397 }
392 // Collect storage buffer and the instruction 398 // Collect storage buffer and the instruction
393 if (IsGlobalMemoryWrite(inst)) { 399 if (IsGlobalMemoryWrite(inst)) {