|
@@ -228,7 +228,7 @@ enum D3D12_COMMAND_LIST_SUPPORT_FLAGS
|
|
D3D12_COMMAND_LIST_SUPPORT_FLAG_COPY = (1 << D3D12_COMMAND_LIST_TYPE_COPY),
|
|
D3D12_COMMAND_LIST_SUPPORT_FLAG_COPY = (1 << D3D12_COMMAND_LIST_TYPE_COPY),
|
|
D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_DECODE = (1 << 4),
|
|
D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_DECODE = (1 << 4),
|
|
D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_PROCESS = (1 << 5)
|
|
D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_PROCESS = (1 << 5)
|
|
-} D3D12_COMMAND_LIST_SUPPORT_FLAGS;
|
|
|
|
|
|
+} D3D12_COMMAND_LIST_SUPPORT_FLAGS;
|
|
|
|
|
|
typedef
|
|
typedef
|
|
enum D3D12_VIEW_INSTANCING_TIER
|
|
enum D3D12_VIEW_INSTANCING_TIER
|
|
@@ -237,7 +237,7 @@ enum D3D12_VIEW_INSTANCING_TIER
|
|
D3D12_VIEW_INSTANCING_TIER_1 = 1,
|
|
D3D12_VIEW_INSTANCING_TIER_1 = 1,
|
|
D3D12_VIEW_INSTANCING_TIER_2 = 2,
|
|
D3D12_VIEW_INSTANCING_TIER_2 = 2,
|
|
D3D12_VIEW_INSTANCING_TIER_3 = 3
|
|
D3D12_VIEW_INSTANCING_TIER_3 = 3
|
|
-} D3D12_VIEW_INSTANCING_TIER;
|
|
|
|
|
|
+} D3D12_VIEW_INSTANCING_TIER;
|
|
|
|
|
|
typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS3
|
|
typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS3
|
|
{
|
|
{
|
|
@@ -246,7 +246,7 @@ typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS3
|
|
_Out_ DWORD WriteBufferImmediateSupportFlags;
|
|
_Out_ DWORD WriteBufferImmediateSupportFlags;
|
|
_Out_ D3D12_VIEW_INSTANCING_TIER ViewInstancingTier;
|
|
_Out_ D3D12_VIEW_INSTANCING_TIER ViewInstancingTier;
|
|
_Out_ BOOL BarycentricsSupported;
|
|
_Out_ BOOL BarycentricsSupported;
|
|
-} D3D12_FEATURE_DATA_D3D12_OPTIONS3;
|
|
|
|
|
|
+} D3D12_FEATURE_DATA_D3D12_OPTIONS3;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS3
|
|
#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS3
|
|
@@ -406,9 +406,20 @@ public:
|
|
TEST_METHOD_PROPERTY(L"Priority", L"2") // Remove this line once warp supports this feature in Shader Model 6.2
|
|
TEST_METHOD_PROPERTY(L"Priority", L"2") // Remove this line once warp supports this feature in Shader Model 6.2
|
|
END_TEST_METHOD()
|
|
END_TEST_METHOD()
|
|
|
|
|
|
- BEGIN_TEST_METHOD(BarycentricsTest)
|
|
|
|
- TEST_METHOD_PROPERTY(L"Priority", L"2")
|
|
|
|
- END_TEST_METHOD()
|
|
|
|
|
|
+ TEST_METHOD(BarycentricsTest);
|
|
|
|
+
|
|
|
|
+ TEST_METHOD(ComputeRawBufferLdStI32);
|
|
|
|
+ TEST_METHOD(ComputeRawBufferLdStFloat);
|
|
|
|
+ TEST_METHOD(ComputeRawBufferLdStI64);
|
|
|
|
+ TEST_METHOD(ComputeRawBufferLdStDouble);
|
|
|
|
+ TEST_METHOD(ComputeRawBufferLdStI16);
|
|
|
|
+ TEST_METHOD(ComputeRawBufferLdStHalf);
|
|
|
|
+ TEST_METHOD(GraphicsRawBufferLdStI32);
|
|
|
|
+ TEST_METHOD(GraphicsRawBufferLdStFloat);
|
|
|
|
+ TEST_METHOD(GraphicsRawBufferLdStI64);
|
|
|
|
+ TEST_METHOD(GraphicsRawBufferLdStDouble);
|
|
|
|
+ TEST_METHOD(GraphicsRawBufferLdStI16);
|
|
|
|
+ TEST_METHOD(GraphicsRawBufferLdStHalf);
|
|
|
|
|
|
// This is defined in d3d.h for Windows 10 Anniversary Edition SDK, but we only
|
|
// This is defined in d3d.h for Windows 10 Anniversary Edition SDK, but we only
|
|
// require the Windows 10 SDK.
|
|
// require the Windows 10 SDK.
|
|
@@ -434,7 +445,7 @@ public:
|
|
|
|
|
|
const float ClearColor[4] = { 0.0f, 0.2f, 0.4f, 1.0f };
|
|
const float ClearColor[4] = { 0.0f, 0.2f, 0.4f, 1.0f };
|
|
|
|
|
|
-// Do not remove the following line - it is used bqy TranslateExecutionTest.py
|
|
|
|
|
|
+// Do not remove the following line - it is used by TranslateExecutionTest.py
|
|
// MARKER: ExecutionTest/DxilConf Shared Implementation Start
|
|
// MARKER: ExecutionTest/DxilConf Shared Implementation Start
|
|
|
|
|
|
bool UseDxbc() {
|
|
bool UseDxbc() {
|
|
@@ -469,6 +480,17 @@ public:
|
|
|
|
|
|
void RunBasicShaderModelTest(D3D_SHADER_MODEL shaderModel);
|
|
void RunBasicShaderModelTest(D3D_SHADER_MODEL shaderModel);
|
|
|
|
|
|
|
|
+ enum class RawBufferLdStType {
|
|
|
|
+ I32,
|
|
|
|
+ Float,
|
|
|
|
+ I64,
|
|
|
|
+ Double,
|
|
|
|
+ I16,
|
|
|
|
+ Half
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ void RunRawBufferLdStTest(D3D_SHADER_MODEL shaderModel, RawBufferLdStType dataType, char *shaderOpName = nullptr);
|
|
|
|
+
|
|
template <class Ty>
|
|
template <class Ty>
|
|
void RunBasicShaderModelTest(CComPtr<ID3D12Device> pDevice, const char *pShaderModelStr, const char *pShader, Ty *pInputDataPairs, unsigned inputDataCount);
|
|
void RunBasicShaderModelTest(CComPtr<ID3D12Device> pDevice, const char *pShaderModelStr, const char *pShader, Ty *pInputDataPairs, unsigned inputDataCount);
|
|
|
|
|
|
@@ -833,6 +855,20 @@ public:
|
|
return O.WaveOps != FALSE;
|
|
return O.WaveOps != FALSE;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ bool DoesDeviceSupportBarycentrics(ID3D12Device *pDevice) {
|
|
|
|
+ D3D12_FEATURE_DATA_D3D12_OPTIONS3 O;
|
|
|
|
+ if (FAILED(pDevice->CheckFeatureSupport((D3D12_FEATURE)D3D12_FEATURE_D3D12_OPTIONS3, &O, sizeof(O))))
|
|
|
|
+ return false;
|
|
|
|
+ return O.BarycentricsSupported != FALSE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bool DoesDeviceSupportNative16bitOps(ID3D12Device *pDevice) {
|
|
|
|
+ D3D12_FEATURE_DATA_D3D12_OPTIONS4 O;
|
|
|
|
+ if (FAILED(pDevice->CheckFeatureSupport((D3D12_FEATURE)D3D12_FEATURE_D3D12_OPTIONS4, &O, sizeof(O))))
|
|
|
|
+ return false;
|
|
|
|
+ return O.Native16BitShaderOpsSupported != FALSE;
|
|
|
|
+ }
|
|
|
|
+
|
|
#ifndef _HLK_CONF
|
|
#ifndef _HLK_CONF
|
|
void DXBCFromText(LPCSTR pText, LPCWSTR pEntryPoint, LPCWSTR pTargetProfile, ID3DBlob **ppBlob) {
|
|
void DXBCFromText(LPCSTR pText, LPCWSTR pEntryPoint, LPCWSTR pTargetProfile, ID3DBlob **ppBlob) {
|
|
CW2A pEntryPointA(pEntryPoint, CP_UTF8);
|
|
CW2A pEntryPointA(pEntryPoint, CP_UTF8);
|
|
@@ -5781,17 +5817,18 @@ TEST_F(ExecutionTest, BarycentricsTest) {
|
|
CComPtr<ID3D12Device> pDevice;
|
|
CComPtr<ID3D12Device> pDevice;
|
|
if (!CreateDevice(&pDevice, D3D_SHADER_MODEL_6_1))
|
|
if (!CreateDevice(&pDevice, D3D_SHADER_MODEL_6_1))
|
|
return;
|
|
return;
|
|
- // TODO: check feature support for different tier. This test does not assume vertex ordering and only tests SV_Barycentrics yet
|
|
|
|
- // Split this test into 2 for different tiers.
|
|
|
|
|
|
|
|
- // Tier 1: Index 0-2 for GetAttributeAtVertex returns values for three different vertices
|
|
|
|
- // Tier 2: Match the provoking vertex (index 0 is a provoking vertex)
|
|
|
|
|
|
+ if (!DoesDeviceSupportBarycentrics(pDevice)) {
|
|
|
|
+ WEX::Logging::Log::Comment(L"Device does not support barycentrics.");
|
|
|
|
+ WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
std::shared_ptr<ShaderOpTestResult> test = RunShaderOpTest(pDevice, m_support, pStream, "Barycentrics", nullptr);
|
|
std::shared_ptr<ShaderOpTestResult> test = RunShaderOpTest(pDevice, m_support, pStream, "Barycentrics", nullptr);
|
|
MappedData data;
|
|
MappedData data;
|
|
D3D12_RESOURCE_DESC &D = test->ShaderOp->GetResourceByName("RTarget")->Desc;
|
|
D3D12_RESOURCE_DESC &D = test->ShaderOp->GetResourceByName("RTarget")->Desc;
|
|
- UINT width = (UINT64)D.Width;
|
|
|
|
- UINT height = (UINT64)D.Height;
|
|
|
|
|
|
+ UINT width = (UINT)D.Width;
|
|
|
|
+ UINT height = D.Height;
|
|
UINT pixelSize = GetByteSizeForFormat(D.Format);
|
|
UINT pixelSize = GetByteSizeForFormat(D.Format);
|
|
|
|
|
|
test->Test->GetReadBackData("RTarget", &data);
|
|
test->Test->GetReadBackData("RTarget", &data);
|
|
@@ -5825,8 +5862,8 @@ TEST_F(ExecutionTest, BarycentricsTest) {
|
|
float x1 = w0 * p0.x + w1 * p1.x + w2 * p2.x;
|
|
float x1 = w0 * p0.x + w1 * p1.x + w2 * p2.x;
|
|
float y1 = w0 * p0.y + w1 * p1.y + w2 * p2.y;
|
|
float y1 = w0 * p0.y + w1 * p1.y + w2 * p2.y;
|
|
// map from x1 y1 to rtv pixels
|
|
// map from x1 y1 to rtv pixels
|
|
- int pixelX = (x1 + 1) * (width - 1) / 2;
|
|
|
|
- int pixelY = (1 - y1) * (height - 1) / 2;
|
|
|
|
|
|
+ int pixelX = (int)((x1 + 1) * (width - 1) / 2);
|
|
|
|
+ int pixelY = (int)((1 - y1) * (height - 1) / 2);
|
|
int offset = pixelSize * (pixelX + pixelY * width) / sizeof(pPixels[0]);
|
|
int offset = pixelSize * (pixelX + pixelY * width) / sizeof(pPixels[0]);
|
|
LogCommentFmt(L"location %u %u, value %f, %f, %f", pixelX, pixelY, pPixels[offset], pPixels[offset + 1], pPixels[offset + 2]);
|
|
LogCommentFmt(L"location %u %u, value %f, %f, %f", pixelX, pixelY, pPixels[offset], pPixels[offset + 1], pPixels[offset + 2]);
|
|
VERIFY_IS_TRUE(CompareFloatEpsilon(pPixels[offset], w0, tolerance));
|
|
VERIFY_IS_TRUE(CompareFloatEpsilon(pPixels[offset], w0, tolerance));
|
|
@@ -5836,6 +5873,106 @@ TEST_F(ExecutionTest, BarycentricsTest) {
|
|
//SavePixelsToFile(pPixels, DXGI_FORMAT_R32G32B32A32_FLOAT, width, height, L"barycentric.bmp");
|
|
//SavePixelsToFile(pPixels, DXGI_FORMAT_R32G32B32A32_FLOAT, width, height, L"barycentric.bmp");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+TEST_F(ExecutionTest, ComputeRawBufferLdStI32) {
|
|
|
|
+ RunRawBufferLdStTest(D3D_SHADER_MODEL_6_2, RawBufferLdStType::I32, "ComputeRawBufferLdStI32");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_F(ExecutionTest, ComputeRawBufferLdStFloat) {
|
|
|
|
+ RunRawBufferLdStTest(D3D_SHADER_MODEL_6_2, RawBufferLdStType::Float, "ComputeRawBufferLdStFloat");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_F(ExecutionTest, ComputeRawBufferLdStI64) {
|
|
|
|
+ RunRawBufferLdStTest(D3D_SHADER_MODEL_6_3, RawBufferLdStType::I64, "ComputeRawBufferLdStI64");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_F(ExecutionTest, ComputeRawBufferLdStDouble) {
|
|
|
|
+ RunRawBufferLdStTest(D3D_SHADER_MODEL_6_3, RawBufferLdStType::Double, "ComputeRawBufferLdStDouble");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_F(ExecutionTest, ComputeRawBufferLdStI16) {
|
|
|
|
+ RunRawBufferLdStTest(D3D_SHADER_MODEL_6_2, RawBufferLdStType::I16, "ComputeRawBufferLdStI16");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_F(ExecutionTest, ComputeRawBufferLdStHalf) {
|
|
|
|
+ RunRawBufferLdStTest(D3D_SHADER_MODEL_6_2, RawBufferLdStType::Half, "ComputeRawBufferLdStHalf");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_F(ExecutionTest, GraphicsRawBufferLdStI32) {
|
|
|
|
+ RunRawBufferLdStTest(D3D_SHADER_MODEL_6_2, RawBufferLdStType::I32, "GraphicsRawBufferLdStI32");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_F(ExecutionTest, GraphicsRawBufferLdStFloat) {
|
|
|
|
+ RunRawBufferLdStTest(D3D_SHADER_MODEL_6_2, RawBufferLdStType::Float, "GraphicsRawBufferLdStFloat");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_F(ExecutionTest, GraphicsRawBufferLdStI64) {
|
|
|
|
+ RunRawBufferLdStTest(D3D_SHADER_MODEL_6_3, RawBufferLdStType::I64, "GraphicsRawBufferLdStI64");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_F(ExecutionTest, GraphicsRawBufferLdStDouble) {
|
|
|
|
+ RunRawBufferLdStTest(D3D_SHADER_MODEL_6_3, RawBufferLdStType::Double, "GraphicsRawBufferLdStDouble");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_F(ExecutionTest, GraphicsRawBufferLdStI16) {
|
|
|
|
+ RunRawBufferLdStTest(D3D_SHADER_MODEL_6_2, RawBufferLdStType::I16, "GraphicsRawBufferLdStI16");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_F(ExecutionTest, GraphicsRawBufferLdStHalf) {
|
|
|
|
+ RunRawBufferLdStTest(D3D_SHADER_MODEL_6_2, RawBufferLdStType::Half, "GraphicsRawBufferLdStHalf");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void ExecutionTest::RunRawBufferLdStTest(D3D_SHADER_MODEL shaderModel, RawBufferLdStType dataType, char *shaderOpName) {
|
|
|
|
+ WEX::TestExecution::SetVerifyOutput verifySettings(
|
|
|
|
+ WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures);
|
|
|
|
+
|
|
|
|
+ CComPtr<ID3D12Device> pDevice;
|
|
|
|
+ if (!CreateDevice(&pDevice, shaderModel)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ switch (dataType) {
|
|
|
|
+ case RawBufferLdStType::I64:
|
|
|
|
+ if (!DoesDeviceSupportInt64(pDevice)) {
|
|
|
|
+ WEX::Logging::Log::Comment(L"Device does not support int64 operations.");
|
|
|
|
+ WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case RawBufferLdStType::Double:
|
|
|
|
+ if (!DoesDeviceSupportDouble(pDevice)) {
|
|
|
|
+ WEX::Logging::Log::Comment(L"Device does not support double operations.");
|
|
|
|
+ WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case RawBufferLdStType::I16:
|
|
|
|
+ case RawBufferLdStType::Half:
|
|
|
|
+ if (!DoesDeviceSupportNative16bitOps(pDevice)) {
|
|
|
|
+ WEX::Logging::Log::Comment(L"Device does not support native 16-bit operations.");
|
|
|
|
+ WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case RawBufferLdStType::I32:
|
|
|
|
+ case RawBufferLdStType::Float:
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ DXASSERT_NOMSG("Invalid RawBufferLdStType");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (shaderOpName == nullptr) {
|
|
|
|
+ // TODO: finish up all variations
|
|
|
|
+ WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CComPtr<IStream> pStream;
|
|
|
|
+ ReadHlslDataIntoNewStream(L"ShaderOpArith.xml", &pStream);
|
|
|
|
+
|
|
|
|
+ // TODO: finish up
|
|
|
|
+ WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
|
|
|
|
+}
|
|
|
|
+
|
|
#ifndef _HLK_CONF
|
|
#ifndef _HLK_CONF
|
|
static void WriteReadBackDump(st::ShaderOp *pShaderOp, st::ShaderOpTest *pTest,
|
|
static void WriteReadBackDump(st::ShaderOp *pShaderOp, st::ShaderOpTest *pTest,
|
|
char **pReadBackDump) {
|
|
char **pReadBackDump) {
|