Skip to content

Instantly share code, notes, and snippets.

@ndevenish
Last active April 7, 2020 17:23
Show Gist options
  • Save ndevenish/4367240d63709d43c761a5a6cd4f8c5c to your computer and use it in GitHub Desktop.
Save ndevenish/4367240d63709d43c761a5a6cd4f8c5c to your computer and use it in GitHub Desktop.
Example of failing ispc bool passing
#include <algorithm>
#include "booltest.h"
int main(int argc, char**argv)
{
bool testmask[50];
std::fill(testmask, &testmask[50], true);
ispc::test_bool(testmask, 50);
}
export void test_bool(uniform bool * uniform mask, uniform int count) {
foreach(i = 0 ... count) {
print("%\n", i);
bool maskvar = mask[i];
if (maskvar) {
print("Ismask %\n", i);
}
}
}
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(ispc_bool)
add_custom_command(OUTPUT booltest.o booltest.h
COMMAND ispc ${CMAKE_SOURCE_DIR}/booltest.ispc -o booltest.o -h booltest.h
DEPENDS booltest.ispc)
add_executable(booltest booltest.cxx booltest.o)
target_include_directories(booltest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment