Fix checking LoadInput for GetAttributeAtVertex for no Opt (#1149)

This commit is contained in:
Young Kim 2018-03-17 08:45:46 -07:00 коммит произвёл GitHub
Родитель cfd787a18e
Коммит f174990c6e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 43 добавлений и 1 удалений

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

@ -1776,7 +1776,8 @@ public:
static_cast<IntrinsicOp>(hlsl::GetHLOpcode(CI));
if (evalOp == IntrinsicOp::IOP_EvaluateAttributeAtSample ||
evalOp == IntrinsicOp::IOP_EvaluateAttributeCentroid ||
evalOp == IntrinsicOp::IOP_EvaluateAttributeSnapped) {
evalOp == IntrinsicOp::IOP_EvaluateAttributeSnapped ||
evalOp == IntrinsicOp::IOP_GetAttributeAtVertex) {
EvalFunctionCalls.push_back(CI);
}
}

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

@ -0,0 +1,35 @@
// RUN: %dxc -E main -T ps_6_1 -O0 %s | FileCheck %s
// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 0, i8 0)
// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 1, i8 0)
// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 2, i8 0)
// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 0, i8 1)
// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 1, i8 1)
// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 2, i8 1)
// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 0, i8 2)
// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 1, i8 2)
// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 2, i8 2)
struct PSInput
{
float4 position : SV_POSITION;
nointerpolation float3 color : COLOR;
};
RWByteAddressBuffer outputUAV : register(u0);
cbuffer constants : register(b0)
{
float4 g_constants;
}
float4 main(PSInput input) : SV_TARGET
{
uint cmp = (uint)(g_constants[0]);
float colorAtV0 = GetAttributeAtVertex(input.color, 0)[cmp];
float colorAtV1 = GetAttributeAtVertex(input.color, 1)[cmp];
float colorAtV2 = GetAttributeAtVertex(input.color, 2)[cmp];
outputUAV.Store(0, asuint(colorAtV0));
outputUAV.Store(4, asuint(colorAtV1));
outputUAV.Store(8, asuint(colorAtV2));
return 1.0;
}

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

@ -476,6 +476,7 @@ public:
TEST_METHOD(CodeGenAtomic)
TEST_METHOD(CodeGenAtomic2)
TEST_METHOD(CodeGenAttributeAtVertex)
TEST_METHOD(CodeGenAttributeAtVertexNoOpt)
TEST_METHOD(CodeGenBarycentrics)
TEST_METHOD(CodeGenBarycentrics1)
TEST_METHOD(CodeGenBarycentricsThreeSV)
@ -3192,6 +3193,11 @@ TEST_F(CompilerTest, CodeGenAttributeAtVertex) {
CodeGenTestCheck(L"..\\CodeGenHLSL\\attributeAtVertex.hlsl");
}
TEST_F(CompilerTest, CodeGenAttributeAtVertexNoOpt) {
if (m_ver.SkipDxilVersion(1,1)) return;
CodeGenTestCheck(L"..\\CodeGenHLSL\\attributeAtVertexNoOpt.hlsl");
}
TEST_F(CompilerTest, CodeGenBarycentrics) {
if (m_ver.SkipDxilVersion(1,1)) return;
CodeGenTestCheck(L"..\\CodeGenHLSL\\barycentrics.hlsl");