diff --git a/tools/clang/lib/SPIRV/SpirvEmitter.cpp b/tools/clang/lib/SPIRV/SpirvEmitter.cpp index 4d33778295..c10b4af350 100644 --- a/tools/clang/lib/SPIRV/SpirvEmitter.cpp +++ b/tools/clang/lib/SPIRV/SpirvEmitter.cpp @@ -5838,9 +5838,11 @@ void SpirvEmitter::handleOptionalTextureSampleArgs( if (index >= numArgs) return; - - *clamp = doExpr(expr->getArg(index)); - index++; + bool hasClampArg = expr->getArg(index)->getType()->isFloatingType(); + if (hasClampArg) { + *clamp = doExpr(expr->getArg(index)); + index++; + } if (index >= numArgs) return; @@ -5880,49 +5882,34 @@ SpirvEmitter::processTextureSampleGather(const CXXMemberCallExpr *expr, // [, uint Status]); // // Other Texture types do not have a Gather method. - const auto numArgs = expr->getNumArgs(); const auto loc = expr->getExprLoc(); const auto range = expr->getSourceRange(); - const bool hasStatusArg = - expr->getArg(numArgs - 1)->getType()->isUnsignedIntegerType(); const auto *imageExpr = expr->getImplicitObjectArgument(); const QualType imageType = imageExpr->getType(); const bool isImageSampledTexture = isSampledTexture(imageType); - int samplerIndex; - uint32_t coordIndex; + int samplerIndex, coordIndex, offsetIndex; if (isImageSampledTexture) { samplerIndex = -1; // non-existant coordIndex = 0; + offsetIndex = 1; } else { samplerIndex = 0; coordIndex = 1; + offsetIndex = 2; } - SpirvInstruction *clamp = nullptr; - if (numArgs > coordIndex + 1 && - expr->getArg(coordIndex + 1)->getType()->isFloatingType()) - clamp = doExpr(expr->getArg(coordIndex + 1)); - else if (numArgs > coordIndex + 2 && - expr->getArg(coordIndex + 2)->getType()->isFloatingType()) - clamp = doExpr(expr->getArg(coordIndex + 2)); - const bool hasClampArg = (clamp != 0); - const auto status = - hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : nullptr; - auto *image = loadIfGLValue(imageExpr); SpirvInstruction *sampler = samplerIndex >= 0 ? doExpr(expr->getArg(samplerIndex)) : nullptr; auto *coordinate = doExpr(expr->getArg(coordIndex)); - // .Sample()/.Gather() may have a third optional paramter for offset. + SpirvInstruction *constOffset = nullptr, *varOffset = nullptr; - // Subtract 1 for status (if it exists), subtract 1 for clamp (if it exists), - // and subtract offsetIndex for sampler_state (if exists) location. - const bool hasOffsetArg = - numArgs - hasStatusArg - hasClampArg - coordIndex > 1; - if (hasOffsetArg) - handleOffsetInMethodCall(expr, coordIndex + 1, &constOffset, &varOffset); + SpirvInstruction *clamp = nullptr; + SpirvInstruction *status = nullptr; + handleOptionalTextureSampleArgs(expr, offsetIndex, &constOffset, &varOffset, + &clamp, &status); const auto retType = expr->getDirectCallee()->getReturnType(); if (isSample) { @@ -5955,6 +5942,8 @@ SpirvEmitter::processTextureSampleBiasLevel(const CXXMemberCallExpr *expr, // [, int Offset] // [, float clamp] // [, out uint Status]); + // Their SampledTexture variants have the same signature without the + // sampler_state parameter. // // For TextureCube and TextureCubeArray: // DXGI_FORMAT Object.SampleBias(sampler_state S, @@ -5969,6 +5958,8 @@ SpirvEmitter::processTextureSampleBiasLevel(const CXXMemberCallExpr *expr, // float LOD // [, int Offset] // [, out uint Status]); + // Their SampledTexture variants have the same signature without the + // sampler_state parameter. // // For TextureCube and TextureCubeArray: // DXGI_FORMAT Object.SampleLevel(sampler_state S, @@ -5976,41 +5967,40 @@ SpirvEmitter::processTextureSampleBiasLevel(const CXXMemberCallExpr *expr, // float LOD // [, out uint Status]); - const auto numArgs = expr->getNumArgs(); - const bool hasStatusArg = - expr->getArg(numArgs - 1)->getType()->isUnsignedIntegerType(); - auto *status = hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : nullptr; + const auto *imageExpr = expr->getImplicitObjectArgument(); + const QualType imageType = imageExpr->getType(); + const bool isImageSampledTexture = isSampledTexture(imageType); - SpirvInstruction *clamp = nullptr; - // The .SampleLevel() methods do not take the clamp argument. - if (isBias) { - if (numArgs > 3 && expr->getArg(3)->getType()->isFloatingType()) - clamp = doExpr(expr->getArg(3)); - else if (numArgs > 4 && expr->getArg(4)->getType()->isFloatingType()) - clamp = doExpr(expr->getArg(4)); + int samplerIndex, coordinateIndex, biasIndex, offsetIndex; + if (isImageSampledTexture) { + samplerIndex = -1; // non-existant + coordinateIndex = 0; + biasIndex = 1; + offsetIndex = 2; + } else { + samplerIndex = 0; + coordinateIndex = 1; + biasIndex = 2; + offsetIndex = 3; } - const bool hasClampArg = clamp != nullptr; - - // Subtract 1 for clamp (if it exists), 1 for status (if it exists), - // and 3 for sampler_state, location, and Bias/LOD. - const bool hasOffsetArg = numArgs - hasClampArg - hasStatusArg - 3 > 0; - const auto *imageExpr = expr->getImplicitObjectArgument(); - const QualType imageType = imageExpr->getType(); auto *image = loadIfGLValue(imageExpr); - auto *sampler = doExpr(expr->getArg(0)); - auto *coordinate = doExpr(expr->getArg(1)); + auto *sampler = + samplerIndex < 0 ? nullptr : doExpr(expr->getArg(samplerIndex)); + auto *coordinate = doExpr(expr->getArg(coordinateIndex)); SpirvInstruction *lod = nullptr; SpirvInstruction *bias = nullptr; if (isBias) { - bias = doExpr(expr->getArg(2)); + bias = doExpr(expr->getArg(biasIndex)); } else { - lod = doExpr(expr->getArg(2)); + lod = doExpr(expr->getArg(biasIndex)); } - // If offset is present in .Bias()/.SampleLevel(), it is the fourth argument. + SpirvInstruction *constOffset = nullptr, *varOffset = nullptr; - if (hasOffsetArg) - handleOffsetInMethodCall(expr, 3, &constOffset, &varOffset); + SpirvInstruction *clamp = nullptr; + SpirvInstruction *status = nullptr; + handleOptionalTextureSampleArgs(expr, offsetIndex, &constOffset, &varOffset, + &clamp, &status); const auto retType = expr->getDirectCallee()->getReturnType(); @@ -6037,6 +6027,8 @@ SpirvEmitter::processTextureSampleGrad(const CXXMemberCallExpr *expr) { // [, int Offset] // [, float Clamp] // [, out uint Status]); + // Their SampledTexture variants have the same signature without the + // sampler_state parameter. // // For TextureCube and TextureCubeArray: // DXGI_FORMAT Object.SampleGrad(sampler_state S, @@ -6046,33 +6038,36 @@ SpirvEmitter::processTextureSampleGrad(const CXXMemberCallExpr *expr) { // [, float Clamp] // [, out uint Status]); - const auto numArgs = expr->getNumArgs(); - const bool hasStatusArg = - expr->getArg(numArgs - 1)->getType()->isUnsignedIntegerType(); - auto *status = hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : nullptr; - - SpirvInstruction *clamp = nullptr; - if (numArgs > 4 && expr->getArg(4)->getType()->isFloatingType()) - clamp = doExpr(expr->getArg(4)); - else if (numArgs > 5 && expr->getArg(5)->getType()->isFloatingType()) - clamp = doExpr(expr->getArg(5)); - const bool hasClampArg = clamp != nullptr; - - // Subtract 1 for clamp (if it exists), 1 for status (if it exists), - // and 4 for sampler_state, location, DDX, and DDY; - const bool hasOffsetArg = numArgs - hasClampArg - hasStatusArg - 4 > 0; - const auto *imageExpr = expr->getImplicitObjectArgument(); const QualType imageType = imageExpr->getType(); + const bool isImageSampledTexture = isSampledTexture(imageType); + + int samplerIndex, coordinateIndex, ddxIndex, ddyIndex, offsetIndex; + if (isImageSampledTexture) { + samplerIndex = -1; // non-existant + coordinateIndex = 0; + ddxIndex = 1; + ddyIndex = 2; + offsetIndex = 3; + } else { + samplerIndex = 0; + coordinateIndex = 1; + ddxIndex = 2; + ddyIndex = 3; + offsetIndex = 4; + } + auto *image = loadIfGLValue(imageExpr); - auto *sampler = doExpr(expr->getArg(0)); - auto *coordinate = doExpr(expr->getArg(1)); - auto *ddx = doExpr(expr->getArg(2)); - auto *ddy = doExpr(expr->getArg(3)); - // If offset is present in .SampleGrad(), it is the fifth argument. + auto *sampler = samplerIndex < 0 ? nullptr : doExpr(expr->getArg(0)); + auto *coordinate = doExpr(expr->getArg(coordinateIndex)); + auto *ddx = doExpr(expr->getArg(ddxIndex)); + auto *ddy = doExpr(expr->getArg(ddyIndex)); + SpirvInstruction *constOffset = nullptr, *varOffset = nullptr; - if (hasOffsetArg) - handleOffsetInMethodCall(expr, 4, &constOffset, &varOffset); + SpirvInstruction *clamp = nullptr; + SpirvInstruction *status = nullptr; + handleOptionalTextureSampleArgs(expr, offsetIndex, &constOffset, &varOffset, + &clamp, &status); const auto retType = expr->getDirectCallee()->getReturnType(); return createImageSample( @@ -6097,6 +6092,8 @@ SpirvEmitter::processTextureSampleCmp(const CXXMemberCallExpr *expr) { // [, float Clamp] // [, out uint Status] // ); + // SampledTexture variants have the same signature without the + // sampler_state parameter. // // For TextureCube and TextureCubeArray: // float Object.SampleCmp( @@ -6107,34 +6104,35 @@ SpirvEmitter::processTextureSampleCmp(const CXXMemberCallExpr *expr) { // [, out uint Status] // ); - const auto numArgs = expr->getNumArgs(); - const bool hasStatusArg = - expr->getArg(numArgs - 1)->getType()->isUnsignedIntegerType(); - auto *status = hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : nullptr; + const auto *imageExpr = expr->getImplicitObjectArgument(); + const QualType imageType = imageExpr->getType(); + const bool isImageSampledTexture = isSampledTexture(imageType); - SpirvInstruction *clamp = nullptr; - if (numArgs > 3 && expr->getArg(3)->getType()->isFloatingType()) - clamp = doExpr(expr->getArg(3)); - else if (numArgs > 4 && expr->getArg(4)->getType()->isFloatingType()) - clamp = doExpr(expr->getArg(4)); - const bool hasClampArg = clamp != nullptr; + int samplerIndex, coordinateIndex, compareValIndex, offsetIndex; + if (isImageSampledTexture) { + samplerIndex = -1; // non-existant + coordinateIndex = 0; + compareValIndex = 1; + offsetIndex = 2; + } else { + samplerIndex = 0; + coordinateIndex = 1; + compareValIndex = 2; + offsetIndex = 3; + } - const auto *imageExpr = expr->getImplicitObjectArgument(); auto *image = loadIfGLValue(imageExpr); - auto *sampler = doExpr(expr->getArg(0)); - auto *coordinate = doExpr(expr->getArg(1)); - auto *compareVal = doExpr(expr->getArg(2)); - // If offset is present in .SampleCmp(), it will be the fourth argument. - SpirvInstruction *constOffset = nullptr, *varOffset = nullptr; + auto *sampler = samplerIndex < 0 ? nullptr : doExpr(expr->getArg(0)); + auto *coordinate = doExpr(expr->getArg(coordinateIndex)); + auto *compareVal = doExpr(expr->getArg(compareValIndex)); - // Subtract 1 for clamp (if it exists), 1 for status (if it exists), - // and 3 for sampler_state, location, and compare_value. - const bool hasOffsetArg = numArgs - hasStatusArg - hasClampArg - 3 > 0; - if (hasOffsetArg) - handleOffsetInMethodCall(expr, 3, &constOffset, &varOffset); + SpirvInstruction *constOffset = nullptr, *varOffset = nullptr; + SpirvInstruction *clamp = nullptr; + SpirvInstruction *status = nullptr; + handleOptionalTextureSampleArgs(expr, offsetIndex, &constOffset, &varOffset, + &clamp, &status); const auto retType = expr->getDirectCallee()->getReturnType(); - const auto imageType = imageExpr->getType(); addDerivativeGroupExecutionMode(); @@ -6160,6 +6158,8 @@ SpirvEmitter::processTextureSampleCmpBias(const CXXMemberCallExpr *expr) { // [, float Clamp] // [, out uint Status] // ); + // SampledTexture variants have the same signature without the + // sampler_state parameter. // // For TextureCube and TextureCubeArray: // float Object.SampleCmpBias( @@ -6173,21 +6173,37 @@ SpirvEmitter::processTextureSampleCmpBias(const CXXMemberCallExpr *expr) { const auto *imageExpr = expr->getImplicitObjectArgument(); auto *image = loadIfGLValue(imageExpr); + const auto imageType = imageExpr->getType(); + const bool isImageSampledTexture = isSampledTexture(imageType); - auto *sampler = doExpr(expr->getArg(0)); - auto *coordinate = doExpr(expr->getArg(1)); - auto *compareVal = doExpr(expr->getArg(2)); - auto *bias = doExpr(expr->getArg(3)); + int samplerIndex, coordinateIndex, compareValIndex, biasIndex, offsetIndex; + if (isImageSampledTexture) { + samplerIndex = -1; // non-existant + coordinateIndex = 0; + compareValIndex = 1; + biasIndex = 2; + offsetIndex = 3; + } else { + samplerIndex = 0; + coordinateIndex = 1; + compareValIndex = 2; + biasIndex = 3; + offsetIndex = 4; + } + + auto *sampler = + samplerIndex < 0 ? nullptr : doExpr(expr->getArg(samplerIndex)); + auto *coordinate = doExpr(expr->getArg(coordinateIndex)); + auto *compareVal = doExpr(expr->getArg(compareValIndex)); + auto *bias = doExpr(expr->getArg(biasIndex)); SpirvInstruction *constOffset = nullptr, *varOffset = nullptr; SpirvInstruction *clamp = nullptr; SpirvInstruction *status = nullptr; - - handleOptionalTextureSampleArgs(expr, 4, &constOffset, &varOffset, &clamp, - &status); + handleOptionalTextureSampleArgs(expr, offsetIndex, &constOffset, &varOffset, + &clamp, &status); const auto retType = expr->getDirectCallee()->getReturnType(); - const auto imageType = imageExpr->getType(); addDerivativeGroupExecutionMode(); @@ -6210,6 +6226,8 @@ SpirvEmitter::processTextureSampleCmpGrad(const CXXMemberCallExpr *expr) { // [, int Offset] // [, float Clamp] // [, out uint Status]); + // Their SampledTexture variants have the same signature without the + // sampler_state parameter. // // For TextureCube and TextureCubeArray: // DXGI_FORMAT Object.SampleGrad(sampler_state S, @@ -6223,19 +6241,38 @@ SpirvEmitter::processTextureSampleCmpGrad(const CXXMemberCallExpr *expr) { const auto *imageExpr = expr->getImplicitObjectArgument(); const QualType imageType = imageExpr->getType(); auto *image = loadIfGLValue(imageExpr); + const bool isImageSampledTexture = isSampledTexture(imageType); - auto *sampler = doExpr(expr->getArg(0)); - auto *coordinate = doExpr(expr->getArg(1)); - auto *compareVal = doExpr(expr->getArg(2)); - auto *ddx = doExpr(expr->getArg(3)); - auto *ddy = doExpr(expr->getArg(4)); + int samplerIndex, coordinateIndex, compareValIndex, ddxIndex, ddyIndex, + offsetIndex; + if (isImageSampledTexture) { + samplerIndex = -1; // non-existant + coordinateIndex = 0; + compareValIndex = 1; + ddxIndex = 2; + ddyIndex = 3; + offsetIndex = 4; + } else { + samplerIndex = 0; + coordinateIndex = 1; + compareValIndex = 2; + ddxIndex = 3; + ddyIndex = 4; + offsetIndex = 5; + } + + auto *sampler = + samplerIndex < 0 ? nullptr : doExpr(expr->getArg(samplerIndex)); + auto *coordinate = doExpr(expr->getArg(coordinateIndex)); + auto *compareVal = doExpr(expr->getArg(compareValIndex)); + auto *ddx = doExpr(expr->getArg(ddxIndex)); + auto *ddy = doExpr(expr->getArg(ddyIndex)); SpirvInstruction *constOffset = nullptr, *varOffset = nullptr; SpirvInstruction *clamp = nullptr; SpirvInstruction *status = nullptr; - - handleOptionalTextureSampleArgs(expr, 5, &constOffset, &varOffset, &clamp, - &status); + handleOptionalTextureSampleArgs(expr, offsetIndex, &constOffset, &varOffset, + &clamp, &status); const auto retType = expr->getDirectCallee()->getReturnType(); return createImageSample( @@ -6265,6 +6302,9 @@ SpirvEmitter::processTextureSampleCmpLevelZero(const CXXMemberCallExpr *expr) { // [, out uint Status] // ); // + // SampledTexture variants have the same signature without the + // sampler_state parameter. + // // For TextureCube and TextureCubeArray: // float Object.SampleCmpLevelZero( // SamplerComparisonState S, @@ -6273,27 +6313,38 @@ SpirvEmitter::processTextureSampleCmpLevelZero(const CXXMemberCallExpr *expr) { // [, out uint Status] // ); - const auto numArgs = expr->getNumArgs(); - const bool hasStatusArg = - expr->getArg(numArgs - 1)->getType()->isUnsignedIntegerType(); - auto *status = hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : nullptr; - const auto *imageExpr = expr->getImplicitObjectArgument(); + const auto imageType = imageExpr->getType(); + const bool isImageSampledTexture = isSampledTexture(imageType); + + int samplerIndex, coordIndex, compareValIndex, offsetIndex; + if (isImageSampledTexture) { + samplerIndex = -1; // non-existant + coordIndex = 0; + compareValIndex = 1; + offsetIndex = 2; + } else { + samplerIndex = 0; + coordIndex = 1; + compareValIndex = 2; + offsetIndex = 3; + } + auto *image = loadIfGLValue(imageExpr); - auto *sampler = doExpr(expr->getArg(0)); - auto *coordinate = doExpr(expr->getArg(1)); - auto *compareVal = doExpr(expr->getArg(2)); + auto *sampler = + samplerIndex < 0 ? nullptr : doExpr(expr->getArg(samplerIndex)); + auto *coordinate = doExpr(expr->getArg(coordIndex)); + auto *compareVal = doExpr(expr->getArg(compareValIndex)); auto *lod = spvBuilder.getConstantFloat(astContext.FloatTy, llvm::APFloat(0.0f)); - // If offset is present in .SampleCmp(), it will be the fourth argument. SpirvInstruction *constOffset = nullptr, *varOffset = nullptr; - const bool hasOffsetArg = numArgs - hasStatusArg - 3 > 0; - if (hasOffsetArg) - handleOffsetInMethodCall(expr, 3, &constOffset, &varOffset); + SpirvInstruction *clamp = nullptr; + SpirvInstruction *status = nullptr; + handleOptionalTextureSampleArgs(expr, offsetIndex, &constOffset, &varOffset, + &clamp, &status); const auto retType = expr->getDirectCallee()->getReturnType(); - const auto imageType = imageExpr->getType(); return createImageSample( retType, imageType, image, sampler, coordinate, compareVal, @@ -6317,6 +6368,8 @@ SpirvEmitter::processTextureSampleCmpLevel(const CXXMemberCallExpr *expr) { // [, int Offset] // [, out uint Status] // ); + // SampledTexture variants have the same signature without the + // sampler_state parameter. // // For TextureCube and TextureCubeArray: // float Object.SampleCmpLevel( @@ -6333,20 +6386,38 @@ SpirvEmitter::processTextureSampleCmpLevel(const CXXMemberCallExpr *expr) { auto *status = hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : nullptr; const auto *imageExpr = expr->getImplicitObjectArgument(); + const auto imageType = imageExpr->getType(); + const bool isImageSampledTexture = isSampledTexture(imageType); + + int samplerIndex, coordIndex, compareValIndex, lodIndex, offsetIndex; + if (isImageSampledTexture) { + samplerIndex = -1; // non-existant + coordIndex = 0; + compareValIndex = 1; + lodIndex = 2; + offsetIndex = 3; + } else { + samplerIndex = 0; + coordIndex = 1; + compareValIndex = 2; + lodIndex = 3; + offsetIndex = 4; + } + auto *image = loadIfGLValue(imageExpr); - auto *sampler = doExpr(expr->getArg(0)); - auto *coordinate = doExpr(expr->getArg(1)); - auto *compareVal = doExpr(expr->getArg(2)); - auto *lod = doExpr(expr->getArg(3)); + auto *sampler = + samplerIndex < 0 ? nullptr : doExpr(expr->getArg(samplerIndex)); + auto *coordinate = doExpr(expr->getArg(coordIndex)); + auto *compareVal = doExpr(expr->getArg(compareValIndex)); + auto *lod = doExpr(expr->getArg(lodIndex)); // If offset is present in .SampleCmp(), it will be the fourth argument. SpirvInstruction *constOffset = nullptr, *varOffset = nullptr; - const bool hasOffsetArg = numArgs - hasStatusArg - 4 > 0; + const bool hasOffsetArg = numArgs - hasStatusArg - offsetIndex > 0; if (hasOffsetArg) - handleOffsetInMethodCall(expr, 4, &constOffset, &varOffset); + handleOffsetInMethodCall(expr, offsetIndex, &constOffset, &varOffset); const auto retType = expr->getDirectCallee()->getReturnType(); - const auto imageType = imageExpr->getType(); return createImageSample( retType, imageType, image, sampler, coordinate, compareVal, diff --git a/tools/clang/test/CodeGenSPIRV/texture.array.sample-bias.hlsl b/tools/clang/test/CodeGenSPIRV/texture.array.sample-bias.hlsl index a809b74a7a..207a97cbb0 100644 --- a/tools/clang/test/CodeGenSPIRV/texture.array.sample-bias.hlsl +++ b/tools/clang/test/CodeGenSPIRV/texture.array.sample-bias.hlsl @@ -43,9 +43,9 @@ float4 main(int2 offset : A) : SV_Target { float4 val3 = t3.SampleBias(gSampler, float4(1, 2, 3, 1), 0.5); float clamp; -// CHECK: [[clamp:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t1_0:%[0-9]+]] = OpLoad %type_1d_image_array %t1 +// CHECK: [[t1_0:%[0-9]+]] = OpLoad %type_1d_image_array %t1 // CHECK-NEXT: [[gSampler_2:%[0-9]+]] = OpLoad %type_sampler %gSampler +// CHECK-NEXT: [[clamp:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_2:%[0-9]+]] = OpSampledImage %type_sampled_image [[t1_0]] [[gSampler_2]] // CHECK-NEXT: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampledImg_2]] [[v2fc]] Bias|ConstOffset|MinLod %float_0_5 %int_1 [[clamp]] float4 val4 = t1.SampleBias(gSampler, float2(1, 1), 0.5, 1, clamp); @@ -57,9 +57,9 @@ float4 main(int2 offset : A) : SV_Target { float4 val5 = t3.SampleBias(gSampler, float4(1, 2, 3, 1), 0.5, /*clamp*/ 2.5f); uint status; -// CHECK: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t1_1:%[0-9]+]] = OpLoad %type_1d_image_array %t1 +// CHECK: [[t1_1:%[0-9]+]] = OpLoad %type_1d_image_array %t1 // CHECK-NEXT: [[gSampler_4:%[0-9]+]] = OpLoad %type_sampler %gSampler +// CHECK-NEXT: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_4:%[0-9]+]] = OpSampledImage %type_sampled_image [[t1_1]] [[gSampler_4]] // CHECK-NEXT: [[structResult:%[0-9]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[sampledImg_4]] [[v2fc]] Bias|ConstOffset|MinLod %float_0_5 %int_1 [[clamp_0]] // CHECK-NEXT: [[status:%[0-9]+]] = OpCompositeExtract %uint [[structResult]] 0 diff --git a/tools/clang/test/CodeGenSPIRV/texture.array.sample-cmp.hlsl b/tools/clang/test/CodeGenSPIRV/texture.array.sample-cmp.hlsl index 44eae8a96d..cee63df78f 100644 --- a/tools/clang/test/CodeGenSPIRV/texture.array.sample-cmp.hlsl +++ b/tools/clang/test/CodeGenSPIRV/texture.array.sample-cmp.hlsl @@ -39,10 +39,10 @@ float4 main(int2 offset: A, float comparator: B) : SV_Target { float val3 = t3.SampleCmp(gSampler, float4(1, 2, 3, 1), comparator); float clamp; -// CHECK: [[clamp:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t2_0:%[0-9]+]] = OpLoad %type_2d_image_array %t2 +// CHECK: [[t2_0:%[0-9]+]] = OpLoad %type_2d_image_array %t2 // CHECK-NEXT: [[gSampler_2:%[0-9]+]] = OpLoad %type_sampler %gSampler // CHECK-NEXT: [[comparator_2:%[0-9]+]] = OpLoad %float %comparator +// CHECK-NEXT: [[clamp:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_2:%[0-9]+]] = OpSampledImage %type_sampled_image_0 [[t2_0]] [[gSampler_2]] // CHECK-NEXT: {{%[0-9]+}} = OpImageSampleDrefImplicitLod %float [[sampledImg_2]] [[v3fc]] [[comparator_2]] ConstOffset|MinLod [[v2ic]] [[clamp]] float val4 = t2.SampleCmp(gSampler, float3(1, 2, 1), comparator, 1, clamp); @@ -55,10 +55,10 @@ float4 main(int2 offset: A, float comparator: B) : SV_Target { float val5 = t3.SampleCmp(gSampler, float4(1, 2, 3, 1), comparator, /*clamp*/ 1.5); uint status; -// CHECK: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t2_1:%[0-9]+]] = OpLoad %type_2d_image_array %t2 +// CHECK: [[t2_1:%[0-9]+]] = OpLoad %type_2d_image_array %t2 // CHECK-NEXT: [[gSampler_4:%[0-9]+]] = OpLoad %type_sampler %gSampler // CHECK-NEXT: [[comparator_4:%[0-9]+]] = OpLoad %float %comparator +// CHECK-NEXT: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_4:%[0-9]+]] = OpSampledImage %type_sampled_image_0 [[t2_1]] [[gSampler_4]] // CHECK-NEXT: [[structResult:%[0-9]+]] = OpImageSparseSampleDrefImplicitLod %SparseResidencyStruct [[sampledImg_4]] [[v3fc]] [[comparator_4]] ConstOffset|MinLod [[v2ic]] [[clamp_0]] // CHECK-NEXT: [[status:%[0-9]+]] = OpCompositeExtract %uint [[structResult]] 0 diff --git a/tools/clang/test/CodeGenSPIRV/texture.array.sample-grad.hlsl b/tools/clang/test/CodeGenSPIRV/texture.array.sample-grad.hlsl index 194da86976..b9335aed17 100644 --- a/tools/clang/test/CodeGenSPIRV/texture.array.sample-grad.hlsl +++ b/tools/clang/test/CodeGenSPIRV/texture.array.sample-grad.hlsl @@ -54,9 +54,9 @@ float4 main(int2 offset : A) : SV_Target { float4 val4 = t2.SampleGrad(gSampler, float3(1, 1, 1), float2(2, 2), float2(3, 3), 1, /*clamp*/2.5); float clamp; -// CHECK: [[clamp:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t3_0:%[0-9]+]] = OpLoad %type_cube_image_array %t3 +// CHECK: [[t3_0:%[0-9]+]] = OpLoad %type_cube_image_array %t3 // CHECK-NEXT: [[gSampler_3:%[0-9]+]] = OpLoad %type_sampler %gSampler +// CHECK-NEXT: [[clamp:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_3:%[0-9]+]] = OpSampledImage %type_sampled_image_1 [[t3_0]] [[gSampler_3]] // CHECK-NEXT: {{%[0-9]+}} = OpImageSampleExplicitLod %v4float [[sampledImg_3]] [[v4f_1]] Grad|MinLod [[v3f_2]] [[v3f_3]] [[clamp]] float4 val5 = t3.SampleGrad(gSampler, float4(1, 1, 1, 1), float3(2, 2, 2), float3(3, 3, 3), clamp); @@ -72,9 +72,9 @@ float4 main(int2 offset : A) : SV_Target { // CHECK-NEXT: OpStore %val6 [[result]] float4 val6 = t2.SampleGrad(gSampler, float3(1, 1, 1), float2(2, 2), float2(3, 3), 1, /*clamp*/2.5, status); -// CHECK: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t3_1:%[0-9]+]] = OpLoad %type_cube_image_array %t3 +// CHECK: [[t3_1:%[0-9]+]] = OpLoad %type_cube_image_array %t3 // CHECK-NEXT: [[gSampler_5:%[0-9]+]] = OpLoad %type_sampler %gSampler +// CHECK-NEXT: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_5:%[0-9]+]] = OpSampledImage %type_sampled_image_1 [[t3_1]] [[gSampler_5]] // CHECK-NEXT: [[structResult_0:%[0-9]+]] = OpImageSparseSampleExplicitLod %SparseResidencyStruct [[sampledImg_5]] [[v4f_1]] Grad|MinLod [[v3f_2]] [[v3f_3]] [[clamp_0]] // CHECK-NEXT: [[status_0:%[0-9]+]] = OpCompositeExtract %uint [[structResult_0]] 0 diff --git a/tools/clang/test/CodeGenSPIRV/texture.array.sample.hlsl b/tools/clang/test/CodeGenSPIRV/texture.array.sample.hlsl index 0420b2af96..4d06d24e22 100644 --- a/tools/clang/test/CodeGenSPIRV/texture.array.sample.hlsl +++ b/tools/clang/test/CodeGenSPIRV/texture.array.sample.hlsl @@ -42,9 +42,9 @@ float4 main() : SV_Target { float4 val3 = t3.Sample(gSampler, float4(0.5, 0.25, 0.125, 1)); float clamp; -// CHECK: [[clamp:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t1_0:%[0-9]+]] = OpLoad %type_1d_image_array %t1 +// CHECK: [[t1_0:%[0-9]+]] = OpLoad %type_1d_image_array %t1 // CHECK-NEXT: [[gSampler_2:%[0-9]+]] = OpLoad %type_sampler %gSampler +// CHECK-NEXT: [[clamp:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_2:%[0-9]+]] = OpSampledImage %type_sampled_image [[t1_0]] [[gSampler_2]] // CHECK-NEXT: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampledImg_2]] [[v2fc]] ConstOffset|MinLod %int_1 [[clamp]] float4 val4 = t1.Sample(gSampler, float2(0.5, 1), 1, clamp); @@ -56,9 +56,9 @@ float4 main() : SV_Target { float4 val5 = t3.Sample(gSampler, float4(0.5, 0.25, 0.125, 1), /*clamp*/ 1.5); uint status; -// CHECK: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t1_1:%[0-9]+]] = OpLoad %type_1d_image_array %t1 +// CHECK: [[t1_1:%[0-9]+]] = OpLoad %type_1d_image_array %t1 // CHECK-NEXT: [[gSampler_4:%[0-9]+]] = OpLoad %type_sampler %gSampler +// CHECK-NEXT: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_4:%[0-9]+]] = OpSampledImage %type_sampled_image [[t1_1]] [[gSampler_4]] // CHECK-NEXT: [[structResult:%[0-9]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[sampledImg_4]] [[v2fc]] ConstOffset|MinLod %int_1 [[clamp_0]] // CHECK-NEXT: [[status:%[0-9]+]] = OpCompositeExtract %uint [[structResult]] 0 diff --git a/tools/clang/test/CodeGenSPIRV/texture.sample-bias.hlsl b/tools/clang/test/CodeGenSPIRV/texture.sample-bias.hlsl index 6b3470edf6..e92a9a1449 100644 --- a/tools/clang/test/CodeGenSPIRV/texture.sample-bias.hlsl +++ b/tools/clang/test/CodeGenSPIRV/texture.sample-bias.hlsl @@ -51,9 +51,9 @@ float4 main(int3 offset: A) : SV_Target { float4 val4 = t4.SampleBias(gSampler, float3(1, 2, 3), 0.5); float clamp; -// CHECK: [[clamp:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t3_0:%[0-9]+]] = OpLoad %type_3d_image %t3 +// CHECK: [[t3_0:%[0-9]+]] = OpLoad %type_3d_image %t3 // CHECK-NEXT: [[gSampler_3:%[0-9]+]] = OpLoad %type_sampler %gSampler +// CHECK-NEXT: [[clamp:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_3:%[0-9]+]] = OpSampledImage %type_sampled_image_1 [[t3_0]] [[gSampler_3]] // CHECK-NEXT: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampledImg_3]] [[v3fc]] Bias|ConstOffset|MinLod %float_0_5 [[v3ic]] [[clamp]] float4 val5 = t3.SampleBias(gSampler, float3(1, 2, 3), 0.5, 1, clamp); @@ -65,9 +65,9 @@ float4 main(int3 offset: A) : SV_Target { float4 val6 = t4.SampleBias(gSampler, float3(1, 2, 3), 0.5, /*clamp*/ 2.5); uint status; -// CHECK: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t3_1:%[0-9]+]] = OpLoad %type_3d_image %t3 +// CHECK: [[t3_1:%[0-9]+]] = OpLoad %type_3d_image %t3 // CHECK-NEXT: [[gSampler_5:%[0-9]+]] = OpLoad %type_sampler %gSampler +// CHECK-NEXT: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_5:%[0-9]+]] = OpSampledImage %type_sampled_image_1 [[t3_1]] [[gSampler_5]] // CHECK-NEXT: [[structResult:%[0-9]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[sampledImg_5]] [[v3fc]] Bias|ConstOffset|MinLod %float_0_5 [[v3ic]] [[clamp_0]] // CHECK-NEXT: [[status:%[0-9]+]] = OpCompositeExtract %uint [[structResult]] 0 diff --git a/tools/clang/test/CodeGenSPIRV/texture.sample-cmp.hlsl b/tools/clang/test/CodeGenSPIRV/texture.sample-cmp.hlsl index 53fb6cdd8f..31222a6a17 100644 --- a/tools/clang/test/CodeGenSPIRV/texture.sample-cmp.hlsl +++ b/tools/clang/test/CodeGenSPIRV/texture.sample-cmp.hlsl @@ -39,10 +39,10 @@ float4 main(int2 offset: A, float comparator: B) : SV_Target { float val4 = t4.SampleCmp(gSampler, float3(1, 2, 3), comparator); float clamp; -// CHECK: [[clamp:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t2_0:%[0-9]+]] = OpLoad %type_2d_image %t2 +// CHECK: [[t2_0:%[0-9]+]] = OpLoad %type_2d_image %t2 // CHECK-NEXT: [[gSampler_2:%[0-9]+]] = OpLoad %type_sampler %gSampler // CHECK-NEXT: [[comparator_2:%[0-9]+]] = OpLoad %float %comparator +// CHECK-NEXT: [[clamp:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_2:%[0-9]+]] = OpSampledImage %type_sampled_image_0 [[t2_0]] [[gSampler_2]] // CHECK-NEXT: {{%[0-9]+}} = OpImageSampleDrefImplicitLod %float [[sampledImg_2]] [[v2fc]] [[comparator_2]] ConstOffset|MinLod [[v2ic]] [[clamp]] float val5 = t2.SampleCmp(gSampler, float2(1, 2), comparator, 1, clamp); @@ -55,10 +55,10 @@ float4 main(int2 offset: A, float comparator: B) : SV_Target { float val6 = t4.SampleCmp(gSampler, float3(1, 2, 3), comparator, /*clamp*/2.5); uint status; -// CHECK: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t2_1:%[0-9]+]] = OpLoad %type_2d_image %t2 +// CHECK: [[t2_1:%[0-9]+]] = OpLoad %type_2d_image %t2 // CHECK-NEXT: [[gSampler_4:%[0-9]+]] = OpLoad %type_sampler %gSampler // CHECK-NEXT: [[comparator_4:%[0-9]+]] = OpLoad %float %comparator +// CHECK-NEXT: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_4:%[0-9]+]] = OpSampledImage %type_sampled_image_0 [[t2_1]] [[gSampler_4]] // CHECK-NEXT: [[structResult:%[0-9]+]] = OpImageSparseSampleDrefImplicitLod %SparseResidencyStruct [[sampledImg_4]] [[v2fc]] [[comparator_4]] ConstOffset|MinLod [[v2ic]] [[clamp_0]] // CHECK-NEXT: [[status:%[0-9]+]] = OpCompositeExtract %uint [[structResult]] 0 diff --git a/tools/clang/test/CodeGenSPIRV/texture.sample-grad.hlsl b/tools/clang/test/CodeGenSPIRV/texture.sample-grad.hlsl index 86a234355e..66235b0b90 100644 --- a/tools/clang/test/CodeGenSPIRV/texture.sample-grad.hlsl +++ b/tools/clang/test/CodeGenSPIRV/texture.sample-grad.hlsl @@ -55,9 +55,9 @@ float4 main(int2 offset : A) : SV_Target { float4 val4 = t4.SampleGrad(gSampler, float3(1, 1, 1), float3(2, 2, 2), float3(3, 3, 3)); float clamp; -// CHECK: [[clamp:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t2_0:%[0-9]+]] = OpLoad %type_2d_image %t2 +// CHECK: [[t2_0:%[0-9]+]] = OpLoad %type_2d_image %t2 // CHECK-NEXT: [[gSampler_3:%[0-9]+]] = OpLoad %type_sampler %gSampler +// CHECK-NEXT: [[clamp:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_3:%[0-9]+]] = OpSampledImage %type_sampled_image_0 [[t2_0]] [[gSampler_3]] // CHECK-NEXT: {{%[0-9]+}} = OpImageSampleExplicitLod %v4float [[sampledImg_3]] [[v2f_1]] Grad|ConstOffset|MinLod [[v2f_2]] [[v2f_3]] [[v2i_3]] [[clamp]] float4 val5 = t2.SampleGrad(gSampler, float2(1, 1), float2(2, 2), float2(3, 3), 3, clamp); @@ -69,9 +69,9 @@ float4 main(int2 offset : A) : SV_Target { float4 val6 = t4.SampleGrad(gSampler, float3(1, 1, 1), float3(2, 2, 2), float3(3, 3, 3), /*clamp*/3.5); uint status; -// CHECK: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t2_1:%[0-9]+]] = OpLoad %type_2d_image %t2 +// CHECK: [[t2_1:%[0-9]+]] = OpLoad %type_2d_image %t2 // CHECK-NEXT: [[gSampler_5:%[0-9]+]] = OpLoad %type_sampler %gSampler +// CHECK-NEXT: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_5:%[0-9]+]] = OpSampledImage %type_sampled_image_0 [[t2_1]] [[gSampler_5]] // CHECK-NEXT: [[structResult:%[0-9]+]] = OpImageSparseSampleExplicitLod %SparseResidencyStruct [[sampledImg_5]] [[v2f_1]] Grad|ConstOffset|MinLod [[v2f_2]] [[v2f_3]] [[v2i_3]] [[clamp_0]] // CHECK-NEXT: [[status:%[0-9]+]] = OpCompositeExtract %uint [[structResult]] 0 diff --git a/tools/clang/test/CodeGenSPIRV/texture.sample.hlsl b/tools/clang/test/CodeGenSPIRV/texture.sample.hlsl index 6a847c3442..440dfb8fbb 100644 --- a/tools/clang/test/CodeGenSPIRV/texture.sample.hlsl +++ b/tools/clang/test/CodeGenSPIRV/texture.sample.hlsl @@ -51,9 +51,9 @@ float4 main(int2 offset: A) : SV_Target { float4 val4 = t4.Sample(gSampler, float3(0.5, 0.25, 0.3)); float clamp; -// CHECK: [[clamp:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t2_0:%[0-9]+]] = OpLoad %type_2d_image %t2 +// CHECK: [[t2_0:%[0-9]+]] = OpLoad %type_2d_image %t2 // CHECK-NEXT: [[gSampler_3:%[0-9]+]] = OpLoad %type_sampler %gSampler +// CHECK-NEXT: [[clamp:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_3:%[0-9]+]] = OpSampledImage %type_sampled_image_0 [[t2_0]] [[gSampler_3]] // CHECK-NEXT: {{%[0-9]+}} = OpImageSampleImplicitLod %v4float [[sampledImg_3]] [[v2fc]] ConstOffset|MinLod [[v2ic]] [[clamp]] float4 val5 = t2.Sample(gSampler, float2(0.5, 0.25), int2(2, 3), clamp); @@ -65,9 +65,9 @@ float4 main(int2 offset: A) : SV_Target { float4 val6 = t4.Sample(gSampler, float3(0.5, 0.25, 0.3), /*clamp*/ 2.0f); uint status; -// CHECK: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp -// CHECK-NEXT: [[t2_1:%[0-9]+]] = OpLoad %type_2d_image %t2 +// CHECK: [[t2_1:%[0-9]+]] = OpLoad %type_2d_image %t2 // CHECK-NEXT: [[gSampler_5:%[0-9]+]] = OpLoad %type_sampler %gSampler +// CHECK-NEXT: [[clamp_0:%[0-9]+]] = OpLoad %float %clamp // CHECK-NEXT: [[sampledImg_5:%[0-9]+]] = OpSampledImage %type_sampled_image_0 [[t2_1]] [[gSampler_5]] // CHECK-NEXT: [[structResult:%[0-9]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[sampledImg_5]] [[v2fc]] ConstOffset|MinLod [[v2ic]] [[clamp_0]] // CHECK-NEXT: [[status:%[0-9]+]] = OpCompositeExtract %uint [[structResult]] 0 diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.cmp-level.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.cmp-level.hlsl new file mode 100644 index 0000000000..4dd8dec8af --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.cmp-level.hlsl @@ -0,0 +1,32 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability SparseResidency + +// CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 +// CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 + +// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] +// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] + +// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant + +vk::SampledTexture2D tex1 : register(t0); + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1_load]] [[v2fc]] %float_2 Lod %float_1 + float val1 = tex1.SampleCmpLevel(float2(0.5, 0.25), 2.0f, 1.0f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex2_load]] [[v2fc]] %float_2 Lod|ConstOffset %float_1 [[v2ic]] + float val2 = tex1.SampleCmpLevel(float2(0.5, 0.25), 2.0f, 1.0f, int2(2,3)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefExplicitLod %SparseResidencyStruct [[tex3_load]] [[v2fc]] %float_2 Lod|ConstOffset %float_1 [[v2ic]] +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result3]] 0 +// CHECK: OpStore %status [[status_0]] + uint status; + float val3 = tex1.SampleCmpLevel(float2(0.5, 0.25), 2.0f, 1.0f, int2(2,3), status); + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-bias.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-bias.hlsl new file mode 100644 index 0000000000..a233394f6e --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-bias.hlsl @@ -0,0 +1,33 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability MinLod +// CHECK: OpCapability SparseResidency + +// CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 +// CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 + +// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] +// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] + +// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant + +vk::SampledTexture2D tex1 : register(t0); + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex1_load]] [[v2fc]] Bias|ConstOffset %float_0_5 [[v2ic]] + float4 val1 = tex1.SampleBias(float2(0.5, 0.25), 0.5f, int2(2, 3)); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleImplicitLod %v4float [[tex2_load]] [[v2fc]] Bias|ConstOffset|MinLod %float_0_5 [[v2ic]] %float_2_5 + float4 val2 = tex1.SampleBias(float2(0.5, 0.25), 0.5f, int2(2, 3), 2.5f); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleImplicitLod %SparseResidencyStruct [[tex3_load]] [[v2fc]] Bias|ConstOffset|MinLod %float_0_5 [[v2ic]] %float_2_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result3]] 0 +// CHECK: OpStore %status [[status_0]] + uint status; + float4 val3 = tex1.SampleBias(float2(0.5, 0.25), 0.5f, int2(2, 3), 2.5f, status); + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-bias.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-bias.hlsl new file mode 100644 index 0000000000..e302d88a50 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-bias.hlsl @@ -0,0 +1,33 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability MinLod +// CHECK: OpCapability SparseResidency + +// CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 +// CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 + +// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] +// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] + +// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant + +vk::SampledTexture2D tex1 : register(t0); + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex1_load]] [[v2fc]] %float_1 Bias|ConstOffset %float_0_5 [[v2ic]] + float val1 = tex1.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, int2(2, 3)); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex2_load]] [[v2fc]] %float_1 Bias|ConstOffset|MinLod %float_0_5 [[v2ic]] %float_2_5 + float val2 = tex1.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, int2(2, 3), 2.5f); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefImplicitLod %SparseResidencyStruct [[tex3_load]] [[v2fc]] %float_1 Bias|ConstOffset|MinLod %float_0_5 [[v2ic]] %float_2_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result3]] 0 +// CHECK: OpStore %status [[status_0]] + uint status; + float val3 = tex1.SampleCmpBias(float2(0.5, 0.25), 1.0f, 0.5f, int2(2, 3), 2.5f, status); + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-grad.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-grad.hlsl new file mode 100644 index 0000000000..4acca8a42e --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-grad.hlsl @@ -0,0 +1,39 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability MinLod +// CHECK: OpCapability SparseResidency + +// CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 +// CHECK: [[v2f_1:%[0-9]+]] = OpConstantComposite %v2float %float_1 %float_1 +// CHECK: [[v2f_2:%[0-9]+]] = OpConstantComposite %v2float %float_2 %float_2 +// CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 + +// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] +// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] + +// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant + +vk::SampledTexture2D tex1 : register(t0); + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1_load]] [[v2fc]] %float_1 Grad [[v2f_1]] [[v2f_2]] + float val1 = tex1.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2)); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex2_load]] [[v2fc]] %float_1 Grad|ConstOffset [[v2f_1]] [[v2f_2]] [[v2ic]] + float val2 = tex1.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2), int2(2,3)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex3_load]] [[v2fc]] %float_1 Grad|ConstOffset|MinLod [[v2f_1]] [[v2f_2]] [[v2ic]] %float_0_5 + float val3 = tex1.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2), int2(2,3), 0.5); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefExplicitLod %SparseResidencyStruct [[tex4_load]] [[v2fc]] %float_1 Grad|ConstOffset|MinLod [[v2f_1]] [[v2f_2]] [[v2ic]] %float_0_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result4]] 0 +// CHECK: OpStore %status [[status_0]] + uint status; + float val4 = tex1.SampleCmpGrad(float2(0.5, 0.25), 1.0f, float2(1, 1), float2(2, 2), int2(2,3), 0.5, status); + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-level-zero.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-level-zero.hlsl new file mode 100644 index 0000000000..b7475a7fca --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp-level-zero.hlsl @@ -0,0 +1,32 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability SparseResidency + +// CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 +// CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 + +// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] +// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] + +// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant + +vk::SampledTexture2D tex1 : register(t0); + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex1_load]] [[v2fc]] %float_2 Lod %float_0 + float val1 = tex1.SampleCmpLevelZero(float2(0.5, 0.25), 2.0f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefExplicitLod %float [[tex2_load]] [[v2fc]] %float_2 Lod|ConstOffset %float_0 [[v2ic]] + float val2 = tex1.SampleCmpLevelZero(float2(0.5, 0.25), 2.0f, int2(2,3)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefExplicitLod %SparseResidencyStruct [[tex3_load]] [[v2fc]] %float_2 Lod|ConstOffset %float_0 [[v2ic]] +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result3]] 0 +// CHECK: OpStore %status [[status_0]] + uint status; + float val3 = tex1.SampleCmpLevelZero(float2(0.5, 0.25), 2.0f, int2(2,3), status); + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp.hlsl new file mode 100644 index 0000000000..3fc5798b09 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-cmp.hlsl @@ -0,0 +1,37 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability MinLod +// CHECK: OpCapability SparseResidency + +// CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 +// CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 + +// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] +// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] + +// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant + +vk::SampledTexture2D tex1 : register(t0); + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex1_load]] [[v2fc]] %float_2 + float val1 = tex1.SampleCmp(float2(0.5, 0.25), 2.0f); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex2_load]] [[v2fc]] %float_2 ConstOffset [[v2ic]] + float val2 = tex1.SampleCmp(float2(0.5, 0.25), 2.0f, int2(2,3)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSampleDrefImplicitLod %float [[tex3_load]] [[v2fc]] %float_2 ConstOffset|MinLod [[v2ic]] %float_0_5 + float val3 = tex1.SampleCmp(float2(0.5, 0.25), 2.0f, int2(2,3), 0.5); + +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleDrefImplicitLod %SparseResidencyStruct [[tex4_load]] [[v2fc]] %float_2 ConstOffset|MinLod [[v2ic]] %float_0_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result4]] 0 +// CHECK: OpStore %status [[status_0]] + uint status; + float val4 = tex1.SampleCmp(float2(0.5, 0.25), 2.0f, int2(2,3), 0.5, status); + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-grad.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-grad.hlsl new file mode 100644 index 0000000000..829e148c02 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-grad.hlsl @@ -0,0 +1,38 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability MinLod +// CHECK: OpCapability SparseResidency + +// CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 +// CHECK: [[v2f_1:%[0-9]+]] = OpConstantComposite %v2float %float_1 %float_1 +// CHECK: [[v2f_2:%[0-9]+]] = OpConstantComposite %v2float %float_2 %float_2 +// CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 + +// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] +// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] + +// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant + +vk::SampledTexture2D tex1 : register(t0); + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex1_load]] [[v2fc]] Grad [[v2f_1]] [[v2f_2]] + float4 val1 = tex1.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2)); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex2_load]] [[v2fc]] Grad|ConstOffset [[v2f_1]] [[v2f_2]] [[v2ic]] + float4 val2 = tex1.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2), int2(2,3)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex3_load]] [[v2fc]] Grad|ConstOffset|MinLod [[v2f_1]] [[v2f_2]] [[v2ic]] %float_0_5 + float4 val3 = tex1.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2), int2(2,3), 0.5); +// CHECK: [[tex4_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result4:%[a-zA-Z0-9_]+]] = OpImageSparseSampleExplicitLod %SparseResidencyStruct [[tex4_load]] [[v2fc]] Grad|ConstOffset|MinLod [[v2f_1]] [[v2f_2]] [[v2ic]] %float_0_5 +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result4]] 0 +// CHECK: OpStore %status [[status_0]] + uint status; + float4 val4 = tex1.SampleGrad(float2(0.5, 0.25), float2(1, 1), float2(2, 2), int2(2,3), 0.5, status); + return 1.0; +} diff --git a/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-level.hlsl b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-level.hlsl new file mode 100644 index 0000000000..a0c885b9ed --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV/vk.sampledtexture.sample-level.hlsl @@ -0,0 +1,32 @@ +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: OpCapability SparseResidency + +// CHECK: [[v2fc:%[0-9]+]] = OpConstantComposite %v2float %float_0_5 %float_0_25 +// CHECK: [[v2ic:%[0-9]+]] = OpConstantComposite %v2int %int_2 %int_3 + +// CHECK: [[type_2d_image_1:%[a-zA-Z0-9_]+]] = OpTypeImage %float 2D 0 0 0 1 Unknown +// CHECK: [[type_sampled_image_1:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_2d_image_1]] +// CHECK: [[ptr_type_1:%[a-zA-Z0-9_]+]] = OpTypePointer UniformConstant [[type_sampled_image_1]] + +// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpVariable [[ptr_type_1]] UniformConstant + +vk::SampledTexture2D tex1 : register(t0); + +float4 main() : SV_Target { +// CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result1:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex1_load]] [[v2fc]] Lod|ConstOffset %float_0_5 [[v2ic]] + float4 val1 = tex1.SampleLevel(float2(0.5, 0.25), 0.5f, int2(2, 3)); + +// CHECK: [[tex2_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result2:%[a-zA-Z0-9_]+]] = OpImageSampleExplicitLod %v4float [[tex2_load]] [[v2fc]] Lod|ConstOffset %float_0_5 [[v2ic]] + float4 val2 = tex1.SampleLevel(float2(0.5, 0.25), 0.5f, int2(2, 3)); + +// CHECK: [[tex3_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_sampled_image_1]] [[tex1]] +// CHECK: [[sampled_result3:%[a-zA-Z0-9_]+]] = OpImageSparseSampleExplicitLod %SparseResidencyStruct [[tex3_load]] [[v2fc]] Lod|ConstOffset %float_0_5 [[v2ic]] +// CHECK: [[status_0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[sampled_result3]] 0 +// CHECK: OpStore %status [[status_0]] + uint status; + float4 val3 = tex1.SampleLevel(float2(0.5, 0.25), 0.5f, int2(2, 3), status); + return 1.0; +} diff --git a/utils/hct/gen_intrin_main.txt b/utils/hct/gen_intrin_main.txt index 0955e388e8..3f20c42ead 100644 --- a/utils/hct/gen_intrin_main.txt +++ b/utils/hct/gen_intrin_main.txt @@ -1245,4 +1245,33 @@ namespace VkSampledTexture2DMethods { $classT [[ro]] Load(in int<3> x) : tex2d_t_load; $classT [[ro]] Load(in int<3> x, in int<2> o) : tex2d_t_load_o; $classT [[]] Load(in int<3> x, in int<2> o, out uint_only status) : tex2d_t_load_o_s; + $classT [[ro]] SampleBias(in float<2> x, in float bias) : tex2d_t_bias; + $classT [[ro]] SampleBias(in float<2> x, in float bias, in int<2> o) : tex2d_t_bias_o; + float_like [[ro]] SampleCmp(in float<2> x, in float compareValue) : tex2d_t_comp; + float_like [[ro]] SampleCmp(in float<2> x, in float compareValue, in int<2> o) : tex2d_t_comp_o; + float_like [[ro]] SampleCmpBias(in float<2> x, in float compareValue, in float bias) : tex2d_t_comp_bias; + float_like [[ro]] SampleCmpBias(in float<2> x, in float compareValue, in float bias, in int<2> o) : tex2d_t_comp_bias_o; + float_like [[ro]] SampleCmpGrad(in float<2> x, in float compareValue, in $type1 ddx, in $type1 ddy) : tex2d_t_comp_dd; + float_like [[ro]] SampleCmpGrad(in float<2> x, in float compareValue, in $type1 ddx, in $type1 ddy, in int<2> o) : tex2d_t_comp_dd_o; + float_like [[ro]] SampleCmpLevel(in float<2> x, in float compareValue, in float lod); + float_like [[ro]] SampleCmpLevel(in float<2> x, in float compareValue, in float lod, in int<2> o); + float_like [[ro]] SampleCmpLevelZero(in float<2> x, in float compareValue) : tex2d_t_comp_lz; + float_like [[ro]] SampleCmpLevelZero(in float<2> x, in float compareValue, in int<2> o) : tex2d_t_comp_lz_o; + $classT [[ro]] SampleGrad(in float<2> x, in $type1 ddx, in $type1 ddy) : tex2d_t_dd; + $classT [[ro]] SampleGrad(in float<2> x, in $type1 ddx, in $type1 ddy, in int<2> o) : tex2d_t_dd_o; + $classT [[ro]] SampleLevel(in float<2> x, in float lod) : tex2d_t_lod; + $classT [[ro]] SampleLevel(in float<2> x, in float lod, in int<2> o) : tex2d_t_lod_o; + float_like [[ro]] SampleCmp(in float<2> x, in float compareValue, in int<2> o, in float clamp) : tex2d_t_comp_o_cl; + float_like [[]] SampleCmp(in float<2> x, in float compareValue, in int<2> o, in float clamp, out uint_only status) : tex2d_t_comp_o_cl_s; + float_like [[ro]] SampleCmpBias(in float<2> x, in float compareValue, in float bias, in int<2> o, in float clamp) : tex2d_t_comp_bias_o_cl; + float_like [[]] SampleCmpBias(in float<2> x, in float compareValue, in float bias, in int<2> o, in float clamp, out uint_only status) : tex2d_t_comp_bias_o_cl_s; + float_like [[ro]] SampleCmpGrad(in float<2> x, in float compareValue, in $type1 ddx, in $type1 ddy, in int<2> o, in float clamp) : tex2d_t_comp_dd_o_cl; + float_like [[]] SampleCmpGrad(in float<2> x, in float compareValue, in $type1 ddx, in $type1 ddy, in int<2> o, in float clamp, out uint_only status) : tex2d_t_comp_dd_o_cl_s; + float_like [[]] SampleCmpLevel(in float<2> x, in float compareValue, in float lod, in int<2> o, out uint_only status); + float_like [[]] SampleCmpLevelZero(in float<2> x, in float compareValue, in int<2> o, out uint_only status) : tex2d_t_comp_o_s; + $classT [[]] SampleLevel(in float<2> x, in float lod, in int<2> o, out uint_only status) : tex2d_t_lod_o_s; + $classT [[ro]] SampleBias(in float<2> x, in float bias, in int<2> o, in float clamp) : tex2d_t_bias_o_cl; + $classT [[]] SampleBias(in float<2> x, in float bias, in int<2> o, in float clamp, out uint_only status) : tex2d_t_bias_o_cl_s; + $classT [[ro]] SampleGrad(in float<2> x, in $type1 ddx, in $type1 ddy, in int<2> o, in float clamp) : tex2d_t_dd_o_cl; + $classT [[]] SampleGrad(in float<2> x, in $type1 ddx, in $type1 ddy, in int<2> o, in float clamp, out uint_only status) : tex2d_t_dd_o_cl_s; } namespace