Handle immediate inline samplers (#3015)

* Handle immediate inline sampler

* Simplify inline sampler handling
This commit is contained in:
Marcin Mikołajczyk
2025-06-17 08:42:14 +02:00
committed by GitHub
parent 9dd35c3a42
commit efa8f6a154
7 changed files with 54 additions and 38 deletions

View File

@@ -531,8 +531,10 @@ IR::Value EmitImageSample(IR::IREmitter& ir, const GcnInst& inst, const IR::Scal
// Load first dword of T# and S#. We will use them as the handle that will guide resource
// tracking pass where to read the sharps. This will later also get patched to the SPIRV texture
// binding index.
const IR::Value handle =
ir.CompositeConstruct(ir.GetScalarReg(tsharp_reg), ir.GetScalarReg(sampler_reg));
const IR::Value handle = ir.GetScalarReg(tsharp_reg);
const IR::Value inline_sampler =
ir.CompositeConstruct(ir.GetScalarReg(sampler_reg), ir.GetScalarReg(sampler_reg + 1),
ir.GetScalarReg(sampler_reg + 2), ir.GetScalarReg(sampler_reg + 3));
// Determine how many address registers need to be passed.
// The image type is unknown, so add all 4 possible base registers and resolve later.
@@ -568,7 +570,8 @@ IR::Value EmitImageSample(IR::IREmitter& ir, const GcnInst& inst, const IR::Scal
const IR::Value address4 = get_addr_reg(12);
// Issue the placeholder IR instruction.
IR::Value texel = ir.ImageSampleRaw(handle, address1, address2, address3, address4, info);
IR::Value texel =
ir.ImageSampleRaw(handle, address1, address2, address3, address4, inline_sampler, info);
if (info.is_depth && !gather) {
// For non-gather depth sampling, only return a single value.
texel = ir.CompositeExtract(texel, 0);