summaryrefslogtreecommitdiffstats
path: root/tools/render-test/shader-input-layout.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-09-09 13:54:31 -0400
committerGitHub <noreply@github.com>2019-09-09 13:54:31 -0400
commit047daae9300c8a94d28383cf992ce00e3ad2da1e (patch)
tree520025463f6493b31d859a812af8a1384a23f715 /tools/render-test/shader-input-layout.cpp
parent4fc07614d6407e49a0c34e7483d410153c0b269a (diff)
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.
Diffstat (limited to 'tools/render-test/shader-input-layout.cpp')
-rw-r--r--tools/render-test/shader-input-layout.cpp34
1 files changed, 18 insertions, 16 deletions
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 <typename F>
+ 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)
{