summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_image.cpp8
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_instructions.h1
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_image.cpp8
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_instructions.h2
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_image.cpp4
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_instructions.h1
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.cpp4
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.h3
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.inc2
-rw-r--r--src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp1
10 files changed, 34 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
index 09e3a9b82..583ed3cf2 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
@@ -608,6 +608,14 @@ void EmitImageWrite(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Re
608 ctx.Add("STOREIM.{} {},{},{},{};", format, image, color, coord, type); 608 ctx.Add("STOREIM.{} {},{},{},{};", format, image, color, coord, type);
609} 609}
610 610
611void EmitIsTextureScaled(EmitContext& ctx, IR::Inst& inst, const IR::Value& index) {
612 if (!index.IsImmediate()) {
613 throw NotImplementedException("Non-constant texture rescaling");
614 }
615 UNIMPLEMENTED();
616 ctx.Add("MOV.S {}.x,-1;", inst);
617}
618
611void EmitImageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord, 619void EmitImageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord,
612 ScalarU32 value) { 620 ScalarU32 value) {
613 ImageAtomic(ctx, inst, index, coord, value, "ADD.U32"); 621 ImageAtomic(ctx, inst, index, coord, value, "ADD.U32");
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h
index 4f8dd8e42..e2b7d601d 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h
@@ -556,6 +556,7 @@ void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
556void EmitImageRead(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord); 556void EmitImageRead(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord);
557void EmitImageWrite(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord, 557void EmitImageWrite(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord,
558 Register color); 558 Register color);
559void EmitIsTextureScaled(EmitContext& ctx, IR::Inst& inst, const IR::Value& index);
559void EmitBindlessImageAtomicIAdd32(EmitContext&); 560void EmitBindlessImageAtomicIAdd32(EmitContext&);
560void EmitBindlessImageAtomicSMin32(EmitContext&); 561void EmitBindlessImageAtomicSMin32(EmitContext&);
561void EmitBindlessImageAtomicUMin32(EmitContext&); 562void EmitBindlessImageAtomicUMin32(EmitContext&);
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
index 447eb8e0a..099e0160b 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
@@ -612,6 +612,14 @@ void EmitImageAtomicExchange32(EmitContext& ctx, IR::Inst& inst, const IR::Value
612 value); 612 value);
613} 613}
614 614
615void EmitIsTextureScaled(EmitContext& ctx, IR::Inst& inst, const IR::Value& index) {
616 if (!index.IsImmediate()) {
617 throw NotImplementedException("Non-constant texture rescaling");
618 }
619 UNIMPLEMENTED();
620 ctx.AddU1("{}=true;", inst);
621}
622
615void EmitBindlessImageSampleImplicitLod(EmitContext&) { 623void EmitBindlessImageSampleImplicitLod(EmitContext&) {
616 NotImplemented(); 624 NotImplemented();
617} 625}
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h
index 159e4b770..f86502e4c 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h
@@ -630,6 +630,8 @@ void EmitImageRead(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
630 std::string_view coords); 630 std::string_view coords);
631void EmitImageWrite(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 631void EmitImageWrite(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
632 std::string_view coords, std::string_view color); 632 std::string_view coords, std::string_view color);
633void EmitIsTextureScaled(EmitContext& ctx, IR::Inst& inst, const IR::Value& index);
634void EmitIsImageScaled(EmitContext& ctx, IR::Inst& inst, const IR::Value& index);
633void EmitBindlessImageAtomicIAdd32(EmitContext&); 635void EmitBindlessImageAtomicIAdd32(EmitContext&);
634void EmitBindlessImageAtomicSMin32(EmitContext&); 636void EmitBindlessImageAtomicSMin32(EmitContext&);
635void EmitBindlessImageAtomicUMin32(EmitContext&); 637void EmitBindlessImageAtomicUMin32(EmitContext&);
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
index 1d5364309..2f925cc3e 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
@@ -470,4 +470,8 @@ void EmitImageWrite(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id
470 ctx.OpImageWrite(Image(ctx, index, info), coords, color); 470 ctx.OpImageWrite(Image(ctx, index, info), coords, color);
471} 471}
472 472
473Id EmitIsTextureScaled([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] const IR::Value& index) {
474 return ctx.false_value;
475}
476
473} // namespace Shader::Backend::SPIRV 477} // namespace Shader::Backend::SPIRV
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h b/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h
index 44eda16ca..69fc18f5f 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h
@@ -513,6 +513,7 @@ Id EmitImageGradient(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, I
513 Id derivates, Id offset, Id lod_clamp); 513 Id derivates, Id offset, Id lod_clamp);
514Id EmitImageRead(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords); 514Id EmitImageRead(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords);
515void EmitImageWrite(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id color); 515void EmitImageWrite(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id color);
516Id EmitIsTextureScaled(EmitContext& ctx, const IR::Value& index);
516Id EmitBindlessImageAtomicIAdd32(EmitContext&); 517Id EmitBindlessImageAtomicIAdd32(EmitContext&);
517Id EmitBindlessImageAtomicSMin32(EmitContext&); 518Id EmitBindlessImageAtomicSMin32(EmitContext&);
518Id EmitBindlessImageAtomicUMin32(EmitContext&); 519Id EmitBindlessImageAtomicUMin32(EmitContext&);
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
index 3dfba8e71..3ccd91c10 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
@@ -1946,6 +1946,10 @@ Value IREmitter::ImageAtomicExchange(const Value& handle, const Value& coords, c
1946 return Inst(op, Flags{info}, handle, coords, value); 1946 return Inst(op, Flags{info}, handle, coords, value);
1947} 1947}
1948 1948
1949U1 IREmitter::IsTextureScaled(const U32& index) {
1950 return Inst<U1>(Opcode::IsTextureScaled, index);
1951}
1952
1949U1 IREmitter::VoteAll(const U1& value) { 1953U1 IREmitter::VoteAll(const U1& value) {
1950 return Inst<U1>(Opcode::VoteAll, value); 1954 return Inst<U1>(Opcode::VoteAll, value);
1951} 1955}
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h
index 1959be42e..a78628413 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.h
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.h
@@ -359,6 +359,9 @@ public:
359 TextureInstInfo info); 359 TextureInstInfo info);
360 [[nodiscard]] Value ImageAtomicExchange(const Value& handle, const Value& coords, 360 [[nodiscard]] Value ImageAtomicExchange(const Value& handle, const Value& coords,
361 const Value& value, TextureInstInfo info); 361 const Value& value, TextureInstInfo info);
362
363 [[nodiscard]] U1 IsTextureScaled(const U32& index);
364
362 [[nodiscard]] U1 VoteAll(const U1& value); 365 [[nodiscard]] U1 VoteAll(const U1& value);
363 [[nodiscard]] U1 VoteAny(const U1& value); 366 [[nodiscard]] U1 VoteAny(const U1& value);
364 [[nodiscard]] U1 VoteEqual(const U1& value); 367 [[nodiscard]] U1 VoteEqual(const U1& value);
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc
index c05e6d312..ec629428a 100644
--- a/src/shader_recompiler/frontend/ir/opcodes.inc
+++ b/src/shader_recompiler/frontend/ir/opcodes.inc
@@ -493,6 +493,8 @@ OPCODE(ImageGradient, F32x4, Opaq
493OPCODE(ImageRead, U32x4, Opaque, Opaque, ) 493OPCODE(ImageRead, U32x4, Opaque, Opaque, )
494OPCODE(ImageWrite, Void, Opaque, Opaque, U32x4, ) 494OPCODE(ImageWrite, Void, Opaque, Opaque, U32x4, )
495 495
496OPCODE(IsTextureScaled, U1, U32, )
497
496// Atomic Image operations 498// Atomic Image operations
497 499
498OPCODE(BindlessImageAtomicIAdd32, U32, U32, Opaque, U32, ) 500OPCODE(BindlessImageAtomicIAdd32, U32, U32, Opaque, U32, )
diff --git a/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp b/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp
index ef918f4d4..ed82fa2ac 100644
--- a/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp
+++ b/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp
@@ -431,6 +431,7 @@ void VisitUsages(Info& info, IR::Inst& inst) {
431 info.uses_is_helper_invocation = true; 431 info.uses_is_helper_invocation = true;
432 break; 432 break;
433 case IR::Opcode::ResolutionDownFactor: 433 case IR::Opcode::ResolutionDownFactor:
434 case IR::Opcode::IsTextureScaled:
434 info.uses_rescaling_uniform = true; 435 info.uses_rescaling_uniform = true;
435 break; 436 break;
436 case IR::Opcode::LaneId: 437 case IR::Opcode::LaneId: