From 047daae9300c8a94d28383cf992ce00e3ad2da1e Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 9 Sep 2019 13:54:31 -0400 Subject: CPU compute testing on non windows targets (#1045) * WIP: Refactor of CPUCompute and stand alone cpu-render-test * Fix compilation on CygWin. * Make CPU compute tests run on non windows targets. * Check that C/C++ compiler is available for CPU compute. * Fix some tabbing issues. * Add -fPIC on gfx * Use dxcompiler_47.dll from slang-binaries on windows. * make https for git module slang-binaries * Fix comment in premake5.lua around d3dcompiler_47.dll * Add resources to the CPUComputeUtil::Context to keep in scope. * Fixes problem compiling on cygwin where dx12 is included in build of gfx lib. --- tools/render-test/shader-input-layout.cpp | 34 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'tools/render-test/shader-input-layout.cpp') diff --git a/tools/render-test/shader-input-layout.cpp b/tools/render-test/shader-input-layout.cpp index 810e31c2c..7f75805e9 100644 --- a/tools/render-test/shader-input-layout.cpp +++ b/tools/render-test/shader-input-layout.cpp @@ -440,6 +440,23 @@ namespace renderer_test } } + template + void _iteratePixels(int dimension, int size, unsigned int * buffer, F f) + { + if (dimension == 1) + for (int i = 0; i < size; i++) + buffer[i] = f(i, 0, 0); + else if (dimension == 2) + for (int i = 0; i < size; i++) + for (int j = 0; j < size; j++) + buffer[i*size + j] = f(j, i, 0); + else if (dimension == 3) + for (int i = 0; i < size; i++) + for (int j = 0; j < size; j++) + for (int k = 0; k < size; k++) + buffer[i*size*size + j * size + k] = f(k, j, i); + }; + void generateTextureDataRGB8(TextureData& output, const InputTextureDesc& inputDesc) { int arrLen = inputDesc.arrayLength; @@ -453,21 +470,6 @@ namespace renderer_test output.textureSize = inputDesc.size; output.mipLevels = Math::Log2Floor(output.textureSize) + 1; output.dataBuffer.setCount(output.mipLevels * output.arraySize); - auto iteratePixels = [&](int dimension, int size, unsigned int * buffer, auto f) - { - if (dimension == 1) - for (int i = 0; i < size; i++) - buffer[i] = f(i, 0, 0); - else if (dimension == 2) - for (int i = 0; i < size; i++) - for (int j = 0; j < size; j++) - buffer[i*size + j] = f(j, i, 0); - else if (dimension == 3) - for (int i = 0; i < size; i++) - for (int j = 0; j < size; j++) - for (int k = 0; k < size; k++) - buffer[i*size*size + j*size + k] = f(k, j, i); - }; int slice = 0; for (int i = 0; i < arraySize; i++) @@ -482,7 +484,7 @@ namespace renderer_test bufferLen *= size*size; dataBuffer[slice].setCount(bufferLen); - iteratePixels(inputDesc.dimension, size, dataBuffer[slice].getBuffer(), [&](int x, int y, int z) -> unsigned int + _iteratePixels(inputDesc.dimension, size, dataBuffer[slice].getBuffer(), [&](int x, int y, int z) -> unsigned int { if (inputDesc.content == InputTextureContent::Zero) { -- cgit v1.2.3