Enable SampleCmpLevelZero for all shader profiles.

This commit is contained in:
Xiang Li 2017-02-10 11:43:30 -08:00
Родитель 3f405a564f
Коммит c1e67e9a93
4 изменённых файлов: 28 добавлений и 3 удалений

Просмотреть файл

@ -573,12 +573,12 @@ static bool ValidateOpcodeInProfile(DXIL::OpCode opcode,
// Instructions: StorePatchConstant=106, OutputControlPointID=107
if (106 <= op && op <= 107)
return pSM->IsHS();
// Instructions: Sample=60, SampleBias=61, SampleCmp=64, SampleCmpLevelZero=65,
// Instructions: Sample=60, SampleBias=61, SampleCmp=64,
// RenderTargetGetSamplePosition=76, RenderTargetGetSampleCount=77,
// CalculateLOD=81, Discard=82, DerivCoarseX=83, DerivCoarseY=84,
// DerivFineX=85, DerivFineY=86, EvalSnapped=87, EvalSampleIndex=88,
// EvalCentroid=89, SampleIndex=90, Coverage=91, InnerCoverage=92
if (60 <= op && op <= 61 || 64 <= op && op <= 65 || 76 <= op && op <= 77 || 81 <= op && op <= 92)
if (60 <= op && op <= 61 || op == 64 || 76 <= op && op <= 77 || 81 <= op && op <= 92)
return pSM->IsPS();
return true;
// VALOPCODESM-TEXT:END

Просмотреть файл

@ -0,0 +1,20 @@
// RUN: %dxc -E main -T cs_6_0 %s | FileCheck %s
// CHECK: sampleCmpLevelZero
SamplerComparisonState samp1 : register(s5);
Texture2D<float4> text1 : register(t3);
float cmpVal;
RWBuffer<float4> buf1;
[numthreads(8, 8, 8)]
void main(uint dtID : SV_DispatchThreadID)
{
uint status;
float2 a = buf1[dtID].xy;
float4 r = 0;
r += text1.SampleCmpLevelZero(samp1, a, cmpVal);
r += text1.SampleCmpLevelZero(samp1, a, cmpVal, uint2(-5, 7));
r += text1.SampleCmpLevelZero(samp1, a, cmpVal, uint2(-3, 2), status); r += status;
buf1[dtID] = r;
}

Просмотреть файл

@ -453,6 +453,7 @@ public:
TEST_METHOD(CodeGenSampleBias)
TEST_METHOD(CodeGenSampleCmp)
TEST_METHOD(CodeGenSampleCmpLZ)
TEST_METHOD(CodeGenSampleCmpLZ2)
TEST_METHOD(CodeGenSampleGrad)
TEST_METHOD(CodeGenSampleL)
TEST_METHOD(CodeGenSaturate1)
@ -2453,6 +2454,10 @@ TEST_F(CompilerTest, CodeGenSampleCmpLZ) {
CodeGenTestCheck(L"..\\CodeGenHLSL\\sampleCmpLZ.hlsl");
}
TEST_F(CompilerTest, CodeGenSampleCmpLZ2) {
CodeGenTestCheck(L"..\\CodeGenHLSL\\sampleCmpLZ2.hlsl");
}
TEST_F(CompilerTest, CodeGenSampleGrad) {
CodeGenTestCheck(L"..\\CodeGenHLSL\\sampleGrad.hlsl");
}

Просмотреть файл

@ -234,7 +234,7 @@ class db_dxil(object):
self.name_idx[i].category = "Resources"
for i in "Sample,SampleBias,SampleLevel,SampleGrad,SampleCmp,SampleCmpLevelZero,Texture2DMSGetSamplePosition,RenderTargetGetSamplePosition,RenderTargetGetSampleCount".split(","):
self.name_idx[i].category = "Resources - sample"
for i in "Sample,SampleBias,SampleCmp,SampleCmpLevelZero,RenderTargetGetSamplePosition,RenderTargetGetSampleCount".split(","):
for i in "Sample,SampleBias,SampleCmp,RenderTargetGetSamplePosition,RenderTargetGetSampleCount".split(","):
self.name_idx[i].shader_models = "p"
for i in "TextureGather,TextureGatherCmp".split(","):
self.name_idx[i].category = "Resources - gather"