diff options
Diffstat (limited to 'demo')
217 files changed, 24628 insertions, 10175 deletions
diff --git a/demo/benchmark.h b/demo/benchmark.h index c0ab7c2..d04e780 100644 --- a/demo/benchmark.h +++ b/demo/benchmark.h @@ -27,166 +27,402 @@ #pragma once + + #include <iomanip> +#include <algorithm> +#include <stdint.h> const char* g_benchmarkFilename = "../../benchmark.txt"; -std::ofstream g_benchmarkFile; +std::wofstream g_benchmarkFile; -// returns the new scene if one is requested -int BenchmarkUpdate() +const int benchmarkPhaseFrameCount = 400; +const int benchmarkEndWarmup = 200; + +const int benchmarkAsyncOffDummyOnBeginFrame = benchmarkPhaseFrameCount; +const int benchmarkAsyncOnDummyOnBeginFrame = benchmarkPhaseFrameCount*2; +const int benchmarkEndFrame = benchmarkPhaseFrameCount*3; +const char* benchmarkList[] = { "Env Cloth Small", "Viscosity Med", "Inflatables", "Game Mesh Particles", "Rigid4" }; +const char* benchmarkChartPrefix[] = { "EnvClothSmall", "ViscosityMed", "Inflatables", "GameMeshParticles", "Rigid4" }; //no spaces +int numBenchmarks = sizeof(benchmarkList)/sizeof(benchmarkList[0]); + +struct GpuTimers +{ + unsigned long long renderBegin; + unsigned long long renderEnd; + unsigned long long renderFreq; + unsigned long long computeBegin; + unsigned long long computeEnd; + unsigned long long computeFreq; + + static const int maxTimerCount = 4; + double timers[benchmarkEndFrame][maxTimerCount]; + int timerCount[benchmarkEndFrame]; +}; + + +struct TimerTotals { - // Enable console benchmark profiling - static NvFlexTimers sTimersSum; - static std::vector<NvFlexDetailTimer> sDTimersSum; - static float sTotalFrameTime = 0.0f; - static int sSamples = 0; + std::vector<NvFlexDetailTimer> detailTimers; + + float frameTime; + int samples; - static int benchmarkIter = 0; - const int numBenchmarks = 5; - const char* benchmarkList[numBenchmarks] = { "Env Cloth Small", "Viscosity Med", "Inflatables", "Game Mesh Particles", "Rigid4" }; - const char* benchmarkChartPrefix[numBenchmarks] = { "EnvClothSmall", "ViscosityMed", "Inflatables", "GameMeshParticles", "Rigid4" }; //no spaces - //float benchmarkEnergyCheck[numBenchmarks] = { 6000, 1000, 1000, 150426, 63710 }; + float frameTimeAsync; + int samplesAsync; - int newScene = -1; + float computeTimeAsyncOff; + float computeTimeAsyncOn; + int computeSamples; + + TimerTotals() : frameTime(0), samples(0), frameTimeAsync(0), samplesAsync(0), computeTimeAsyncOff(0), computeTimeAsyncOn(0), computeSamples(0) {} +}; + +GpuTimers g_GpuTimers; + +int g_benchmarkFrame = 0; +int g_benchmarkScene = 0; +int g_benchmarkSceneNumber; + +#if defined(__linux__) +int sprintf_s(char* const buffer, size_t const bufferCount, + const char* format,...) +{ + va_list args; + va_start(args, format); + int retval = vsprintf(buffer, format, args); + va_end(args); + + return retval; +} +#endif + +//----------------------------------------------------------------------------- +char* removeSpaces(const char* in) +{ + int len = strlen(in); + char* out = new char[len+1]; - if (g_benchmark && benchmarkIter == 0 && g_frame == 1) + int i = 0; + int j = 0; + while (in[i] != 0) { - // check and see if the first scene is the same as the first benchmark - // switch to benchmark if it is not the same - if (strcmp(benchmarkList[0], g_scenes[g_scene]->GetName()) == 0) - benchmarkIter++; - else - g_frame = -1; + if (in[i] != ' ') + { + out[j] = in[i]; + j++; + } + i++; } + out[j] = 0; + + return out; +} +//----------------------------------------------------------------------------- +void ProcessGpuTimes() +{ + static bool timerfirstTime = true; + + double renderTime; + double compTime; + double unionTime; + double overlapBeginTime; + + int numParticles = NvFlexGetActiveCount(g_solver); - if (g_frame == 200) + renderTime = double(g_GpuTimers.renderEnd - g_GpuTimers.renderBegin) / double(g_GpuTimers.renderFreq); + compTime = double(g_GpuTimers.computeEnd - g_GpuTimers.computeBegin) / double(g_GpuTimers.computeFreq); + + uint64_t minTime = min(g_GpuTimers.renderBegin, g_GpuTimers.computeBegin); + uint64_t maxTime = max(g_GpuTimers.renderEnd, g_GpuTimers.computeEnd); + unionTime = double(maxTime - minTime) / double(g_GpuTimers.computeFreq); + + overlapBeginTime = abs((long long)g_GpuTimers.renderBegin - (long long)g_GpuTimers.computeBegin) / double(g_GpuTimers.computeFreq); + + if (!timerfirstTime && g_benchmarkFrame < benchmarkEndFrame) { - memset(&sTimersSum, 0, sizeof(NvFlexTimers)); - sTotalFrameTime = 0.0f; - sSamples = 0; - g_emit = true; - sDTimersSum.resize(g_numDetailTimers); + if (g_useAsyncCompute) + { + g_GpuTimers.timers[g_benchmarkFrame][0] = numParticles; + g_GpuTimers.timers[g_benchmarkFrame][1] = unionTime * 1000; + g_GpuTimers.timers[g_benchmarkFrame][2] = overlapBeginTime * 1000; + g_GpuTimers.timers[g_benchmarkFrame][3] = g_realdt * 1000; + g_GpuTimers.timerCount[g_benchmarkFrame] = 4; + } + else + { + g_GpuTimers.timers[g_benchmarkFrame][0] = numParticles; + g_GpuTimers.timers[g_benchmarkFrame][1] = renderTime * 1000; + g_GpuTimers.timers[g_benchmarkFrame][2] = compTime * 1000; + g_GpuTimers.timers[g_benchmarkFrame][3] = g_realdt * 1000; + g_GpuTimers.timerCount[g_benchmarkFrame] = 4; + } } - if (g_frame >= 200 && g_frame < 400) + timerfirstTime = false; +} +//----------------------------------------------------------------------------- +void UpdateTotals(TimerTotals& totals) +{ + // Phase 0B, async off, dummy work off + if (benchmarkEndWarmup <= g_benchmarkFrame && g_benchmarkFrame < benchmarkAsyncOffDummyOnBeginFrame) { - sTotalFrameTime += g_realdt * 1000.0f; //convert to milliseconds + totals.frameTime += g_realdt * 1000.0f; //convert to milliseconds for (int i = 0; i < g_numDetailTimers; i++) { - sDTimersSum[i].name = g_detailTimers[i].name; - sDTimersSum[i].time += g_detailTimers[i].time; + strcpy(totals.detailTimers[i].name,g_detailTimers[i].name); + totals.detailTimers[i].time += g_detailTimers[i].time; } - sTimersSum.total += g_timers.total; + totals.samples++; + } - sSamples++; + // Phase 2B, async on, dummy work on + if (benchmarkAsyncOnDummyOnBeginFrame + benchmarkEndWarmup <= g_benchmarkFrame) + { + float offGraphics = (float)g_GpuTimers.timers[g_benchmarkFrame - benchmarkPhaseFrameCount][1]; + float offCompute = (float)g_GpuTimers.timers[g_benchmarkFrame - benchmarkPhaseFrameCount][2]; + float onBoth = (float)g_GpuTimers.timers[g_benchmarkFrame][1]; + + float onCompute = onBoth - offGraphics; + + totals.computeTimeAsyncOff += offCompute; + totals.computeTimeAsyncOn += onCompute; + totals.computeSamples++; + + totals.frameTimeAsync += g_realdt * 1000.0f; //convert to milliseconds + totals.samplesAsync++; } - if (g_frame == 400) +} +//----------------------------------------------------------------------------- +void BeginNewPhaseIfNecessary(int& sceneToSwitchTo,TimerTotals& totals) +{ + // Are we beginning phase 0B? + if (g_benchmarkFrame == benchmarkEndWarmup) { + totals.frameTime = 0.0f; + totals.samples = 0; + g_emit = true; + totals.detailTimers.resize(g_numDetailTimers); - for (int i = 0; i < g_numDetailTimers; i++) { - sDTimersSum[i].time /= sSamples; + for (int i = 0; i != g_numDetailTimers; i++) + { + totals.detailTimers[i].name = new char[256]; } + } - if (g_teamCity) - { - const char* prefix = benchmarkChartPrefix[benchmarkIter - 1]; + // Are we beginning phase 1? + if (g_benchmarkFrame == benchmarkAsyncOffDummyOnBeginFrame) + { + sceneToSwitchTo = g_benchmarkSceneNumber; + g_useAsyncCompute = false; + g_increaseGfxLoadForAsyncComputeTesting = true; + } - float exclusive = 0.0f; + // Are we beginning phase 2? + if (g_benchmarkFrame == benchmarkAsyncOnDummyOnBeginFrame) + { + sceneToSwitchTo = g_benchmarkSceneNumber; + g_useAsyncCompute = true; + g_increaseGfxLoadForAsyncComputeTesting = true; + } - for (int i = 0; i < g_numDetailTimers - 1; i++) { - exclusive += sDTimersSum[i].time; - } + // Are we beginning phase 2B? + if (g_benchmarkFrame == benchmarkAsyncOnDummyOnBeginFrame + benchmarkEndWarmup) + { + totals.frameTimeAsync = 0.0f; + totals.samplesAsync = 0; + totals.computeTimeAsyncOff = 0.0f; + totals.computeTimeAsyncOn = 0.0f; + totals.computeSamples = 0; + g_emit = true; + } +} +//----------------------------------------------------------------------------- +void WriteSceneResults(TimerTotals& totals) +{ + // Write results for scene + for (int i = 0; i < g_numDetailTimers; i++) { + totals.detailTimers[i].time /= totals.samples; + } - printf("##teamcity[buildStatisticValue key='%s_FrameTime' value='%f']\n", prefix, sTotalFrameTime / sSamples); - printf("##teamcity[buildStatisticValue key='%s_SumKernel' value='%f']\n", prefix, exclusive); + if (g_profile && g_teamCity) + { + const char* prefix = benchmarkChartPrefix[g_benchmarkScene - 1]; - for (int i = 0; i < g_numDetailTimers - 1; i++) { - printf("##teamcity[buildStatisticValue key='%s_%s' value='%f']\n", prefix, sDTimersSum[i].name, sDTimersSum[i].time); - } - printf("\n"); + float exclusive = 0.0f; + + for (int i = 0; i < g_numDetailTimers - 1; i++) { + exclusive += totals.detailTimers[i].time; } - else - { - printf("Scene: %s\n", g_scenes[g_scene]->GetName()); - printf("FrameTime %f\n", sTotalFrameTime / sSamples); - printf("________________________________\n"); - float exclusive = 0.0f; - - for (int i = 0; i < g_numDetailTimers-1; i++) { - exclusive += sDTimersSum[i].time; - printf("%s %f\n", sDTimersSum[i].name, sDTimersSum[i].time); - } - printf("Sum(exclusive) %f\n", exclusive); - printf("Sum(inclusive) %f\n", sDTimersSum[g_numDetailTimers - 1].time); - printf("________________________________\n"); + + printf("##teamcity[buildStatisticValue key='%s_FrameTime' value='%f']\n", prefix, totals.frameTime / totals.samples); + printf("##teamcity[buildStatisticValue key='%s_SumKernel' value='%f']\n", prefix, exclusive); + + for (int i = 0; i < g_numDetailTimers - 1; i++) { + printf("##teamcity[buildStatisticValue key='%s_%s' value='%f']\n", prefix, totals.detailTimers[i].name, totals.detailTimers[i].time); } + printf("\n"); + } - // Dumping benchmark data to txt files + printf("Scene: %s\n", g_scenes[g_scene]->GetName()); + printf("FrameTime %f\n", totals.frameTime / totals.samples); + printf("________________________________\n"); + float exclusive = 0.0f; - g_benchmarkFile.open(g_benchmarkFilename, std::ofstream::out | std::ofstream::app); - g_benchmarkFile << std::fixed << std::setprecision(6); - g_benchmarkFile << "Scene: " << g_scenes[g_scene]->GetName() << std::endl; - g_benchmarkFile << "FrameTime " << sTotalFrameTime / sSamples << std::endl; - g_benchmarkFile << "________________________________" << std::endl; + for (int i = 0; i < g_numDetailTimers - 1; i++) { + exclusive += totals.detailTimers[i].time; + printf("%s %f\n", totals.detailTimers[i].name, totals.detailTimers[i].time); + } + printf("Sum(exclusive) %f\n", exclusive); + printf("Sum(inclusive) %f\n", totals.detailTimers[g_numDetailTimers - 1].time); + printf("________________________________\n"); + + // Dumping benchmark data to txt files + + g_benchmarkFile.open(g_benchmarkFilename, std::ofstream::out | std::ofstream::app); + g_benchmarkFile << std::fixed << std::setprecision(6); + g_benchmarkFile << "Scene: " << g_scenes[g_scene]->GetName() << std::endl; + g_benchmarkFile << "FrameTime " << totals.frameTime / totals.samples << std::endl; + g_benchmarkFile << "________________________________" << std::endl; + + if (g_profile) + { float exclusive = 0.0f; + g_benchmarkFile << std::fixed << std::setprecision(6); + for (int i = 0; i < g_numDetailTimers - 1; i++) { - exclusive += sDTimersSum[i].time; - g_benchmarkFile << sDTimersSum[i].name<<" "<< sDTimersSum[i].time << std::endl; + exclusive += totals.detailTimers[i].time; + g_benchmarkFile << totals.detailTimers[i].name << " " << totals.detailTimers[i].time << std::endl; + + delete totals.detailTimers[i].name; } - g_benchmarkFile << "Sum(exclusive) "<< exclusive << std::endl; - g_benchmarkFile << "Sum(inclusive) "<< sDTimersSum[g_numDetailTimers - 1].time<< std::endl; + g_benchmarkFile << "Sum(exclusive) " << exclusive << std::endl; + g_benchmarkFile << "Sum(inclusive) " << totals.detailTimers[g_numDetailTimers - 1].time << std::endl; g_benchmarkFile << "________________________________" << std::endl << std::endl; - g_benchmarkFile.close(); + } - if (g_benchmark) + if (g_outputAllFrameTimes) + { + for (int i = 0; i != benchmarkEndFrame; i++) { + g_benchmarkFile << g_GpuTimers.timers[i][3] << std::endl; + } -#if 0 - // Do basic kinetic energy verification check to ensure that the benchmark runs correctly - NvFlexGetVelocities(g_flex, g_buffers->velocities.buffer, g_buffers->velocities.size()); + // Per frame timers + for (int i = benchmarkAsyncOffDummyOnBeginFrame; i != benchmarkAsyncOnDummyOnBeginFrame; i++) + { + for (int j = 0; j != g_GpuTimers.timerCount[i]; j++) + { + g_benchmarkFile << g_GpuTimers.timers[i][j] << " "; + } - float sumVelocities = 0.0f; - for (int i = 0; i < g_buffers->velocities.size(); ++i) + for (int j = 0; j != g_GpuTimers.timerCount[i + benchmarkPhaseFrameCount]; j++) { - sumVelocities += g_buffers->velocities[i].x * g_buffers->velocities[i].x + g_buffers->velocities[i].y * g_buffers->velocities[i].y + g_buffers->velocities[i].z * g_buffers->velocities[i].z; + g_benchmarkFile << g_GpuTimers.timers[i + benchmarkPhaseFrameCount][j] << " "; } - // Tolerance 50% - int benchmark_id = benchmarkIter - 1; - if (sumVelocities > (benchmarkEnergyCheck[benchmark_id] * 1.50) || - sumVelocities < (benchmarkEnergyCheck[benchmark_id] * 0.50)) - printf("Benchmark kinetic energy verification failed! Expected: [%f], Actual: [%f]\n\n", benchmarkEnergyCheck[benchmark_id], sumVelocities); -#endif - g_frame = -1; + g_benchmarkFile << std::endl; } + } - if (g_benchmark && g_frame == -1) + g_benchmarkFile.close(); + + if (g_benchmark) { - if (benchmarkIter == numBenchmarks) - exit(0); - for (int i = 0; i < int(g_scenes.size()); ++i) +#if 0 + // Do basic kinetic energy verification check to ensure that the benchmark runs correctly + NvFlexGetVelocities(g_flex, g_buffers->velocities.buffer, g_buffers->velocities.size()); + + float sumVelocities = 0.0f; + for (int i = 0; i < g_buffers->velocities.size(); ++i) { - if (strcmp(benchmarkList[benchmarkIter], g_scenes[i]->GetName()) == 0) - newScene = i; + sumVelocities += g_buffers->velocities[i].x * g_buffers->velocities[i].x + g_buffers->velocities[i].y * g_buffers->velocities[i].y + g_buffers->velocities[i].z * g_buffers->velocities[i].z; } - assert(newScene != -1); + // Tolerance 50% + int benchmark_id = g_benchmarkScene - 1; + if (sumVelocities >(benchmarkEnergyCheck[benchmark_id] * 1.50) || + sumVelocities < (benchmarkEnergyCheck[benchmark_id] * 0.50)) + printf("Benchmark kinetic energy verification failed! Expected: [%f], Actual: [%f]\n\n", benchmarkEnergyCheck[benchmark_id], sumVelocities); +#endif - benchmarkIter++; } - - return newScene; } - -void BenchmarkInit() +//----------------------------------------------------------------------------- +int GoToNextScene() { - g_benchmarkFile.open(g_benchmarkFilename, std::ofstream::out | std::ofstream::app); - g_benchmarkFile << "Compute Device: " << g_deviceName << std::endl; - g_benchmarkFile << "HLSL Extensions: " << (g_extensions ? "ON" : "OFF") << std::endl << std::endl; - g_benchmarkFile.close(); + int sceneToSwitchTo = -1; + + // Advance to next benchmark scene + for (int i = 0; i < int(g_scenes.size()); ++i) + { + if (strcmp(benchmarkList[g_benchmarkScene], g_scenes[i]->GetName()) == 0) + { + sceneToSwitchTo = i; + g_benchmarkSceneNumber = i; + } + } + assert(sceneToSwitchTo != -1); + + g_useAsyncCompute = false; + g_increaseGfxLoadForAsyncComputeTesting = false; + + return sceneToSwitchTo; } +//----------------------------------------------------------------------------- +// Returns scene number if benchmark wants to switch scene, -1 otherwise +//----------------------------------------------------------------------------- +int BenchmarkUpdate() +{ + static TimerTotals s_totals; + int sceneToSwitchTo = -1; + + if (!g_benchmark) return sceneToSwitchTo; + + ProcessGpuTimes(); + UpdateTotals(s_totals); + + // Next frame + g_benchmarkFrame++; + + BeginNewPhaseIfNecessary(sceneToSwitchTo, s_totals); + + // Check whether at end of scene + if (g_benchmarkFrame == benchmarkEndFrame) + { + WriteSceneResults(s_totals); + // Next scene + g_benchmarkScene++; + // Go to next scene, or exit if all scenes done + if (g_benchmarkScene != numBenchmarks) + { + sceneToSwitchTo = GoToNextScene(); + + g_benchmarkFrame = 0; + g_frame = -1; + } + else + { + exit(0); + } + } + + return sceneToSwitchTo; +} +//----------------------------------------------------------------------------- +int BenchmarkInit() +{ + int sceneToSwitchTo = GoToNextScene(); + + return sceneToSwitchTo; +} +//----------------------------------------------------------------------------- +void BenchmarkUpdateGraph() +{ +} +//----------------------------------------------------------------------------- diff --git a/demo/compiler/makeandroid/Makefile b/demo/compiler/makeandroid/Makefile index 0b462ff..02650e4 100644 --- a/demo/compiler/makeandroid/Makefile +++ b/demo/compiler/makeandroid/Makefile @@ -2,11 +2,11 @@ # Makefile generated by XPJ for android DEPSDIR = .deps -NDKROOT = "$(NDK_ROOT)"/"$(NDK_VERSION)" -NDK_BIN_DIR = "$(NDK_ROOT)"/"$(NDK_VERSION)"/toolchains/"$(NDK_TOOLCHAIN)"/prebuilt/"linux-x86_64"/bin +NDKROOT = ./../../../../../../external/android-ndk/android-ndk-r10e-linux +NDK_BIN_DIR = ./../../../../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin NDK_PREFIX = arm-linux-androideabi- -JAVA_HOME = ./../xpj/"$(JAVA_HOME)" -ANT_TOOL = ./../xpj/"$(ANT_HOME}"/bin/ant +JAVA_HOME = ./../../../../../../external/java/jdk1.8.0_20 +ANT_TOOL = ./../../../../../../external/ant/apache-ant-1.8.2/bin/ant #default defines OBJS_DIR = build RMDIR = rm -fr @@ -23,22 +23,20 @@ OBJCOPY = $(NDK_BIN_DIR)/$(NDK_PREFIX)objcopy all: debug release -debug: build_flexExtCUDA_debug +debug: build_flexCUDA_debug build_flexExtCUDA_debug -release: build_flexExtCUDA_release build_flexDemoCUDA_release +release: build_flexDevice_release build_flexCUDA_release build_flexExtCUDA_release build_flexDemoCUDA_release -clean: clean_flexExtCUDA_release clean_flexExtCUDA_debug clean_flexDemoCUDA_release +clean: clean_flexDevice_release clean_flexCUDA_release clean_flexCUDA_debug clean_flexExtCUDA_release clean_flexExtCUDA_debug clean_flexDemoCUDA_release rm -rf $(DEPSDIR) -clean_release: clean_flexExtCUDA_release clean_flexDemoCUDA_release - rm -rf $(DEPSDIR) - - -clean_debug: clean_flexExtCUDA_debug clean_flexDemoCUDA_debug +clean_release: clean_flexDevice_release clean_flexCUDA_release clean_flexExtCUDA_release clean_flexDemoCUDA_release rm -rf $(DEPSDIR) +include Makefile.flexDevice.mk +include Makefile.flexCUDA.mk include Makefile.flexExtCUDA.mk include Makefile.flexDemoCUDA.mk diff --git a/demo/compiler/makeandroid/Makefile.flexDemoCUDA.mk b/demo/compiler/makeandroid/Makefile.flexDemoCUDA.mk index dbfbaab..74e8454 100644 --- a/demo/compiler/makeandroid/Makefile.flexDemoCUDA.mk +++ b/demo/compiler/makeandroid/Makefile.flexDemoCUDA.mk @@ -18,6 +18,9 @@ flexDemoCUDA_cppfiles += ./../../../core/sdf.cpp flexDemoCUDA_cppfiles += ./../../../core/tga.cpp flexDemoCUDA_cppfiles += ./../../../core/voxelize.cpp flexDemoCUDA_cppfiles += ./../../../external/egl_setup/egl_setup.cpp +flexDemoCUDA_cppfiles += ./../../android/android_main.cpp +flexDemoCUDA_cppfiles += ./../../android/android_mainRender.cpp +flexDemoCUDA_cfiles += ./../../android/android_native_app_glue.c flexDemoCUDA_cpp_release_dep = $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexDemoCUDA_cppfiles))))) flexDemoCUDA_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(flexDemoCUDA_ccfiles))))) @@ -26,15 +29,15 @@ flexDemoCUDA_release_dep = $(flexDemoCUDA_cpp_release_dep) $(flexDemoCUDA_c -include $(flexDemoCUDA_release_dep) flexDemoCUDA_release_hpaths := flexDemoCUDA_release_hpaths += ./../../.. -flexDemoCUDA_release_hpaths += $(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include -flexDemoCUDA_release_hpaths += $(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport -flexDemoCUDA_release_hpaths += $(CUDA_PATH)/targets/armv7-linux-androideabi/include +flexDemoCUDA_release_hpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include +flexDemoCUDA_release_hpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport +flexDemoCUDA_release_hpaths += ./../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include flexDemoCUDA_release_hpaths += ./../../../external/egl_setup flexDemoCUDA_release_hpaths += ./../../../external/regal_static/include flexDemoCUDA_release_lpaths := -flexDemoCUDA_release_lpaths += $(CUDA_PATH)/targets/armv7-linux-androideabi/lib +flexDemoCUDA_release_lpaths += ./../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/lib flexDemoCUDA_release_lpaths += ./../../../lib/android -flexDemoCUDA_release_lpaths += $(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/libs/armeabi-v7a +flexDemoCUDA_release_lpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/libs/armeabi-v7a flexDemoCUDA_release_lpaths += ./../../../external/regal_static/lib/armeabi-v7a flexDemoCUDA_release_lpaths += ./../../../lib/android flexDemoCUDA_release_defines := $(flexDemoCUDA_custom_defines) @@ -44,6 +47,8 @@ flexDemoCUDA_release_defines += ANDROID_PLAT=1 flexDemoCUDA_release_defines += DISABLE_IMPORTGL flexDemoCUDA_release_defines += NDEBUG flexDemoCUDA_release_libraries := +flexDemoCUDA_release_libraries += NvFlexReleaseCUDA_armv7l +flexDemoCUDA_release_libraries += flexDevice_x64 flexDemoCUDA_release_libraries += flexExt_cuda_release_armv7l flexDemoCUDA_release_libraries += android flexDemoCUDA_release_libraries += stdc++ @@ -62,14 +67,16 @@ flexDemoCUDA_release_common_cflags := $(flexDemoCUDA_custom_cflags) flexDemoCUDA_release_common_cflags += -MMD flexDemoCUDA_release_common_cflags += $(addprefix -D, $(flexDemoCUDA_release_defines)) flexDemoCUDA_release_common_cflags += $(addprefix -I, $(flexDemoCUDA_release_hpaths)) -flexDemoCUDA_release_common_cflags += -std=c++11 -fno-exceptions -fno-rtti -flexDemoCUDA_release_common_cflags += -fpic -fPIC -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -O2 -g -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 flexDemoCUDA_release_cflags := $(flexDemoCUDA_release_common_cflags) +flexDemoCUDA_release_cflags += -std=c++11 -fno-exceptions -fno-rtti +flexDemoCUDA_release_cflags += -fpic -fPIC -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -O2 -g -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 flexDemoCUDA_release_cppflags := $(flexDemoCUDA_release_common_cflags) +flexDemoCUDA_release_cppflags += -std=c++11 -fno-exceptions -fno-rtti +flexDemoCUDA_release_cppflags += -fpic -fPIC -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -O2 -g -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 flexDemoCUDA_release_lflags := $(flexDemoCUDA_custom_lflags) flexDemoCUDA_release_lflags += $(addprefix -L, $(flexDemoCUDA_release_lpaths)) flexDemoCUDA_release_lflags += -Wl,--start-group $(addprefix -l, $(flexDemoCUDA_release_libraries)) -Wl,--end-group -flexDemoCUDA_release_lflags += --sysroot="$(NDK_ROOT)"/"$(NDK_VERSION)"/platforms/android-15/arch-arm -shared -Wl,--no-undefined +flexDemoCUDA_release_lflags += --sysroot=/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm -shared -Wl,--no-undefined flexDemoCUDA_release_objsdir = $(OBJS_DIR)/flexDemoCUDA_release flexDemoCUDA_release_cpp_o = $(addprefix $(flexDemoCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexDemoCUDA_cppfiles))))) flexDemoCUDA_release_cc_o = $(addprefix $(flexDemoCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexDemoCUDA_ccfiles))))) @@ -91,7 +98,7 @@ antbuild_flexDemoCUDA_release: preantbuild_flexDemoCUDA_release mainbuild_flexDemoCUDA_release: prebuild_flexDemoCUDA_release $(flexDemoCUDA_release_bin) prebuild_flexDemoCUDA_release: -$(flexDemoCUDA_release_bin): $(flexDemoCUDA_release_obj) build_flexExtCUDA_release +$(flexDemoCUDA_release_bin): $(flexDemoCUDA_release_obj) build_flexCUDA_release build_flexDevice_release build_flexExtCUDA_release mkdir -p `dirname ./../android/flex_project/libs/armeabi-v7a/libflexDemo.so` $(CXX) -shared $(flexDemoCUDA_release_obj) $(flexDemoCUDA_release_lflags) -lc -o $@ $(ECHO) building $@ complete! diff --git a/demo/compiler/makeandroid/Makefile.flexExtCUDA.mk b/demo/compiler/makeandroid/Makefile.flexExtCUDA.mk index 8a33251..9e4826c 100644 --- a/demo/compiler/makeandroid/Makefile.flexExtCUDA.mk +++ b/demo/compiler/makeandroid/Makefile.flexExtCUDA.mk @@ -24,28 +24,32 @@ flexExtCUDA_debug_dep = $(flexExtCUDA_cpp_debug_dep) $(flexExtCUDA_cc_debug -include $(flexExtCUDA_debug_dep) flexExtCUDA_release_hpaths := flexExtCUDA_release_hpaths += ./../../.. -flexExtCUDA_release_hpaths += $(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include -flexExtCUDA_release_hpaths += $(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport -flexExtCUDA_release_hpaths += $(CUDA_PATH)/targets/armv7-linux-androideabi/include +flexExtCUDA_release_hpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include +flexExtCUDA_release_hpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport +flexExtCUDA_release_hpaths += ./../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include flexExtCUDA_release_lpaths := -flexExtCUDA_release_lpaths += $(CUDA_PATH)/targets/armv7-linux-androideabi/lib +flexExtCUDA_release_lpaths += ./../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/lib +flexExtCUDA_release_lpaths += ./../../../lib/android +flexExtCUDA_release_lpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/libs/armeabi-v7a flexExtCUDA_release_lpaths += ./../../../lib/android -flexExtCUDA_release_lpaths += $(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/libs/armeabi-v7a flexExtCUDA_release_defines := $(flexExtCUDA_custom_defines) flexExtCUDA_release_defines += android flexExtCUDA_release_defines += ANDROID=1 flexExtCUDA_release_defines += ANDROID_PLAT=1 flexExtCUDA_release_defines += DISABLE_IMPORTGL flexExtCUDA_release_libraries := +flexExtCUDA_release_libraries += NvFlexReleaseCUDA_armv7l flexExtCUDA_release_libraries += ./../../../lib/android/libNvFlexRelease_armv7l.a flexExtCUDA_release_common_cflags := $(flexExtCUDA_custom_cflags) flexExtCUDA_release_common_cflags += -MMD flexExtCUDA_release_common_cflags += $(addprefix -D, $(flexExtCUDA_release_defines)) flexExtCUDA_release_common_cflags += $(addprefix -I, $(flexExtCUDA_release_hpaths)) -flexExtCUDA_release_common_cflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions -flexExtCUDA_release_common_cflags += -O3 -ffast-math flexExtCUDA_release_cflags := $(flexExtCUDA_release_common_cflags) +flexExtCUDA_release_cflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions +flexExtCUDA_release_cflags += -O3 -ffast-math flexExtCUDA_release_cppflags := $(flexExtCUDA_release_common_cflags) +flexExtCUDA_release_cppflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions +flexExtCUDA_release_cppflags += -O3 -ffast-math flexExtCUDA_release_lflags := $(flexExtCUDA_custom_lflags) flexExtCUDA_release_lflags += $(addprefix -L, $(flexExtCUDA_release_lpaths)) flexExtCUDA_release_lflags += -Wl,--start-group $(addprefix -l, $(flexExtCUDA_release_libraries)) -Wl,--end-group @@ -68,15 +72,15 @@ postbuild_flexExtCUDA_release: mainbuild_flexExtCUDA_release mainbuild_flexExtCUDA_release: prebuild_flexExtCUDA_release $(flexExtCUDA_release_bin) prebuild_flexExtCUDA_release: -$(flexExtCUDA_release_bin): $(flexExtCUDA_release_obj) +$(flexExtCUDA_release_bin): $(flexExtCUDA_release_obj) build_flexCUDA_release mkdir -p `dirname ./../../../lib/android/libflexExt_cuda_release_armv7l.a` @$(AR) rcs $(flexExtCUDA_release_bin) $(flexExtCUDA_release_obj) $(ECHO) building $@ complete! $(flexExtCUDA_release_cuda_extensions_cuda_flexExt_cu_o): $(flexExtCUDA_cuda_extensions_cuda_flexExt_cu) @mkdir -p `dirname $(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o` - $(ECHO) "$(CUDA_PATH)/bin/nvcc" -ccbin $(NDK_ROOT)/$(NDK_VERSION)/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"$(CUDA_PATH)/targets/armv7-linux-androideabi/include" -I"../../.." -I"$(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport" -I"$(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include" --compile "./../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o" - "$(CUDA_PATH)/bin/nvcc" -ccbin $(NDK_ROOT)/$(NDK_VERSION)/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"$(CUDA_PATH)/targets/armv7-linux-androideabi/include" -I"../../.." -I"$(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport" -I"$(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include" --compile "./../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o" + $(ECHO) "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o" + "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o" flexExtCUDA_release_DEPDIR = $(dir $(@))/$(*F) $(flexExtCUDA_release_cpp_o): $(flexExtCUDA_release_objsdir)/%.o: @@ -111,28 +115,32 @@ $(flexExtCUDA_release_c_o): $(flexExtCUDA_release_objsdir)/%.o: flexExtCUDA_debug_hpaths := flexExtCUDA_debug_hpaths += ./../../.. -flexExtCUDA_debug_hpaths += $(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include -flexExtCUDA_debug_hpaths += $(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport -flexExtCUDA_debug_hpaths += $(CUDA_PATH)/targets/armv7-linux-androideabi/include +flexExtCUDA_debug_hpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include +flexExtCUDA_debug_hpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport +flexExtCUDA_debug_hpaths += ./../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include flexExtCUDA_debug_lpaths := -flexExtCUDA_debug_lpaths += $(CUDA_PATH)/targets/armv7-linux-androideabi/lib +flexExtCUDA_debug_lpaths += ./../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/lib +flexExtCUDA_debug_lpaths += ./../../../lib/android +flexExtCUDA_debug_lpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/libs/armeabi-v7a flexExtCUDA_debug_lpaths += ./../../../lib/android -flexExtCUDA_debug_lpaths += $(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/libs/armeabi-v7a flexExtCUDA_debug_defines := $(flexExtCUDA_custom_defines) flexExtCUDA_debug_defines += android flexExtCUDA_debug_defines += ANDROID=1 flexExtCUDA_debug_defines += ANDROID_PLAT=1 flexExtCUDA_debug_defines += DISABLE_IMPORTGL flexExtCUDA_debug_libraries := +flexExtCUDA_debug_libraries += NvFlexDebugCUDA_armv7l flexExtCUDA_debug_libraries += ./../../../lib/android/libNvFlexDebug_armv7l.a flexExtCUDA_debug_common_cflags := $(flexExtCUDA_custom_cflags) flexExtCUDA_debug_common_cflags += -MMD flexExtCUDA_debug_common_cflags += $(addprefix -D, $(flexExtCUDA_debug_defines)) flexExtCUDA_debug_common_cflags += $(addprefix -I, $(flexExtCUDA_debug_hpaths)) -flexExtCUDA_debug_common_cflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions -flexExtCUDA_debug_common_cflags += -g -O0 flexExtCUDA_debug_cflags := $(flexExtCUDA_debug_common_cflags) +flexExtCUDA_debug_cflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions +flexExtCUDA_debug_cflags += -g -O0 flexExtCUDA_debug_cppflags := $(flexExtCUDA_debug_common_cflags) +flexExtCUDA_debug_cppflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions +flexExtCUDA_debug_cppflags += -g -O0 flexExtCUDA_debug_lflags := $(flexExtCUDA_custom_lflags) flexExtCUDA_debug_lflags += $(addprefix -L, $(flexExtCUDA_debug_lpaths)) flexExtCUDA_debug_lflags += -Wl,--start-group $(addprefix -l, $(flexExtCUDA_debug_libraries)) -Wl,--end-group @@ -155,15 +163,15 @@ postbuild_flexExtCUDA_debug: mainbuild_flexExtCUDA_debug mainbuild_flexExtCUDA_debug: prebuild_flexExtCUDA_debug $(flexExtCUDA_debug_bin) prebuild_flexExtCUDA_debug: -$(flexExtCUDA_debug_bin): $(flexExtCUDA_debug_obj) +$(flexExtCUDA_debug_bin): $(flexExtCUDA_debug_obj) build_flexCUDA_debug mkdir -p `dirname ./../../../lib/android/libflexExt_cuda_debug_armv7l.a` @$(AR) rcs $(flexExtCUDA_debug_bin) $(flexExtCUDA_debug_obj) $(ECHO) building $@ complete! $(flexExtCUDA_debug_cuda_extensions_cuda_flexExt_cu_o): $(flexExtCUDA_cuda_extensions_cuda_flexExt_cu) @mkdir -p `dirname $(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o` - $(ECHO) "$(CUDA_PATH)/bin/nvcc" -ccbin $(NDK_ROOT)/$(NDK_VERSION)/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"$(CUDA_PATH)/targets/armv7-linux-androideabi/include" -I"../../.." -I"$(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport" -I"$(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include" --compile "./../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o" - "$(CUDA_PATH)/bin/nvcc" -ccbin $(NDK_ROOT)/$(NDK_VERSION)/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"$(CUDA_PATH)/targets/armv7-linux-androideabi/include" -I"../../.." -I"$(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport" -I"$(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include" --compile "./../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o" + $(ECHO) "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o" + "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o" flexExtCUDA_debug_DEPDIR = $(dir $(@))/$(*F) $(flexExtCUDA_debug_cpp_o): $(flexExtCUDA_debug_objsdir)/%.o: diff --git a/demo/compiler/makelinux64/Makefile.flexDemoCUDA.mk b/demo/compiler/makelinux64/Makefile.flexDemoCUDA.mk index 152205d..f37fc83 100644 --- a/demo/compiler/makelinux64/Makefile.flexDemoCUDA.mk +++ b/demo/compiler/makelinux64/Makefile.flexDemoCUDA.mk @@ -54,7 +54,7 @@ flexDemoCUDA_release_cppflags := $(flexDemoCUDA_release_common_cflags) flexDemoCUDA_release_lflags := $(flexDemoCUDA_custom_lflags) flexDemoCUDA_release_lflags += $(addprefix -L, $(flexDemoCUDA_release_lpaths)) flexDemoCUDA_release_lflags += -Wl,--start-group $(addprefix -l, $(flexDemoCUDA_release_libraries)) -Wl,--end-group -flexDemoCUDA_release_lflags += -g -L../../../external/glew/lib/linux -L/usr/lib -L"../../../lib/linux64" -L../../../external/SDL2-2.0.4/lib/x64/ -L$(CUDA_PATH)/lib64 -lGL -lglut -lGLU -lGLEW -lcudart_static -ldl +flexDemoCUDA_release_lflags += -g -L../../../external/glew/lib/linux -L/usr/lib -L"../../../lib/linux64" -L../../../external/SDL2-2.0.4/lib/x64/ -L$(CUDA_PATH)/lib64 -lGL -lglut -lGLU -lGLEW -lcudart_static -ldl -lrt -pthread flexDemoCUDA_release_lflags += -m64 flexDemoCUDA_release_objsdir = $(OBJS_DIR)/flexDemoCUDA_release flexDemoCUDA_release_cpp_o = $(addprefix $(flexDemoCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexDemoCUDA_cppfiles))))) @@ -136,7 +136,7 @@ flexDemoCUDA_debug_cppflags := $(flexDemoCUDA_debug_common_cflags) flexDemoCUDA_debug_lflags := $(flexDemoCUDA_custom_lflags) flexDemoCUDA_debug_lflags += $(addprefix -L, $(flexDemoCUDA_debug_lpaths)) flexDemoCUDA_debug_lflags += -Wl,--start-group $(addprefix -l, $(flexDemoCUDA_debug_libraries)) -Wl,--end-group -flexDemoCUDA_debug_lflags += -g -L../../../external/glew/lib/linux -L/usr/lib -L"../../../lib/linux64" -L../../../external/SDL2-2.0.4/lib/x64/ -L$(CUDA_PATH)/lib64 -lGL -lglut -lGLU -lGLEW -lcudart_static -ldl +flexDemoCUDA_debug_lflags += -g -L../../../external/glew/lib/linux -L/usr/lib -L"../../../lib/linux64" -L../../../external/SDL2-2.0.4/lib/x64/ -L$(CUDA_PATH)/lib64 -lGL -lglut -lGLU -lGLEW -lcudart_static -ldl -lrt -pthread flexDemoCUDA_debug_lflags += -m64 flexDemoCUDA_debug_objsdir = $(OBJS_DIR)/flexDemoCUDA_debug flexDemoCUDA_debug_cpp_o = $(addprefix $(flexDemoCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexDemoCUDA_cppfiles))))) diff --git a/demo/compiler/vc12win32/flexDemoCUDA.vcxproj b/demo/compiler/vc12win32/flexDemoCUDA.vcxproj index 5073547..aa6f0ae 100644 --- a/demo/compiler/vc12win32/flexDemoCUDA.vcxproj +++ b/demo/compiler/vc12win32/flexDemoCUDA.vcxproj @@ -55,7 +55,7 @@ <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win32/NvFlexDebugCUDA_x86.lib;./../../../lib/win32/NvFlexExtDebugCUDA_x86.lib;./../../../lib/win32/NvFlexDeviceDebug_x86.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win32/NvFlexDebugCUDA_x86.lib;./../../../lib/win32/NvFlexExtDebugCUDA_x86.lib;./../../../lib/win32/NvFlexDeviceDebug_x86.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoDebugCUDA_x86.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugCUDA_x86.exe.pdb</ProgramDatabaseFile> @@ -95,7 +95,7 @@ <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win32/NvFlexReleaseCUDA_x86.lib;./../../../lib/win32/NvFlexExtReleaseCUDA_x86.lib;./../../../lib/win32/NvFlexDeviceRelease_x86.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win32/NvFlexReleaseCUDA_x86.lib;./../../../lib/win32/NvFlexExtReleaseCUDA_x86.lib;./../../../lib/win32/NvFlexDeviceRelease_x86.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoReleaseCUDA_x86.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseCUDA_x86.exe.pdb</ProgramDatabaseFile> @@ -184,8 +184,6 @@ </ClInclude> <ClInclude Include="..\..\scenes\plasticbody.h"> </ClInclude> - <ClInclude Include="..\..\scenes\plasticstack.h"> - </ClInclude> <ClInclude Include="..\..\scenes\player.h"> </ClInclude> <ClInclude Include="..\..\scenes\potpourri.h"> @@ -206,6 +204,8 @@ </ClInclude> <ClInclude Include="..\..\scenes\sdfcollision.h"> </ClInclude> + <ClInclude Include="..\..\scenes\shapechannels.h"> + </ClInclude> <ClInclude Include="..\..\scenes\shapecollision.h"> </ClInclude> <ClInclude Include="..\..\scenes\softbody.h"> diff --git a/demo/compiler/vc12win32/flexDemoCUDA.vcxproj.filters b/demo/compiler/vc12win32/flexDemoCUDA.vcxproj.filters index 45f6d6c..e5989dc 100644 --- a/demo/compiler/vc12win32/flexDemoCUDA.vcxproj.filters +++ b/demo/compiler/vc12win32/flexDemoCUDA.vcxproj.filters @@ -111,9 +111,6 @@ <ClInclude Include="..\..\scenes\plasticbody.h">
<Filter>demo\scenes</Filter>
</ClInclude>
- <ClInclude Include="..\..\scenes\plasticstack.h">
- <Filter>demo\scenes</Filter>
- </ClInclude>
<ClInclude Include="..\..\scenes\player.h">
<Filter>demo\scenes</Filter>
</ClInclude>
@@ -144,6 +141,9 @@ <ClInclude Include="..\..\scenes\sdfcollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
+ <ClInclude Include="..\..\scenes\shapechannels.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
<ClInclude Include="..\..\scenes\shapecollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
diff --git a/demo/compiler/vc12win32/flexDemoD3D.vcxproj b/demo/compiler/vc12win32/flexDemoD3D.vcxproj index 4708dba..264f9d9 100644 --- a/demo/compiler/vc12win32/flexDemoD3D.vcxproj +++ b/demo/compiler/vc12win32/flexDemoD3D.vcxproj @@ -47,15 +47,15 @@ <FloatingPointModel>Precise</FloatingPointModel> <AdditionalOptions> /d2Zi+</AdditionalOptions> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;FLEX_DIRECT_COMPUTE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../d3d12;./../../../external/SDL2-2.0.4/include;./../../../external/D3D12/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;FLEX_DX12;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;FLEX_DIRECT_COMPUTE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WarningLevel>Level3</WarningLevel> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../lib/win32/NvFlexDebugD3D_x86.lib;./../../../lib/win32/NvFlexExtDebugD3D_x86.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;d3dcompiler.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib;./../../../external/D3D12/libs/x86/d3d12.lib;./../../../lib/win32/NvFlexDebugD3D_x86.lib;./../../../lib/win32/NvFlexExtDebugD3D_x86.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoDebugD3D_x86.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugD3D_x86.exe.pdb</ProgramDatabaseFile> @@ -86,15 +86,15 @@ <FloatingPointModel>Fast</FloatingPointModel> <AdditionalOptions> /d2Zi+</AdditionalOptions> <Optimization>Full</Optimization> - <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../d3d12;./../../../external/SDL2-2.0.4/include;./../../../external/D3D12/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;FLEX_DX12;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WarningLevel>Level3</WarningLevel> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../lib/win32/NvFlexReleaseD3D_x86.lib;./../../../lib/win32/NvFlexExtReleaseD3D_x86.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;d3dcompiler.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib;./../../../external/D3D12/libs/x86/d3d12.lib;./../../../lib/win32/NvFlexReleaseD3D_x86.lib;./../../../lib/win32/NvFlexExtReleaseD3D_x86.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoReleaseD3D_x86.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseD3D_x86.exe.pdb</ProgramDatabaseFile> @@ -183,8 +183,6 @@ </ClInclude> <ClInclude Include="..\..\scenes\plasticbody.h"> </ClInclude> - <ClInclude Include="..\..\scenes\plasticstack.h"> - </ClInclude> <ClInclude Include="..\..\scenes\player.h"> </ClInclude> <ClInclude Include="..\..\scenes\potpourri.h"> @@ -205,6 +203,8 @@ </ClInclude> <ClInclude Include="..\..\scenes\sdfcollision.h"> </ClInclude> + <ClInclude Include="..\..\scenes\shapechannels.h"> + </ClInclude> <ClInclude Include="..\..\scenes\shapecollision.h"> </ClInclude> <ClInclude Include="..\..\scenes\softbody.h"> @@ -325,56 +325,200 @@ </ClInclude> </ItemGroup> <ItemGroup> + <ClInclude Include="..\..\d3d12\appD3D12Ctx.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\bufferD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\demoContextD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\diffusePointRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\imguiGraphD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\lineRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshRendererD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12CircularResourceHeap.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12CounterFence.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12DescriptorHeap.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12Handle.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12HelperUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12RenderTarget.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12Resource.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12ResourceScopeManager.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDxDebugUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDxFormatUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoFreeList.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvResult.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\pipelineUtilD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\pointRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\renderStateD3D12.h"> + </ClInclude> + <ClCompile Include="..\..\d3d12\appD3D12Ctx.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\bufferD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\demoContextD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\diffusePointRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\imguiGraphD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\imguiInteropD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\lineRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshRendererD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12CircularResourceHeap.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12CounterFence.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12DescriptorHeap.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12HelperUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12RenderTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12Resource.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12ResourceScopeManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDxDebugUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDxFormatUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoFreeList.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\pipelineUtilD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\pointRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\renderStateD3D12.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> <ClInclude Include="..\..\d3d11\appD3D11Ctx.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\debugLineRender.h"> + <ClInclude Include="..\..\d3d11\debugLineRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\diffuseRender.h"> + <ClInclude Include="..\..\d3d11\demoContextD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\fluidRender.h"> + <ClInclude Include="..\..\d3d11\diffuseRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\imguiGraph.h"> + <ClInclude Include="..\..\d3d11\fluidRenderD3D11.h"> </ClInclude> <ClInclude Include="..\..\d3d11\imguiGraphD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\meshRender.h"> + <ClInclude Include="..\..\d3d11\meshRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\pointRender.h"> + <ClInclude Include="..\..\d3d11\pointRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\renderTarget.h"> + <ClInclude Include="..\..\d3d11\renderTargetD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\shadowMap.h"> + <ClInclude Include="..\..\d3d11\shadowMapD3D11.h"> </ClInclude> <ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\diffuseRender.cpp"> + <ClCompile Include="..\..\d3d11\debugLineRenderD3D11.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\fluidRender.cpp"> + <ClCompile Include="..\..\d3d11\demoContextD3D11.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\imguiGraph.cpp"> + <ClCompile Include="..\..\d3d11\diffuseRenderD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\fluidRenderD3D11.cpp"> </ClCompile> <ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\meshRender.cpp"> + <ClCompile Include="..\..\d3d11\imguiInteropD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\meshRenderD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\pointRenderD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\renderTargetD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\shadowMapD3D11.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\d3d\appGraphCtx.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\demoContext.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\imguiGraph.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\loader.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\loaderMacros.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\renderParamsD3D.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\shaderCommonD3D.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\shadersDemoContext.h"> + </ClInclude> + <ClCompile Include="..\..\d3d\appGraphCtxLoader.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\pointRender.cpp"> + <ClCompile Include="..\..\d3d\imguiGraph.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\renderTarget.cpp"> + <ClCompile Include="..\..\d3d\imguiGraphLoader.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\shadersD3D11.cpp"> + <ClCompile Include="..\..\d3d\loader.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\shadowMap.cpp"> + <ClCompile Include="..\..\d3d\renderParamsD3D.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d\shadersDemoContext.cpp"> </ClCompile> </ItemGroup> <ItemGroup> - <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/debugLineVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">debugLineVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -382,17 +526,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">debugLineVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl"> + <FxCompile Include="./../../d3d/shaders/debugLinePS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">debugLinePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -400,17 +544,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">debugLinePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/imguiPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">imguiPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -418,17 +562,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">imguiPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/imguiVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">imguiVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -436,17 +580,35 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">imguiVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> + </FxCompile> + <FxCompile Include="./../../d3d/shaders/meshPS.hlsl"> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/meshAsyncComputeBenchPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -454,17 +616,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/meshShadowPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshPS_Shadow</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -472,17 +634,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshPS_Shadow</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/meshVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -490,17 +652,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/pointVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -508,17 +670,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl"> + <FxCompile Include="./../../d3d/shaders/pointGS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -526,17 +688,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/pointPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -544,17 +706,35 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> + </FxCompile> + <FxCompile Include="./../../d3d/shaders/pointShadowPS.hlsl"> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointShadowPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointShadowPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/diffuseVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">diffuseVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -562,17 +742,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">diffuseVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl"> + <FxCompile Include="./../../d3d/shaders/diffuseGS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">diffuseGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -580,17 +760,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">diffuseGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl"> + <FxCompile Include="./../../d3d/shaders/diffusePS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">diffusePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -598,17 +778,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">diffusePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/ellipsoidDepthVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">ellipsoidDepthVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -616,17 +796,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">ellipsoidDepthVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl"> + <FxCompile Include="./../../d3d/shaders/ellipsoidDepthGS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">ellipsoidDepthGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -634,17 +814,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">ellipsoidDepthGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/ellipsoidDepthPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">ellipsoidDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -652,17 +832,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">ellipsoidDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/passThroughVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">passThroughVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -670,17 +850,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">passThroughVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/blurDepthPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">blurDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -688,17 +868,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">blurDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl"> + <FxCompile Include="./../../d3d/shaders/compositePS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">compositePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -706,7 +886,7 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">compositePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> </ItemGroup> diff --git a/demo/compiler/vc12win32/flexDemoD3D.vcxproj.filters b/demo/compiler/vc12win32/flexDemoD3D.vcxproj.filters index 15615f5..b7f0548 100644 --- a/demo/compiler/vc12win32/flexDemoD3D.vcxproj.filters +++ b/demo/compiler/vc12win32/flexDemoD3D.vcxproj.filters @@ -111,9 +111,6 @@ <ClInclude Include="..\..\scenes\plasticbody.h">
<Filter>demo\scenes</Filter>
</ClInclude>
- <ClInclude Include="..\..\scenes\plasticstack.h">
- <Filter>demo\scenes</Filter>
- </ClInclude>
<ClInclude Include="..\..\scenes\player.h">
<Filter>demo\scenes</Filter>
</ClInclude>
@@ -144,6 +141,9 @@ <ClInclude Include="..\..\scenes\sdfcollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
+ <ClInclude Include="..\..\scenes\shapechannels.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
<ClInclude Include="..\..\scenes\shapecollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
@@ -328,6 +328,177 @@ </ClInclude>
</ItemGroup>
<ItemGroup>
+ <Filter Include="d3d12">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d12\appD3D12Ctx.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\bufferD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\demoContextD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\diffusePointRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\imguiGraphD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\lineRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshRenderer.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshRendererD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12CircularResourceHeap.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12CounterFence.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12DescriptorHeap.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12Handle.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12HelperUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12RenderTarget.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12Resource.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12ResourceScopeManager.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDxDebugUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDxFormatUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoFreeList.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvResult.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\pipelineUtilD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\pointRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\renderStateD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\d3d12\appD3D12Ctx.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\bufferD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\demoContextD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\diffusePointRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\imguiGraphD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\imguiInteropD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\lineRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshRenderer.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshRendererD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12CircularResourceHeap.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12CounterFence.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12DescriptorHeap.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12HelperUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12RenderTarget.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12Resource.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12ResourceScopeManager.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDxDebugUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDxFormatUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoFreeList.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\pipelineUtilD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\pointRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\renderStateD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
<Filter Include="d3d11">
</Filter>
</ItemGroup>
@@ -335,121 +506,178 @@ <ClInclude Include="..\..\d3d11\appD3D11Ctx.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\debugLineRender.h">
+ <ClInclude Include="..\..\d3d11\debugLineRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\diffuseRender.h">
+ <ClInclude Include="..\..\d3d11\demoContextD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\fluidRender.h">
+ <ClInclude Include="..\..\d3d11\diffuseRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\imguiGraph.h">
+ <ClInclude Include="..\..\d3d11\fluidRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
<ClInclude Include="..\..\d3d11\imguiGraphD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\meshRender.h">
+ <ClInclude Include="..\..\d3d11\meshRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\pointRender.h">
+ <ClInclude Include="..\..\d3d11\pointRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\renderTarget.h">
+ <ClInclude Include="..\..\d3d11\renderTargetD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\shadowMap.h">
+ <ClInclude Include="..\..\d3d11\shadowMapD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
<ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\diffuseRender.cpp">
+ <ClCompile Include="..\..\d3d11\debugLineRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\fluidRender.cpp">
+ <ClCompile Include="..\..\d3d11\demoContextD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\imguiGraph.cpp">
+ <ClCompile Include="..\..\d3d11\diffuseRenderD3D11.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\fluidRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
<ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\meshRender.cpp">
+ <ClCompile Include="..\..\d3d11\imguiInteropD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\pointRender.cpp">
+ <ClCompile Include="..\..\d3d11\meshRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\renderTarget.cpp">
+ <ClCompile Include="..\..\d3d11\pointRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\shadersD3D11.cpp">
+ <ClCompile Include="..\..\d3d11\renderTargetD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\shadowMap.cpp">
+ <ClCompile Include="..\..\d3d11\shadowMapD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
</ItemGroup>
+ <ItemGroup>
+ <Filter Include="d3d">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d\appGraphCtx.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\demoContext.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\imguiGraph.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\loader.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\loaderMacros.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\renderParamsD3D.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\shaderCommonD3D.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\shadersDemoContext.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\d3d\appGraphCtxLoader.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\imguiGraph.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\imguiGraphLoader.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\loader.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\renderParamsD3D.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\shadersDemoContext.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ </ItemGroup>
<ItemGroup><Filter Include="Shader Files"></Filter></ItemGroup>
<ItemGroup>
- <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/debugLineVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d/shaders/debugLinePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d/shaders/imguiPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/imguiVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshAsyncComputeBenchPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshShadowPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointGS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointShadowPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/diffuseVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/diffuseGS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/diffusePS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/ellipsoidDepthVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/ellipsoidDepthGS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/ellipsoidDepthPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/passThroughVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/blurDepthPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/compositePS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
</ItemGroup>
diff --git a/demo/compiler/vc12win64/flexDemoCUDA.vcxproj b/demo/compiler/vc12win64/flexDemoCUDA.vcxproj index d00d61c..e37c7e7 100644 --- a/demo/compiler/vc12win64/flexDemoCUDA.vcxproj +++ b/demo/compiler/vc12win64/flexDemoCUDA.vcxproj @@ -55,7 +55,7 @@ <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win64/NvFlexDebugCUDA_x64.lib;./../../../lib/win64/NvFlexExtDebugCUDA_x64.lib;./../../../lib/win64/NvFlexDeviceDebug_x64.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win64/NvFlexDebugCUDA_x64.lib;./../../../lib/win64/NvFlexExtDebugCUDA_x64.lib;./../../../lib/win64/NvFlexDeviceDebug_x64.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/NvToolsExt/lib/x64/nvToolsExt64_1.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoDebugCUDA_x64.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugCUDA_x64.exe.pdb</ProgramDatabaseFile> @@ -95,7 +95,7 @@ <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win64/NvFlexReleaseCUDA_x64.lib;./../../../lib/win64/NvFlexExtReleaseCUDA_x64.lib;./../../../lib/win64/NvFlexDeviceRelease_x64.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win64/NvFlexReleaseCUDA_x64.lib;./../../../lib/win64/NvFlexExtReleaseCUDA_x64.lib;./../../../lib/win64/NvFlexDeviceRelease_x64.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/NvToolsExt/lib/x64/nvToolsExt64_1.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoReleaseCUDA_x64.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseCUDA_x64.exe.pdb</ProgramDatabaseFile> @@ -184,8 +184,6 @@ </ClInclude> <ClInclude Include="..\..\scenes\plasticbody.h"> </ClInclude> - <ClInclude Include="..\..\scenes\plasticstack.h"> - </ClInclude> <ClInclude Include="..\..\scenes\player.h"> </ClInclude> <ClInclude Include="..\..\scenes\potpourri.h"> @@ -206,6 +204,8 @@ </ClInclude> <ClInclude Include="..\..\scenes\sdfcollision.h"> </ClInclude> + <ClInclude Include="..\..\scenes\shapechannels.h"> + </ClInclude> <ClInclude Include="..\..\scenes\shapecollision.h"> </ClInclude> <ClInclude Include="..\..\scenes\softbody.h"> diff --git a/demo/compiler/vc12win64/flexDemoCUDA.vcxproj.filters b/demo/compiler/vc12win64/flexDemoCUDA.vcxproj.filters index 45f6d6c..e5989dc 100644 --- a/demo/compiler/vc12win64/flexDemoCUDA.vcxproj.filters +++ b/demo/compiler/vc12win64/flexDemoCUDA.vcxproj.filters @@ -111,9 +111,6 @@ <ClInclude Include="..\..\scenes\plasticbody.h">
<Filter>demo\scenes</Filter>
</ClInclude>
- <ClInclude Include="..\..\scenes\plasticstack.h">
- <Filter>demo\scenes</Filter>
- </ClInclude>
<ClInclude Include="..\..\scenes\player.h">
<Filter>demo\scenes</Filter>
</ClInclude>
@@ -144,6 +141,9 @@ <ClInclude Include="..\..\scenes\sdfcollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
+ <ClInclude Include="..\..\scenes\shapechannels.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
<ClInclude Include="..\..\scenes\shapecollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
diff --git a/demo/compiler/vc12win64/flexDemoD3D.vcxproj b/demo/compiler/vc12win64/flexDemoD3D.vcxproj index 50513db..d30d642 100644 --- a/demo/compiler/vc12win64/flexDemoD3D.vcxproj +++ b/demo/compiler/vc12win64/flexDemoD3D.vcxproj @@ -47,15 +47,15 @@ <FloatingPointModel>Precise</FloatingPointModel> <AdditionalOptions> /d2Zi+</AdditionalOptions> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../d3d12;./../../../external/SDL2-2.0.4/include;./../../../external/D3D12/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;FLEX_DX12;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WarningLevel>Level3</WarningLevel> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../lib/win64/NvFlexDebugD3D_x64.lib;./../../../lib/win64/NvFlexExtDebugD3D_x64.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;d3dcompiler.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/NvToolsExt/lib/x64/nvToolsExt64_1.lib;./../../../external/D3D12/libs/x64/d3d12.lib;./../../../lib/win64/NvFlexDebugD3D_x64.lib;./../../../lib/win64/NvFlexExtDebugD3D_x64.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoDebugD3D_x64.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugD3D_x64.exe.pdb</ProgramDatabaseFile> @@ -86,15 +86,15 @@ <FloatingPointModel>Fast</FloatingPointModel> <AdditionalOptions> /d2Zi+</AdditionalOptions> <Optimization>Full</Optimization> - <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../d3d12;./../../../external/SDL2-2.0.4/include;./../../../external/D3D12/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;FLEX_DX12;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WarningLevel>Level3</WarningLevel> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../lib/win64/NvFlexReleaseD3D_x64.lib;./../../../lib/win64/NvFlexExtReleaseD3D_x64.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;d3dcompiler.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/NvToolsExt/lib/x64/nvToolsExt64_1.lib;./../../../external/D3D12/libs/x64/d3d12.lib;./../../../lib/win64/NvFlexReleaseD3D_x64.lib;./../../../lib/win64/NvFlexExtReleaseD3D_x64.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoReleaseD3D_x64.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseD3D_x64.exe.pdb</ProgramDatabaseFile> @@ -183,8 +183,6 @@ </ClInclude> <ClInclude Include="..\..\scenes\plasticbody.h"> </ClInclude> - <ClInclude Include="..\..\scenes\plasticstack.h"> - </ClInclude> <ClInclude Include="..\..\scenes\player.h"> </ClInclude> <ClInclude Include="..\..\scenes\potpourri.h"> @@ -205,6 +203,8 @@ </ClInclude> <ClInclude Include="..\..\scenes\sdfcollision.h"> </ClInclude> + <ClInclude Include="..\..\scenes\shapechannels.h"> + </ClInclude> <ClInclude Include="..\..\scenes\shapecollision.h"> </ClInclude> <ClInclude Include="..\..\scenes\softbody.h"> @@ -325,56 +325,200 @@ </ClInclude> </ItemGroup> <ItemGroup> + <ClInclude Include="..\..\d3d12\appD3D12Ctx.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\bufferD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\demoContextD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\diffusePointRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\imguiGraphD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\lineRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshRendererD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12CircularResourceHeap.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12CounterFence.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12DescriptorHeap.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12Handle.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12HelperUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12RenderTarget.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12Resource.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12ResourceScopeManager.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDxDebugUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDxFormatUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoFreeList.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvResult.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\pipelineUtilD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\pointRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\renderStateD3D12.h"> + </ClInclude> + <ClCompile Include="..\..\d3d12\appD3D12Ctx.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\bufferD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\demoContextD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\diffusePointRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\imguiGraphD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\imguiInteropD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\lineRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshRendererD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12CircularResourceHeap.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12CounterFence.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12DescriptorHeap.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12HelperUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12RenderTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12Resource.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12ResourceScopeManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDxDebugUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDxFormatUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoFreeList.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\pipelineUtilD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\pointRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\renderStateD3D12.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> <ClInclude Include="..\..\d3d11\appD3D11Ctx.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\debugLineRender.h"> + <ClInclude Include="..\..\d3d11\debugLineRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\diffuseRender.h"> + <ClInclude Include="..\..\d3d11\demoContextD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\fluidRender.h"> + <ClInclude Include="..\..\d3d11\diffuseRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\imguiGraph.h"> + <ClInclude Include="..\..\d3d11\fluidRenderD3D11.h"> </ClInclude> <ClInclude Include="..\..\d3d11\imguiGraphD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\meshRender.h"> + <ClInclude Include="..\..\d3d11\meshRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\pointRender.h"> + <ClInclude Include="..\..\d3d11\pointRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\renderTarget.h"> + <ClInclude Include="..\..\d3d11\renderTargetD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\shadowMap.h"> + <ClInclude Include="..\..\d3d11\shadowMapD3D11.h"> </ClInclude> <ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\diffuseRender.cpp"> + <ClCompile Include="..\..\d3d11\debugLineRenderD3D11.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\fluidRender.cpp"> + <ClCompile Include="..\..\d3d11\demoContextD3D11.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\imguiGraph.cpp"> + <ClCompile Include="..\..\d3d11\diffuseRenderD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\fluidRenderD3D11.cpp"> </ClCompile> <ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\meshRender.cpp"> + <ClCompile Include="..\..\d3d11\imguiInteropD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\meshRenderD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\pointRenderD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\renderTargetD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\shadowMapD3D11.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\d3d\appGraphCtx.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\demoContext.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\imguiGraph.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\loader.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\loaderMacros.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\renderParamsD3D.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\shaderCommonD3D.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\shadersDemoContext.h"> + </ClInclude> + <ClCompile Include="..\..\d3d\appGraphCtxLoader.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\pointRender.cpp"> + <ClCompile Include="..\..\d3d\imguiGraph.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\renderTarget.cpp"> + <ClCompile Include="..\..\d3d\imguiGraphLoader.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\shadersD3D11.cpp"> + <ClCompile Include="..\..\d3d\loader.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\shadowMap.cpp"> + <ClCompile Include="..\..\d3d\renderParamsD3D.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d\shadersDemoContext.cpp"> </ClCompile> </ItemGroup> <ItemGroup> - <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/debugLineVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">debugLineVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -382,17 +526,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">debugLineVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl"> + <FxCompile Include="./../../d3d/shaders/debugLinePS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">debugLinePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -400,17 +544,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">debugLinePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/imguiPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">imguiPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -418,17 +562,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">imguiPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/imguiVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">imguiVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -436,17 +580,35 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">imguiVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> + </FxCompile> + <FxCompile Include="./../../d3d/shaders/meshPS.hlsl"> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/meshAsyncComputeBenchPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -454,17 +616,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/meshShadowPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshPS_Shadow</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -472,17 +634,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshPS_Shadow</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/meshVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -490,17 +652,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/pointVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -508,17 +670,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl"> + <FxCompile Include="./../../d3d/shaders/pointGS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -526,17 +688,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/pointPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -544,17 +706,35 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> + </FxCompile> + <FxCompile Include="./../../d3d/shaders/pointShadowPS.hlsl"> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointShadowPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointShadowPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/diffuseVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">diffuseVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -562,17 +742,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">diffuseVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl"> + <FxCompile Include="./../../d3d/shaders/diffuseGS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">diffuseGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -580,17 +760,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">diffuseGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl"> + <FxCompile Include="./../../d3d/shaders/diffusePS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">diffusePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -598,17 +778,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">diffusePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/ellipsoidDepthVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">ellipsoidDepthVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -616,17 +796,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">ellipsoidDepthVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl"> + <FxCompile Include="./../../d3d/shaders/ellipsoidDepthGS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">ellipsoidDepthGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -634,17 +814,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">ellipsoidDepthGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/ellipsoidDepthPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">ellipsoidDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -652,17 +832,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">ellipsoidDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/passThroughVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">passThroughVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -670,17 +850,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">passThroughVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/blurDepthPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">blurDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -688,17 +868,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">blurDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl"> + <FxCompile Include="./../../d3d/shaders/compositePS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">compositePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -706,7 +886,7 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">compositePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> </ItemGroup> diff --git a/demo/compiler/vc12win64/flexDemoD3D.vcxproj.filters b/demo/compiler/vc12win64/flexDemoD3D.vcxproj.filters index 15615f5..b7f0548 100644 --- a/demo/compiler/vc12win64/flexDemoD3D.vcxproj.filters +++ b/demo/compiler/vc12win64/flexDemoD3D.vcxproj.filters @@ -111,9 +111,6 @@ <ClInclude Include="..\..\scenes\plasticbody.h">
<Filter>demo\scenes</Filter>
</ClInclude>
- <ClInclude Include="..\..\scenes\plasticstack.h">
- <Filter>demo\scenes</Filter>
- </ClInclude>
<ClInclude Include="..\..\scenes\player.h">
<Filter>demo\scenes</Filter>
</ClInclude>
@@ -144,6 +141,9 @@ <ClInclude Include="..\..\scenes\sdfcollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
+ <ClInclude Include="..\..\scenes\shapechannels.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
<ClInclude Include="..\..\scenes\shapecollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
@@ -328,6 +328,177 @@ </ClInclude>
</ItemGroup>
<ItemGroup>
+ <Filter Include="d3d12">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d12\appD3D12Ctx.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\bufferD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\demoContextD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\diffusePointRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\imguiGraphD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\lineRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshRenderer.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshRendererD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12CircularResourceHeap.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12CounterFence.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12DescriptorHeap.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12Handle.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12HelperUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12RenderTarget.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12Resource.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12ResourceScopeManager.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDxDebugUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDxFormatUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoFreeList.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvResult.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\pipelineUtilD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\pointRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\renderStateD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\d3d12\appD3D12Ctx.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\bufferD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\demoContextD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\diffusePointRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\imguiGraphD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\imguiInteropD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\lineRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshRenderer.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshRendererD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12CircularResourceHeap.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12CounterFence.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12DescriptorHeap.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12HelperUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12RenderTarget.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12Resource.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12ResourceScopeManager.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDxDebugUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDxFormatUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoFreeList.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\pipelineUtilD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\pointRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\renderStateD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
<Filter Include="d3d11">
</Filter>
</ItemGroup>
@@ -335,121 +506,178 @@ <ClInclude Include="..\..\d3d11\appD3D11Ctx.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\debugLineRender.h">
+ <ClInclude Include="..\..\d3d11\debugLineRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\diffuseRender.h">
+ <ClInclude Include="..\..\d3d11\demoContextD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\fluidRender.h">
+ <ClInclude Include="..\..\d3d11\diffuseRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\imguiGraph.h">
+ <ClInclude Include="..\..\d3d11\fluidRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
<ClInclude Include="..\..\d3d11\imguiGraphD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\meshRender.h">
+ <ClInclude Include="..\..\d3d11\meshRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\pointRender.h">
+ <ClInclude Include="..\..\d3d11\pointRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\renderTarget.h">
+ <ClInclude Include="..\..\d3d11\renderTargetD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\shadowMap.h">
+ <ClInclude Include="..\..\d3d11\shadowMapD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
<ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\diffuseRender.cpp">
+ <ClCompile Include="..\..\d3d11\debugLineRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\fluidRender.cpp">
+ <ClCompile Include="..\..\d3d11\demoContextD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\imguiGraph.cpp">
+ <ClCompile Include="..\..\d3d11\diffuseRenderD3D11.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\fluidRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
<ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\meshRender.cpp">
+ <ClCompile Include="..\..\d3d11\imguiInteropD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\pointRender.cpp">
+ <ClCompile Include="..\..\d3d11\meshRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\renderTarget.cpp">
+ <ClCompile Include="..\..\d3d11\pointRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\shadersD3D11.cpp">
+ <ClCompile Include="..\..\d3d11\renderTargetD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\shadowMap.cpp">
+ <ClCompile Include="..\..\d3d11\shadowMapD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
</ItemGroup>
+ <ItemGroup>
+ <Filter Include="d3d">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d\appGraphCtx.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\demoContext.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\imguiGraph.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\loader.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\loaderMacros.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\renderParamsD3D.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\shaderCommonD3D.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\shadersDemoContext.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\d3d\appGraphCtxLoader.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\imguiGraph.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\imguiGraphLoader.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\loader.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\renderParamsD3D.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\shadersDemoContext.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ </ItemGroup>
<ItemGroup><Filter Include="Shader Files"></Filter></ItemGroup>
<ItemGroup>
- <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/debugLineVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d/shaders/debugLinePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d/shaders/imguiPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/imguiVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshAsyncComputeBenchPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshShadowPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointGS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointShadowPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/diffuseVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/diffuseGS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/diffusePS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/ellipsoidDepthVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/ellipsoidDepthGS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/ellipsoidDepthPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/passThroughVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/blurDepthPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/compositePS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
</ItemGroup>
diff --git a/demo/compiler/vc14win32/flexDemoCUDA.vcxproj b/demo/compiler/vc14win32/flexDemoCUDA.vcxproj index d9aca99..984c2e4 100644 --- a/demo/compiler/vc14win32/flexDemoCUDA.vcxproj +++ b/demo/compiler/vc14win32/flexDemoCUDA.vcxproj @@ -55,7 +55,7 @@ <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win32/NvFlexDebugCUDA_x86.lib;./../../../lib/win32/NvFlexExtDebugCUDA_x86.lib;./../../../lib/win32/NvFlexDeviceDebug_x86.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win32/NvFlexDebugCUDA_x86.lib;./../../../lib/win32/NvFlexExtDebugCUDA_x86.lib;./../../../lib/win32/NvFlexDeviceDebug_x86.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoDebugCUDA_x86.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugCUDA_x86.exe.pdb</ProgramDatabaseFile> @@ -95,7 +95,7 @@ <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win32/NvFlexReleaseCUDA_x86.lib;./../../../lib/win32/NvFlexExtReleaseCUDA_x86.lib;./../../../lib/win32/NvFlexDeviceRelease_x86.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win32/NvFlexReleaseCUDA_x86.lib;./../../../lib/win32/NvFlexExtReleaseCUDA_x86.lib;./../../../lib/win32/NvFlexDeviceRelease_x86.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoReleaseCUDA_x86.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseCUDA_x86.exe.pdb</ProgramDatabaseFile> @@ -184,8 +184,6 @@ </ClInclude> <ClInclude Include="..\..\scenes\plasticbody.h"> </ClInclude> - <ClInclude Include="..\..\scenes\plasticstack.h"> - </ClInclude> <ClInclude Include="..\..\scenes\player.h"> </ClInclude> <ClInclude Include="..\..\scenes\potpourri.h"> @@ -206,6 +204,8 @@ </ClInclude> <ClInclude Include="..\..\scenes\sdfcollision.h"> </ClInclude> + <ClInclude Include="..\..\scenes\shapechannels.h"> + </ClInclude> <ClInclude Include="..\..\scenes\shapecollision.h"> </ClInclude> <ClInclude Include="..\..\scenes\softbody.h"> diff --git a/demo/compiler/vc14win32/flexDemoCUDA.vcxproj.filters b/demo/compiler/vc14win32/flexDemoCUDA.vcxproj.filters index 45f6d6c..e5989dc 100644 --- a/demo/compiler/vc14win32/flexDemoCUDA.vcxproj.filters +++ b/demo/compiler/vc14win32/flexDemoCUDA.vcxproj.filters @@ -111,9 +111,6 @@ <ClInclude Include="..\..\scenes\plasticbody.h">
<Filter>demo\scenes</Filter>
</ClInclude>
- <ClInclude Include="..\..\scenes\plasticstack.h">
- <Filter>demo\scenes</Filter>
- </ClInclude>
<ClInclude Include="..\..\scenes\player.h">
<Filter>demo\scenes</Filter>
</ClInclude>
@@ -144,6 +141,9 @@ <ClInclude Include="..\..\scenes\sdfcollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
+ <ClInclude Include="..\..\scenes\shapechannels.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
<ClInclude Include="..\..\scenes\shapecollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
diff --git a/demo/compiler/vc14win32/flexDemoD3D.vcxproj b/demo/compiler/vc14win32/flexDemoD3D.vcxproj index 6744073..a926666 100644 --- a/demo/compiler/vc14win32/flexDemoD3D.vcxproj +++ b/demo/compiler/vc14win32/flexDemoD3D.vcxproj @@ -13,6 +13,7 @@ <PropertyGroup Label="Globals"> <ProjectGuid>{EF4EDDD8-2620-47AA-E75D-4C682C276C02}</ProjectGuid> <RootNamespace>flexDemoD3D</RootNamespace> + <WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration"> @@ -47,15 +48,15 @@ <FloatingPointModel>Precise</FloatingPointModel> <AdditionalOptions> /d2Zi+</AdditionalOptions> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;FLEX_DIRECT_COMPUTE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../d3d12;./../../../external/SDL2-2.0.4/include;./../../../external/D3D12/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;FLEX_DX12;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;FLEX_DIRECT_COMPUTE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WarningLevel>Level3</WarningLevel> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../lib/win32/NvFlexDebugD3D_x86.lib;./../../../lib/win32/NvFlexExtDebugD3D_x86.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;d3dcompiler.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib;./../../../external/D3D12/libs/x86/d3d12.lib;./../../../lib/win32/NvFlexDebugD3D_x86.lib;./../../../lib/win32/NvFlexExtDebugD3D_x86.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoDebugD3D_x86.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugD3D_x86.exe.pdb</ProgramDatabaseFile> @@ -86,15 +87,15 @@ <FloatingPointModel>Fast</FloatingPointModel> <AdditionalOptions> /d2Zi+</AdditionalOptions> <Optimization>Full</Optimization> - <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../d3d12;./../../../external/SDL2-2.0.4/include;./../../../external/D3D12/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;FLEX_DX12;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WarningLevel>Level3</WarningLevel> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../lib/win32/NvFlexReleaseD3D_x86.lib;./../../../lib/win32/NvFlexExtReleaseD3D_x86.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;d3dcompiler.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib;./../../../external/D3D12/libs/x86/d3d12.lib;./../../../lib/win32/NvFlexReleaseD3D_x86.lib;./../../../lib/win32/NvFlexExtReleaseD3D_x86.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoReleaseD3D_x86.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseD3D_x86.exe.pdb</ProgramDatabaseFile> @@ -183,8 +184,6 @@ </ClInclude> <ClInclude Include="..\..\scenes\plasticbody.h"> </ClInclude> - <ClInclude Include="..\..\scenes\plasticstack.h"> - </ClInclude> <ClInclude Include="..\..\scenes\player.h"> </ClInclude> <ClInclude Include="..\..\scenes\potpourri.h"> @@ -205,6 +204,8 @@ </ClInclude> <ClInclude Include="..\..\scenes\sdfcollision.h"> </ClInclude> + <ClInclude Include="..\..\scenes\shapechannels.h"> + </ClInclude> <ClInclude Include="..\..\scenes\shapecollision.h"> </ClInclude> <ClInclude Include="..\..\scenes\softbody.h"> @@ -325,56 +326,200 @@ </ClInclude> </ItemGroup> <ItemGroup> + <ClInclude Include="..\..\d3d12\appD3D12Ctx.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\bufferD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\demoContextD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\diffusePointRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\imguiGraphD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\lineRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshRendererD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12CircularResourceHeap.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12CounterFence.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12DescriptorHeap.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12Handle.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12HelperUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12RenderTarget.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12Resource.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12ResourceScopeManager.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDxDebugUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDxFormatUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoFreeList.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvResult.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\pipelineUtilD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\pointRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\renderStateD3D12.h"> + </ClInclude> + <ClCompile Include="..\..\d3d12\appD3D12Ctx.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\bufferD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\demoContextD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\diffusePointRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\imguiGraphD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\imguiInteropD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\lineRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshRendererD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12CircularResourceHeap.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12CounterFence.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12DescriptorHeap.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12HelperUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12RenderTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12Resource.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12ResourceScopeManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDxDebugUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDxFormatUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoFreeList.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\pipelineUtilD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\pointRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\renderStateD3D12.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> <ClInclude Include="..\..\d3d11\appD3D11Ctx.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\debugLineRender.h"> + <ClInclude Include="..\..\d3d11\debugLineRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\diffuseRender.h"> + <ClInclude Include="..\..\d3d11\demoContextD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\fluidRender.h"> + <ClInclude Include="..\..\d3d11\diffuseRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\imguiGraph.h"> + <ClInclude Include="..\..\d3d11\fluidRenderD3D11.h"> </ClInclude> <ClInclude Include="..\..\d3d11\imguiGraphD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\meshRender.h"> + <ClInclude Include="..\..\d3d11\meshRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\pointRender.h"> + <ClInclude Include="..\..\d3d11\pointRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\renderTarget.h"> + <ClInclude Include="..\..\d3d11\renderTargetD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\shadowMap.h"> + <ClInclude Include="..\..\d3d11\shadowMapD3D11.h"> </ClInclude> <ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\diffuseRender.cpp"> + <ClCompile Include="..\..\d3d11\debugLineRenderD3D11.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\fluidRender.cpp"> + <ClCompile Include="..\..\d3d11\demoContextD3D11.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\imguiGraph.cpp"> + <ClCompile Include="..\..\d3d11\diffuseRenderD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\fluidRenderD3D11.cpp"> </ClCompile> <ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\meshRender.cpp"> + <ClCompile Include="..\..\d3d11\imguiInteropD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\meshRenderD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\pointRenderD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\renderTargetD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\shadowMapD3D11.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\d3d\appGraphCtx.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\demoContext.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\imguiGraph.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\loader.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\loaderMacros.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\renderParamsD3D.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\shaderCommonD3D.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\shadersDemoContext.h"> + </ClInclude> + <ClCompile Include="..\..\d3d\appGraphCtxLoader.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\pointRender.cpp"> + <ClCompile Include="..\..\d3d\imguiGraph.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\renderTarget.cpp"> + <ClCompile Include="..\..\d3d\imguiGraphLoader.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\shadersD3D11.cpp"> + <ClCompile Include="..\..\d3d\loader.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\shadowMap.cpp"> + <ClCompile Include="..\..\d3d\renderParamsD3D.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d\shadersDemoContext.cpp"> </ClCompile> </ItemGroup> <ItemGroup> - <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/debugLineVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">debugLineVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -382,17 +527,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">debugLineVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl"> + <FxCompile Include="./../../d3d/shaders/debugLinePS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">debugLinePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -400,17 +545,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">debugLinePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/imguiPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">imguiPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -418,17 +563,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">imguiPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/imguiVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">imguiVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -436,17 +581,35 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">imguiVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> + </FxCompile> + <FxCompile Include="./../../d3d/shaders/meshPS.hlsl"> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/meshAsyncComputeBenchPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -454,17 +617,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/meshShadowPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshPS_Shadow</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -472,17 +635,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshPS_Shadow</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/meshVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -490,17 +653,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/pointVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -508,17 +671,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl"> + <FxCompile Include="./../../d3d/shaders/pointGS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -526,17 +689,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/pointPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -544,17 +707,35 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> + </FxCompile> + <FxCompile Include="./../../d3d/shaders/pointShadowPS.hlsl"> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointShadowPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointShadowPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/diffuseVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">diffuseVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -562,17 +743,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">diffuseVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl"> + <FxCompile Include="./../../d3d/shaders/diffuseGS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">diffuseGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -580,17 +761,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">diffuseGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl"> + <FxCompile Include="./../../d3d/shaders/diffusePS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">diffusePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -598,17 +779,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">diffusePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/ellipsoidDepthVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">ellipsoidDepthVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -616,17 +797,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">ellipsoidDepthVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl"> + <FxCompile Include="./../../d3d/shaders/ellipsoidDepthGS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">ellipsoidDepthGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -634,17 +815,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">ellipsoidDepthGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/ellipsoidDepthPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">ellipsoidDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -652,17 +833,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">ellipsoidDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/passThroughVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">passThroughVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -670,17 +851,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">passThroughVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/blurDepthPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">blurDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -688,17 +869,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">blurDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl"> + <FxCompile Include="./../../d3d/shaders/compositePS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">compositePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel> @@ -706,7 +887,7 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">compositePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput> </FxCompile> </ItemGroup> diff --git a/demo/compiler/vc14win32/flexDemoD3D.vcxproj.filters b/demo/compiler/vc14win32/flexDemoD3D.vcxproj.filters index 15615f5..b7f0548 100644 --- a/demo/compiler/vc14win32/flexDemoD3D.vcxproj.filters +++ b/demo/compiler/vc14win32/flexDemoD3D.vcxproj.filters @@ -111,9 +111,6 @@ <ClInclude Include="..\..\scenes\plasticbody.h">
<Filter>demo\scenes</Filter>
</ClInclude>
- <ClInclude Include="..\..\scenes\plasticstack.h">
- <Filter>demo\scenes</Filter>
- </ClInclude>
<ClInclude Include="..\..\scenes\player.h">
<Filter>demo\scenes</Filter>
</ClInclude>
@@ -144,6 +141,9 @@ <ClInclude Include="..\..\scenes\sdfcollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
+ <ClInclude Include="..\..\scenes\shapechannels.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
<ClInclude Include="..\..\scenes\shapecollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
@@ -328,6 +328,177 @@ </ClInclude>
</ItemGroup>
<ItemGroup>
+ <Filter Include="d3d12">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d12\appD3D12Ctx.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\bufferD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\demoContextD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\diffusePointRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\imguiGraphD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\lineRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshRenderer.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshRendererD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12CircularResourceHeap.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12CounterFence.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12DescriptorHeap.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12Handle.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12HelperUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12RenderTarget.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12Resource.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12ResourceScopeManager.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDxDebugUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDxFormatUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoFreeList.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvResult.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\pipelineUtilD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\pointRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\renderStateD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\d3d12\appD3D12Ctx.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\bufferD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\demoContextD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\diffusePointRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\imguiGraphD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\imguiInteropD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\lineRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshRenderer.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshRendererD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12CircularResourceHeap.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12CounterFence.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12DescriptorHeap.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12HelperUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12RenderTarget.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12Resource.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12ResourceScopeManager.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDxDebugUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDxFormatUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoFreeList.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\pipelineUtilD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\pointRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\renderStateD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
<Filter Include="d3d11">
</Filter>
</ItemGroup>
@@ -335,121 +506,178 @@ <ClInclude Include="..\..\d3d11\appD3D11Ctx.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\debugLineRender.h">
+ <ClInclude Include="..\..\d3d11\debugLineRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\diffuseRender.h">
+ <ClInclude Include="..\..\d3d11\demoContextD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\fluidRender.h">
+ <ClInclude Include="..\..\d3d11\diffuseRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\imguiGraph.h">
+ <ClInclude Include="..\..\d3d11\fluidRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
<ClInclude Include="..\..\d3d11\imguiGraphD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\meshRender.h">
+ <ClInclude Include="..\..\d3d11\meshRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\pointRender.h">
+ <ClInclude Include="..\..\d3d11\pointRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\renderTarget.h">
+ <ClInclude Include="..\..\d3d11\renderTargetD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\shadowMap.h">
+ <ClInclude Include="..\..\d3d11\shadowMapD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
<ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\diffuseRender.cpp">
+ <ClCompile Include="..\..\d3d11\debugLineRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\fluidRender.cpp">
+ <ClCompile Include="..\..\d3d11\demoContextD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\imguiGraph.cpp">
+ <ClCompile Include="..\..\d3d11\diffuseRenderD3D11.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\fluidRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
<ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\meshRender.cpp">
+ <ClCompile Include="..\..\d3d11\imguiInteropD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\pointRender.cpp">
+ <ClCompile Include="..\..\d3d11\meshRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\renderTarget.cpp">
+ <ClCompile Include="..\..\d3d11\pointRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\shadersD3D11.cpp">
+ <ClCompile Include="..\..\d3d11\renderTargetD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\shadowMap.cpp">
+ <ClCompile Include="..\..\d3d11\shadowMapD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
</ItemGroup>
+ <ItemGroup>
+ <Filter Include="d3d">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d\appGraphCtx.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\demoContext.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\imguiGraph.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\loader.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\loaderMacros.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\renderParamsD3D.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\shaderCommonD3D.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\shadersDemoContext.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\d3d\appGraphCtxLoader.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\imguiGraph.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\imguiGraphLoader.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\loader.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\renderParamsD3D.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\shadersDemoContext.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ </ItemGroup>
<ItemGroup><Filter Include="Shader Files"></Filter></ItemGroup>
<ItemGroup>
- <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/debugLineVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d/shaders/debugLinePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d/shaders/imguiPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/imguiVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshAsyncComputeBenchPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshShadowPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointGS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointShadowPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/diffuseVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/diffuseGS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/diffusePS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/ellipsoidDepthVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/ellipsoidDepthGS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/ellipsoidDepthPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/passThroughVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/blurDepthPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/compositePS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
</ItemGroup>
diff --git a/demo/compiler/vc14win64/flexDemoCUDA.vcxproj b/demo/compiler/vc14win64/flexDemoCUDA.vcxproj index 056fb6d..8b4c665 100644 --- a/demo/compiler/vc14win64/flexDemoCUDA.vcxproj +++ b/demo/compiler/vc14win64/flexDemoCUDA.vcxproj @@ -55,7 +55,7 @@ <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win64/NvFlexDebugCUDA_x64.lib;./../../../lib/win64/NvFlexExtDebugCUDA_x64.lib;./../../../lib/win64/NvFlexDeviceDebug_x64.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win64/NvFlexDebugCUDA_x64.lib;./../../../lib/win64/NvFlexExtDebugCUDA_x64.lib;./../../../lib/win64/NvFlexDeviceDebug_x64.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/NvToolsExt/lib/x64/nvToolsExt64_1.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoDebugCUDA_x64.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugCUDA_x64.exe.pdb</ProgramDatabaseFile> @@ -95,7 +95,7 @@ <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win64/NvFlexReleaseCUDA_x64.lib;./../../../lib/win64/NvFlexExtReleaseCUDA_x64.lib;./../../../lib/win64/NvFlexDeviceRelease_x64.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win64/NvFlexReleaseCUDA_x64.lib;./../../../lib/win64/NvFlexExtReleaseCUDA_x64.lib;./../../../lib/win64/NvFlexDeviceRelease_x64.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/NvToolsExt/lib/x64/nvToolsExt64_1.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoReleaseCUDA_x64.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseCUDA_x64.exe.pdb</ProgramDatabaseFile> @@ -184,8 +184,6 @@ </ClInclude> <ClInclude Include="..\..\scenes\plasticbody.h"> </ClInclude> - <ClInclude Include="..\..\scenes\plasticstack.h"> - </ClInclude> <ClInclude Include="..\..\scenes\player.h"> </ClInclude> <ClInclude Include="..\..\scenes\potpourri.h"> @@ -206,6 +204,8 @@ </ClInclude> <ClInclude Include="..\..\scenes\sdfcollision.h"> </ClInclude> + <ClInclude Include="..\..\scenes\shapechannels.h"> + </ClInclude> <ClInclude Include="..\..\scenes\shapecollision.h"> </ClInclude> <ClInclude Include="..\..\scenes\softbody.h"> diff --git a/demo/compiler/vc14win64/flexDemoCUDA.vcxproj.filters b/demo/compiler/vc14win64/flexDemoCUDA.vcxproj.filters index 45f6d6c..e5989dc 100644 --- a/demo/compiler/vc14win64/flexDemoCUDA.vcxproj.filters +++ b/demo/compiler/vc14win64/flexDemoCUDA.vcxproj.filters @@ -111,9 +111,6 @@ <ClInclude Include="..\..\scenes\plasticbody.h">
<Filter>demo\scenes</Filter>
</ClInclude>
- <ClInclude Include="..\..\scenes\plasticstack.h">
- <Filter>demo\scenes</Filter>
- </ClInclude>
<ClInclude Include="..\..\scenes\player.h">
<Filter>demo\scenes</Filter>
</ClInclude>
@@ -144,6 +141,9 @@ <ClInclude Include="..\..\scenes\sdfcollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
+ <ClInclude Include="..\..\scenes\shapechannels.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
<ClInclude Include="..\..\scenes\shapecollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
diff --git a/demo/compiler/vc14win64/flexDemoD3D.vcxproj b/demo/compiler/vc14win64/flexDemoD3D.vcxproj index 9b3dfae..3fbd922 100644 --- a/demo/compiler/vc14win64/flexDemoD3D.vcxproj +++ b/demo/compiler/vc14win64/flexDemoD3D.vcxproj @@ -13,6 +13,7 @@ <PropertyGroup Label="Globals"> <ProjectGuid>{EF4EDDD8-2620-47AA-E75D-4C682C276C02}</ProjectGuid> <RootNamespace>flexDemoD3D</RootNamespace> + <WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration"> @@ -47,15 +48,15 @@ <FloatingPointModel>Precise</FloatingPointModel> <AdditionalOptions> /d2Zi+</AdditionalOptions> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../d3d12;./../../../external/SDL2-2.0.4/include;./../../../external/D3D12/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;FLEX_DX12;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WarningLevel>Level3</WarningLevel> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../lib/win64/NvFlexDebugD3D_x64.lib;./../../../lib/win64/NvFlexExtDebugD3D_x64.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;d3dcompiler.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/NvToolsExt/lib/x64/nvToolsExt64_1.lib;./../../../external/D3D12/libs/x64/d3d12.lib;./../../../lib/win64/NvFlexDebugD3D_x64.lib;./../../../lib/win64/NvFlexExtDebugD3D_x64.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoDebugD3D_x64.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugD3D_x64.exe.pdb</ProgramDatabaseFile> @@ -86,15 +87,15 @@ <FloatingPointModel>Fast</FloatingPointModel> <AdditionalOptions> /d2Zi+</AdditionalOptions> <Optimization>Full</Optimization> - <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../d3d12;./../../../external/SDL2-2.0.4/include;./../../../external/D3D12/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;FLEX_DX12;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WarningLevel>Level3</WarningLevel> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeaderFile></PrecompiledHeaderFile> </ClCompile> <Link> - <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../lib/win64/NvFlexReleaseD3D_x64.lib;./../../../lib/win64/NvFlexExtReleaseD3D_x64.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;d3dcompiler.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/NvToolsExt/lib/x64/nvToolsExt64_1.lib;./../../../external/D3D12/libs/x64/d3d12.lib;./../../../lib/win64/NvFlexReleaseD3D_x64.lib;./../../../lib/win64/NvFlexExtReleaseD3D_x64.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)NvFlexDemoReleaseD3D_x64.exe</OutputFile> <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseD3D_x64.exe.pdb</ProgramDatabaseFile> @@ -183,8 +184,6 @@ </ClInclude> <ClInclude Include="..\..\scenes\plasticbody.h"> </ClInclude> - <ClInclude Include="..\..\scenes\plasticstack.h"> - </ClInclude> <ClInclude Include="..\..\scenes\player.h"> </ClInclude> <ClInclude Include="..\..\scenes\potpourri.h"> @@ -205,6 +204,8 @@ </ClInclude> <ClInclude Include="..\..\scenes\sdfcollision.h"> </ClInclude> + <ClInclude Include="..\..\scenes\shapechannels.h"> + </ClInclude> <ClInclude Include="..\..\scenes\shapecollision.h"> </ClInclude> <ClInclude Include="..\..\scenes\softbody.h"> @@ -325,56 +326,200 @@ </ClInclude> </ItemGroup> <ItemGroup> + <ClInclude Include="..\..\d3d12\appD3D12Ctx.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\bufferD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\demoContextD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\diffusePointRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\imguiGraphD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\lineRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshRendererD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\meshUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12CircularResourceHeap.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12CounterFence.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12DescriptorHeap.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12Handle.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12HelperUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12RenderTarget.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12Resource.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDx12ResourceScopeManager.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDxDebugUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoDxFormatUtil.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvCoFreeList.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\NvResult.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\pipelineUtilD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\pointRenderPipelineD3D12.h"> + </ClInclude> + <ClInclude Include="..\..\d3d12\renderStateD3D12.h"> + </ClInclude> + <ClCompile Include="..\..\d3d12\appD3D12Ctx.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\bufferD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\demoContextD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\diffusePointRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\imguiGraphD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\imguiInteropD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\lineRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshRendererD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\meshUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12CircularResourceHeap.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12CounterFence.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12DescriptorHeap.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12HelperUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12RenderTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12Resource.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDx12ResourceScopeManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDxDebugUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoDxFormatUtil.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\NvCoFreeList.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\pipelineUtilD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\pointRenderPipelineD3D12.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d12\renderStateD3D12.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> <ClInclude Include="..\..\d3d11\appD3D11Ctx.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\debugLineRender.h"> + <ClInclude Include="..\..\d3d11\debugLineRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\diffuseRender.h"> + <ClInclude Include="..\..\d3d11\demoContextD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\fluidRender.h"> + <ClInclude Include="..\..\d3d11\diffuseRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\imguiGraph.h"> + <ClInclude Include="..\..\d3d11\fluidRenderD3D11.h"> </ClInclude> <ClInclude Include="..\..\d3d11\imguiGraphD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\meshRender.h"> + <ClInclude Include="..\..\d3d11\meshRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\pointRender.h"> + <ClInclude Include="..\..\d3d11\pointRenderD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\renderTarget.h"> + <ClInclude Include="..\..\d3d11\renderTargetD3D11.h"> </ClInclude> - <ClInclude Include="..\..\d3d11\shadowMap.h"> + <ClInclude Include="..\..\d3d11\shadowMapD3D11.h"> </ClInclude> <ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\diffuseRender.cpp"> + <ClCompile Include="..\..\d3d11\debugLineRenderD3D11.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\fluidRender.cpp"> + <ClCompile Include="..\..\d3d11\demoContextD3D11.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\imguiGraph.cpp"> + <ClCompile Include="..\..\d3d11\diffuseRenderD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\fluidRenderD3D11.cpp"> </ClCompile> <ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\meshRender.cpp"> + <ClCompile Include="..\..\d3d11\imguiInteropD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\meshRenderD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\pointRenderD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\renderTargetD3D11.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d11\shadowMapD3D11.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\d3d\appGraphCtx.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\demoContext.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\imguiGraph.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\loader.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\loaderMacros.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\renderParamsD3D.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\shaderCommonD3D.h"> + </ClInclude> + <ClInclude Include="..\..\d3d\shadersDemoContext.h"> + </ClInclude> + <ClCompile Include="..\..\d3d\appGraphCtxLoader.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\pointRender.cpp"> + <ClCompile Include="..\..\d3d\imguiGraph.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\renderTarget.cpp"> + <ClCompile Include="..\..\d3d\imguiGraphLoader.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\shadersD3D11.cpp"> + <ClCompile Include="..\..\d3d\loader.cpp"> </ClCompile> - <ClCompile Include="..\..\d3d11\shadowMap.cpp"> + <ClCompile Include="..\..\d3d\renderParamsD3D.cpp"> + </ClCompile> + <ClCompile Include="..\..\d3d\shadersDemoContext.cpp"> </ClCompile> </ItemGroup> <ItemGroup> - <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/debugLineVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">debugLineVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -382,17 +527,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">debugLineVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl"> + <FxCompile Include="./../../d3d/shaders/debugLinePS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">debugLinePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -400,17 +545,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">debugLinePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/imguiPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">imguiPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -418,17 +563,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">imguiPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/imguiVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">imguiVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -436,17 +581,35 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">imguiVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> + </FxCompile> + <FxCompile Include="./../../d3d/shaders/meshPS.hlsl"> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/meshAsyncComputeBenchPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -454,17 +617,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/meshShadowPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshPS_Shadow</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -472,17 +635,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshPS_Shadow</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/meshVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -490,17 +653,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/pointVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -508,17 +671,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl"> + <FxCompile Include="./../../d3d/shaders/pointGS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -526,17 +689,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/pointPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -544,17 +707,35 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> + </FxCompile> + <FxCompile Include="./../../d3d/shaders/pointShadowPS.hlsl"> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointShadowPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> + <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> + <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> + <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation> + <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> + <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointShadowPS</EntryPointName> + <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/diffuseVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">diffuseVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -562,17 +743,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">diffuseVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl"> + <FxCompile Include="./../../d3d/shaders/diffuseGS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">diffuseGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -580,17 +761,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">diffuseGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl"> + <FxCompile Include="./../../d3d/shaders/diffusePS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">diffusePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -598,17 +779,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">diffusePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/ellipsoidDepthVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">ellipsoidDepthVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -616,17 +797,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">ellipsoidDepthVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl"> + <FxCompile Include="./../../d3d/shaders/ellipsoidDepthGS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">ellipsoidDepthGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Geometry</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -634,17 +815,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">ellipsoidDepthGS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/ellipsoidDepthPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">ellipsoidDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -652,17 +833,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">ellipsoidDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl"> + <FxCompile Include="./../../d3d/shaders/passThroughVS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">passThroughVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -670,17 +851,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">passThroughVS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl"> + <FxCompile Include="./../../d3d/shaders/blurDepthPS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">blurDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -688,17 +869,17 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">blurDepthPS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> - <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl"> + <FxCompile Include="./../../d3d/shaders/compositePS.hlsl"> <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel> <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation> <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">compositePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput> <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel> @@ -706,7 +887,7 @@ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations> <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">compositePS</EntryPointName> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError> - <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput> + <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d/shaders/%(Filename).hlsl.h</HeaderFileOutput> <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput> </FxCompile> </ItemGroup> diff --git a/demo/compiler/vc14win64/flexDemoD3D.vcxproj.filters b/demo/compiler/vc14win64/flexDemoD3D.vcxproj.filters index 15615f5..b7f0548 100644 --- a/demo/compiler/vc14win64/flexDemoD3D.vcxproj.filters +++ b/demo/compiler/vc14win64/flexDemoD3D.vcxproj.filters @@ -111,9 +111,6 @@ <ClInclude Include="..\..\scenes\plasticbody.h">
<Filter>demo\scenes</Filter>
</ClInclude>
- <ClInclude Include="..\..\scenes\plasticstack.h">
- <Filter>demo\scenes</Filter>
- </ClInclude>
<ClInclude Include="..\..\scenes\player.h">
<Filter>demo\scenes</Filter>
</ClInclude>
@@ -144,6 +141,9 @@ <ClInclude Include="..\..\scenes\sdfcollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
+ <ClInclude Include="..\..\scenes\shapechannels.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
<ClInclude Include="..\..\scenes\shapecollision.h">
<Filter>demo\scenes</Filter>
</ClInclude>
@@ -328,6 +328,177 @@ </ClInclude>
</ItemGroup>
<ItemGroup>
+ <Filter Include="d3d12">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d12\appD3D12Ctx.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\bufferD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\demoContextD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\diffusePointRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\imguiGraphD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\lineRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshRenderer.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshRendererD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\meshUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12CircularResourceHeap.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12CounterFence.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12DescriptorHeap.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12Handle.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12HelperUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12RenderTarget.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12Resource.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDx12ResourceScopeManager.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDxDebugUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoDxFormatUtil.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvCoFreeList.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\NvResult.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\pipelineUtilD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\pointRenderPipelineD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d12\renderStateD3D12.h">
+ <Filter>d3d12</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\d3d12\appD3D12Ctx.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\bufferD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\demoContextD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\diffusePointRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\fluidCompositeRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\fluidEllipsoidRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\fluidSmoothRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\imguiGraphD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\imguiInteropD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\lineRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshRenderer.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshRendererD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\meshUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12CircularResourceHeap.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12CounterFence.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12DescriptorHeap.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12HelperUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12RenderTarget.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12Resource.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDx12ResourceScopeManager.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDxDebugUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoDxFormatUtil.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\NvCoFreeList.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\pipelineUtilD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\pointRenderPipelineD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d12\renderStateD3D12.cpp">
+ <Filter>d3d12</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
<Filter Include="d3d11">
</Filter>
</ItemGroup>
@@ -335,121 +506,178 @@ <ClInclude Include="..\..\d3d11\appD3D11Ctx.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\debugLineRender.h">
+ <ClInclude Include="..\..\d3d11\debugLineRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\diffuseRender.h">
+ <ClInclude Include="..\..\d3d11\demoContextD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\fluidRender.h">
+ <ClInclude Include="..\..\d3d11\diffuseRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\imguiGraph.h">
+ <ClInclude Include="..\..\d3d11\fluidRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
<ClInclude Include="..\..\d3d11\imguiGraphD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\meshRender.h">
+ <ClInclude Include="..\..\d3d11\meshRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\pointRender.h">
+ <ClInclude Include="..\..\d3d11\pointRenderD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\renderTarget.h">
+ <ClInclude Include="..\..\d3d11\renderTargetD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
- <ClInclude Include="..\..\d3d11\shadowMap.h">
+ <ClInclude Include="..\..\d3d11\shadowMapD3D11.h">
<Filter>d3d11</Filter>
</ClInclude>
<ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\diffuseRender.cpp">
+ <ClCompile Include="..\..\d3d11\debugLineRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\fluidRender.cpp">
+ <ClCompile Include="..\..\d3d11\demoContextD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\imguiGraph.cpp">
+ <ClCompile Include="..\..\d3d11\diffuseRenderD3D11.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\fluidRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
<ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\meshRender.cpp">
+ <ClCompile Include="..\..\d3d11\imguiInteropD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\pointRender.cpp">
+ <ClCompile Include="..\..\d3d11\meshRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\renderTarget.cpp">
+ <ClCompile Include="..\..\d3d11\pointRenderD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\shadersD3D11.cpp">
+ <ClCompile Include="..\..\d3d11\renderTargetD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
- <ClCompile Include="..\..\d3d11\shadowMap.cpp">
+ <ClCompile Include="..\..\d3d11\shadowMapD3D11.cpp">
<Filter>d3d11</Filter>
</ClCompile>
</ItemGroup>
+ <ItemGroup>
+ <Filter Include="d3d">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d\appGraphCtx.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\demoContext.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\imguiGraph.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\loader.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\loaderMacros.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\renderParamsD3D.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\shaderCommonD3D.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d\shadersDemoContext.h">
+ <Filter>d3d</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\d3d\appGraphCtxLoader.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\imguiGraph.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\imguiGraphLoader.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\loader.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\renderParamsD3D.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d\shadersDemoContext.cpp">
+ <Filter>d3d</Filter>
+ </ClCompile>
+ </ItemGroup>
<ItemGroup><Filter Include="Shader Files"></Filter></ItemGroup>
<ItemGroup>
- <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/debugLineVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d/shaders/debugLinePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d/shaders/imguiPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/imguiVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshAsyncComputeBenchPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshShadowPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/meshVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointGS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/pointShadowPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/diffuseVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/diffuseGS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/diffusePS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/ellipsoidDepthVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/ellipsoidDepthGS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/ellipsoidDepthPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/passThroughVS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/blurDepthPS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
- <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl">
+ <FxCompile Include="./../../d3d/shaders/compositePS.hlsl">
<Filter>Shader Files</Filter>
</FxCompile>
</ItemGroup>
diff --git a/demo/compiler/xpj/flexDemoCUDA.xpj b/demo/compiler/xpj/flexDemoCUDA.xpj index 1257e14..c4b7ab5 100644 --- a/demo/compiler/xpj/flexDemoCUDA.xpj +++ b/demo/compiler/xpj/flexDemoCUDA.xpj @@ -74,6 +74,7 @@ ../../../lib/win32/NvFlexDeviceDebug_x86.lib ../../../external/SDL2-2.0.4/lib/x86/SDL2.lib ../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib + ../../../external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib ../../../external/glew/lib/win32/glew32.lib </Libraries> <Libraries platforms="Win64"> @@ -82,6 +83,7 @@ ../../../lib/win64/NvFlexDeviceDebug_x64.lib ../../../external/SDL2-2.0.4/lib/x64/SDL2.lib ../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib + ../../../external/NvToolsExt/lib/x64/nvToolsExt64_1.lib ../../../external/glew/lib/x64/glew32.lib </Libraries> @@ -111,6 +113,7 @@ ../../../lib/win32/NvFlexDeviceRelease_x86.lib ../../../external/SDL2-2.0.4/lib/x86/SDL2.lib ../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib + ../../../external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib ../../../external/glew/lib/win32/glew32.lib </Libraries> <Libraries platforms="Win64"> @@ -119,87 +122,12 @@ ../../../lib/win64/NvFlexDeviceRelease_x64.lib ../../../external/SDL2-2.0.4/lib/x64/SDL2.lib ../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib + ../../../external/NvToolsExt/lib/x64/nvToolsExt64_1.lib ../../../external/glew/lib/x64/glew32.lib </Libraries> </Config> - - <!-- Android --> - - <Config name="default" type="app" platforms="android{x}"> - - <apply-template name="android-common"/> - - <OutDir tool="make">${user:ProjectRoot}/demo/compiler/android/flex_project/libs/armeabi-v7a</OutDir> - - <Preprocessor type="define"> - android - ANDROID=1 - ANDROID_PLAT=1 - DISABLE_IMPORTGL - </Preprocessor> - - <SearchPaths type="header" tool="make"> - "${user:ProjectRoot}" - "${user:ProjectRoot}/external/egl_setup" - "${user:ProjectRoot}/external/regal_static/include" - </SearchPaths> - - <SearchPaths type="library" tool="make"> - "${user:ProjectRoot}/external/regal_static/lib/armeabi-v7a" - "${user:ProjectRoot}/lib/android" - </SearchPaths> - - <Libraries> - android stdc++ c m log dl EGL gomp cudart_static Regal_static - </Libraries> - - <Libraries tool="make"> - stlport_static - </Libraries> - - <ExceptionHandling>True</ExceptionHandling> - <RuntimeTypeInfo>True</RuntimeTypeInfo> - - <CFlags> - -std=c++11 -fno-exceptions -fno-rtti - </CFlags> - - <CFlags tool="make"> - -fpic -fPIC -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -O2 -g -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 - </CFlags> - - <LFlags tool="make"> - --sysroot=${NDK_ROOT}/${NDK_VERSION}/platforms/android-15/arch-arm -shared -Wl,--no-undefined - </LFlags> - - <AndroidAPILevel>15</AndroidAPILevel> - <AntBuildDirectory> - ${user:ProjectRoot}/demo/compiler/android/flex_project - </AntBuildDirectory> - <AntJavaSourceDir> - ${user:ProjectRoot}/demo/compiler/android/src - </AntJavaSourceDir> - - </Config> - - <Configuration name="release" platforms="android{x}"> - <OutFile>libflexDemo.so</OutFile> - - <Preprocessor type="define"> - NDEBUG - </Preprocessor> - - <AntBuildType>debug</AntBuildType> - - <Libraries> - NvFlexRelease_armv7l - NvFlexExtRelease_armv7l - </Libraries> - - </Configuration> - <!-- Linux --> <Config name="default" type="console" platforms="linux64"> @@ -220,7 +148,7 @@ </CFlags> <LFlags> - -g -L${user:External}/glew/lib/linux -L/usr/lib -L"../../../lib/linux64" -L${user:External}/SDL2-2.0.4/lib/x64/ -L${user:CUDA_PATH}/lib64 -lGL -lglut -lGLU -lGLEW -lcudart_static -ldl + -g -L${user:External}/glew/lib/linux -L/usr/lib -L"../../../lib/linux64" -L${user:External}/SDL2-2.0.4/lib/x64/ -L${user:CUDA_PATH}/lib64 -lGL -lglut -lGLU -lGLEW -lcudart_static -ldl -lrt -pthread </LFlags> </Config> diff --git a/demo/compiler/xpj/flexDemoD3D.xpj b/demo/compiler/xpj/flexDemoD3D.xpj index 0c95377..e957c5b 100644 --- a/demo/compiler/xpj/flexDemoD3D.xpj +++ b/demo/compiler/xpj/flexDemoD3D.xpj @@ -19,6 +19,9 @@ <Target name="flexDemoD3D"> + <!-- Dx12 needs a post 8.1 version of windows SDK --> + <WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion> + <!-- Windows --> <Config name="default" type="console" platforms="Win32 Win64"> @@ -34,6 +37,7 @@ WIN32 _CRT_SECURE_NO_WARNINGS FLEX_DX + FLEX_DX12 </Preprocessor> <WarningLevel>3</WarningLevel> @@ -42,23 +46,29 @@ <CharacterSet>MultiByte</CharacterSet> <SearchPaths type="header"> - ${user:ProjectRoot} - ${user:ProjectRoot}\demo - ${user:ProjectRoot}\demo\d3d11 - ${user:ProjectRoot}\external\SDL2-2.0.4\include + ${user:ProjectRoot} + ${user:ProjectRoot}\demo + ${user:ProjectRoot}\demo\d3d11 + ${user:ProjectRoot}\demo\d3d12 + ${user:ProjectRoot}\external\SDL2-2.0.4\include + ${user:ProjectRoot}\external\D3D12\include </SearchPaths> <Libraries> - kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib + kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib d3dcompiler.lib </Libraries> <Libraries platforms="Win32"> ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x86/SDL2.lib ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x86/SDL2main.lib + ${user:ProjectRoot}/external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib + ${user:ProjectRoot}/external/D3D12/libs/x86/d3d12.lib </Libraries> <Libraries platforms="Win64"> ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x64/SDL2.lib ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x64/SDL2main.lib + ${user:ProjectRoot}/external/NvToolsExt/lib/x64/nvToolsExt64_1.lib + ${user:ProjectRoot}/external/D3D12/libs/x64/d3d12.lib </Libraries> </Config> @@ -87,14 +97,14 @@ ${user:ProjectRoot}/lib/win32/NvFlexExtDebugD3D_x86.lib ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x86/SDL2.lib ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x86/SDL2main.lib - ${user:ProjectRoot}/external/glew/lib/win32/glew32.lib + ${user:ProjectRoot}/external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib </Libraries> <Libraries platforms="Win64"> ${user:ProjectRoot}/lib/win64/NvFlexDebugD3D_x64.lib ${user:ProjectRoot}/lib/win64/NvFlexExtDebugD3D_x64.lib ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x64/SDL2.lib ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x64/SDL2main.lib - ${user:ProjectRoot}/external/glew/lib/x64/glew32.lib + ${user:ProjectRoot}/external/NvToolsExt/lib/x64/nvToolsExt64_1.lib </Libraries> </Config> @@ -124,20 +134,67 @@ ${user:ProjectRoot}/lib/win32/NvFlexExtReleaseD3D_x86.lib ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x86/SDL2.lib ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x86/SDL2main.lib - ${user:ProjectRoot}/external/glew/lib/win32/glew32.lib + ${user:ProjectRoot}/external/NvToolsExt/lib/Win32/nvToolsExt32_1.lib </Libraries> <Libraries platforms="Win64"> ${user:ProjectRoot}/lib/win64/NvFlexReleaseD3D_x64.lib ${user:ProjectRoot}/lib/win64/NvFlexExtReleaseD3D_x64.lib ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x64/SDL2.lib ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x64/SDL2main.lib - ${user:ProjectRoot}/external/glew/lib/x64/glew32.lib + ${user:ProjectRoot}/external/NvToolsExt/lib/x64/nvToolsExt64_1.lib </Libraries> </Config> <!-- Common Source --> - + + <Files name="NvCommon" type="source" root="${user:ProjectRoot}/external/NvCommon/src"> + Nv/Common/*.cpp + Nv/Common/*.h + -Nv/Common/NvCoPathFinder.* + -Nv/Common/NvCoMemoryMappedFile.* + -Nv/Common/NvCoMemoryReadStream.* + -Nv/Common/NvCoMemoryWriteStream.* + -Nv/Common/NvCoCircularHeap.* + -Nv/Common/NvCoFreeListHeap.* + + Nv/Common/Platform/Win/*.cpp + Nv/Common/Platform/Win/*.h + -Nv/Common/Platform/Win/NvCoWinMemoryMappedFile.* + -Nv/Common/Platform/Win/NvCoWinPathUtil.* + -Nv/Common/Platform/Win/NvCoWinMinimalInclude.* + -Nv/Common/Platform/Win/NvCoWinCriticalSection.* + + Nv/Common/Util/*.cpp + Nv/Common/Util/*.h + -Nv/Common/Util/NvCoParseUtil.* + -Nv/Common/Util/NvCoStringEscapeUtil.* + -Nv/Common/Util/NvCoPathUtil.* + -Nv/Common/Util/NvCoArgParseUtil.* + -Nv/Common/Util/NvCoBitUtil.* + + -Nv/Common/Random/*.cpp + -Nv/Common/Random/*.h + + Nv/Common/Container/*.cpp + Nv/Common/Container/*.h + -Nv/Common/Container/NvCoHandleMap.* + + Nv/Common/Render/Dx/*.cpp + Nv/Common/Render/Dx/*.h + Nv/Common/Render/Dx12/*.cpp + Nv/Common/Render/Dx12/*.h + -Nv/Common/Render/Dx/NvCoDxIncludeHandler.* + -Nv/Common/Render/Dx/NvCoDxShaderUtil.* + -Nv/Common/Render/Dx12/NvCoDx12AsyncManager.* + -Nv/Common/Render/Dx12/NvCoDx12DescriptorCache.* + + Nv/Common/Render/Context/*.cpp + Nv/Common/Render/Context/*.h + Nv/Common/Render/Context/Dx12/*.cpp + Nv/Common/Render/Context/Dx12/*.h + </Files> + <Files name="demo" type="source" root="${user:ProjectRoot}/demo"> *.cpp *.h scenes/*.h @@ -154,41 +211,52 @@ <Dependencies> flexD3D flexExtD3D - </Dependencies> + </Dependencies> + + <Files name="d3d12" type="source" root="${user:ProjectRoot}/demo/d3d12"> + *.h + *.cpp + </Files> <Files name="d3d11" type="source" root="${user:ProjectRoot}/demo/d3d11"> *.h *.cpp </Files> + <Files name="d3d" type="source" root="${user:ProjectRoot}/demo/d3d"> + *.h + *.cpp + </Files> - <HLSL Configurations="release" DisableOptim="No" Debug="No" ShaderModel="5.0" Platforms="Win32 Win64" ObjectFileOutput=" " WarningAsErrors="false" OutputHeaderFileName="${user:ProjectRoot}/demo/d3d11/shaders/%(Filename).hlsl.h"> + <HLSL Configurations="release" DisableOptim="No" Debug="No" ShaderModel="5.0" Platforms="Win32 Win64" ObjectFileOutput=" " WarningAsErrors="false" OutputHeaderFileName="${user:ProjectRoot}/demo/d3d/shaders/%(Filename).hlsl.h"> - <File ShaderType="Vertex" EntryPoint="debugLineVS"> "${user:ProjectRoot}/demo/d3d11/shaders/debugLineVS.hlsl" </File> - <File ShaderType="Pixel" EntryPoint="debugLinePS"> "${user:ProjectRoot}/demo/d3d11/shaders/debugLinePS.hlsl" </File> + <File ShaderType="Vertex" EntryPoint="debugLineVS"> "${user:ProjectRoot}/demo/d3d/shaders/debugLineVS.hlsl" </File> + <File ShaderType="Pixel" EntryPoint="debugLinePS"> "${user:ProjectRoot}/demo/d3d/shaders/debugLinePS.hlsl" </File> - <File ShaderType="Pixel" EntryPoint="imguiPS"> "${user:ProjectRoot}/demo/d3d11/shaders/imguiPS.hlsl" </File> - <File ShaderType="Vertex" EntryPoint="imguiVS"> "${user:ProjectRoot}/demo/d3d11/shaders/imguiVS.hlsl" </File> + <File ShaderType="Pixel" EntryPoint="imguiPS"> "${user:ProjectRoot}/demo/d3d/shaders/imguiPS.hlsl" </File> + <File ShaderType="Vertex" EntryPoint="imguiVS"> "${user:ProjectRoot}/demo/d3d/shaders/imguiVS.hlsl" </File> - <File ShaderType="Pixel" EntryPoint="meshPS"> "${user:ProjectRoot}/demo/d3d11/shaders/meshPS.hlsl" </File> - <File ShaderType="Pixel" EntryPoint="meshPS_Shadow"> "${user:ProjectRoot}/demo/d3d11/shaders/meshShadowPS.hlsl" </File> - <File ShaderType="Vertex" EntryPoint="meshVS"> "${user:ProjectRoot}/demo/d3d11/shaders/meshVS.hlsl" </File> + <File ShaderType="Pixel" EntryPoint="meshPS"> "${user:ProjectRoot}/demo/d3d/shaders/meshPS.hlsl" </File> + <File ShaderType="Pixel" EntryPoint="meshPS"> "${user:ProjectRoot}/demo/d3d/shaders/meshAsyncComputeBenchPS.hlsl" </File> + <File ShaderType="Pixel" EntryPoint="meshPS_Shadow"> "${user:ProjectRoot}/demo/d3d/shaders/meshShadowPS.hlsl" </File> + <File ShaderType="Vertex" EntryPoint="meshVS"> "${user:ProjectRoot}/demo/d3d/shaders/meshVS.hlsl" </File> - <File ShaderType="Vertex" EntryPoint="pointVS"> "${user:ProjectRoot}/demo/d3d11/shaders/pointVS.hlsl" </File> - <File ShaderType="Geometry" EntryPoint="pointGS"> "${user:ProjectRoot}/demo/d3d11/shaders/pointGS.hlsl" </File> - <File ShaderType="Pixel" EntryPoint="pointPS"> "${user:ProjectRoot}/demo/d3d11/shaders/pointPS.hlsl" </File> - - <File ShaderType="Vertex" EntryPoint="diffuseVS"> "${user:ProjectRoot}/demo/d3d11/shaders/diffuseVS.hlsl" </File> - <File ShaderType="Geometry" EntryPoint="diffuseGS"> "${user:ProjectRoot}/demo/d3d11/shaders/diffuseGS.hlsl" </File> - <File ShaderType="Pixel" EntryPoint="diffusePS"> "${user:ProjectRoot}/demo/d3d11/shaders/diffusePS.hlsl" </File> + <File ShaderType="Vertex" EntryPoint="pointVS"> "${user:ProjectRoot}/demo/d3d/shaders/pointVS.hlsl" </File> + <File ShaderType="Geometry" EntryPoint="pointGS"> "${user:ProjectRoot}/demo/d3d/shaders/pointGS.hlsl" </File> + <File ShaderType="Pixel" EntryPoint="pointPS"> "${user:ProjectRoot}/demo/d3d/shaders/pointPS.hlsl" </File> + <File ShaderType="Pixel" EntryPoint="pointShadowPS"> "${user:ProjectRoot}/demo/d3d/shaders/pointShadowPS.hlsl" </File> + + <File ShaderType="Vertex" EntryPoint="diffuseVS"> "${user:ProjectRoot}/demo/d3d/shaders/diffuseVS.hlsl" </File> + <File ShaderType="Geometry" EntryPoint="diffuseGS"> "${user:ProjectRoot}/demo/d3d/shaders/diffuseGS.hlsl" </File> + <File ShaderType="Pixel" EntryPoint="diffusePS"> "${user:ProjectRoot}/demo/d3d/shaders/diffusePS.hlsl" </File> - <File ShaderType="Vertex" EntryPoint="ellipsoidDepthVS"> "${user:ProjectRoot}/demo/d3d11/shaders/ellipsoidDepthVS.hlsl" </File> - <File ShaderType="Geometry" EntryPoint="ellipsoidDepthGS"> "${user:ProjectRoot}/demo/d3d11/shaders/ellipsoidDepthGS.hlsl" </File> - <File ShaderType="Pixel" EntryPoint="ellipsoidDepthPS"> "${user:ProjectRoot}/demo/d3d11/shaders/ellipsoidDepthPS.hlsl" </File> + <File ShaderType="Vertex" EntryPoint="ellipsoidDepthVS"> "${user:ProjectRoot}/demo/d3d/shaders/ellipsoidDepthVS.hlsl" </File> + <File ShaderType="Geometry" EntryPoint="ellipsoidDepthGS"> "${user:ProjectRoot}/demo/d3d/shaders/ellipsoidDepthGS.hlsl" </File> + <File ShaderType="Pixel" EntryPoint="ellipsoidDepthPS"> "${user:ProjectRoot}/demo/d3d/shaders/ellipsoidDepthPS.hlsl" </File> - <File ShaderType="Vertex" EntryPoint="passThroughVS"> "${user:ProjectRoot}/demo/d3d11/shaders/passThroughVS.hlsl" </File> - <File ShaderType="Pixel" EntryPoint="blurDepthPS"> "${user:ProjectRoot}/demo/d3d11/shaders/blurDepthPS.hlsl" </File> - <File ShaderType="Pixel" EntryPoint="compositePS"> "${user:ProjectRoot}/demo/d3d11/shaders/compositePS.hlsl" </File> + <File ShaderType="Vertex" EntryPoint="passThroughVS"> "${user:ProjectRoot}/demo/d3d/shaders/passThroughVS.hlsl" </File> + <File ShaderType="Pixel" EntryPoint="blurDepthPS"> "${user:ProjectRoot}/demo/d3d/shaders/blurDepthPS.hlsl" </File> + <File ShaderType="Pixel" EntryPoint="compositePS"> "${user:ProjectRoot}/demo/d3d/shaders/compositePS.hlsl" </File> </HLSL> diff --git a/demo/d3d/appGraphCtx.h b/demo/d3d/appGraphCtx.h new file mode 100644 index 0000000..2c6300d --- /dev/null +++ b/demo/d3d/appGraphCtx.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#define APP_GRAPH_CTX_API extern "C" __declspec(dllexport) + +struct SDL_Window; + +struct AppGraphCtx; + +struct AppGraphColor +{ + float r, g, b, a; +}; + +APP_GRAPH_CTX_API AppGraphCtx* AppGraphCtxCreate(int deviceID); + +APP_GRAPH_CTX_API bool AppGraphCtxUpdateSize(AppGraphCtx* context, SDL_Window* window, bool fullscreen, int numMSAASamples); + +APP_GRAPH_CTX_API void AppGraphCtxReleaseRenderTarget(AppGraphCtx* context); + +APP_GRAPH_CTX_API void AppGraphCtxRelease(AppGraphCtx* context); + +APP_GRAPH_CTX_API void AppGraphCtxFrameStart(AppGraphCtx* context, AppGraphColor clearColor); + +APP_GRAPH_CTX_API void AppGraphCtxFramePresent(AppGraphCtx* context, bool fullsync); + +APP_GRAPH_CTX_API void AppGraphCtxWaitForFrames(AppGraphCtx* context, unsigned int maxFramesInFlight); + +APP_GRAPH_CTX_API void AppGraphCtxProfileEnable(AppGraphCtx* context, bool enabled); + +APP_GRAPH_CTX_API void AppGraphCtxProfileBegin(AppGraphCtx* context, const char* label); + +APP_GRAPH_CTX_API void AppGraphCtxProfileEnd(AppGraphCtx* context, const char* label); + +APP_GRAPH_CTX_API bool AppGraphCtxProfileGet(AppGraphCtx* context, const char** plabel, float* cpuTime, float* gpuTime, int index); + +APP_GRAPH_CTX_API size_t AppGraphCtxDedicatedVideoMemory(AppGraphCtx* context); + diff --git a/demo/d3d/appGraphCtxLoader.cpp b/demo/d3d/appGraphCtxLoader.cpp new file mode 100644 index 0000000..07375b8 --- /dev/null +++ b/demo/d3d/appGraphCtxLoader.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#include <SDL.h> + +#include "loader.h" +#include "loaderMacros.h" + +#include "appGraphCtx.h" + +#include <stdio.h> + +#define LOADER_APPC_CTX_FUNCTIONS(op, inst, inst_func) \ + op(inst, inst_func, AppGraphCtx*, AppGraphCtxCreate, 1, ((int, deviceID)) ) \ + op(inst, inst_func, bool, AppGraphCtxUpdateSize, 4, ((AppGraphCtx*, context), (SDL_Window*, window), (bool, fullscreen), (int, numMSAASamples)) ) \ + op(inst, inst_func, void, AppGraphCtxReleaseRenderTarget, 1, ((AppGraphCtx*, context)) ) \ + op(inst, inst_func, void, AppGraphCtxRelease, 1, ((AppGraphCtx*, context)) ) \ + op(inst, inst_func, void, AppGraphCtxFrameStart, 2, ((AppGraphCtx*, context), (AppGraphColor, clearColor)) ) \ + op(inst, inst_func, void, AppGraphCtxFramePresent, 2, ((AppGraphCtx*, context), (bool, fullsync)) ) \ + op(inst, inst_func, void, AppGraphCtxWaitForFrames, 2, ((AppGraphCtx*, context), (unsigned int, maxFramesInFlight)) ) \ + op(inst, inst_func, void, AppGraphCtxProfileEnable, 2, ((AppGraphCtx*, context), (bool, enabled)) ) \ + op(inst, inst_func, void, AppGraphCtxProfileBegin, 2, ((AppGraphCtx*, context), (const char*, label)) ) \ + op(inst, inst_func, void, AppGraphCtxProfileEnd, 2, ((AppGraphCtx*, context), (const char*, label)) ) \ + op(inst, inst_func, bool, AppGraphCtxProfileGet, 5, ((AppGraphCtx*, context), (const char**, plabel), (float*, cpuTime), (float*, gpuTime), (int, index)) ) \ + op(inst, inst_func, size_t, AppGraphCtxDedicatedVideoMemory, 1, ((AppGraphCtx*, context)) ) + +LOADER_APPC_CTX_FUNCTIONS(LOADER_DECLARE_FUNCTION_PTR, (), ()) + +struct AppCtxFunctionSet +{ + LOADER_APPC_CTX_FUNCTIONS(LOADER_DECLARE_FUNCTION_VAR, (), ()) +}; + +// Declare D3D11/D3D12 versions +#define APP_CTX_D3D11_FUNCTION_NAME(x) x##D3D11 +#define APP_CTX_D3D12_FUNCTION_NAME(x) x##D3D12 + +extern "C" { + +LOADER_APPC_CTX_FUNCTIONS(LOADER_DECLARE_FUNCTION_NAME, (), APP_CTX_D3D11_FUNCTION_NAME) +LOADER_APPC_CTX_FUNCTIONS(LOADER_DECLARE_FUNCTION_NAME, (), APP_CTX_D3D12_FUNCTION_NAME) + +} // extern "C" + +static AppCtxFunctionSet g_functionSet; + +void loadAppGraphCtx(AppGraphCtxType type) +{ + if (type == APP_CONTEXT_D3D11) + { + LOADER_APPC_CTX_FUNCTIONS(LOADER_SET_FUNCTION, g_functionSet, APP_CTX_D3D11_FUNCTION_NAME) + } + if (type == APP_CONTEXT_D3D12) + { + LOADER_APPC_CTX_FUNCTIONS(LOADER_SET_FUNCTION, g_functionSet, APP_CTX_D3D12_FUNCTION_NAME) + } +} + +void unloadAppGraphCtx() +{ + g_functionSet = AppCtxFunctionSet{}; +} + +// Generate the patches +LOADER_APPC_CTX_FUNCTIONS(LOADER_FUNCTION_PTR_CALL, g_functionSet, ()) diff --git a/demo/d3d/demoContext.h b/demo/d3d/demoContext.h new file mode 100644 index 0000000..bca41f0 --- /dev/null +++ b/demo/d3d/demoContext.h @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#ifndef DEMO_CONTEXT_H +#define DEMO_CONTEXT_H + +#include "shaders.h" + +//#include "../d3d/imguiGraph.h" + +class DemoContext +{ + public: + /// Returns false if couldn't start up + virtual bool initialize(const RenderInitOptions& options) = 0; + + virtual void startFrame(Vec4 colorIn) = 0; + virtual void endFrame() = 0; + virtual void presentFrame(bool fullsync) = 0; + + virtual void getViewRay(int x, int y, Vec3& origin, Vec3& dir) = 0; + virtual void setView(Matrix44 view, Matrix44 projection) = 0; + virtual void renderEllipsoids(FluidRenderer* renderer, FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, Vec4 color, float blur, float ior, bool debug) = 0; + + virtual void drawMesh(const Mesh* m, Vec3 color) = 0; + virtual void drawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex, float expand, bool twosided, bool smooth) = 0; + virtual void drawRope(Vec4* positions, int* indices, int numIndices, float radius, int color) = 0; + virtual void drawPlane(const Vec4& p, bool color) = 0; + virtual void drawPlanes(Vec4* planes, int n, float bias) = 0; + + virtual void graphicsTimerBegin() = 0; + virtual void graphicsTimerEnd() = 0; + + virtual float rendererGetDeviceTimestamps(unsigned long long* begin, unsigned long long* end, unsigned long long* freq) = 0; + + virtual void bindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, float bias, Vec4 fogColor) = 0; + virtual void unbindSolidShader() = 0; + + virtual ShadowMap* shadowCreate() = 0; + virtual void shadowDestroy(ShadowMap* map) = 0; + virtual void shadowBegin(ShadowMap* map) = 0; + virtual void shadowEnd() = 0; + + virtual FluidRenderer* createFluidRenderer(uint32_t width, uint32_t height) = 0; + virtual void destroyFluidRenderer(FluidRenderer* renderer) = 0; + + virtual FluidRenderBuffers* createFluidRenderBuffers(int numParticles, bool enableInterop) = 0; + virtual void drawPoints(FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowTex, bool showDensity) = 0; + virtual void updateFluidRenderBuffers(FluidRenderBuffers* buffers, NvFlexSolver* flex, bool anisotropy, bool density) = 0; + virtual void updateFluidRenderBuffers(FluidRenderBuffers* buffers, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices) = 0; + virtual void destroyFluidRenderBuffers(FluidRenderBuffers* buffers) = 0; + + virtual GpuMesh* createGpuMesh(const Mesh* m) = 0; + virtual void destroyGpuMesh(GpuMesh* mesh) = 0; + virtual void drawGpuMesh(GpuMesh* m, const Matrix44& xform, const Vec3& color) = 0; + virtual void drawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const Vec3& color) = 0; + + virtual DiffuseRenderBuffers* createDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop) = 0; + virtual void destroyDiffuseRenderBuffers(DiffuseRenderBuffers* buffers) = 0; + virtual void updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, Vec4* diffusePositions, Vec4* diffuseVelocities, int numDiffuseParticles) = 0; + virtual void updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, NvFlexSolver* solver) = 0; + virtual int getNumDiffuseRenderParticles(DiffuseRenderBuffers* buffers) = 0; + + virtual void drawDiffuse(FluidRenderer* render, const DiffuseRenderBuffers* buffers, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadowEnabled, bool front) = 0; + + virtual void beginLines() = 0; + virtual void drawLine(const Vec3& p, const Vec3& q, const Vec4& color) = 0; + virtual void endLines() = 0; + + virtual void onSizeChanged(int width, int height, bool minimized) = 0; + + virtual void startGpuWork() = 0; + virtual void endGpuWork() = 0; + virtual void flushGraphicsAndWait() = 0; + + virtual void setFillMode(bool wire) = 0; + virtual void setCullMode(bool enabled) = 0; + + virtual void drawImguiGraph() = 0; + virtual void* getGraphicsCommandQueue() { return nullptr; } + virtual void getRenderDevice(void** device, void** context) = 0; + + virtual ~DemoContext() {} +}; + +#endif // DEMO_CONTEXT_H
\ No newline at end of file diff --git a/demo/d3d11/imguiGraph.cpp b/demo/d3d/imguiGraph.cpp index 011e71b..7babb96 100644 --- a/demo/d3d11/imguiGraph.cpp +++ b/demo/d3d/imguiGraph.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. * * NVIDIA CORPORATION and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation @@ -16,7 +16,6 @@ #include <stdint.h> #include "imguiGraph.h" -#include "imguiGraphD3D11.h" // Some math headers don't have PI defined. static const float PI = 3.14159265f; @@ -224,8 +223,7 @@ static void drawLine(float x0, float y0, float x1, float y1, float r, float fth, drawPolygon(verts, 4, fth, col); } - -bool imguiGraphInit(const char* fontpath, const ImguiGraphDesc* desc) +bool imguiGraphInit(const char* fontpath, float defaultFontHeight, const ImguiGraphDesc* desc) { imguiGraphContextInit(desc); @@ -263,7 +261,9 @@ bool imguiGraphInit(const char* fontpath, const ImguiGraphDesc* desc) return false; } - stbtt_BakeFontBitmap(ttfBuffer, 0, 15.0f, bmap, 512, 512, 32, 96, g_cdata); + defaultFontHeight = (defaultFontHeight <= 0.0f) ? 15.0f : defaultFontHeight; + + stbtt_BakeFontBitmap(ttfBuffer, 0, defaultFontHeight, bmap, 512, 512, 32, 96, g_cdata); // can free ttf_buffer at this point imguiGraphFontTextureInit(bmap); @@ -469,4 +469,3 @@ void imguiGraphDraw() imguiGraphRecordEnd(); } - diff --git a/demo/d3d/imguiGraph.h b/demo/d3d/imguiGraph.h new file mode 100644 index 0000000..361fa7b --- /dev/null +++ b/demo/d3d/imguiGraph.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#include <stdint.h> + +#define IMGUI_GRAPH_API extern "C" __declspec(dllexport) + +struct ImguiGraphDesc; + +typedef bool (*imguiGraphInit_t)(const char* fontpath, const ImguiGraphDesc* desc); + +typedef void (*imguiGraphUpdate_t)(const ImguiGraphDesc* desc); + +bool imguiGraphInit(const char* fontpath, float defaultFontHeight, const ImguiGraphDesc* desc); + +void imguiGraphUpdate(const ImguiGraphDesc* desc); + +void imguiGraphDestroy(); + +void imguiGraphDraw(); + +// Below are the functions that must be implemented per graphics API + +IMGUI_GRAPH_API void imguiGraphContextInit(const ImguiGraphDesc* desc); + +IMGUI_GRAPH_API void imguiGraphContextUpdate(const ImguiGraphDesc* desc); + +IMGUI_GRAPH_API void imguiGraphContextDestroy(); + +IMGUI_GRAPH_API void imguiGraphRecordBegin(); + +IMGUI_GRAPH_API void imguiGraphRecordEnd(); + +IMGUI_GRAPH_API void imguiGraphVertex2f(float x, float y); + +IMGUI_GRAPH_API void imguiGraphVertex2fv(const float* v); + +IMGUI_GRAPH_API void imguiGraphTexCoord2f(float u, float v); + +IMGUI_GRAPH_API void imguiGraphColor4ub(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha); + +IMGUI_GRAPH_API void imguiGraphColor4ubv(const uint8_t* v); + +IMGUI_GRAPH_API void imguiGraphFontTextureEnable(); + +IMGUI_GRAPH_API void imguiGraphFontTextureDisable(); + +IMGUI_GRAPH_API void imguiGraphEnableScissor(int x, int y, int width, int height); + +IMGUI_GRAPH_API void imguiGraphDisableScissor(); + +IMGUI_GRAPH_API void imguiGraphFontTextureInit(unsigned char* data); + +IMGUI_GRAPH_API void imguiGraphFontTextureRelease();
\ No newline at end of file diff --git a/demo/d3d/imguiGraphLoader.cpp b/demo/d3d/imguiGraphLoader.cpp new file mode 100644 index 0000000..6c5dbce --- /dev/null +++ b/demo/d3d/imguiGraphLoader.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +//#include <SDL.h> + +#include "loader.h" + +#include "imguiGraph.h" +#include "loaderMacros.h" + +#include <stdio.h> + +#include "imguiGraph.h" + +struct AppGraphCtx; + +#define LOADER_IMGUI_GRAPH_FUNCTIONS(op, inst, inst_func) \ + op(inst, inst_func, void, imguiGraphContextInit, 1, ((const ImguiGraphDesc*, desc)) ) \ + op(inst, inst_func, void, imguiGraphContextUpdate, 1, ((const ImguiGraphDesc*, desc)) ) \ + op(inst, inst_func, void, imguiGraphContextDestroy, 0, (()) ) \ + op(inst, inst_func, void, imguiGraphRecordBegin, 0, (()) ) \ + op(inst, inst_func, void, imguiGraphRecordEnd, 0, (()) ) \ + op(inst, inst_func, void, imguiGraphVertex2f, 2, ((float, x), (float, y)) ) \ + op(inst, inst_func, void, imguiGraphVertex2fv, 1, ((const float*, v)) ) \ + op(inst, inst_func, void, imguiGraphTexCoord2f, 2, ((float, u), (float, v)) ) \ + op(inst, inst_func, void, imguiGraphColor4ub, 4, ((uint8_t, red), (uint8_t, green), (uint8_t, blue), (uint8_t, alpha)) ) \ + op(inst, inst_func, void, imguiGraphColor4ubv, 1, ((const uint8_t*, v)) ) \ + op(inst, inst_func, void, imguiGraphFontTextureEnable, 0, (()) ) \ + op(inst, inst_func, void, imguiGraphFontTextureDisable, 0, (()) ) \ + op(inst, inst_func, void, imguiGraphEnableScissor, 4, ((int, x), (int, y), (int, width), (int, height)) ) \ + op(inst, inst_func, void, imguiGraphDisableScissor, 0, (()) ) \ + op(inst, inst_func, void, imguiGraphFontTextureInit, 1, ((unsigned char*, data)) ) \ + op(inst, inst_func, void, imguiGraphFontTextureRelease, 0, (()) ) \ + op(inst, inst_func, bool, imguiInteropGraphInit, 3, ((imguiGraphInit_t, func), (const char*, fontpath), (AppGraphCtx*, appctx)) ) \ + op(inst, inst_func, void, imguiInteropGraphUpdate, 2, ((imguiGraphUpdate_t, func), (AppGraphCtx*, appctx)) ) + +LOADER_IMGUI_GRAPH_FUNCTIONS(LOADER_DECLARE_FUNCTION_PTR, (), ()) + +struct ImguiFunctionSet +{ +LOADER_IMGUI_GRAPH_FUNCTIONS(LOADER_DECLARE_FUNCTION_VAR, (), ()) +}; + +// Declare D3D11/D3D12 versions +#define IMGUI_D3D11_FUNCTION_NAME(x) x##D3D11 +#define IMGUI_D3D12_FUNCTION_NAME(x) x##D3D12 + +extern "C" { + +LOADER_IMGUI_GRAPH_FUNCTIONS(LOADER_DECLARE_FUNCTION_NAME, (), IMGUI_D3D11_FUNCTION_NAME) +LOADER_IMGUI_GRAPH_FUNCTIONS(LOADER_DECLARE_FUNCTION_NAME, (), IMGUI_D3D12_FUNCTION_NAME) + +} // extern "C" + +static ImguiFunctionSet g_functionSet; + +void loadImgui(AppGraphCtxType type) +{ + if (type == APP_CONTEXT_D3D11) + { + LOADER_IMGUI_GRAPH_FUNCTIONS(LOADER_SET_FUNCTION, g_functionSet, IMGUI_D3D11_FUNCTION_NAME) + } + if (type == APP_CONTEXT_D3D12) + { + LOADER_IMGUI_GRAPH_FUNCTIONS(LOADER_SET_FUNCTION, g_functionSet, IMGUI_D3D12_FUNCTION_NAME) + } +} + +void unloadImgui() +{ + g_functionSet = ImguiFunctionSet{}; +} + +// Generate the patches +LOADER_IMGUI_GRAPH_FUNCTIONS(LOADER_FUNCTION_PTR_CALL, g_functionSet, ()) + + diff --git a/demo/d3d/loader.cpp b/demo/d3d/loader.cpp new file mode 100644 index 0000000..2ade2be --- /dev/null +++ b/demo/d3d/loader.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#include "loader.h" + +//#include <SDL.h> + +#include "imgui.h" + +void loadModules(AppGraphCtxType type) +{ + loadAppGraphCtx(type); + loadImgui(type); +} + +void unloadModules() +{ + unloadImgui(); + unloadAppGraphCtx(); +}
\ No newline at end of file diff --git a/demo/d3d/loader.h b/demo/d3d/loader.h new file mode 100644 index 0000000..1696001 --- /dev/null +++ b/demo/d3d/loader.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +enum AppGraphCtxType +{ + APP_CONTEXT_D3D11 = 1, + APP_CONTEXT_D3D12 = 2 +}; + +void loadModules(AppGraphCtxType type); +void unloadModules(); + +extern void loadImgui(AppGraphCtxType type); +extern void unloadImgui(); + +extern void loadAppGraphCtx(AppGraphCtxType type); +extern void unloadAppGraphCtx(); diff --git a/demo/d3d/loaderMacros.h b/demo/d3d/loaderMacros.h new file mode 100644 index 0000000..24b4999 --- /dev/null +++ b/demo/d3d/loaderMacros.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + #pragma once + +/// ----------------------------- Module Loader ----------------------------- + +#define LOADER_ESC_N(...) __VA_ARGS__ + +#define LOADER_PARAM_DECLARE(a, b) a b +#define LOADER_PARAM_NAME(a, b) b + +#define LOADER_ESC_PARAM0(PARAM, p0) +#define LOADER_ESC_PARAM1(PARAM, p0) PARAM p0 +#define LOADER_ESC_PARAM2(PARAM, p0, p1) PARAM p0, LOADER_ESC_PARAM1(PARAM, p1) +#define LOADER_ESC_PARAM3(PARAM, p0, p1, p2) PARAM p0, LOADER_ESC_PARAM2(PARAM, p1, p2) +#define LOADER_ESC_PARAM4(PARAM, p0, p1, p2, p3) PARAM p0, LOADER_ESC_PARAM3(PARAM, p1, p2, p3) +#define LOADER_ESC_PARAM5(PARAM, p0, p1, p2, p3, p4) PARAM p0, LOADER_ESC_PARAM4(PARAM, p1, p2, p3, p4) +#define LOADER_ESC_PARAM6(PARAM, p0, p1, p2, p3, p4, p5) PARAM p0, LOADER_ESC_PARAM5(PARAM, p1, p2, p3, p4, p5) +#define LOADER_ESC_PARAM7(PARAM, p0, p1, p2, p3, p4, p5, p6) PARAM p0, LOADER_ESC_PARAM6(PARAM, p1, p2, p3, p4, p5, p6) + +#define LOADER_ESC_MERGE(a, b) (a, b) + +#define LOADER_ESC(mode, numParams, params) \ + LOADER_ESC_PARAM##numParams LOADER_ESC_MERGE(mode, LOADER_ESC_N params) + +#define LOADER_DECLARE_FUNCTION_PTR(inst, inst_func, retType, method, numParams, params) \ + typedef retType (*method##_ptr_t)( LOADER_ESC (LOADER_PARAM_DECLARE, numParams, params) ); + +#define LOADER_DECLARE_FUNCTION_VAR(inst, inst_func, retType, method, numParams, params) \ + method##_ptr_t method##_ptr; + +#define LOADER_DECLARE_FUNCTION_NAME(inst, inst_func, retType, method, numParams, params) \ + extern retType inst_func(method) (LOADER_ESC (LOADER_PARAM_DECLARE, numParams, params) ); + +#define LOADER_SET_FUNCTION(inst, inst_func, retType, method, numParams, params) \ + inst.method##_ptr = inst_func(method); + + +#define LOADER_FUNCTION_PTR_CALL(inst, inst_func, retType, method, numParams, params) \ + retType method( LOADER_ESC (LOADER_PARAM_DECLARE, numParams, params) ) { \ + return inst.method##_ptr( LOADER_ESC (LOADER_PARAM_NAME, numParams, params) ); \ + } + +#define LOADER_LOAD_FUNCTION_PTR(inst, inst_func, retType, method, numParams, params) \ + inst->method##_ptr = (retType (*)( LOADER_ESC (LOADER_PARAM_DECLARE, numParams, params) ))(inst_func(inst, #method)); + +#define LOADER_CLEAR_FUNCTION_PTR(inst, inst_func, retType, method, numParams, params) \ + inst->method##_ptr = nullptr; + +#define LOADER_DECLARE_FUNCTION(inst, inst_func, retType, method, numParams, params) \ + retType method( LOADER_ESC (LOADER_PARAM_DECLARE, numParams, params) ); + +#define LOADER_FUNCTION_IMPL(inst, inst_func, retType, method, numParams, params) \ + retType method( LOADER_ESC (LOADER_PARAM_DECLARE, numParams, params) ) { \ + return method##Impl( LOADER_ESC (LOADER_PARAM_NAME, numParams, params) ); \ + } + diff --git a/demo/d3d/renderParamsD3D.cpp b/demo/d3d/renderParamsD3D.cpp new file mode 100644 index 0000000..22962ba --- /dev/null +++ b/demo/d3d/renderParamsD3D.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#include "renderParamsD3D.h" + +/* static */void RenderParamsUtilD3D::calcShadowParams(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, float shadowBias, ShadowParamsD3D* paramsOut) +{ + paramsOut->lightTransform = (DirectX::XMMATRIX&)(convertGLToD3DProjection(lightTransform)); + paramsOut->lightPos = (float3&)lightPos; + paramsOut->lightDir = (float3&)Normalize(lightTarget - lightPos); + paramsOut->bias = shadowBias; + + const Vec4 taps[] = + { + Vec2(-0.326212f,-0.40581f), Vec2(-0.840144f,-0.07358f), + Vec2(-0.695914f,0.457137f), Vec2(-0.203345f,0.620716f), + Vec2(0.96234f,-0.194983f), Vec2(0.473434f,-0.480026f), + Vec2(0.519456f,0.767022f), Vec2(0.185461f,-0.893124f), + Vec2(0.507431f,0.064425f), Vec2(0.89642f,0.412458f), + Vec2(-0.32194f,-0.932615f), Vec2(-0.791559f,-0.59771f) + }; + memcpy(paramsOut->shadowTaps, taps, sizeof(taps)); +} + +Matrix44 RenderParamsUtilD3D::convertGLToD3DProjection(const Matrix44& proj) +{ + Matrix44 scale = Matrix44::kIdentity; + scale.columns[2][2] = 0.5f; + + Matrix44 bias = Matrix44::kIdentity; + bias.columns[3][2] = 1.0f; + + return scale*bias*proj; +} + +/* static */void RenderParamsUtilD3D::calcMeshConstantBuffer(const MeshDrawParamsD3D& params, Hlsl::MeshShaderConst& constBuf) +{ + constBuf.modelViewProjection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params.model, params.view), params.projection)); + + constBuf.modelView = (float4x4&)XMMatrixMultiply(params.model, params.view); + + constBuf.objectTransform = (float4x4&)params.objectTransform; + constBuf.lightTransform = (float4x4&)params.lightTransform; + + constBuf.clipPlane = params.clipPlane; + constBuf.fogColor = params.fogColor; + constBuf.color = params.color; + constBuf.secondaryColor = params.secondaryColor; + + constBuf.lightPos = params.lightPos; + constBuf.lightDir = params.lightDir; + + constBuf.bias = params.bias; + constBuf.expand = params.expand; + constBuf.spotMin = params.spotMin; + constBuf.spotMax = params.spotMax; + + constBuf.grid = params.grid; + constBuf.tex = params.tex; + constBuf.colorArray = params.colorArray; + + memcpy(constBuf.shadowTaps, params.shadowTaps, sizeof(constBuf.shadowTaps)); +} + +/* static */void RenderParamsUtilD3D::calcFluidConstantBuffer(const FluidDrawParamsD3D& params, Hlsl::FluidShaderConst& constBuf) +{ + constBuf.modelViewProjection = (Hlsl::float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params.model, params.view), params.projection)); + constBuf.projection = (Hlsl::float4x4&)params.projection; + constBuf.inverseModelView = (Hlsl::float4x4&)XMMatrixInverse(nullptr, XMMatrixMultiply(params.model, params.view)); + constBuf.inverseProjection = (Hlsl::float4x4&)XMMatrixInverse(nullptr, params.projection); + + //constBuf.invTexScale = invTexScale; + //constBuf.invProjection = invProjection; + constBuf.invViewport = params.invViewport; + + constBuf.blurRadiusWorld = params.blurRadiusWorld; + constBuf.blurScale = params.blurScale; + constBuf.blurFalloff = params.blurFalloff; + constBuf.debug = params.debug; +} + +/* static */void RenderParamsUtilD3D::calcDiffuseConstantBuffer(const DiffuseDrawParamsD3D& params, Hlsl::DiffuseShaderConst& constBuf) +{ + using namespace DirectX; + + XMMATRIX modelViewProj = XMMatrixMultiply(XMMatrixMultiply(params.model, params.view), params.projection); + constBuf.modelViewProjection = (Hlsl::float4x4&)modelViewProj; + XMMATRIX modelView = XMMatrixMultiply(params.model, params.view); + constBuf.modelView = (Hlsl::float4x4&)modelView; + constBuf.projection = (Hlsl::float4x4&)params.projection; + + constBuf.motionBlurScale = params.motionScale; + constBuf.diffuseRadius = params.diffuseRadius; + constBuf.diffuseScale = params.diffuseScale; + constBuf.spotMin = params.spotMin; + constBuf.spotMax = params.spotMax; + + constBuf.lightTransform = (Hlsl::float4x4&)params.lightTransform; + constBuf.lightPos = params.lightPos; + constBuf.lightDir = params.lightDir; + constBuf.color = params.color; + + memcpy(constBuf.shadowTaps, params.shadowTaps, sizeof(constBuf.shadowTaps)); +} + +/* static */void RenderParamsUtilD3D::calcFluidCompositeConstantBuffer(const FluidDrawParamsD3D& params, Hlsl::FluidShaderConst& constBuf) +{ + constBuf.modelViewProjection = (Hlsl::float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params.model, params.view), params.projection)); + constBuf.modelView = (Hlsl::float4x4&)XMMatrixMultiply(params.model, params.view); + constBuf.projection = (Hlsl::float4x4&)params.projection; + constBuf.inverseModelView = (Hlsl::float4x4&)XMMatrixInverse(nullptr, XMMatrixMultiply(params.model, params.view)); + constBuf.inverseProjection = (Hlsl::float4x4&)XMMatrixInverse(nullptr, params.projection); + + constBuf.lightTransform = (Hlsl::float4x4&)params.lightTransform; + + constBuf.invTexScale = params.invTexScale; + + //constBuf.invViewport = params.invViewport; + //constBuf.invProjection = params.invProjection; + + constBuf.blurRadiusWorld = params.blurRadiusWorld; + constBuf.blurScale = params.blurScale; + constBuf.blurFalloff = params.blurFalloff; + constBuf.debug = params.debug; + + constBuf.clipPosToEye = params.clipPosToEye; + constBuf.color = params.color; + constBuf.ior = params.ior; + constBuf.spotMin = params.spotMin; + constBuf.spotMax = params.spotMax; + + constBuf.lightPos = params.lightPos; + constBuf.lightDir = params.lightDir; + + typedef DirectX::XMFLOAT2 float2; + const float2 taps[] = + { + float2(-0.326212f,-0.40581f), float2(-0.840144f,-0.07358f), + float2(-0.695914f,0.457137f), float2(-0.203345f,0.620716f), + float2(0.96234f,-0.194983f), float2(0.473434f,-0.480026f), + float2(0.519456f,0.767022f), float2(0.185461f,-0.893124f), + float2(0.507431f,0.064425f), float2(0.89642f,0.412458f), + float2(-0.32194f,-0.932615f), float2(-0.791559f,-0.59771f) + }; + memcpy(constBuf.shadowTaps, taps, sizeof(taps)); +} + +/* static */void RenderParamsUtilD3D::calcPointConstantBuffer(const PointDrawParamsD3D& params, Hlsl::PointShaderConst& constBuf) +{ + using namespace DirectX; + + constBuf.modelView = (float4x4&)XMMatrixMultiply(params.model, params.view); + constBuf.projection = (float4x4&)params.projection; + + constBuf.pointRadius = params.pointRadius; + constBuf.pointScale = params.pointScale; + constBuf.spotMin = params.spotMin; + constBuf.spotMax = params.spotMax; + + constBuf.lightTransform = (float4x4&)params.lightTransform; + constBuf.lightPos = params.lightPos; + constBuf.lightDir = params.lightDir; + + for (int i = 0; i < 8; i++) + constBuf.colors[i] = params.colors[i]; + + memcpy(constBuf.shadowTaps, params.shadowTaps, sizeof(constBuf.shadowTaps)); + + constBuf.mode = params.mode; +}
\ No newline at end of file diff --git a/demo/d3d/renderParamsD3D.h b/demo/d3d/renderParamsD3D.h new file mode 100644 index 0000000..0c730bc --- /dev/null +++ b/demo/d3d/renderParamsD3D.h @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#define NOMINMAX + +#include "core/maths.h" +#include <DirectXMath.h> + +#include "shaderCommonD3D.h" + +struct ShadowMapD3D; + +typedef DirectX::XMFLOAT3 float3; +typedef DirectX::XMFLOAT4 float4; +typedef DirectX::XMFLOAT4X4 float4x4; + +struct DiffuseDrawParamsD3D +{ + DirectX::XMMATRIX projection; + DirectX::XMMATRIX view; + DirectX::XMMATRIX model; + + float diffuseRadius; // point size in world space + float diffuseScale; // scale to calculate size in pixels + float spotMin; + float spotMax; + float motionScale; + + DirectX::XMMATRIX lightTransform; + float3 lightPos; + float3 lightDir; + + float4 color; + + float4 shadowTaps[12]; + ShadowMapD3D* shadowMap; + + int mode; +}; + +enum FluidRenderMode +{ + FLUID_RENDER_WIREFRAME, + FLUID_RENDER_SOLID, + NUM_FLUID_RENDER_MODES +}; + +enum FluidCullMode +{ + FLUID_CULL_NONE, + FLUID_CULL_FRONT, + FLUID_CULL_BACK, + NUM_FLUID_CULL_MODES +}; + +enum FluidDrawStage +{ + FLUID_DRAW_NULL, + FLUID_DRAW_SHADOW, + FLUID_DRAW_REFLECTION, + FLUID_DRAW_LIGHT +}; + +struct FluidDrawParamsD3D +{ + FluidRenderMode renderMode; + FluidCullMode cullMode; + FluidDrawStage renderStage; + + int offset; + int n; + + DirectX::XMMATRIX projection; + DirectX::XMMATRIX view; + DirectX::XMMATRIX model; + + float4 invTexScale; + + float3 invViewport; + float3 invProjection; + + float blurRadiusWorld; + float blurScale; + float blurFalloff; + int debug; + + float3 lightPos; + float3 lightDir; + DirectX::XMMATRIX lightTransform; + + float4 color; + float4 clipPosToEye; + + float spotMin; + float spotMax; + float ior; + + ShadowMapD3D* shadowMap; + + // Used on D3D12 + int m_srvDescriptorBase; + int m_sampleDescriptorBase; +}; + +enum MeshRenderMode +{ + MESH_RENDER_WIREFRAME, + MESH_RENDER_SOLID, + NUM_MESH_RENDER_MODES +}; + +enum MeshCullMode +{ + MESH_CULL_NONE, + MESH_CULL_FRONT, + MESH_CULL_BACK, + NUM_MESH_CULL_MODES +}; + +enum MeshDrawStage +{ + MESH_DRAW_NULL, + MESH_DRAW_SHADOW, + MESH_DRAW_REFLECTION, + MESH_DRAW_LIGHT +}; + +struct MeshDrawParamsD3D +{ + MeshRenderMode renderMode; + MeshCullMode cullMode; + MeshDrawStage renderStage; + + DirectX::XMMATRIX projection; + DirectX::XMMATRIX view; + DirectX::XMMATRIX model; + + float4x4 objectTransform; + + DirectX::XMMATRIX lightTransform; + float3 lightPos; + float3 lightDir; + + float4 clipPlane; + float4 fogColor; + float4 color; + float4 secondaryColor; + + float bias; + float expand; + float spotMin; + float spotMax; + + int grid; + int tex; + int colorArray; + + float4 shadowTaps[12]; + ShadowMapD3D* shadowMap; +}; + +enum PointRenderMode +{ + POINT_RENDER_WIREFRAME, + POINT_RENDER_SOLID, + NUM_POINT_RENDER_MODES +}; + +enum PointCullMode +{ + POINT_CULL_NONE, + POINT_CULL_FRONT, + POINT_CULL_BACK, + NUM_POINT_CULL_MODES +}; + +enum PointDrawStage +{ + POINT_DRAW_NULL, + POINT_DRAW_SHADOW, + POINT_DRAW_REFLECTION, + POINT_DRAW_LIGHT +}; + +struct PointDrawParamsD3D +{ + PointRenderMode renderMode; + PointCullMode cullMode; + PointDrawStage renderStage; + + DirectX::XMMATRIX projection; + DirectX::XMMATRIX view; + DirectX::XMMATRIX model; + + float pointRadius; // point size in world space + float pointScale; // scale to calculate size in pixels + float spotMin; + float spotMax; + + DirectX::XMMATRIX lightTransform; + float3 lightPos; + float3 lightDir; + + float4 colors[8]; + + float4 shadowTaps[12]; + ShadowMapD3D* shadowMap; + + int mode; +}; + +struct ShadowParamsD3D +{ + DirectX::XMMATRIX lightTransform; + float3 lightPos; + float3 lightDir; + float bias; + float4 shadowTaps[12]; +}; + +struct RenderParamsUtilD3D +{ + /// Assumes the lightTransform is in OpenGl projection format + static void calcShadowParams(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, float shadowBias, ShadowParamsD3D* paramsOut); + + /// Convert a projection from GL into the same projection as can be used by Direct3D + /// D3D has clip z range [0, 1], GL -1 to 1 (as is unit cube) + static Matrix44 convertGLToD3DProjection(const Matrix44& proj); + + static void calcMeshConstantBuffer(const MeshDrawParamsD3D& params, Hlsl::MeshShaderConst& constBufOut); + + static void calcFluidConstantBuffer(const FluidDrawParamsD3D& params, Hlsl::FluidShaderConst& constBuf); + + static void calcFluidCompositeConstantBuffer(const FluidDrawParamsD3D& params, Hlsl::FluidShaderConst& constBuf); + + static void calcDiffuseConstantBuffer(const DiffuseDrawParamsD3D& params, Hlsl::DiffuseShaderConst& constBuf); + + static void calcPointConstantBuffer(const PointDrawParamsD3D& params, Hlsl::PointShaderConst& constBuf); +}; diff --git a/demo/d3d/shaderCommonD3D.h b/demo/d3d/shaderCommonD3D.h new file mode 100644 index 0000000..e143d18 --- /dev/null +++ b/demo/d3d/shaderCommonD3D.h @@ -0,0 +1,19 @@ +#ifndef SHADER_COMMON_D3D_H +#define SHADER_COMMON_D3D_H + +#include <DirectXMath.h> + +struct ShadowMap; + +namespace Hlsl { + +typedef DirectX::XMFLOAT3 float3; +typedef DirectX::XMFLOAT4 float4; +typedef DirectX::XMFLOAT4X4 float4x4; + +#define EXCLUDE_SHADER_STRUCTS 1 +#include "../d3d/shaders/shaderCommon.h" + +} // namespace Shader + +#endif // SHADER_COMMON_D3D_H diff --git a/demo/d3d11/shaders/blurDepthPS.hlsl b/demo/d3d/shaders/blurDepthPS.hlsl index a2eee0a..c08d7f5 100644 --- a/demo/d3d11/shaders/blurDepthPS.hlsl +++ b/demo/d3d/shaders/blurDepthPS.hlsl @@ -9,29 +9,26 @@ Texture2D<float> depthTex : register(t0); float sqr(float x) { return x*x; } -float4 blurDepthPS(PassthroughVertexOut input) : SV_TARGET +float blurDepthPS(PassthroughVertexOut input) : SV_TARGET { - float4 gl_FragColor = float4(0.0, 0.0, 0.0, 0.0); - float4 gl_FragCoord = input.position; + float4 inPosition = input.position; // debug: return the center depth sample - //float d = depthTex.Load(int3(gl_FragCoord.xy, 0)).x; - //return d; - + //return depthTex.Load(int3(inPosition.xy, 0)).x; + const float blurRadiusWorld = gParams.blurRadiusWorld; const float blurScale = gParams.blurScale; const float blurFalloff = gParams.blurFalloff; // eye-space depth of center sample - float depth = depthTex.Load(int3(gl_FragCoord.xy, 0)).x; + float depth = depthTex.Load(int3(inPosition.xy, 0)).x; float thickness = 0.0f; //texture2D(thicknessTex, gl_TexCoord[0].xy).x; /* // threshold on thickness to create nice smooth silhouettes if (depth == 0.0) { - gl_FragColor.x = 0.0; - return gl_FragColor; + return 0.0f; } */ @@ -54,9 +51,7 @@ float4 blurDepthPS(PassthroughVertexOut input) : SV_TARGET for (float x = -taps; x <= taps; x += 1.0) { float2 offset = float2(x, y); - - //float sample = texture2DRect(depthTex, gl_FragCoord.xy + offset).x; - float sample = depthTex.Load(int3(gl_FragCoord.xy + offset, 0)).x; + float sample = depthTex.Load(int3(inPosition.xy + offset, 0)).x; //if (sample < -10000.0 * 0.5) //continue; @@ -85,7 +80,5 @@ float4 blurDepthPS(PassthroughVertexOut input) : SV_TARGET } float blend = count / sqr(2.0 * radius + 1.0); - gl_FragColor.x = lerp(depth, sum, blend); - - return gl_FragColor; + return lerp(depth, sum, blend); } diff --git a/demo/d3d11/shaders/blurDepthPS.hlsl.h b/demo/d3d/shaders/blurDepthPS.hlsl.h index ff191f8..ce5eec9 100644 --- a/demo/d3d11/shaders/blurDepthPS.hlsl.h +++ b/demo/d3d/shaders/blurDepthPS.hlsl.h @@ -11,11 +11,11 @@ // struct FluidShaderConst // { // -// float4x4 modelviewprojection; // Offset: 0 -// float4x4 modelview; // Offset: 64 +// float4x4 modelViewProjection; // Offset: 0 +// float4x4 modelView; // Offset: 64 // float4x4 projection; // Offset: 128 -// float4x4 modelview_inverse; // Offset: 192 -// float4x4 projection_inverse; // Offset: 256 +// float4x4 inverseModelView; // Offset: 192 +// float4x4 inverseProjection; // Offset: 256 // float4 invTexScale; // Offset: 320 // float3 invViewport; // Offset: 336 // float _pad0; // Offset: 348 @@ -62,14 +62,14 @@ // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw +// SV_TARGET 0 x 0 TARGET float x // ps_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer cb0[23], immediateIndexed dcl_resource_texture2d (float,float,float,float) t0 dcl_input_ps_siv linear noperspective v0.xy, position -dcl_output o0.xyzw +dcl_output o0.x dcl_temps 5 ftoi r0.xy, v0.xyxx mov r0.zw, l(0,0,0,0) @@ -129,28 +129,27 @@ mul r0.y, r0.y, r0.y div r0.y, r1.w, r0.y add r0.z, -r0.x, r0.z mad o0.x, r0.y, r0.z, r0.x -mov o0.yzw, l(0,0,0,0) ret -// Approximately 60 instruction slots used +// Approximately 59 instruction slots used #endif const BYTE g_blurDepthPS[] = { - 68, 88, 66, 67, 244, 233, - 190, 43, 161, 207, 241, 98, - 173, 248, 128, 15, 40, 190, - 66, 70, 1, 0, 0, 0, - 76, 12, 0, 0, 5, 0, + 68, 88, 66, 67, 25, 16, + 90, 102, 178, 215, 22, 204, + 41, 91, 183, 73, 123, 5, + 153, 37, 1, 0, 0, 0, + 40, 12, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, - 156, 4, 0, 0, 244, 4, - 0, 0, 40, 5, 0, 0, - 176, 11, 0, 0, 82, 68, - 69, 70, 96, 4, 0, 0, + 152, 4, 0, 0, 240, 4, + 0, 0, 36, 5, 0, 0, + 140, 11, 0, 0, 82, 68, + 69, 70, 92, 4, 0, 0, 1, 0, 0, 0, 144, 0, 0, 0, 2, 0, 0, 0, 60, 0, 0, 0, 0, 5, 255, 255, 0, 1, 0, 0, - 44, 4, 0, 0, 82, 68, + 40, 4, 0, 0, 82, 68, 49, 49, 60, 0, 0, 0, 24, 0, 0, 0, 32, 0, 0, 0, 40, 0, 0, 0, @@ -176,7 +175,7 @@ const BYTE g_blurDepthPS[] = 0, 0, 0, 0, 0, 0, 208, 0, 0, 0, 0, 0, 0, 0, 192, 2, 0, 0, - 2, 0, 0, 0, 8, 4, + 2, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, @@ -185,8 +184,8 @@ const BYTE g_blurDepthPS[] = 70, 108, 117, 105, 100, 83, 104, 97, 100, 101, 114, 67, 111, 110, 115, 116, 0, 109, - 111, 100, 101, 108, 118, 105, - 101, 119, 112, 114, 111, 106, + 111, 100, 101, 108, 86, 105, + 101, 119, 80, 114, 111, 106, 101, 99, 116, 105, 111, 110, 0, 102, 108, 111, 97, 116, 52, 120, 52, 0, 171, 171, @@ -196,447 +195,441 @@ const BYTE g_blurDepthPS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253, 0, 0, 0, - 109, 111, 100, 101, 108, 118, + 109, 111, 100, 101, 108, 86, 105, 101, 119, 0, 112, 114, 111, 106, 101, 99, 116, 105, - 111, 110, 0, 109, 111, 100, - 101, 108, 118, 105, 101, 119, - 95, 105, 110, 118, 101, 114, - 115, 101, 0, 112, 114, 111, + 111, 110, 0, 105, 110, 118, + 101, 114, 115, 101, 77, 111, + 100, 101, 108, 86, 105, 101, + 119, 0, 105, 110, 118, 101, + 114, 115, 101, 80, 114, 111, 106, 101, 99, 116, 105, 111, - 110, 95, 105, 110, 118, 101, - 114, 115, 101, 0, 105, 110, - 118, 84, 101, 120, 83, 99, - 97, 108, 101, 0, 102, 108, - 111, 97, 116, 52, 0, 171, - 171, 171, 1, 0, 3, 0, - 1, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, + 110, 0, 105, 110, 118, 84, + 101, 120, 83, 99, 97, 108, + 101, 0, 102, 108, 111, 97, + 116, 52, 0, 171, 1, 0, + 3, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 114, 1, - 0, 0, 105, 110, 118, 86, - 105, 101, 119, 112, 111, 114, - 116, 0, 102, 108, 111, 97, - 116, 51, 0, 171, 1, 0, - 3, 0, 1, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 112, 1, 0, 0, 105, 110, + 118, 86, 105, 101, 119, 112, + 111, 114, 116, 0, 102, 108, + 111, 97, 116, 51, 0, 171, + 1, 0, 3, 0, 1, 0, + 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 172, 1, 0, 0, 95, 112, - 97, 100, 48, 0, 102, 108, - 111, 97, 116, 0, 0, 0, - 3, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 168, 1, 0, 0, + 95, 112, 97, 100, 48, 0, + 102, 108, 111, 97, 116, 0, + 0, 0, 3, 0, 1, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 218, 1, 0, 0, + 98, 108, 117, 114, 82, 97, + 100, 105, 117, 115, 87, 111, + 114, 108, 100, 0, 98, 108, + 117, 114, 83, 99, 97, 108, + 101, 0, 98, 108, 117, 114, + 70, 97, 108, 108, 111, 102, + 102, 0, 100, 101, 98, 117, + 103, 0, 105, 110, 116, 0, + 0, 0, 2, 0, 1, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 2, 0, 0, + 108, 105, 103, 104, 116, 80, + 111, 115, 0, 95, 112, 97, + 100, 49, 0, 108, 105, 103, + 104, 116, 68, 105, 114, 0, + 95, 112, 97, 100, 50, 0, + 108, 105, 103, 104, 116, 84, + 114, 97, 110, 115, 102, 111, + 114, 109, 0, 99, 111, 108, + 111, 114, 0, 99, 108, 105, + 112, 80, 111, 115, 84, 111, + 69, 121, 101, 0, 115, 112, + 111, 116, 77, 105, 110, 0, + 115, 112, 111, 116, 77, 97, + 120, 0, 105, 111, 114, 0, + 95, 112, 97, 100, 51, 0, + 115, 104, 97, 100, 111, 119, + 84, 97, 112, 115, 0, 171, + 171, 171, 1, 0, 3, 0, + 1, 0, 4, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 222, 1, 0, 0, 98, 108, - 117, 114, 82, 97, 100, 105, - 117, 115, 87, 111, 114, 108, - 100, 0, 98, 108, 117, 114, - 83, 99, 97, 108, 101, 0, - 98, 108, 117, 114, 70, 97, - 108, 108, 111, 102, 102, 0, - 100, 101, 98, 117, 103, 0, - 105, 110, 116, 0, 0, 0, - 2, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 112, 1, + 0, 0, 233, 0, 0, 0, + 8, 1, 0, 0, 0, 0, + 0, 0, 44, 1, 0, 0, + 8, 1, 0, 0, 64, 0, + 0, 0, 54, 1, 0, 0, + 8, 1, 0, 0, 128, 0, + 0, 0, 65, 1, 0, 0, + 8, 1, 0, 0, 192, 0, + 0, 0, 82, 1, 0, 0, + 8, 1, 0, 0, 0, 1, + 0, 0, 100, 1, 0, 0, + 120, 1, 0, 0, 64, 1, + 0, 0, 156, 1, 0, 0, + 176, 1, 0, 0, 80, 1, + 0, 0, 212, 1, 0, 0, + 224, 1, 0, 0, 92, 1, + 0, 0, 4, 2, 0, 0, + 224, 1, 0, 0, 96, 1, + 0, 0, 20, 2, 0, 0, + 224, 1, 0, 0, 100, 1, + 0, 0, 30, 2, 0, 0, + 224, 1, 0, 0, 104, 1, + 0, 0, 42, 2, 0, 0, + 52, 2, 0, 0, 108, 1, + 0, 0, 88, 2, 0, 0, + 176, 1, 0, 0, 112, 1, + 0, 0, 97, 2, 0, 0, + 224, 1, 0, 0, 124, 1, + 0, 0, 103, 2, 0, 0, + 176, 1, 0, 0, 128, 1, + 0, 0, 112, 2, 0, 0, + 224, 1, 0, 0, 140, 1, + 0, 0, 118, 2, 0, 0, + 8, 1, 0, 0, 144, 1, + 0, 0, 133, 2, 0, 0, + 120, 1, 0, 0, 208, 1, + 0, 0, 139, 2, 0, 0, + 120, 1, 0, 0, 224, 1, + 0, 0, 152, 2, 0, 0, + 224, 1, 0, 0, 240, 1, + 0, 0, 160, 2, 0, 0, + 224, 1, 0, 0, 244, 1, + 0, 0, 168, 2, 0, 0, + 224, 1, 0, 0, 248, 1, + 0, 0, 172, 2, 0, 0, + 224, 1, 0, 0, 252, 1, + 0, 0, 178, 2, 0, 0, + 192, 2, 0, 0, 0, 2, + 0, 0, 5, 0, 0, 0, + 1, 0, 176, 0, 0, 0, + 24, 0, 228, 2, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 216, 0, + 0, 0, 77, 105, 99, 114, + 111, 115, 111, 102, 116, 32, + 40, 82, 41, 32, 72, 76, + 83, 76, 32, 83, 104, 97, + 100, 101, 114, 32, 67, 111, + 109, 112, 105, 108, 101, 114, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 171, 171, + 73, 83, 71, 78, 80, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, + 15, 3, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, - 52, 2, 0, 0, 108, 105, - 103, 104, 116, 80, 111, 115, - 0, 95, 112, 97, 100, 49, - 0, 108, 105, 103, 104, 116, - 68, 105, 114, 0, 95, 112, - 97, 100, 50, 0, 108, 105, - 103, 104, 116, 84, 114, 97, - 110, 115, 102, 111, 114, 109, - 0, 99, 111, 108, 111, 114, - 0, 99, 108, 105, 112, 80, - 111, 115, 84, 111, 69, 121, - 101, 0, 115, 112, 111, 116, - 77, 105, 110, 0, 115, 112, - 111, 116, 77, 97, 120, 0, - 105, 111, 114, 0, 95, 112, - 97, 100, 51, 0, 115, 104, - 97, 100, 111, 119, 84, 97, - 112, 115, 0, 171, 171, 171, - 1, 0, 3, 0, 1, 0, - 4, 0, 12, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 114, 1, 0, 0, - 233, 0, 0, 0, 8, 1, - 0, 0, 0, 0, 0, 0, - 44, 1, 0, 0, 8, 1, - 0, 0, 64, 0, 0, 0, - 54, 1, 0, 0, 8, 1, - 0, 0, 128, 0, 0, 0, - 65, 1, 0, 0, 8, 1, - 0, 0, 192, 0, 0, 0, - 83, 1, 0, 0, 8, 1, - 0, 0, 0, 1, 0, 0, - 102, 1, 0, 0, 124, 1, - 0, 0, 64, 1, 0, 0, - 160, 1, 0, 0, 180, 1, - 0, 0, 80, 1, 0, 0, - 216, 1, 0, 0, 228, 1, - 0, 0, 92, 1, 0, 0, - 8, 2, 0, 0, 228, 1, - 0, 0, 96, 1, 0, 0, - 24, 2, 0, 0, 228, 1, - 0, 0, 100, 1, 0, 0, - 34, 2, 0, 0, 228, 1, - 0, 0, 104, 1, 0, 0, - 46, 2, 0, 0, 56, 2, - 0, 0, 108, 1, 0, 0, - 92, 2, 0, 0, 180, 1, - 0, 0, 112, 1, 0, 0, - 101, 2, 0, 0, 228, 1, - 0, 0, 124, 1, 0, 0, - 107, 2, 0, 0, 180, 1, - 0, 0, 128, 1, 0, 0, - 116, 2, 0, 0, 228, 1, - 0, 0, 140, 1, 0, 0, - 122, 2, 0, 0, 8, 1, - 0, 0, 144, 1, 0, 0, - 137, 2, 0, 0, 124, 1, - 0, 0, 208, 1, 0, 0, - 143, 2, 0, 0, 124, 1, - 0, 0, 224, 1, 0, 0, - 156, 2, 0, 0, 228, 1, - 0, 0, 240, 1, 0, 0, - 164, 2, 0, 0, 228, 1, - 0, 0, 244, 1, 0, 0, - 172, 2, 0, 0, 228, 1, - 0, 0, 248, 1, 0, 0, - 176, 2, 0, 0, 228, 1, - 0, 0, 252, 1, 0, 0, - 182, 2, 0, 0, 196, 2, - 0, 0, 0, 2, 0, 0, - 5, 0, 0, 0, 1, 0, - 176, 0, 0, 0, 24, 0, - 232, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 216, 0, 0, 0, - 77, 105, 99, 114, 111, 115, - 111, 102, 116, 32, 40, 82, - 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, - 114, 32, 67, 111, 109, 112, - 105, 108, 101, 114, 32, 54, - 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, - 52, 0, 171, 171, 73, 83, - 71, 78, 80, 0, 0, 0, - 2, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 3, - 0, 0, 68, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 83, 86, + 95, 80, 79, 83, 73, 84, + 73, 79, 78, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 171, 171, 79, 83, + 71, 78, 44, 0, 0, 0, + 1, 0, 0, 0, 8, 0, + 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 83, 86, 95, 80, - 79, 83, 73, 84, 73, 79, - 78, 0, 84, 69, 88, 67, - 79, 79, 82, 68, 0, 171, - 171, 171, 79, 83, 71, 78, - 44, 0, 0, 0, 1, 0, - 0, 0, 8, 0, 0, 0, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 83, 86, 95, 84, 65, 82, - 71, 69, 84, 0, 171, 171, - 83, 72, 69, 88, 128, 6, - 0, 0, 80, 0, 0, 0, - 160, 1, 0, 0, 106, 8, - 0, 1, 89, 0, 0, 4, - 70, 142, 32, 0, 0, 0, - 0, 0, 23, 0, 0, 0, - 88, 24, 0, 4, 0, 112, + 0, 0, 0, 0, 1, 14, + 0, 0, 83, 86, 95, 84, + 65, 82, 71, 69, 84, 0, + 171, 171, 83, 72, 69, 88, + 96, 6, 0, 0, 80, 0, + 0, 0, 152, 1, 0, 0, + 106, 8, 0, 1, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 100, 32, 0, 4, 50, 16, 16, 0, 0, 0, 0, 0, - 85, 85, 0, 0, 100, 32, - 0, 4, 50, 16, 16, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 0, 0, - 0, 0, 104, 0, 0, 2, - 5, 0, 0, 0, 27, 0, - 0, 5, 50, 0, 16, 0, - 0, 0, 0, 0, 70, 16, - 16, 0, 0, 0, 0, 0, - 54, 0, 0, 8, 194, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 18, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 5, 0, 0, 0, + 27, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, + 70, 16, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 8, + 194, 0, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 45, 0, 0, 137, - 194, 0, 0, 128, 67, 85, - 21, 0, 18, 0, 16, 0, - 0, 0, 0, 0, 70, 14, + 0, 0, 0, 0, 45, 0, + 0, 137, 194, 0, 0, 128, + 67, 85, 21, 0, 18, 0, 16, 0, 0, 0, 0, 0, - 70, 126, 16, 0, 0, 0, - 0, 0, 14, 0, 0, 9, - 34, 0, 16, 0, 0, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 22, 0, - 0, 0, 10, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 56, 0, 0, 8, - 34, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 26, 128, + 70, 14, 16, 0, 0, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 14, 0, + 0, 9, 34, 0, 16, 0, + 0, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 51, 0, - 0, 7, 34, 0, 16, 0, + 22, 0, 0, 0, 10, 0, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 34, 0, 16, 0, 0, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 160, 64, 14, 0, 0, 10, - 66, 0, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, + 26, 128, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 51, 0, 0, 7, 34, 0, + 16, 0, 0, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 160, 64, 14, 0, + 0, 10, 66, 0, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, - 0, 0, 128, 63, 26, 0, - 16, 0, 0, 0, 0, 0, - 66, 0, 0, 5, 130, 0, - 16, 0, 0, 0, 0, 0, 26, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 8, - 18, 0, 16, 0, 1, 0, - 0, 0, 26, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 8, 194, 0, 16, 0, - 2, 0, 0, 0, 2, 64, + 0, 0, 66, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 0, 0, + 0, 8, 18, 0, 16, 0, + 1, 0, 0, 0, 26, 0, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 8, 194, 0, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 54, 0, 0, 8, 226, 0, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 8, + 226, 0, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 54, 0, + 0, 6, 34, 0, 16, 0, + 3, 0, 0, 0, 58, 0, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 1, 49, 0, 0, 7, + 66, 0, 16, 0, 3, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 3, 0, 0, 0, + 3, 0, 4, 3, 42, 0, + 16, 0, 3, 0, 0, 0, + 54, 0, 0, 5, 114, 0, + 16, 0, 4, 0, 0, 0, + 150, 7, 16, 0, 1, 0, 0, 0, 54, 0, 0, 6, - 34, 0, 16, 0, 3, 0, + 130, 0, 16, 0, 4, 0, 0, 0, 58, 0, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 1, 49, 0, 0, 7, 66, 0, 16, 0, 3, 0, 0, 0, 58, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 3, 0, 0, 0, 3, 0, + 0, 0, 58, 0, 16, 0, + 4, 0, 0, 0, 3, 0, 4, 3, 42, 0, 16, 0, 3, 0, 0, 0, 54, 0, - 0, 5, 114, 0, 16, 0, - 4, 0, 0, 0, 150, 7, - 16, 0, 1, 0, 0, 0, - 54, 0, 0, 6, 130, 0, - 16, 0, 4, 0, 0, 0, - 58, 0, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 48, 0, 0, 1, 49, 0, - 0, 7, 66, 0, 16, 0, + 0, 5, 18, 0, 16, 0, 3, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 4, 0, - 0, 0, 3, 0, 4, 3, - 42, 0, 16, 0, 3, 0, - 0, 0, 54, 0, 0, 5, - 18, 0, 16, 0, 3, 0, - 0, 0, 58, 0, 16, 0, - 4, 0, 0, 0, 0, 0, - 0, 7, 194, 0, 16, 0, - 3, 0, 0, 0, 6, 4, + 16, 0, 4, 0, 0, 0, + 0, 0, 0, 7, 194, 0, 16, 0, 3, 0, 0, 0, - 6, 20, 16, 0, 0, 0, - 0, 0, 27, 0, 0, 5, - 50, 0, 16, 0, 2, 0, - 0, 0, 230, 10, 16, 0, - 3, 0, 0, 0, 45, 0, - 0, 137, 194, 0, 0, 128, - 67, 85, 21, 0, 18, 0, - 16, 0, 2, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 70, 126, 16, 0, - 0, 0, 0, 0, 15, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 70, 0, + 6, 4, 16, 0, 3, 0, + 0, 0, 6, 20, 16, 0, + 0, 0, 0, 0, 27, 0, + 0, 5, 50, 0, 16, 0, + 2, 0, 0, 0, 230, 10, 16, 0, 3, 0, 0, 0, + 45, 0, 0, 137, 194, 0, + 0, 128, 67, 85, 21, 0, + 18, 0, 16, 0, 2, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 15, 0, 0, 7, 34, 0, + 16, 0, 2, 0, 0, 0, 70, 0, 16, 0, 3, 0, - 0, 0, 75, 0, 0, 5, - 34, 0, 16, 0, 2, 0, + 0, 0, 70, 0, 16, 0, + 3, 0, 0, 0, 75, 0, + 0, 5, 34, 0, 16, 0, + 2, 0, 0, 0, 26, 0, + 16, 0, 2, 0, 0, 0, + 56, 0, 0, 7, 34, 0, + 16, 0, 2, 0, 0, 0, + 42, 0, 16, 0, 0, 0, 0, 0, 26, 0, 16, 0, 2, 0, 0, 0, 56, 0, 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 26, 0, + 16, 0, 2, 0, 0, 0, 26, 0, 16, 0, 2, 0, 0, 0, 56, 0, 0, 7, 34, 0, 16, 0, 2, 0, 0, 0, 26, 0, 16, 0, - 2, 0, 0, 0, 26, 0, - 16, 0, 2, 0, 0, 0, - 56, 0, 0, 7, 34, 0, + 2, 0, 0, 0, 1, 64, + 0, 0, 59, 170, 184, 191, + 25, 0, 0, 5, 34, 0, 16, 0, 2, 0, 0, 0, 26, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 59, 170, 184, 191, 25, 0, - 0, 5, 34, 0, 16, 0, - 2, 0, 0, 0, 26, 0, - 16, 0, 2, 0, 0, 0, - 0, 0, 0, 8, 18, 0, + 0, 0, 0, 0, 0, 8, + 18, 0, 16, 0, 3, 0, + 0, 0, 10, 0, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 7, 18, 0, 16, 0, + 3, 0, 0, 0, 10, 0, 16, 0, 3, 0, 0, 0, - 10, 0, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 2, 0, - 0, 0, 56, 0, 0, 7, + 1, 64, 0, 0, 0, 0, + 176, 64, 56, 0, 0, 7, 18, 0, 16, 0, 3, 0, 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 176, 64, + 3, 0, 0, 0, 10, 0, + 16, 0, 3, 0, 0, 0, 56, 0, 0, 7, 18, 0, 16, 0, 3, 0, 0, 0, 10, 0, 16, 0, 3, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 56, 0, - 0, 7, 18, 0, 16, 0, + 0, 0, 1, 64, 0, 0, + 59, 170, 184, 191, 25, 0, + 0, 5, 18, 0, 16, 0, 3, 0, 0, 0, 10, 0, 16, 0, 3, 0, 0, 0, - 1, 64, 0, 0, 59, 170, - 184, 191, 25, 0, 0, 5, - 18, 0, 16, 0, 3, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 52, 0, - 0, 9, 66, 0, 16, 0, - 3, 0, 0, 0, 26, 0, - 16, 128, 129, 0, 0, 0, - 3, 0, 0, 0, 58, 0, - 16, 128, 129, 0, 0, 0, - 4, 0, 0, 0, 29, 0, + 52, 0, 0, 9, 66, 0, + 16, 0, 3, 0, 0, 0, + 26, 0, 16, 128, 129, 0, + 0, 0, 3, 0, 0, 0, + 58, 0, 16, 128, 129, 0, + 0, 0, 4, 0, 0, 0, + 29, 0, 0, 7, 66, 0, + 16, 0, 3, 0, 0, 0, + 42, 0, 16, 0, 3, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 1, 0, 0, 7, 66, 0, 16, 0, 3, 0, 0, 0, 42, 0, 16, 0, 3, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 1, 0, 0, 7, + 1, 64, 0, 0, 0, 0, + 128, 63, 50, 0, 0, 10, 66, 0, 16, 0, 3, 0, - 0, 0, 42, 0, 16, 0, - 3, 0, 0, 0, 1, 64, + 0, 0, 42, 0, 16, 128, + 65, 0, 0, 0, 3, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, - 50, 0, 0, 10, 66, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 128, 65, 0, - 0, 0, 3, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 7, 18, 0, 16, 0, - 2, 0, 0, 0, 26, 0, + 56, 0, 0, 7, 18, 0, 16, 0, 2, 0, 0, 0, + 26, 0, 16, 0, 2, 0, + 0, 0, 10, 0, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 7, 18, 0, 16, 0, + 2, 0, 0, 0, 10, 0, + 16, 0, 3, 0, 0, 0, 10, 0, 16, 0, 2, 0, + 0, 0, 50, 0, 0, 9, + 18, 0, 16, 0, 4, 0, + 0, 0, 10, 0, 16, 0, + 2, 0, 0, 0, 42, 0, + 16, 0, 3, 0, 0, 0, + 10, 0, 16, 0, 4, 0, 0, 0, 56, 0, 0, 7, 18, 0, 16, 0, 2, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 10, 0, - 16, 0, 2, 0, 0, 0, - 50, 0, 0, 9, 18, 0, + 0, 0, 26, 0, 16, 0, + 2, 0, 0, 0, 10, 0, + 16, 0, 3, 0, 0, 0, + 50, 0, 0, 9, 34, 0, 16, 0, 4, 0, 0, 0, 10, 0, 16, 0, 2, 0, 0, 0, 42, 0, 16, 0, - 3, 0, 0, 0, 10, 0, + 3, 0, 0, 0, 26, 0, 16, 0, 4, 0, 0, 0, - 56, 0, 0, 7, 18, 0, - 16, 0, 2, 0, 0, 0, - 26, 0, 16, 0, 2, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 50, 0, - 0, 9, 34, 0, 16, 0, - 4, 0, 0, 0, 10, 0, - 16, 0, 2, 0, 0, 0, - 42, 0, 16, 0, 3, 0, - 0, 0, 26, 0, 16, 0, - 4, 0, 0, 0, 50, 0, - 0, 9, 66, 0, 16, 0, - 4, 0, 0, 0, 10, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 3, 0, + 50, 0, 0, 9, 66, 0, + 16, 0, 4, 0, 0, 0, + 10, 0, 16, 0, 3, 0, 0, 0, 42, 0, 16, 0, - 4, 0, 0, 0, 0, 0, - 0, 7, 130, 0, 16, 0, - 4, 0, 0, 0, 58, 0, + 3, 0, 0, 0, 42, 0, 16, 0, 4, 0, 0, 0, + 0, 0, 0, 7, 130, 0, + 16, 0, 4, 0, 0, 0, + 58, 0, 16, 0, 4, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 22, 0, + 0, 1, 54, 0, 0, 5, + 226, 0, 16, 0, 1, 0, + 0, 0, 6, 9, 16, 0, + 4, 0, 0, 0, 0, 0, + 0, 7, 34, 0, 16, 0, + 3, 0, 0, 0, 26, 0, + 16, 0, 3, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 22, 0, 0, 1, - 54, 0, 0, 5, 226, 0, + 49, 0, 0, 7, 66, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 1, 0, 0, 0, 14, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 26, 0, 16, 0, 1, 0, 0, 0, - 6, 9, 16, 0, 4, 0, - 0, 0, 0, 0, 0, 7, - 34, 0, 16, 0, 3, 0, + 42, 0, 16, 0, 1, 0, + 0, 0, 55, 0, 0, 9, + 66, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 26, 0, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 9, + 34, 0, 16, 0, 0, 0, 0, 0, 26, 0, 16, 0, - 3, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 22, 0, 0, 1, 49, 0, - 0, 7, 66, 0, 16, 0, 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 14, 0, 0, 7, - 130, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 64, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 7, + 34, 0, 16, 0, 0, 0, 0, 0, 26, 0, 16, 0, - 1, 0, 0, 0, 42, 0, - 16, 0, 1, 0, 0, 0, - 55, 0, 0, 9, 66, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 26, 0, - 16, 0, 1, 0, 0, 0, - 50, 0, 0, 9, 34, 0, 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 64, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 7, 34, 0, + 14, 0, 0, 7, 34, 0, 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, + 58, 0, 16, 0, 1, 0, 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 14, 0, - 0, 7, 34, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 8, 66, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 9, 18, 32, + 16, 0, 0, 0, 0, 0, 26, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 8, - 66, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 128, - 65, 0, 0, 0, 0, 0, 0, 0, 42, 0, 16, 0, - 0, 0, 0, 0, 50, 0, - 0, 9, 18, 32, 16, 0, - 0, 0, 0, 0, 26, 0, + 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 8, 226, 32, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 148, 0, 0, 0, - 60, 0, 0, 0, 5, 0, + 59, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, @@ -648,7 +641,7 @@ const BYTE g_blurDepthPS[] = 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 0, + 0, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/demo/d3d11/shaders/compositePS.hlsl b/demo/d3d/shaders/compositePS.hlsl index b082aa6..6e8bb6a 100644 --- a/demo/d3d11/shaders/compositePS.hlsl +++ b/demo/d3d/shaders/compositePS.hlsl @@ -44,9 +44,7 @@ float shadowSample(float3 worldPos, out float attenuation) { float2 shadowTaps = gParams.shadowTaps[i].xy; shadowTaps.y = 1.0f - shadowTaps.y; - s += shadowTex.SampleCmpLevelZero(shadowSampler, uvw.xy + shadowTaps * radius, uvw.z); - - //s += shadow2D(shadowTex, vec3(uvw.xy + shadowTaps[i] * radius, uvw.z)).r; + s += shadowTex.SampleCmp(shadowSampler, uvw.xy + shadowTaps * radius, uvw.z); } s /= 8.0; @@ -71,16 +69,11 @@ float3 linearToSrgb(float3 c) { const float v = 1.0 / 2.2; return pow(c, float3( float sqr(float x) { return x*x; } float cube(float x) { return x*x*x; } -float4 compositePS(PassthroughVertexOut input - , out float gl_FragDepth : SV_DEPTH -) : SV_TARGET +float4 compositePS(PassthroughVertexOut input, out float depthOut : SV_DEPTH) : SV_TARGET { - - float4 gl_FragColor; - - const float4x4 gl_ProjectionMatrix = gParams.projection; - const float4x4 gl_ModelViewMatrix = gParams.modelview; - const float4x4 gl_ModelViewMatrixInverse = gParams.modelview_inverse; + const float4x4 projectionMatrix = gParams.projection; + const float4x4 modelViewMatrix = gParams.modelView; + const float4x4 modelViewMatrixInverse = gParams.inverseModelView; const float2 invTexScale = gParams.invTexScale.xy; @@ -92,7 +85,7 @@ float4 compositePS(PassthroughVertexOut input const float4 color = gParams.color; // flip uv y-coordinate - float2 uvCoord = float2(input.texCoord[0].x, 1.0f-input.texCoord[0].y); + float2 uvCoord = float2(input.texCoord.x, 1.0f-input.texCoord.y); float eyeZ = depthTex.Sample(texSampler, uvCoord).x; @@ -102,7 +95,6 @@ float4 compositePS(PassthroughVertexOut input // reconstruct eye space pos from depth float3 eyePos = viewportToEyeSpace(uvCoord, eyeZ); - // finite difference approx for normals, can't take dFdx because // the one-sided difference is incorrect at shape boundaries float3 zl = eyePos - viewportToEyeSpace(uvCoord - float2(invTexScale.x, 0.0), depthTex.Sample(texSampler, uvCoord - float2(invTexScale.x, 0.0)).x); @@ -118,17 +110,16 @@ float4 compositePS(PassthroughVertexOut input if (abs(zb.z) < abs(zt.z)) dy = zb; - //float3 dx = ddx(eyePos.xyz); //float3 dy = -ddy(eyePos.xyz); - float4 worldPos = mul(gl_ModelViewMatrixInverse, float4(eyePos, 1.0)); + float4 worldPos = mul(modelViewMatrixInverse, float4(eyePos, 1.0)); float attenuation; float shadow = shadowSample(worldPos.xyz, attenuation); - float3 l = mul(gl_ModelViewMatrix, float4(lightDir, 0.0)).xyz; + float3 l = mul(modelViewMatrix, float4(lightDir, 0.0)).xyz; float3 v = -normalize(eyePos); float3 n = -normalize(cross(dx, dy)); // sign difference from texcoord coordinate difference between OpenGL @@ -144,7 +135,7 @@ float4 compositePS(PassthroughVertexOut input float ln = dot(l, n)*attenuation; float3 rEye = reflect(-v, n).xyz; - float3 rWorld = mul(gl_ModelViewMatrixInverse, float4(rEye, 0.0)).xyz; + float3 rWorld = mul(modelViewMatrixInverse, float4(rEye, 0.0)).xyz; float2 texScale = float2(0.75, 1.0); // to account for backbuffer aspect ratio (todo: pass in) @@ -175,20 +166,17 @@ float4 compositePS(PassthroughVertexOut input // lighting float3 diffuse = color.xyz * lerp(float3(0.29, 0.379, 0.59), float3(1.0, 1.0, 1.0), (ln*0.5 + 0.5)*max(shadow, 0.4))*(1.0 - color.w); float specular = 1.2*pow(max(dot(h, n), 0.0), 400.0); - - gl_FragColor.xyz = diffuse + (lerp(refract, reflect, fresnel) + specular)*color.w; - gl_FragColor.w = 1.0; - - // visualize normals - //gl_FragColor = float4(n*0.5 + 0.5, 1.0); - //gl_FragColor.xyz = float3(fresnel, fresnel, fresnel); - //gl_FragColor.xyz = n; - + // write valid z - float4 clipPos = mul(gl_ProjectionMatrix, float4(0.0, 0.0, eyeZ, 1.0)); + float4 clipPos = mul(projectionMatrix, float4(0.0, 0.0, eyeZ, 1.0)); clipPos.z /= clipPos.w; - gl_FragDepth = clipPos.z; - - return gl_FragColor; + depthOut = clipPos.z; + // visualize normals + //return float4(n*0.5 + 0.5, 1.0); + //return float4(fresnel, fresnel, fresnel, 0); + //return float4(n, 1); + + // Color + return float4(diffuse + (lerp(refract, reflect, fresnel) + specular)*color.w, 1.0); } diff --git a/demo/d3d11/shaders/compositePS.hlsl.h b/demo/d3d/shaders/compositePS.hlsl.h index 77d3814..76f4c49 100644 --- a/demo/d3d11/shaders/compositePS.hlsl.h +++ b/demo/d3d/shaders/compositePS.hlsl.h @@ -11,11 +11,11 @@ // struct FluidShaderConst // { // -// float4x4 modelviewprojection; // Offset: 0 -// float4x4 modelview; // Offset: 64 +// float4x4 modelViewProjection; // Offset: 0 +// float4x4 modelView; // Offset: 64 // float4x4 projection; // Offset: 128 -// float4x4 modelview_inverse; // Offset: 192 -// float4x4 projection_inverse; // Offset: 256 +// float4x4 inverseModelView; // Offset: 192 +// float4x4 inverseProjection; // Offset: 256 // float4 invTexScale; // Offset: 320 // float3 invViewport; // Offset: 336 // float _pad0; // Offset: 348 @@ -136,59 +136,59 @@ mad r5.xyz, r4.xzwx, l(0.500000, 0.500000, 1.000000, 0.000000), l(0.500000, 0.50 lt r0.z, r5.x, l(0.000000) lt r0.w, l(1.000000), r5.x or r0.z, r0.w, r0.z +add r0.w, -cb0[32].y, l(1.000000) +mul r6.x, cb0[32].x, l(0.002000) +mul r6.y, r0.w, l(0.002000) +add r5.w, -r5.y, l(1.000000) +add r4.xz, r5.xxwx, r6.xxyx +sample_c_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z +add r1.w, -cb0[33].y, l(1.000000) +mul r6.x, cb0[33].x, l(0.002000) +mul r6.y, r1.w, l(0.002000) +add r4.xz, r5.xxwx, r6.xxyx +sample_c_indexable(texture2d)(float,float,float,float) r1.w, r4.xzxx, t2.xxxx, s1, r5.z +add r2.w, -cb0[34].y, l(1.000000) +mul r6.x, cb0[34].x, l(0.002000) +mul r6.y, r2.w, l(0.002000) +add r4.xz, r5.xxwx, r6.xxyx +sample_c_indexable(texture2d)(float,float,float,float) r2.w, r4.xzxx, t2.xxxx, s1, r5.z +add r3.w, -cb0[35].y, l(1.000000) +mul r6.x, cb0[35].x, l(0.002000) +mul r6.y, r3.w, l(0.002000) +add r4.xz, r5.xxwx, r6.xxyx +sample_c_indexable(texture2d)(float,float,float,float) r3.w, r4.xzxx, t2.xxxx, s1, r5.z +add r4.x, -cb0[36].y, l(1.000000) +mul r6.x, cb0[36].x, l(0.002000) +mul r6.y, r4.x, l(0.002000) +add r4.xz, r5.xxwx, r6.xxyx +sample_c_indexable(texture2d)(float,float,float,float) r4.x, r4.xzxx, t2.xxxx, s1, r5.z +add r4.z, -cb0[37].y, l(1.000000) +mul r6.x, cb0[37].x, l(0.002000) +mul r6.y, r4.z, l(0.002000) +add r4.zw, r5.xxxw, r6.xxxy +sample_c_indexable(texture2d)(float,float,float,float) r4.z, r4.zwzz, t2.xxxx, s1, r5.z +add r4.w, -cb0[38].y, l(1.000000) +mul r6.x, cb0[38].x, l(0.002000) +mul r6.y, r4.w, l(0.002000) +add r6.xy, r5.xwxx, r6.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r4.w, r6.xyxx, t2.xxxx, s1, r5.z +add r6.x, -cb0[39].y, l(1.000000) +mul r7.x, cb0[39].x, l(0.002000) +mul r7.y, r6.x, l(0.002000) +add r5.xw, r5.xxxw, r7.xxxy +sample_c_indexable(texture2d)(float,float,float,float) r5.x, r5.xwxx, t2.xxxx, s1, r5.z if_z r0.z lt r0.z, r5.y, l(0.000000) - lt r0.w, l(1.000000), r5.y - or r0.z, r0.w, r0.z + lt r5.y, l(1.000000), r5.y + or r0.z, r0.z, r5.y if_z r0.z - add r0.z, -cb0[32].y, l(1.000000) - mul r6.x, cb0[32].x, l(0.002000) - mul r6.y, r0.z, l(0.002000) - add r5.w, -r5.y, l(1.000000) - add r0.zw, r5.xxxw, r6.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.z, r0.zwzz, t2.xxxx, s1, r5.z - add r0.w, -cb0[33].y, l(1.000000) - mul r6.x, cb0[33].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[34].y, l(1.000000) - mul r6.x, cb0[34].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[35].y, l(1.000000) - mul r6.x, cb0[35].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[36].y, l(1.000000) - mul r6.x, cb0[36].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[37].y, l(1.000000) - mul r6.x, cb0[37].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[38].y, l(1.000000) - mul r6.x, cb0[38].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[39].y, l(1.000000) - mul r6.x, cb0[39].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z + add r0.z, r0.w, r1.w + add r0.z, r2.w, r0.z + add r0.z, r3.w, r0.z + add r0.z, r4.x, r0.z + add r0.z, r4.z, r0.z + add r0.z, r4.w, r0.z + add r0.z, r5.x, r0.z mul r0.z, r0.z, l(0.125000) else mov r0.z, l(1.000000) @@ -264,13 +264,13 @@ max r1.x, r1.x, l(0.000000) log r1.x, r1.x mul r1.x, r1.x, l(400.000000) exp r1.x, r1.x -mad r2.xyz, -r4.xyzx, r6.xyzx, r3.xyzx -mad r2.xyz, r0.wwww, r2.xyzx, r7.xyzx -mad r1.xyw, r1.xxxx, l(1.200000, 1.200000, 0.000000, 1.200000), r2.xyxz -mul r1.xyw, r1.xyxw, cb0[29].wwww -mad o0.xyz, r0.xyzx, r6.wwww, r1.xywx -mad r0.xy, cb0[10].zwzz, r1.zzzz, cb0[11].zwzz -div oDepth, r0.x, r0.y +mad r1.yz, cb0[10].zzwz, r1.zzzz, cb0[11].zzwz +div oDepth, r1.y, r1.z +mad r1.yzw, -r4.xxyz, r6.xxyz, r3.xxyz +mad r1.yzw, r0.wwww, r1.yyzw, r7.xxyz +mad r1.xyz, r1.xxxx, l(1.200000, 1.200000, 1.200000, 0.000000), r1.yzwy +mul r1.xyz, r1.xyzx, cb0[29].wwww +mad o0.xyz, r0.xyzx, r6.wwww, r1.xyzx mov o0.w, l(1.000000) ret // Approximately 192 instruction slots used @@ -278,21 +278,21 @@ ret const BYTE g_compositePS[] = { - 68, 88, 66, 67, 223, 79, - 142, 103, 26, 30, 227, 152, - 95, 75, 188, 26, 149, 14, - 233, 77, 1, 0, 0, 0, - 232, 31, 0, 0, 5, 0, + 68, 88, 66, 67, 88, 43, + 70, 135, 189, 112, 158, 157, + 120, 182, 250, 215, 210, 92, + 57, 163, 1, 0, 0, 0, + 228, 31, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, - 72, 5, 0, 0, 160, 5, - 0, 0, 244, 5, 0, 0, - 76, 31, 0, 0, 82, 68, - 69, 70, 12, 5, 0, 0, + 68, 5, 0, 0, 156, 5, + 0, 0, 240, 5, 0, 0, + 72, 31, 0, 0, 82, 68, + 69, 70, 8, 5, 0, 0, 1, 0, 0, 0, 60, 1, 0, 0, 6, 0, 0, 0, 60, 0, 0, 0, 0, 5, 255, 255, 0, 1, 0, 0, - 216, 4, 0, 0, 82, 68, + 212, 4, 0, 0, 82, 68, 49, 49, 60, 0, 0, 0, 24, 0, 0, 0, 32, 0, 0, 0, 40, 0, 0, 0, @@ -347,7 +347,7 @@ const BYTE g_compositePS[] = 0, 0, 0, 0, 124, 1, 0, 0, 0, 0, 0, 0, 192, 2, 0, 0, 2, 0, - 0, 0, 180, 4, 0, 0, + 0, 0, 176, 4, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, @@ -356,8 +356,8 @@ const BYTE g_compositePS[] = 117, 105, 100, 83, 104, 97, 100, 101, 114, 67, 111, 110, 115, 116, 0, 109, 111, 100, - 101, 108, 118, 105, 101, 119, - 112, 114, 111, 106, 101, 99, + 101, 108, 86, 105, 101, 119, + 80, 114, 111, 106, 101, 99, 116, 105, 111, 110, 0, 102, 108, 111, 97, 116, 52, 120, 52, 0, 171, 171, 3, 0, @@ -367,256 +367,304 @@ const BYTE g_compositePS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 169, 1, 0, 0, 109, 111, - 100, 101, 108, 118, 105, 101, + 100, 101, 108, 86, 105, 101, 119, 0, 112, 114, 111, 106, 101, 99, 116, 105, 111, 110, - 0, 109, 111, 100, 101, 108, - 118, 105, 101, 119, 95, 105, - 110, 118, 101, 114, 115, 101, - 0, 112, 114, 111, 106, 101, - 99, 116, 105, 111, 110, 95, + 0, 105, 110, 118, 101, 114, + 115, 101, 77, 111, 100, 101, + 108, 86, 105, 101, 119, 0, 105, 110, 118, 101, 114, 115, - 101, 0, 105, 110, 118, 84, - 101, 120, 83, 99, 97, 108, - 101, 0, 102, 108, 111, 97, - 116, 52, 0, 171, 171, 171, - 1, 0, 3, 0, 1, 0, - 4, 0, 0, 0, 0, 0, + 101, 80, 114, 111, 106, 101, + 99, 116, 105, 111, 110, 0, + 105, 110, 118, 84, 101, 120, + 83, 99, 97, 108, 101, 0, + 102, 108, 111, 97, 116, 52, + 0, 171, 1, 0, 3, 0, + 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 30, 2, 0, 0, - 105, 110, 118, 86, 105, 101, - 119, 112, 111, 114, 116, 0, - 102, 108, 111, 97, 116, 51, - 0, 171, 1, 0, 3, 0, - 1, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 88, 2, - 0, 0, 95, 112, 97, 100, - 48, 0, 102, 108, 111, 97, - 116, 0, 0, 0, 3, 0, - 1, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 138, 2, - 0, 0, 98, 108, 117, 114, - 82, 97, 100, 105, 117, 115, - 87, 111, 114, 108, 100, 0, - 98, 108, 117, 114, 83, 99, - 97, 108, 101, 0, 98, 108, - 117, 114, 70, 97, 108, 108, - 111, 102, 102, 0, 100, 101, - 98, 117, 103, 0, 105, 110, - 116, 0, 0, 0, 2, 0, - 1, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 224, 2, - 0, 0, 108, 105, 103, 104, - 116, 80, 111, 115, 0, 95, - 112, 97, 100, 49, 0, 108, - 105, 103, 104, 116, 68, 105, - 114, 0, 95, 112, 97, 100, - 50, 0, 108, 105, 103, 104, - 116, 84, 114, 97, 110, 115, - 102, 111, 114, 109, 0, 99, - 111, 108, 111, 114, 0, 99, - 108, 105, 112, 80, 111, 115, - 84, 111, 69, 121, 101, 0, - 115, 112, 111, 116, 77, 105, - 110, 0, 115, 112, 111, 116, - 77, 97, 120, 0, 105, 111, - 114, 0, 95, 112, 97, 100, - 51, 0, 115, 104, 97, 100, - 111, 119, 84, 97, 112, 115, - 0, 171, 171, 171, 1, 0, - 3, 0, 1, 0, 4, 0, - 12, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 30, 2, 0, 0, 149, 1, - 0, 0, 180, 1, 0, 0, - 0, 0, 0, 0, 216, 1, - 0, 0, 180, 1, 0, 0, - 64, 0, 0, 0, 226, 1, - 0, 0, 180, 1, 0, 0, - 128, 0, 0, 0, 237, 1, - 0, 0, 180, 1, 0, 0, - 192, 0, 0, 0, 255, 1, - 0, 0, 180, 1, 0, 0, - 0, 1, 0, 0, 18, 2, - 0, 0, 40, 2, 0, 0, - 64, 1, 0, 0, 76, 2, - 0, 0, 96, 2, 0, 0, - 80, 1, 0, 0, 132, 2, - 0, 0, 144, 2, 0, 0, - 92, 1, 0, 0, 180, 2, - 0, 0, 144, 2, 0, 0, - 96, 1, 0, 0, 196, 2, - 0, 0, 144, 2, 0, 0, - 100, 1, 0, 0, 206, 2, - 0, 0, 144, 2, 0, 0, - 104, 1, 0, 0, 218, 2, - 0, 0, 228, 2, 0, 0, - 108, 1, 0, 0, 8, 3, - 0, 0, 96, 2, 0, 0, - 112, 1, 0, 0, 17, 3, - 0, 0, 144, 2, 0, 0, - 124, 1, 0, 0, 23, 3, - 0, 0, 96, 2, 0, 0, - 128, 1, 0, 0, 32, 3, - 0, 0, 144, 2, 0, 0, - 140, 1, 0, 0, 38, 3, - 0, 0, 180, 1, 0, 0, - 144, 1, 0, 0, 53, 3, - 0, 0, 40, 2, 0, 0, - 208, 1, 0, 0, 59, 3, - 0, 0, 40, 2, 0, 0, - 224, 1, 0, 0, 72, 3, - 0, 0, 144, 2, 0, 0, - 240, 1, 0, 0, 80, 3, - 0, 0, 144, 2, 0, 0, - 244, 1, 0, 0, 88, 3, - 0, 0, 144, 2, 0, 0, - 248, 1, 0, 0, 92, 3, - 0, 0, 144, 2, 0, 0, - 252, 1, 0, 0, 98, 3, - 0, 0, 112, 3, 0, 0, - 0, 2, 0, 0, 5, 0, - 0, 0, 1, 0, 176, 0, - 0, 0, 24, 0, 148, 3, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 132, 1, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, - 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, - 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, - 101, 114, 32, 54, 46, 51, - 46, 57, 54, 48, 48, 46, - 49, 54, 51, 56, 52, 0, - 171, 171, 73, 83, 71, 78, - 80, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 28, 2, + 0, 0, 105, 110, 118, 86, + 105, 101, 119, 112, 111, 114, + 116, 0, 102, 108, 111, 97, + 116, 51, 0, 171, 1, 0, + 3, 0, 1, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 84, 2, 0, 0, 95, 112, + 97, 100, 48, 0, 102, 108, + 111, 97, 116, 0, 0, 0, + 3, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 134, 2, 0, 0, 98, 108, + 117, 114, 82, 97, 100, 105, + 117, 115, 87, 111, 114, 108, + 100, 0, 98, 108, 117, 114, + 83, 99, 97, 108, 101, 0, + 98, 108, 117, 114, 70, 97, + 108, 108, 111, 102, 102, 0, + 100, 101, 98, 117, 103, 0, + 105, 110, 116, 0, 0, 0, + 2, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 220, 2, 0, 0, 108, 105, + 103, 104, 116, 80, 111, 115, + 0, 95, 112, 97, 100, 49, + 0, 108, 105, 103, 104, 116, + 68, 105, 114, 0, 95, 112, + 97, 100, 50, 0, 108, 105, + 103, 104, 116, 84, 114, 97, + 110, 115, 102, 111, 114, 109, + 0, 99, 111, 108, 111, 114, + 0, 99, 108, 105, 112, 80, + 111, 115, 84, 111, 69, 121, + 101, 0, 115, 112, 111, 116, + 77, 105, 110, 0, 115, 112, + 111, 116, 77, 97, 120, 0, + 105, 111, 114, 0, 95, 112, + 97, 100, 51, 0, 115, 104, + 97, 100, 111, 119, 84, 97, + 112, 115, 0, 171, 171, 171, + 1, 0, 3, 0, 1, 0, + 4, 0, 12, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 28, 2, 0, 0, + 149, 1, 0, 0, 180, 1, + 0, 0, 0, 0, 0, 0, + 216, 1, 0, 0, 180, 1, + 0, 0, 64, 0, 0, 0, + 226, 1, 0, 0, 180, 1, + 0, 0, 128, 0, 0, 0, + 237, 1, 0, 0, 180, 1, + 0, 0, 192, 0, 0, 0, + 254, 1, 0, 0, 180, 1, + 0, 0, 0, 1, 0, 0, + 16, 2, 0, 0, 36, 2, + 0, 0, 64, 1, 0, 0, + 72, 2, 0, 0, 92, 2, + 0, 0, 80, 1, 0, 0, + 128, 2, 0, 0, 140, 2, + 0, 0, 92, 1, 0, 0, + 176, 2, 0, 0, 140, 2, + 0, 0, 96, 1, 0, 0, + 192, 2, 0, 0, 140, 2, + 0, 0, 100, 1, 0, 0, + 202, 2, 0, 0, 140, 2, + 0, 0, 104, 1, 0, 0, + 214, 2, 0, 0, 224, 2, + 0, 0, 108, 1, 0, 0, + 4, 3, 0, 0, 92, 2, + 0, 0, 112, 1, 0, 0, + 13, 3, 0, 0, 140, 2, + 0, 0, 124, 1, 0, 0, + 19, 3, 0, 0, 92, 2, + 0, 0, 128, 1, 0, 0, + 28, 3, 0, 0, 140, 2, + 0, 0, 140, 1, 0, 0, + 34, 3, 0, 0, 180, 1, + 0, 0, 144, 1, 0, 0, + 49, 3, 0, 0, 36, 2, + 0, 0, 208, 1, 0, 0, + 55, 3, 0, 0, 36, 2, + 0, 0, 224, 1, 0, 0, + 68, 3, 0, 0, 140, 2, + 0, 0, 240, 1, 0, 0, + 76, 3, 0, 0, 140, 2, + 0, 0, 244, 1, 0, 0, + 84, 3, 0, 0, 140, 2, + 0, 0, 248, 1, 0, 0, + 88, 3, 0, 0, 140, 2, + 0, 0, 252, 1, 0, 0, + 94, 3, 0, 0, 108, 3, + 0, 0, 0, 2, 0, 0, + 5, 0, 0, 0, 1, 0, + 176, 0, 0, 0, 24, 0, + 144, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 132, 1, 0, 0, + 77, 105, 99, 114, 111, 115, + 111, 102, 116, 32, 40, 82, + 41, 32, 72, 76, 83, 76, + 32, 83, 104, 97, 100, 101, + 114, 32, 67, 111, 109, 112, + 105, 108, 101, 114, 32, 54, + 46, 51, 46, 57, 54, 48, + 48, 46, 49, 54, 51, 56, + 52, 0, 171, 171, 73, 83, + 71, 78, 80, 0, 0, 0, + 2, 0, 0, 0, 8, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 68, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 3, 3, + 0, 0, 83, 86, 95, 80, + 79, 83, 73, 84, 73, 79, + 78, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 171, + 171, 171, 79, 83, 71, 78, + 76, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, - 68, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 3, 3, 0, 0, - 83, 86, 95, 80, 79, 83, - 73, 84, 73, 79, 78, 0, - 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, - 79, 83, 71, 78, 76, 0, - 0, 0, 2, 0, 0, 0, - 8, 0, 0, 0, 56, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 66, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 255, 255, 255, 255, - 1, 14, 0, 0, 83, 86, - 95, 84, 65, 82, 71, 69, - 84, 0, 83, 86, 95, 68, - 69, 80, 84, 72, 0, 171, - 83, 72, 69, 88, 80, 25, - 0, 0, 80, 0, 0, 0, - 84, 6, 0, 0, 106, 8, - 0, 1, 89, 0, 0, 4, - 70, 142, 32, 0, 0, 0, - 0, 0, 40, 0, 0, 0, - 90, 0, 0, 3, 0, 96, - 16, 0, 0, 0, 0, 0, - 90, 8, 0, 3, 0, 96, - 16, 0, 1, 0, 0, 0, - 88, 24, 0, 4, 0, 112, - 16, 0, 0, 0, 0, 0, - 85, 85, 0, 0, 88, 24, - 0, 4, 0, 112, 16, 0, - 1, 0, 0, 0, 85, 85, + 66, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 255, 255, + 255, 255, 1, 14, 0, 0, + 83, 86, 95, 84, 65, 82, + 71, 69, 84, 0, 83, 86, + 95, 68, 69, 80, 84, 72, + 0, 171, 83, 72, 69, 88, + 80, 25, 0, 0, 80, 0, + 0, 0, 84, 6, 0, 0, + 106, 8, 0, 1, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 40, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 90, 8, 0, 3, + 0, 96, 16, 0, 1, 0, 0, 0, 88, 24, 0, 4, - 0, 112, 16, 0, 2, 0, + 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, - 98, 16, 0, 3, 50, 16, + 88, 24, 0, 4, 0, 112, 16, 0, 1, 0, 0, 0, - 101, 0, 0, 3, 242, 32, + 85, 85, 0, 0, 88, 24, + 0, 4, 0, 112, 16, 0, + 2, 0, 0, 0, 85, 85, + 0, 0, 98, 16, 0, 3, + 50, 16, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 2, + 1, 192, 0, 0, 104, 0, + 0, 2, 8, 0, 0, 0, + 50, 0, 0, 15, 50, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 191, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 128, 63, 0, 0, + 0, 0, 0, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 0, 16, 0, + 0, 0, 0, 0, 150, 124, 16, 0, 0, 0, 0, 0, - 101, 0, 0, 2, 1, 192, - 0, 0, 104, 0, 0, 2, - 8, 0, 0, 0, 50, 0, - 0, 15, 50, 0, 16, 0, - 0, 0, 0, 0, 70, 16, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 128, 63, 0, 0, 128, 191, + 0, 96, 16, 0, 0, 0, + 0, 0, 24, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, + 13, 0, 4, 3, 42, 0, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 15, 194, 0, + 16, 0, 0, 0, 0, 0, + 6, 20, 16, 0, 1, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, - 128, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 69, 0, - 0, 139, 194, 0, 0, 128, - 67, 85, 21, 0, 66, 0, - 16, 0, 1, 0, 0, 0, - 70, 0, 16, 0, 0, 0, - 0, 0, 150, 124, 16, 0, - 0, 0, 0, 0, 0, 96, + 0, 0, 0, 0, 0, 64, + 0, 0, 0, 64, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 128, 191, 0, 0, 128, 191, + 56, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, - 24, 0, 0, 7, 66, 0, + 166, 14, 16, 0, 0, 0, + 0, 0, 6, 132, 32, 0, + 0, 0, 0, 0, 30, 0, + 0, 0, 56, 0, 0, 8, + 50, 0, 16, 0, 1, 0, + 0, 0, 166, 10, 16, 0, + 1, 0, 0, 0, 230, 10, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 54, 0, + 0, 6, 34, 0, 16, 0, + 2, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 20, 0, 0, 0, 54, 0, + 0, 5, 66, 0, 16, 0, + 2, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 13, 0, - 4, 3, 42, 0, 16, 0, + 6, 4, 16, 0, 0, 0, + 0, 0, 86, 9, 16, 128, + 65, 0, 0, 0, 2, 0, + 0, 0, 69, 0, 0, 139, + 194, 0, 0, 128, 67, 85, + 21, 0, 18, 0, 16, 0, + 2, 0, 0, 0, 230, 10, + 16, 0, 0, 0, 0, 0, + 70, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 50, 0, 0, 15, 194, 0, 16, 0, - 0, 0, 0, 0, 6, 20, - 16, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 166, 14, + 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, - 0, 64, 2, 64, 0, 0, + 0, 192, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 191, - 0, 0, 128, 191, 56, 0, + 0, 0, 128, 63, 56, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 166, 14, 16, 0, 0, 0, 0, 0, 6, 132, 32, 0, 0, 0, 0, 0, 30, 0, 0, 0, - 56, 0, 0, 8, 50, 0, - 16, 0, 1, 0, 0, 0, - 166, 10, 16, 0, 1, 0, - 0, 0, 230, 10, 16, 128, + 56, 0, 0, 8, 98, 0, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 2, 0, + 0, 0, 166, 11, 16, 128, 65, 0, 0, 0, 0, 0, - 0, 0, 54, 0, 0, 6, - 34, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 20, 0, - 0, 0, 54, 0, 0, 5, - 66, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 8, 194, 0, 16, 0, - 0, 0, 0, 0, 6, 4, + 0, 0, 0, 0, 0, 8, + 114, 0, 16, 0, 2, 0, + 0, 0, 38, 9, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 2, 0, 0, 0, 54, 0, + 0, 6, 34, 0, 16, 0, + 3, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 20, 0, 0, 0, 54, 0, + 0, 5, 66, 0, 16, 0, + 3, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 50, 0, 0, 12, 194, 0, 16, 0, 0, 0, 0, 0, - 86, 9, 16, 128, 65, 0, - 0, 0, 2, 0, 0, 0, + 6, 20, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 191, 86, 9, + 16, 0, 3, 0, 0, 0, 69, 0, 0, 139, 194, 0, 0, 128, 67, 85, 21, 0, - 18, 0, 16, 0, 2, 0, + 18, 0, 16, 0, 3, 0, 0, 0, 230, 10, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, @@ -638,79 +686,69 @@ const BYTE g_compositePS[] = 32, 0, 0, 0, 0, 0, 30, 0, 0, 0, 56, 0, 0, 8, 98, 0, 16, 0, - 2, 0, 0, 0, 6, 0, - 16, 0, 2, 0, 0, 0, + 3, 0, 0, 0, 6, 0, + 16, 0, 3, 0, 0, 0, 166, 11, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 114, 0, - 16, 0, 2, 0, 0, 0, - 38, 9, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 128, - 65, 0, 0, 0, 2, 0, - 0, 0, 54, 0, 0, 6, - 34, 0, 16, 0, 3, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 20, 0, + 16, 0, 3, 0, 0, 0, + 38, 9, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 3, 0, 0, 0, 54, 0, 0, 5, - 66, 0, 16, 0, 3, 0, + 66, 0, 16, 0, 4, 0, 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 50, 0, - 0, 12, 194, 0, 16, 0, - 0, 0, 0, 0, 6, 20, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 128, 63, 0, 0, - 128, 191, 86, 9, 16, 0, - 3, 0, 0, 0, 69, 0, - 0, 139, 194, 0, 0, 128, - 67, 85, 21, 0, 18, 0, - 16, 0, 3, 0, 0, 0, - 230, 10, 16, 0, 0, 0, - 0, 0, 70, 126, 16, 0, - 0, 0, 0, 0, 0, 96, + 0, 0, 0, 0, 54, 0, + 0, 6, 18, 0, 16, 0, + 4, 0, 0, 0, 26, 128, + 32, 0, 0, 0, 0, 0, + 20, 0, 0, 0, 0, 0, + 0, 7, 194, 0, 16, 0, + 0, 0, 0, 0, 86, 1, 16, 0, 0, 0, 0, 0, - 50, 0, 0, 15, 194, 0, + 6, 8, 16, 0, 4, 0, + 0, 0, 69, 0, 0, 139, + 194, 0, 0, 128, 67, 85, + 21, 0, 34, 0, 16, 0, + 5, 0, 0, 0, 182, 15, 16, 0, 0, 0, 0, 0, - 166, 14, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 64, - 0, 0, 0, 192, 2, 64, + 22, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 15, 194, 0, 16, 0, + 0, 0, 0, 0, 166, 14, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 192, 0, 0, + 0, 64, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, - 128, 191, 0, 0, 128, 63, - 56, 0, 0, 8, 194, 0, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 191, 56, 0, + 0, 8, 194, 0, 16, 0, + 0, 0, 0, 0, 166, 14, 16, 0, 0, 0, 0, 0, - 166, 14, 16, 0, 0, 0, - 0, 0, 6, 132, 32, 0, - 0, 0, 0, 0, 30, 0, - 0, 0, 56, 0, 0, 8, - 98, 0, 16, 0, 3, 0, - 0, 0, 6, 0, 16, 0, - 3, 0, 0, 0, 166, 11, - 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 8, 114, 0, 16, 0, - 3, 0, 0, 0, 38, 9, - 16, 128, 65, 0, 0, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 3, 0, 0, 0, - 54, 0, 0, 5, 66, 0, - 16, 0, 4, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 0, 54, 0, 0, 6, - 18, 0, 16, 0, 4, 0, - 0, 0, 26, 128, 32, 0, - 0, 0, 0, 0, 20, 0, - 0, 0, 0, 0, 0, 7, - 194, 0, 16, 0, 0, 0, - 0, 0, 86, 1, 16, 0, - 0, 0, 0, 0, 6, 8, - 16, 0, 4, 0, 0, 0, + 86, 129, 32, 0, 0, 0, + 0, 0, 30, 0, 0, 0, + 56, 0, 0, 8, 82, 0, + 16, 0, 5, 0, 0, 0, + 86, 5, 16, 0, 5, 0, + 0, 0, 166, 11, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 8, + 114, 0, 16, 0, 5, 0, + 0, 0, 150, 4, 16, 128, + 65, 0, 0, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 5, 0, 0, 0, 0, 0, + 0, 8, 194, 0, 16, 0, + 0, 0, 0, 0, 86, 1, + 16, 0, 0, 0, 0, 0, + 6, 8, 16, 128, 65, 0, + 0, 0, 4, 0, 0, 0, 69, 0, 0, 139, 194, 0, 0, 128, 67, 85, 21, 0, - 34, 0, 16, 0, 5, 0, + 34, 0, 16, 0, 4, 0, 0, 0, 182, 15, 16, 0, 0, 0, 0, 0, 22, 126, 16, 0, 0, 0, 0, 0, @@ -732,237 +770,151 @@ const BYTE g_compositePS[] = 32, 0, 0, 0, 0, 0, 30, 0, 0, 0, 56, 0, 0, 8, 82, 0, 16, 0, - 5, 0, 0, 0, 86, 5, - 16, 0, 5, 0, 0, 0, + 4, 0, 0, 0, 86, 5, + 16, 0, 4, 0, 0, 0, 166, 11, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 114, 0, - 16, 0, 5, 0, 0, 0, - 150, 4, 16, 128, 65, 0, - 0, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 8, - 194, 0, 16, 0, 0, 0, - 0, 0, 86, 1, 16, 0, - 0, 0, 0, 0, 6, 8, - 16, 128, 65, 0, 0, 0, - 4, 0, 0, 0, 69, 0, - 0, 139, 194, 0, 0, 128, - 67, 85, 21, 0, 34, 0, 16, 0, 4, 0, 0, 0, - 182, 15, 16, 0, 0, 0, - 0, 0, 22, 126, 16, 0, - 0, 0, 0, 0, 0, 96, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 15, 194, 0, - 16, 0, 0, 0, 0, 0, - 166, 14, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 192, - 0, 0, 0, 64, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 128, 63, 0, 0, 128, 191, - 56, 0, 0, 8, 194, 0, - 16, 0, 0, 0, 0, 0, - 166, 14, 16, 0, 0, 0, - 0, 0, 86, 129, 32, 0, - 0, 0, 0, 0, 30, 0, + 150, 4, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 4, 0, + 0, 0, 49, 0, 0, 9, + 66, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 128, + 129, 0, 0, 0, 3, 0, + 0, 0, 10, 0, 16, 128, + 129, 0, 0, 0, 2, 0, + 0, 0, 55, 0, 0, 9, + 114, 0, 16, 0, 2, 0, + 0, 0, 166, 10, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 49, 0, 0, 9, + 66, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 128, + 129, 0, 0, 0, 4, 0, + 0, 0, 26, 0, 16, 128, + 129, 0, 0, 0, 5, 0, + 0, 0, 55, 0, 0, 9, + 114, 0, 16, 0, 3, 0, + 0, 0, 166, 10, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 5, 0, 0, 0, 56, 0, 0, 8, - 82, 0, 16, 0, 4, 0, + 114, 0, 16, 0, 4, 0, 0, 0, 86, 5, 16, 0, - 4, 0, 0, 0, 166, 11, - 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 8, 114, 0, 16, 0, - 4, 0, 0, 0, 150, 4, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 13, 0, 0, 0, 50, 0, + 0, 10, 114, 0, 16, 0, + 4, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, - 70, 2, 16, 128, 65, 0, - 0, 0, 4, 0, 0, 0, - 49, 0, 0, 9, 66, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 128, 129, 0, - 0, 0, 3, 0, 0, 0, - 10, 0, 16, 128, 129, 0, - 0, 0, 2, 0, 0, 0, - 55, 0, 0, 9, 114, 0, - 16, 0, 2, 0, 0, 0, - 166, 10, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 70, 2, - 16, 0, 2, 0, 0, 0, - 49, 0, 0, 9, 66, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 128, 129, 0, - 0, 0, 4, 0, 0, 0, - 26, 0, 16, 128, 129, 0, - 0, 0, 5, 0, 0, 0, - 55, 0, 0, 9, 114, 0, - 16, 0, 3, 0, 0, 0, - 166, 10, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 4, 0, 0, 0, 70, 2, - 16, 0, 5, 0, 0, 0, - 56, 0, 0, 8, 114, 0, - 16, 0, 4, 0, 0, 0, - 86, 5, 16, 0, 1, 0, - 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 13, 0, + 70, 2, 16, 0, 4, 0, 0, 0, 50, 0, 0, 10, 114, 0, 16, 0, 4, 0, 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 12, 0, - 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 166, 10, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 4, 0, 0, 0, - 50, 0, 0, 10, 114, 0, - 16, 0, 4, 0, 0, 0, - 70, 130, 32, 0, 0, 0, - 0, 0, 14, 0, 0, 0, - 166, 10, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 0, - 4, 0, 0, 0, 0, 0, - 0, 8, 114, 0, 16, 0, - 4, 0, 0, 0, 70, 2, - 16, 0, 4, 0, 0, 0, - 70, 130, 32, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 50, 0, 0, 13, 210, 0, + 0, 0, 0, 8, 114, 0, 16, 0, 4, 0, 0, 0, - 6, 137, 32, 0, 0, 0, - 0, 0, 24, 0, 0, 0, - 2, 64, 0, 0, 154, 153, - 25, 62, 0, 0, 0, 0, - 154, 153, 25, 62, 154, 153, - 25, 62, 6, 9, 16, 0, - 4, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 5, 0, 0, 0, 166, 10, + 70, 2, 16, 0, 4, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 50, 0, 0, 13, + 210, 0, 16, 0, 4, 0, + 0, 0, 6, 137, 32, 0, + 0, 0, 0, 0, 24, 0, + 0, 0, 2, 64, 0, 0, + 154, 153, 25, 62, 0, 0, + 0, 0, 154, 153, 25, 62, + 154, 153, 25, 62, 6, 9, 16, 0, 4, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 26, 0, 0, 0, + 56, 0, 0, 8, 242, 0, + 16, 0, 5, 0, 0, 0, + 166, 10, 16, 0, 4, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 26, 0, + 0, 0, 50, 0, 0, 10, + 242, 0, 16, 0, 5, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 25, 0, + 0, 0, 6, 0, 16, 0, + 4, 0, 0, 0, 70, 14, + 16, 0, 5, 0, 0, 0, 50, 0, 0, 10, 242, 0, 16, 0, 5, 0, 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 25, 0, 0, 0, - 6, 0, 16, 0, 4, 0, + 0, 0, 27, 0, 0, 0, + 246, 15, 16, 0, 4, 0, 0, 0, 70, 14, 16, 0, + 5, 0, 0, 0, 0, 0, + 0, 8, 242, 0, 16, 0, + 5, 0, 0, 0, 70, 14, + 16, 0, 5, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 28, 0, 0, 0, + 14, 0, 0, 7, 210, 0, + 16, 0, 4, 0, 0, 0, + 6, 9, 16, 0, 5, 0, + 0, 0, 246, 15, 16, 0, 5, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 5, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 27, 0, 0, 0, 246, 15, + 0, 15, 114, 0, 16, 0, + 5, 0, 0, 0, 134, 3, 16, 0, 4, 0, 0, 0, - 70, 14, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 8, - 242, 0, 16, 0, 5, 0, - 0, 0, 70, 14, 16, 0, - 5, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 14, 0, - 0, 7, 210, 0, 16, 0, - 4, 0, 0, 0, 6, 9, - 16, 0, 5, 0, 0, 0, - 246, 15, 16, 0, 5, 0, - 0, 0, 50, 0, 0, 15, - 114, 0, 16, 0, 5, 0, - 0, 0, 134, 3, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 128, 63, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, - 0, 0, 0, 0, 0, 0, - 0, 0, 49, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 5, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 49, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 10, 0, 16, 0, - 5, 0, 0, 0, 60, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 31, 0, 0, 3, - 42, 0, 16, 0, 0, 0, - 0, 0, 49, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 5, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 49, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 26, 0, 16, 0, - 5, 0, 0, 0, 60, 0, + 0, 0, 128, 63, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 63, 0, 0, + 0, 63, 0, 0, 0, 0, + 0, 0, 0, 0, 49, 0, 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 31, 0, 0, 3, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 66, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 5, 0, 0, 0, 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 6, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 32, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 6, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 8, - 130, 0, 16, 0, 5, 0, - 0, 0, 26, 0, 16, 128, - 65, 0, 0, 0, 5, 0, + 0, 0, 49, 0, 0, 7, + 130, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 0, 0, - 0, 7, 194, 0, 16, 0, - 0, 0, 0, 0, 6, 12, - 16, 0, 5, 0, 0, 0, - 6, 4, 16, 0, 6, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 0, 0, 0, 0, 230, 10, - 16, 0, 0, 0, 0, 0, - 6, 112, 16, 0, 2, 0, - 0, 0, 0, 96, 16, 0, - 1, 0, 0, 0, 42, 0, + 0, 0, 128, 63, 10, 0, 16, 0, 5, 0, 0, 0, - 0, 0, 0, 9, 130, 0, + 60, 0, 0, 7, 66, 0, 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 0, 0, - 33, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 6, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 33, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 6, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, + 0, 9, 130, 0, 16, 0, + 0, 0, 0, 0, 26, 128, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 32, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 8, 18, 0, 16, 0, + 6, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 32, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, + 56, 0, 0, 7, 34, 0, + 16, 0, 6, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 0, 0, + 0, 8, 130, 0, 16, 0, + 5, 0, 0, 0, 26, 0, + 16, 128, 65, 0, 0, 0, + 5, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, 0, 0, 0, 7, 82, 0, 16, 0, 4, 0, 0, 0, 6, 3, 16, 0, 5, 0, 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, + 6, 0, 0, 0, 70, 0, 0, 141, 194, 0, 0, 128, 67, 85, 21, 0, 130, 0, 16, 0, 0, 0, 0, 0, @@ -971,47 +923,67 @@ const BYTE g_compositePS[] = 2, 0, 0, 0, 0, 96, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 6, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 34, 0, 0, 0, + 0, 0, 0, 0, 0, 9, + 130, 0, 16, 0, 1, 0, + 0, 0, 26, 128, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 33, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 8, + 18, 0, 16, 0, 6, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 33, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 56, 0, + 0, 7, 34, 0, 16, 0, + 6, 0, 0, 0, 58, 0, + 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 6, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, + 3, 59, 0, 0, 0, 7, + 82, 0, 16, 0, 4, 0, + 0, 0, 6, 3, 16, 0, + 5, 0, 0, 0, 6, 1, + 16, 0, 6, 0, 0, 0, + 70, 0, 0, 141, 194, 0, + 0, 128, 67, 85, 21, 0, + 130, 0, 16, 0, 1, 0, + 0, 0, 134, 0, 16, 0, + 4, 0, 0, 0, 6, 112, + 16, 0, 2, 0, 0, 0, + 0, 96, 16, 0, 1, 0, + 0, 0, 42, 0, 16, 0, + 5, 0, 0, 0, 0, 0, + 0, 9, 130, 0, 16, 0, + 2, 0, 0, 0, 26, 128, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 34, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 8, 18, 0, 16, 0, + 6, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 34, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, - 0, 0, 0, 7, 82, 0, + 56, 0, 0, 7, 34, 0, + 16, 0, 6, 0, 0, 0, + 58, 0, 16, 0, 2, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 0, 0, + 0, 7, 82, 0, 16, 0, + 4, 0, 0, 0, 6, 3, + 16, 0, 5, 0, 0, 0, + 6, 1, 16, 0, 6, 0, + 0, 0, 70, 0, 0, 141, + 194, 0, 0, 128, 67, 85, + 21, 0, 130, 0, 16, 0, + 2, 0, 0, 0, 134, 0, 16, 0, 4, 0, 0, 0, - 6, 3, 16, 0, 5, 0, - 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, - 134, 0, 16, 0, 4, 0, - 0, 0, 6, 112, 16, 0, - 2, 0, 0, 0, 0, 96, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, + 6, 112, 16, 0, 2, 0, + 0, 0, 0, 96, 16, 0, + 1, 0, 0, 0, 42, 0, + 16, 0, 5, 0, 0, 0, 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, + 16, 0, 3, 0, 0, 0, 26, 128, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 1, 64, @@ -1024,96 +996,82 @@ const BYTE g_compositePS[] = 3, 59, 56, 0, 0, 7, 34, 0, 16, 0, 6, 0, 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, + 3, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 0, 0, 0, 7, 82, 0, 16, 0, 4, 0, 0, 0, 6, 3, 16, 0, 5, 0, 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, + 6, 0, 0, 0, 70, 0, 0, 141, 194, 0, 0, 128, 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, + 16, 0, 3, 0, 0, 0, 134, 0, 16, 0, 4, 0, 0, 0, 6, 112, 16, 0, 2, 0, 0, 0, 0, 96, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 36, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 6, 0, 0, 0, - 10, 128, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 9, + 18, 0, 16, 0, 4, 0, + 0, 0, 26, 128, 32, 128, + 65, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 6, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 0, 0, 0, 7, 82, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 8, + 18, 0, 16, 0, 6, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 36, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 56, 0, + 0, 7, 34, 0, 16, 0, + 6, 0, 0, 0, 10, 0, 16, 0, 4, 0, 0, 0, - 6, 3, 16, 0, 5, 0, - 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, - 134, 0, 16, 0, 4, 0, - 0, 0, 6, 112, 16, 0, - 2, 0, 0, 0, 0, 96, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 37, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 6, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 37, 0, 0, 0, 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 6, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, + 3, 59, 0, 0, 0, 7, + 82, 0, 16, 0, 4, 0, + 0, 0, 6, 3, 16, 0, + 5, 0, 0, 0, 6, 1, + 16, 0, 6, 0, 0, 0, + 70, 0, 0, 141, 194, 0, + 0, 128, 67, 85, 21, 0, + 18, 0, 16, 0, 4, 0, + 0, 0, 134, 0, 16, 0, + 4, 0, 0, 0, 6, 112, + 16, 0, 2, 0, 0, 0, + 0, 96, 16, 0, 1, 0, + 0, 0, 42, 0, 16, 0, + 5, 0, 0, 0, 0, 0, + 0, 9, 66, 0, 16, 0, + 4, 0, 0, 0, 26, 128, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 37, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 8, 18, 0, 16, 0, + 6, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 37, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, - 0, 0, 0, 7, 82, 0, + 56, 0, 0, 7, 34, 0, + 16, 0, 6, 0, 0, 0, + 42, 0, 16, 0, 4, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 0, 0, + 0, 7, 194, 0, 16, 0, + 4, 0, 0, 0, 6, 12, + 16, 0, 5, 0, 0, 0, + 6, 4, 16, 0, 6, 0, + 0, 0, 70, 0, 0, 141, + 194, 0, 0, 128, 67, 85, + 21, 0, 66, 0, 16, 0, + 4, 0, 0, 0, 230, 10, 16, 0, 4, 0, 0, 0, - 6, 3, 16, 0, 5, 0, - 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, - 134, 0, 16, 0, 4, 0, - 0, 0, 6, 112, 16, 0, - 2, 0, 0, 0, 0, 96, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, + 6, 112, 16, 0, 2, 0, + 0, 0, 0, 96, 16, 0, + 1, 0, 0, 0, 42, 0, + 16, 0, 5, 0, 0, 0, 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, + 16, 0, 4, 0, 0, 0, 26, 128, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 38, 0, 0, 0, 1, 64, @@ -1126,509 +1084,550 @@ const BYTE g_compositePS[] = 3, 59, 56, 0, 0, 7, 34, 0, 16, 0, 6, 0, 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, + 4, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, - 0, 0, 0, 7, 82, 0, - 16, 0, 4, 0, 0, 0, - 6, 3, 16, 0, 5, 0, - 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, + 0, 0, 0, 7, 50, 0, + 16, 0, 6, 0, 0, 0, + 198, 0, 16, 0, 5, 0, + 0, 0, 70, 0, 16, 0, + 6, 0, 0, 0, 70, 0, 0, 141, 194, 0, 0, 128, 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, - 134, 0, 16, 0, 4, 0, + 16, 0, 4, 0, 0, 0, + 70, 0, 16, 0, 6, 0, 0, 0, 6, 112, 16, 0, 2, 0, 0, 0, 0, 96, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 5, 0, + 0, 0, 0, 0, 0, 9, + 18, 0, 16, 0, 6, 0, + 0, 0, 26, 128, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 39, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 8, + 18, 0, 16, 0, 7, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 39, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 56, 0, + 0, 7, 34, 0, 16, 0, + 7, 0, 0, 0, 10, 0, + 16, 0, 6, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 0, 0, 0, 7, + 146, 0, 16, 0, 5, 0, + 0, 0, 6, 12, 16, 0, + 5, 0, 0, 0, 6, 4, + 16, 0, 7, 0, 0, 0, + 70, 0, 0, 141, 194, 0, + 0, 128, 67, 85, 21, 0, + 18, 0, 16, 0, 5, 0, + 0, 0, 198, 0, 16, 0, + 5, 0, 0, 0, 6, 112, + 16, 0, 2, 0, 0, 0, + 0, 96, 16, 0, 1, 0, + 0, 0, 42, 0, 16, 0, + 5, 0, 0, 0, 31, 0, + 0, 3, 42, 0, 16, 0, + 0, 0, 0, 0, 49, 0, + 0, 7, 66, 0, 16, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 5, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 49, 0, 0, 7, + 34, 0, 16, 0, 5, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 26, 0, + 16, 0, 5, 0, 0, 0, + 60, 0, 0, 7, 66, 0, + 16, 0, 0, 0, 0, 0, + 42, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 5, 0, 0, 0, 31, 0, + 0, 3, 42, 0, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 7, 66, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 1, 0, 0, 0, 0, 0, 0, 7, 66, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, + 2, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 130, 0, + 0, 0, 0, 7, 66, 0, 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, + 58, 0, 16, 0, 3, 0, + 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 0, 0, - 39, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 6, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 39, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 6, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 0, 0, 0, 7, 82, 0, + 0, 7, 66, 0, 16, 0, + 0, 0, 0, 0, 10, 0, 16, 0, 4, 0, 0, 0, - 6, 3, 16, 0, 5, 0, - 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, - 134, 0, 16, 0, 4, 0, - 0, 0, 6, 112, 16, 0, - 2, 0, 0, 0, 0, 96, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 5, 0, + 42, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 7, 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, + 0, 0, 42, 0, 16, 0, + 4, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 66, 0, + 0, 0, 0, 7, 66, 0, 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 4, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 7, 66, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 5, 0, 0, 0, 42, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 62, 18, 0, + 0, 0, 56, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 62, + 18, 0, 0, 1, 54, 0, + 0, 5, 66, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 21, 0, 0, 1, 18, 0, 0, 1, 54, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 21, 0, - 0, 1, 18, 0, 0, 1, - 54, 0, 0, 5, 66, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 21, 0, 0, 1, - 56, 0, 0, 9, 210, 0, - 16, 0, 4, 0, 0, 0, - 6, 137, 32, 0, 0, 0, - 0, 0, 5, 0, 0, 0, - 86, 133, 32, 0, 0, 0, - 0, 0, 24, 0, 0, 0, - 50, 0, 0, 11, 210, 0, - 16, 0, 4, 0, 0, 0, - 6, 137, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 6, 128, 32, 0, 0, 0, - 0, 0, 24, 0, 0, 0, - 6, 14, 16, 0, 4, 0, + 0, 1, 56, 0, 0, 9, + 210, 0, 16, 0, 4, 0, + 0, 0, 6, 137, 32, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 86, 133, 32, 0, + 0, 0, 0, 0, 24, 0, 0, 0, 50, 0, 0, 11, 210, 0, 16, 0, 4, 0, 0, 0, 6, 137, 32, 0, - 0, 0, 0, 0, 6, 0, - 0, 0, 166, 138, 32, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 6, 128, 32, 0, 0, 0, 0, 0, 24, 0, 0, 0, 6, 14, 16, 0, - 4, 0, 0, 0, 16, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 68, 0, 0, 5, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 7, 114, 0, 16, 0, - 5, 0, 0, 0, 246, 15, + 4, 0, 0, 0, 50, 0, + 0, 11, 210, 0, 16, 0, + 4, 0, 0, 0, 6, 137, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 166, 138, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 6, 14, + 16, 0, 4, 0, 0, 0, + 16, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 1, 0, - 0, 0, 56, 0, 0, 7, - 114, 0, 16, 0, 6, 0, 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 70, 2, - 16, 0, 3, 0, 0, 0, - 50, 0, 0, 10, 114, 0, - 16, 0, 2, 0, 0, 0, - 38, 9, 16, 0, 2, 0, - 0, 0, 150, 4, 16, 0, - 3, 0, 0, 0, 70, 2, - 16, 128, 65, 0, 0, 0, - 6, 0, 0, 0, 16, 0, - 0, 7, 130, 0, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 2, 0, 0, 0, - 70, 2, 16, 0, 2, 0, - 0, 0, 68, 0, 0, 5, - 130, 0, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, + 1, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 5, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, 1, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, - 2, 0, 0, 0, 246, 15, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 2, 0, + 6, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 3, 0, 0, 0, 50, 0, 0, 10, - 178, 0, 16, 0, 1, 0, - 0, 0, 70, 8, 16, 128, - 65, 0, 0, 0, 1, 0, - 0, 0, 246, 15, 16, 0, - 0, 0, 0, 0, 134, 12, - 16, 0, 4, 0, 0, 0, + 114, 0, 16, 0, 2, 0, + 0, 0, 38, 9, 16, 0, + 2, 0, 0, 0, 150, 4, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 6, 0, 0, 0, 16, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 70, 3, 16, 0, 1, 0, - 0, 0, 70, 3, 16, 0, - 1, 0, 0, 0, 68, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 68, 0, 0, 5, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 178, 0, + 1, 0, 0, 0, 58, 0, 16, 0, 1, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 70, 12, 16, 0, - 1, 0, 0, 0, 16, 0, - 0, 9, 130, 0, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 128, 65, 0, 0, 0, - 2, 0, 0, 0, 70, 2, + 56, 0, 0, 7, 114, 0, + 16, 0, 2, 0, 0, 0, + 246, 15, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 50, 0, + 0, 10, 178, 0, 16, 0, + 1, 0, 0, 0, 70, 8, 16, 128, 65, 0, 0, 0, - 5, 0, 0, 0, 52, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, + 1, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 8, + 134, 12, 16, 0, 4, 0, + 0, 0, 16, 0, 0, 7, 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 7, 130, 0, 16, 0, - 2, 0, 0, 0, 58, 0, + 0, 0, 70, 3, 16, 0, + 1, 0, 0, 0, 70, 3, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 130, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 2, 0, 0, 0, - 50, 0, 0, 9, 130, 0, + 178, 0, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 12, + 16, 0, 1, 0, 0, 0, + 16, 0, 0, 9, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 2, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 5, 0, 0, 0, + 52, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, - 102, 102, 102, 63, 1, 64, - 0, 0, 205, 204, 204, 61, - 16, 0, 0, 8, 130, 0, + 0, 0, 0, 0, 0, 0, + 0, 8, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 7, 130, 0, 16, 0, 2, 0, 0, 0, - 134, 3, 16, 0, 4, 0, - 0, 0, 70, 2, 16, 128, - 65, 0, 0, 0, 2, 0, - 0, 0, 16, 0, 0, 8, - 18, 0, 16, 0, 3, 0, - 0, 0, 70, 2, 16, 0, - 5, 0, 0, 0, 70, 2, + 58, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 2, 0, + 0, 0, 50, 0, 0, 9, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 102, 102, 102, 63, + 1, 64, 0, 0, 205, 204, + 204, 61, 16, 0, 0, 8, + 130, 0, 16, 0, 2, 0, + 0, 0, 134, 3, 16, 0, + 4, 0, 0, 0, 70, 2, 16, 128, 65, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 7, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 0, + 2, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 5, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 7, 18, 0, 16, 0, 3, 0, 0, 0, 10, 0, 16, 0, 3, 0, - 0, 0, 50, 0, 0, 9, - 114, 0, 16, 0, 3, 0, + 0, 0, 10, 0, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 9, 114, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 6, 0, + 5, 0, 0, 0, 56, 0, + 0, 8, 130, 0, 16, 0, + 3, 0, 0, 0, 26, 0, 16, 0, 3, 0, 0, 0, - 70, 2, 16, 0, 5, 0, - 0, 0, 56, 0, 0, 8, - 130, 0, 16, 0, 3, 0, - 0, 0, 26, 0, 16, 0, - 3, 0, 0, 0, 26, 128, - 32, 0, 0, 0, 0, 0, - 13, 0, 0, 0, 50, 0, - 0, 10, 130, 0, 16, 0, + 26, 128, 32, 0, 0, 0, + 0, 0, 13, 0, 0, 0, + 50, 0, 0, 10, 130, 0, + 16, 0, 3, 0, 0, 0, + 26, 128, 32, 0, 0, 0, + 0, 0, 12, 0, 0, 0, + 10, 0, 16, 0, 3, 0, + 0, 0, 58, 0, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 10, 66, 0, 16, 0, 3, 0, 0, 0, 26, 128, 32, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 10, 0, + 14, 0, 0, 0, 42, 0, 16, 0, 3, 0, 0, 0, 58, 0, 16, 0, 3, 0, - 0, 0, 50, 0, 0, 10, - 66, 0, 16, 0, 3, 0, - 0, 0, 26, 128, 32, 0, - 0, 0, 0, 0, 14, 0, - 0, 0, 42, 0, 16, 0, - 3, 0, 0, 0, 58, 0, - 16, 0, 3, 0, 0, 0, - 56, 0, 0, 11, 50, 0, - 16, 0, 5, 0, 0, 0, - 166, 138, 32, 0, 0, 0, - 0, 0, 31, 0, 0, 0, - 2, 64, 0, 0, 205, 204, - 204, 60, 205, 204, 204, 61, + 0, 0, 56, 0, 0, 11, + 50, 0, 16, 0, 5, 0, + 0, 0, 166, 138, 32, 0, + 0, 0, 0, 0, 31, 0, + 0, 0, 2, 64, 0, 0, + 205, 204, 204, 60, 205, 204, + 204, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, + 0, 7, 130, 0, 16, 0, + 3, 0, 0, 0, 26, 0, + 16, 0, 4, 0, 0, 0, + 1, 64, 0, 0, 205, 204, + 204, 189, 56, 32, 0, 7, 130, 0, 16, 0, 3, 0, - 0, 0, 26, 0, 16, 0, - 4, 0, 0, 0, 1, 64, - 0, 0, 205, 204, 204, 189, - 56, 32, 0, 7, 130, 0, - 16, 0, 3, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 3, 0, 0, 0, 1, 64, + 0, 0, 85, 85, 85, 64, + 50, 0, 0, 9, 18, 0, + 16, 0, 4, 0, 0, 0, 58, 0, 16, 0, 3, 0, 0, 0, 1, 64, 0, 0, - 85, 85, 85, 64, 50, 0, - 0, 9, 18, 0, 16, 0, - 4, 0, 0, 0, 58, 0, + 0, 0, 0, 192, 1, 64, + 0, 0, 0, 0, 64, 64, + 56, 0, 0, 7, 130, 0, 16, 0, 3, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 192, 1, 64, 0, 0, - 0, 0, 64, 64, 56, 0, + 58, 0, 16, 0, 3, 0, + 0, 0, 58, 0, 16, 0, + 3, 0, 0, 0, 56, 0, 0, 7, 130, 0, 16, 0, 3, 0, 0, 0, 58, 0, 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 3, 0, + 10, 0, 16, 0, 4, 0, 0, 0, 56, 0, 0, 7, 130, 0, 16, 0, 3, 0, 0, 0, 58, 0, 16, 0, 3, 0, 0, 0, 10, 0, + 16, 0, 5, 0, 0, 0, + 56, 0, 0, 8, 50, 0, 16, 0, 4, 0, 0, 0, - 56, 0, 0, 7, 130, 0, - 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 3, 0, - 0, 0, 10, 0, 16, 0, - 5, 0, 0, 0, 56, 0, - 0, 8, 50, 0, 16, 0, - 4, 0, 0, 0, 70, 0, - 16, 128, 65, 0, 0, 0, - 2, 0, 0, 0, 246, 15, - 16, 0, 3, 0, 0, 0, - 50, 0, 0, 12, 50, 0, - 16, 0, 4, 0, 0, 0, - 70, 0, 16, 0, 4, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 64, 63, 0, 0, - 128, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 70, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 12, 242, 0, - 16, 0, 6, 0, 0, 0, - 70, 142, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 29, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 63, + 70, 0, 16, 128, 65, 0, + 0, 0, 2, 0, 0, 0, + 246, 15, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 12, + 50, 0, 16, 0, 4, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 64, 63, 0, 0, 128, 63, 0, 0, + 0, 0, 0, 0, 0, 0, + 70, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 12, + 242, 0, 16, 0, 6, 0, + 0, 0, 70, 142, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 29, 0, 0, 0, + 2, 64, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, - 50, 0, 0, 16, 114, 0, - 16, 0, 6, 0, 0, 0, - 70, 2, 16, 128, 65, 0, - 0, 0, 6, 0, 0, 0, - 2, 64, 0, 0, 11, 215, - 35, 63, 11, 215, 35, 63, - 11, 215, 35, 63, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 50, 0, 0, 16, + 114, 0, 16, 0, 6, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 6, 0, 0, 0, 2, 64, 0, 0, + 11, 215, 35, 63, 11, 215, + 35, 63, 11, 215, 35, 63, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, - 128, 63, 0, 0, 128, 63, - 0, 0, 0, 0, 56, 0, - 0, 8, 114, 0, 16, 0, - 6, 0, 0, 0, 70, 2, + 128, 63, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, 16, 0, 6, 0, 0, 0, - 246, 143, 32, 0, 0, 0, - 0, 0, 29, 0, 0, 0, - 69, 0, 0, 139, 194, 0, - 0, 128, 67, 85, 21, 0, - 114, 0, 16, 0, 4, 0, - 0, 0, 70, 0, 16, 0, - 4, 0, 0, 0, 70, 126, - 16, 0, 1, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 114, 0, 16, 0, 7, 0, - 0, 0, 70, 2, 16, 0, - 6, 0, 0, 0, 70, 2, + 70, 2, 16, 0, 6, 0, + 0, 0, 246, 143, 32, 0, + 0, 0, 0, 0, 29, 0, + 0, 0, 69, 0, 0, 139, + 194, 0, 0, 128, 67, 85, + 21, 0, 114, 0, 16, 0, + 4, 0, 0, 0, 70, 0, 16, 0, 4, 0, 0, 0, - 54, 0, 0, 8, 82, 0, - 16, 0, 5, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 64, 63, 0, 0, 0, 0, - 0, 0, 128, 63, 0, 0, - 0, 0, 56, 0, 0, 7, - 50, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 0, - 3, 0, 0, 0, 150, 5, - 16, 0, 5, 0, 0, 0, - 56, 0, 0, 8, 34, 0, - 16, 0, 5, 0, 0, 0, - 42, 128, 32, 0, 0, 0, - 0, 0, 31, 0, 0, 0, - 1, 64, 0, 0, 205, 204, - 204, 61, 56, 0, 0, 7, - 50, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 0, + 70, 126, 16, 0, 1, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 7, 0, 0, 0, 70, 2, + 16, 0, 6, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 54, 0, 0, 8, + 82, 0, 16, 0, 5, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 64, 63, 0, 0, + 0, 0, 0, 0, 128, 63, + 0, 0, 0, 0, 56, 0, + 0, 7, 50, 0, 16, 0, 3, 0, 0, 0, 70, 0, - 16, 0, 5, 0, 0, 0, - 14, 0, 0, 7, 50, 0, 16, 0, 3, 0, 0, 0, - 70, 0, 16, 0, 3, 0, - 0, 0, 166, 10, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 8, 50, 0, 16, 0, - 0, 0, 0, 0, 70, 0, - 16, 0, 0, 0, 0, 0, - 70, 0, 16, 128, 65, 0, - 0, 0, 3, 0, 0, 0, - 69, 0, 0, 139, 194, 0, - 0, 128, 67, 85, 21, 0, - 178, 0, 16, 0, 3, 0, + 150, 5, 16, 0, 5, 0, + 0, 0, 56, 0, 0, 8, + 34, 0, 16, 0, 5, 0, + 0, 0, 42, 128, 32, 0, + 0, 0, 0, 0, 31, 0, + 0, 0, 1, 64, 0, 0, + 205, 204, 204, 61, 56, 0, + 0, 7, 50, 0, 16, 0, + 3, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 5, 0, + 0, 0, 14, 0, 0, 7, + 50, 0, 16, 0, 3, 0, 0, 0, 70, 0, 16, 0, - 0, 0, 0, 0, 70, 123, + 3, 0, 0, 0, 166, 10, 16, 0, 1, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 3, 0, 0, 0, 1, 64, - 0, 0, 154, 153, 25, 190, - 56, 32, 0, 7, 18, 0, + 0, 0, 0, 8, 50, 0, 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 1, 0, 32, 65, 50, 0, - 0, 9, 34, 0, 16, 0, - 0, 0, 0, 0, 10, 0, + 70, 0, 16, 0, 0, 0, + 0, 0, 70, 0, 16, 128, + 65, 0, 0, 0, 3, 0, + 0, 0, 69, 0, 0, 139, + 194, 0, 0, 128, 67, 85, + 21, 0, 178, 0, 16, 0, + 3, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 192, 1, 64, 0, 0, - 0, 0, 64, 64, 56, 0, + 70, 123, 16, 0, 1, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 0, 0, 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, + 0, 0, 0, 0, 42, 0, + 16, 0, 3, 0, 0, 0, + 1, 64, 0, 0, 154, 153, + 25, 190, 56, 32, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 26, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 1, 0, 32, 65, + 50, 0, 0, 9, 34, 0, 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 192, 1, 64, + 0, 0, 0, 0, 64, 64, 56, 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, + 10, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 56, 0, - 0, 10, 114, 0, 16, 0, - 5, 0, 0, 0, 6, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 8, 215, - 163, 60, 40, 92, 15, 62, - 40, 92, 143, 62, 0, 0, - 0, 0, 50, 0, 0, 9, - 114, 0, 16, 0, 3, 0, - 0, 0, 70, 3, 16, 0, - 3, 0, 0, 0, 166, 10, + 26, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 10, - 114, 0, 16, 0, 3, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 5, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 8, 215, 163, 60, 40, 92, + 15, 62, 40, 92, 143, 62, + 0, 0, 0, 0, 50, 0, + 0, 9, 114, 0, 16, 0, + 3, 0, 0, 0, 70, 3, + 16, 0, 3, 0, 0, 0, + 166, 10, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 205, 204, 204, 61, - 205, 204, 204, 61, 205, 204, - 76, 62, 0, 0, 0, 0, - 50, 0, 0, 9, 18, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 63, 1, 64, + 5, 0, 0, 0, 0, 0, + 0, 10, 114, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 205, 204, + 204, 61, 205, 204, 204, 61, + 205, 204, 76, 62, 0, 0, + 0, 0, 50, 0, 0, 9, + 18, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 63, - 52, 0, 0, 7, 34, 0, + 1, 64, 0, 0, 0, 0, + 0, 63, 52, 0, 0, 7, + 34, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 205, 204, 204, 62, + 56, 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 205, 204, 204, 62, 56, 0, - 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 26, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 15, 114, 0, 16, 0, + 0, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 15, - 114, 0, 16, 0, 0, 0, - 0, 0, 6, 0, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 144, 194, 53, 63, - 219, 249, 30, 63, 134, 235, - 209, 62, 0, 0, 0, 0, - 2, 64, 0, 0, 225, 122, - 148, 62, 74, 12, 194, 62, - 61, 10, 23, 63, 0, 0, - 0, 0, 56, 0, 0, 8, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 29, 0, 0, 0, 16, 0, - 0, 8, 18, 0, 16, 0, - 1, 0, 0, 0, 70, 3, + 2, 64, 0, 0, 144, 194, + 53, 63, 219, 249, 30, 63, + 134, 235, 209, 62, 0, 0, + 0, 0, 2, 64, 0, 0, + 225, 122, 148, 62, 74, 12, + 194, 62, 61, 10, 23, 63, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 29, 0, 0, 0, + 16, 0, 0, 8, 18, 0, 16, 0, 1, 0, 0, 0, - 70, 2, 16, 128, 65, 0, - 0, 0, 2, 0, 0, 0, - 52, 0, 0, 7, 18, 0, + 70, 3, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 2, 0, + 0, 0, 52, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 47, 0, 0, 5, 18, 0, 16, 0, 1, 0, 0, 0, 10, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 47, 0, - 0, 5, 18, 0, 16, 0, - 1, 0, 0, 0, 10, 0, - 16, 0, 1, 0, 0, 0, - 56, 0, 0, 7, 18, 0, + 0, 0, 56, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 200, 67, + 25, 0, 0, 5, 18, 0, 16, 0, 1, 0, 0, 0, 10, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 200, 67, 25, 0, - 0, 5, 18, 0, 16, 0, - 1, 0, 0, 0, 10, 0, + 0, 0, 50, 0, 0, 11, + 98, 0, 16, 0, 1, 0, + 0, 0, 166, 139, 32, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 166, 10, 16, 0, + 1, 0, 0, 0, 166, 139, + 32, 0, 0, 0, 0, 0, + 11, 0, 0, 0, 14, 0, + 0, 6, 1, 192, 0, 0, + 26, 0, 16, 0, 1, 0, + 0, 0, 42, 0, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 226, 0, 16, 0, + 1, 0, 0, 0, 6, 9, + 16, 128, 65, 0, 0, 0, + 4, 0, 0, 0, 6, 9, + 16, 0, 6, 0, 0, 0, + 6, 9, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 9, + 226, 0, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 86, 14, 16, 0, 1, 0, 0, 0, - 50, 0, 0, 10, 114, 0, - 16, 0, 2, 0, 0, 0, - 70, 2, 16, 128, 65, 0, - 0, 0, 4, 0, 0, 0, - 70, 2, 16, 0, 6, 0, + 6, 9, 16, 0, 7, 0, + 0, 0, 50, 0, 0, 12, + 114, 0, 16, 0, 1, 0, + 0, 0, 6, 0, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 154, 153, 153, 63, + 154, 153, 153, 63, 154, 153, + 153, 63, 0, 0, 0, 0, + 150, 7, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 50, 0, - 0, 9, 114, 0, 16, 0, - 2, 0, 0, 0, 246, 15, + 1, 0, 0, 0, 246, 143, + 32, 0, 0, 0, 0, 0, + 29, 0, 0, 0, 50, 0, + 0, 9, 114, 32, 16, 0, + 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 2, 0, + 246, 15, 16, 0, 6, 0, 0, 0, 70, 2, 16, 0, - 7, 0, 0, 0, 50, 0, - 0, 12, 178, 0, 16, 0, - 1, 0, 0, 0, 6, 0, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 154, 153, - 153, 63, 154, 153, 153, 63, - 0, 0, 0, 0, 154, 153, - 153, 63, 70, 8, 16, 0, - 2, 0, 0, 0, 56, 0, - 0, 8, 178, 0, 16, 0, - 1, 0, 0, 0, 70, 12, - 16, 0, 1, 0, 0, 0, - 246, 143, 32, 0, 0, 0, - 0, 0, 29, 0, 0, 0, - 50, 0, 0, 9, 114, 32, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 0, 0, - 0, 0, 246, 15, 16, 0, - 6, 0, 0, 0, 70, 3, - 16, 0, 1, 0, 0, 0, - 50, 0, 0, 11, 50, 0, - 16, 0, 0, 0, 0, 0, - 230, 138, 32, 0, 0, 0, - 0, 0, 10, 0, 0, 0, - 166, 10, 16, 0, 1, 0, - 0, 0, 230, 138, 32, 0, - 0, 0, 0, 0, 11, 0, - 0, 0, 14, 0, 0, 6, - 1, 192, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, - 130, 32, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 62, 0, - 0, 1, 83, 84, 65, 84, - 148, 0, 0, 0, 192, 0, - 0, 0, 8, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 155, 0, 0, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 54, 0, + 0, 5, 130, 32, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 62, 0, 0, 1, 83, 84, + 65, 84, 148, 0, 0, 0, + 192, 0, 0, 0, 8, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 155, 0, 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 0, 0, 0, 0, 0, - 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 10, 0, 0, 0, - 2, 0, 0, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1639,5 +1638,5 @@ const BYTE g_compositePS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 + 0, 0, 0, 0 }; diff --git a/demo/d3d11/shaders/debugLinePS.hlsl b/demo/d3d/shaders/debugLinePS.hlsl index d01847b..d01847b 100644 --- a/demo/d3d11/shaders/debugLinePS.hlsl +++ b/demo/d3d/shaders/debugLinePS.hlsl diff --git a/demo/d3d11/shaders/debugLinePS.hlsl.h b/demo/d3d/shaders/debugLinePS.hlsl.h index 6243104..6243104 100644 --- a/demo/d3d11/shaders/debugLinePS.hlsl.h +++ b/demo/d3d/shaders/debugLinePS.hlsl.h diff --git a/demo/d3d11/shaders/debugLineVS.hlsl b/demo/d3d/shaders/debugLineVS.hlsl index 1033b35..1033b35 100644 --- a/demo/d3d11/shaders/debugLineVS.hlsl +++ b/demo/d3d/shaders/debugLineVS.hlsl diff --git a/demo/d3d11/shaders/debugLineVS.hlsl.h b/demo/d3d/shaders/debugLineVS.hlsl.h index cdf7e4b..cdf7e4b 100644 --- a/demo/d3d11/shaders/debugLineVS.hlsl.h +++ b/demo/d3d/shaders/debugLineVS.hlsl.h diff --git a/demo/d3d/shaders/diffuseGS.hlsl b/demo/d3d/shaders/diffuseGS.hlsl new file mode 100644 index 0000000..e7a50d8 --- /dev/null +++ b/demo/d3d/shaders/diffuseGS.hlsl @@ -0,0 +1,83 @@ +#include "shaderCommon.h" + +cbuffer constBuf : register(b0) +{ + DiffuseShaderConst gParams; +}; + +static const float2 corners[4] = +{ + float2(0.0, 1.0), + float2(0.0, 0.0), + float2(1.0, 1.0), + float2(1.0, 0.0) +}; + +[maxvertexcount(4)] +void diffuseGS(point DiffuseVertexOut input[1], inout TriangleStream<DiffuseGeometryOut> triStream) +{ + float4 ndcPos = input[0].ndcPos; + + // frustrum culling + const float ndcBound = 1.0; + if (ndcPos.x < -ndcBound) return; + if (ndcPos.x > ndcBound) return; + if (ndcPos.y < -ndcBound) return; + if (ndcPos.y > ndcBound) return; + + float pointScale = gParams.diffuseScale; + float velocityScale = 1.0; + + float3 v = input[0].viewVel.xyz; + float3 p = input[0].viewPos.xyz; + + // billboard in eye space + float3 u = float3(0.0, pointScale, 0.0); + float3 l = float3(pointScale, 0.0, 0.0); + + // increase size based on life + float lifeTime = input[0].worldPos.w; + + float lifeFade = lerp(1.0f + gParams.diffusion, 1.0, min(1.0, lifeTime*0.25f)); + u *= lifeFade; + l *= lifeFade; + + float fade = 1.0/(lifeFade*lifeFade); + float vlen = length(v)*gParams.motionBlurScale; + + if (vlen > 0.5) + { + float len = max(pointScale, vlen*0.016); + fade = min(1.0, 2.0/(len/pointScale)); + + u = normalize(v)*max(pointScale, vlen*0.016); // assume 60hz + l = normalize(cross(u, float3(0.0, 0.0, -1.0)))*pointScale; + } + + { + DiffuseGeometryOut output; + + output.worldPos = input[0].worldPos; // vertex world pos (life in w) + output.viewPos = input[0].viewPos; // vertex eye pos + output.viewVel.xyz = input[0].viewVel.xyz; // vertex velocity in view space + output.viewVel.w = fade; + output.lightDir = mul(gParams.modelView, float4(gParams.lightDir, 0.0)); + output.color = input[0].color; + + output.uv = float2(0.0, 1.0); + output.clipPos = mul(gParams.projection, float4(p + u - l, 1.0)); + triStream.Append(output); + + output.uv = float2(0.0, 0.0); + output.clipPos = mul(gParams.projection, float4(p - u - l, 1.0)); + triStream.Append(output); + + output.uv = float2(1.0, 1.0); + output.clipPos = mul(gParams.projection, float4(p + u + l, 1.0)); + triStream.Append(output); + + output.uv = float2(1.0, 0.0); + output.clipPos = mul(gParams.projection, float4(p - u + l, 1.0)); + triStream.Append(output); + } +} diff --git a/demo/d3d11/shaders/diffuseGS.hlsl.h b/demo/d3d/shaders/diffuseGS.hlsl.h index 1f71735..6e3efd8 100644 --- a/demo/d3d11/shaders/diffuseGS.hlsl.h +++ b/demo/d3d/shaders/diffuseGS.hlsl.h @@ -64,7 +64,7 @@ // VIEWVEL 0 xyzw 3 NONE float xyzw // LIGHTDIR 0 xyzw 4 NONE float xyzw // COLOR 0 xyzw 5 NONE float xyzw -// UV 0 xyzw 6 NONE float xyzw +// UV 0 xy 6 NONE float xy // gs_5_0 dcl_globalFlags refactoringAllowed @@ -84,7 +84,7 @@ dcl_output o2.xyzw dcl_output o3.xyzw dcl_output o4.xyzw dcl_output o5.xyzw -dcl_output o6.xyzw +dcl_output o6.xy dcl_maxout 4 lt r0.x, v[0][1].x, l(-1.000000) if_nz r0.x @@ -107,8 +107,8 @@ mul r0.y, l(0.250000), v[0][0].w min r0.y, r0.y, l(1.000000) add r0.z, -r0.x, l(1.000000) mad r0.x, r0.y, r0.z, r0.x -mov r1.x, cb0[31].z mov r1.yz, l(0,0,0,0) +mov r1.x, cb0[31].z mul r1.xyz, r0.xxxx, r1.xyzx mul r0.x, r0.x, r0.x div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x @@ -148,7 +148,7 @@ mov o3.xyz, v[0][3].xyzx mov o3.w, r1.w mov o4.xyzw, r2.xyzw mov o5.xyzw, v[0][4].xyzw -mov o6.xyzw, l(0,1.000000,0,0) +mov o6.xy, l(0,1.000000,0,0) emit_stream m0 add r0.xyz, -r0.xywx, v[0][2].xyzx add r4.xyz, -r1.xyzx, r0.xyzx @@ -163,7 +163,7 @@ mov o3.xyz, v[0][3].xyzx mov o3.w, r1.w mov o4.xyzw, r2.xyzw mov o5.xyzw, v[0][4].xyzw -mov o6.xyzw, l(0,0,0,0) +mov o6.xy, l(0,0,0,0) emit_stream m0 add r3.xyz, r1.xyzx, r3.xyzx mul r4.xyzw, r3.yyyy, cb0[16].xyzw @@ -177,7 +177,7 @@ mov o3.xyz, v[0][3].xyzx mov o3.w, r1.w mov o4.xyzw, r2.xyzw mov o5.xyzw, v[0][4].xyzw -mov o6.xyzw, l(1.000000,1.000000,0,0) +mov o6.xy, l(1.000000,1.000000,0,0) emit_stream m0 add r0.xyz, r1.xyzx, r0.xyzx mul r3.xyzw, r0.yyyy, cb0[16].xyzw @@ -191,7 +191,7 @@ mov o3.xyz, v[0][3].xyzx mov o3.w, r1.w mov o4.xyzw, r2.xyzw mov o5.xyzw, v[0][4].xyzw -mov o6.xyzw, l(1.000000,0,0,0) +mov o6.xy, l(1.000000,0,0,0) emit_stream m0 ret // Approximately 108 instruction slots used @@ -199,10 +199,10 @@ ret const BYTE g_diffuseGS[] = { - 68, 88, 66, 67, 206, 113, - 108, 237, 96, 228, 115, 111, - 205, 11, 177, 210, 155, 123, - 232, 125, 1, 0, 0, 0, + 68, 88, 66, 67, 210, 25, + 219, 88, 83, 177, 178, 56, + 31, 41, 77, 1, 224, 175, + 13, 250, 1, 0, 0, 0, 16, 18, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 188, 3, 0, 0, 108, 4, @@ -422,7 +422,7 @@ const BYTE g_diffuseGS[] = 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 6, 0, - 0, 0, 15, 0, 0, 0, + 0, 0, 3, 12, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 80, 79, 83, 73, 84, 73, @@ -469,7 +469,7 @@ const BYTE g_diffuseGS[] = 16, 0, 4, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 5, 0, 0, 0, - 101, 0, 0, 3, 242, 32, + 101, 0, 0, 3, 50, 32, 16, 0, 6, 0, 0, 0, 94, 0, 0, 2, 4, 0, 0, 0, 49, 0, 0, 8, @@ -534,15 +534,15 @@ const BYTE g_diffuseGS[] = 42, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, - 0, 6, 18, 0, 16, 0, - 1, 0, 0, 0, 42, 128, - 32, 0, 0, 0, 0, 0, - 31, 0, 0, 0, 54, 0, 0, 8, 98, 0, 16, 0, 1, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 54, 0, 0, 6, 18, 0, + 16, 0, 1, 0, 0, 0, + 42, 128, 32, 0, 0, 0, + 0, 0, 31, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 1, 0, 0, 0, 6, 0, 16, 0, 0, 0, @@ -743,7 +743,7 @@ const BYTE g_diffuseGS[] = 16, 0, 5, 0, 0, 0, 70, 30, 32, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 54, 0, 0, 8, 242, 32, + 54, 0, 0, 8, 50, 32, 16, 0, 6, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, @@ -812,7 +812,7 @@ const BYTE g_diffuseGS[] = 5, 0, 0, 0, 70, 30, 32, 0, 0, 0, 0, 0, 4, 0, 0, 0, 54, 0, - 0, 8, 242, 32, 16, 0, + 0, 8, 50, 32, 16, 0, 6, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -874,7 +874,7 @@ const BYTE g_diffuseGS[] = 5, 0, 0, 0, 70, 30, 32, 0, 0, 0, 0, 0, 4, 0, 0, 0, 54, 0, - 0, 8, 242, 32, 16, 0, + 0, 8, 50, 32, 16, 0, 6, 0, 0, 0, 2, 64, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, @@ -936,7 +936,7 @@ const BYTE g_diffuseGS[] = 5, 0, 0, 0, 70, 30, 32, 0, 0, 0, 0, 0, 4, 0, 0, 0, 54, 0, - 0, 8, 242, 32, 16, 0, + 0, 8, 50, 32, 16, 0, 6, 0, 0, 0, 2, 64, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/demo/d3d11/shaders/diffusePS.hlsl b/demo/d3d/shaders/diffusePS.hlsl index c6e474e..b548b49 100644 --- a/demo/d3d11/shaders/diffusePS.hlsl +++ b/demo/d3d/shaders/diffusePS.hlsl @@ -7,21 +7,15 @@ cbuffer constBuf : register(b0) float sqr(float x) { return x * x; } - -float4 diffusePS(DiffuseGeometryOut input - //, out float gl_FragDepth : SV_DEPTH -) : SV_TARGET +float4 diffusePS(DiffuseGeometryOut input) : SV_TARGET { - //return float4(1.0f, 0.0f, 0.0f, 1.0f); - float attenuation = 1.0f; float lifeTime = input.worldPos.w; float lifeFade = min(1.0, lifeTime*0.125); float velocityFade = input.viewVel.w; // calculate normal from texture coordinates - float3 normal; - normal.xy = input.uv.xy*float2(2.0, 2.0) + float2(-1.0, -1.0); + float3 normal = float3(input.uv * 2.0 + float2(-1.0, -1.0), 0.0); float mag = dot(normal.xy, normal.xy); // kill pixels outside circle @@ -31,7 +25,5 @@ float4 diffusePS(DiffuseGeometryOut input normal.z = 1.0-mag; float alpha = lifeFade*velocityFade*sqr(normal.z); - return float4(alpha, alpha, alpha, alpha); - } diff --git a/demo/d3d11/shaders/diffusePS.hlsl.h b/demo/d3d/shaders/diffusePS.hlsl.h index b77dc1c..44a31b1 100644 --- a/demo/d3d11/shaders/diffusePS.hlsl.h +++ b/demo/d3d/shaders/diffusePS.hlsl.h @@ -14,7 +14,7 @@ // VIEWVEL 0 xyzw 3 NONE float w // LIGHTDIR 0 xyzw 4 NONE float // COLOR 0 xyzw 5 NONE float -// UV 0 xyzw 6 NONE float xy +// UV 0 xy 6 NONE float xy // // // Output signature: @@ -46,10 +46,10 @@ ret const BYTE g_diffusePS[] = { - 68, 88, 66, 67, 142, 84, - 94, 27, 80, 231, 240, 136, - 237, 253, 148, 77, 42, 64, - 90, 183, 1, 0, 0, 0, + 68, 88, 66, 67, 226, 109, + 117, 161, 154, 99, 48, 92, + 15, 92, 142, 117, 138, 39, + 5, 123, 1, 0, 0, 0, 232, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 172, 0, 0, 0, 156, 1, @@ -104,7 +104,7 @@ const BYTE g_diffusePS[] = 0, 0, 228, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 6, 0, 0, 0, 15, 3, + 6, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 80, 79, 83, 73, diff --git a/demo/d3d11/shaders/diffuseVS.hlsl b/demo/d3d/shaders/diffuseVS.hlsl index afca738..303b896 100644 --- a/demo/d3d11/shaders/diffuseVS.hlsl +++ b/demo/d3d/shaders/diffuseVS.hlsl @@ -22,5 +22,4 @@ DiffuseVertexOut diffuseVS(DiffuseVertexIn input) output.ndcPos = ndcPos / ndcPos.w; return output; - } diff --git a/demo/d3d11/shaders/diffuseVS.hlsl.h b/demo/d3d/shaders/diffuseVS.hlsl.h index 7db0a8c..7db0a8c 100644 --- a/demo/d3d11/shaders/diffuseVS.hlsl.h +++ b/demo/d3d/shaders/diffuseVS.hlsl.h diff --git a/demo/d3d/shaders/ellipsoidDepthGS.hlsl b/demo/d3d/shaders/ellipsoidDepthGS.hlsl new file mode 100644 index 0000000..92169d3 --- /dev/null +++ b/demo/d3d/shaders/ellipsoidDepthGS.hlsl @@ -0,0 +1,65 @@ +#include "shaderCommon.h" + +cbuffer constBuf : register(b0) +{ + FluidShaderConst gParams; +}; + +static const float2 corners[4] = +{ + float2(0.0, 1.0), float2(0.0, 0.0), float2(1.0, 1.0), float2(1.0, 0.0) +}; + +[maxvertexcount(4)] +void ellipsoidDepthGS(point FluidVertexOut input[1], inout TriangleStream<FluidGeoOut> triStream) +{ + const float4 ndcPos = input[0].ndcPos; + // frustrum culling + const float ndcBound = 1.0; + if (any(abs(ndcPos.xy) > ndcBound)) + { + return; + } + + float4 bounds = input[0].bounds; + + const float4 invQuad0 = input[0].invQ0; + const float4 invQuad1 = input[0].invQ1; + const float4 invQuad2 = input[0].invQ2; + const float4 invQuad3 = input[0].invQ3; + + float xmin = bounds.x; + float xmax = bounds.y; + float ymin = bounds.z; + float ymax = bounds.w; + + FluidGeoOut output; + + output.position = float4(xmin, ymax, 0.5, 1.0); + output.invQ0 = invQuad0; + output.invQ1 = invQuad1; + output.invQ2 = invQuad2; + output.invQ3 = invQuad3; + triStream.Append(output); + + output.position = float4(xmin, ymin, 0.5, 1.0); + output.invQ0 = invQuad0; + output.invQ1 = invQuad1; + output.invQ2 = invQuad2; + output.invQ3 = invQuad3; + triStream.Append(output); + + output.position = float4(xmax, ymax, 0.5, 1.0); + output.invQ0 = invQuad0; + output.invQ1 = invQuad1; + output.invQ2 = invQuad2; + output.invQ3 = invQuad3; + triStream.Append(output); + + output.position = float4(xmax, ymin, 0.5, 1.0); + output.invQ0 = invQuad0; + output.invQ1 = invQuad1; + output.invQ2 = invQuad2; + output.invQ3 = invQuad3; + triStream.Append(output); +} diff --git a/demo/d3d11/shaders/ellipsoidDepthGS.hlsl.h b/demo/d3d/shaders/ellipsoidDepthGS.hlsl.h index c82cc89..5966899 100644 --- a/demo/d3d11/shaders/ellipsoidDepthGS.hlsl.h +++ b/demo/d3d/shaders/ellipsoidDepthGS.hlsl.h @@ -14,7 +14,7 @@ // TEXCOORD 2 xyzw 3 NONE float xyzw // TEXCOORD 3 xyzw 4 NONE float xyzw // TEXCOORD 4 xyzw 5 NONE float xyzw -// TEXCOORD 5 xyzw 6 NONE float xy w +// TEXCOORD 5 xyzw 6 NONE float xy // // // Output signature: @@ -46,23 +46,8 @@ dcl_output o2.xyzw dcl_output o3.xyzw dcl_output o4.xyzw dcl_maxout 4 -lt r0.x, v[0][6].w, l(0.000000) -if_nz r0.x - ret -endif -lt r0.x, v[0][6].x, l(-1.000000) -if_nz r0.x - ret -endif -lt r0.x, l(1.000000), v[0][6].x -if_nz r0.x - ret -endif -lt r0.x, v[0][6].y, l(-1.000000) -if_nz r0.x - ret -endif -lt r0.x, l(1.000000), v[0][6].y +lt r0.xy, l(1.000000, 1.000000, 0.000000, 0.000000), |v[0][6].xyxx| +or r0.x, r0.y, r0.x if_nz r0.x ret endif @@ -95,20 +80,20 @@ mov o3.xyzw, v[0][4].xyzw mov o4.xyzw, v[0][5].xyzw emit_stream m0 ret -// Approximately 49 instruction slots used +// Approximately 34 instruction slots used #endif const BYTE g_ellipsoidDepthGS[] = { - 68, 88, 66, 67, 121, 233, - 112, 246, 66, 190, 203, 227, - 242, 237, 242, 197, 75, 158, - 125, 123, 1, 0, 0, 0, - 72, 7, 0, 0, 5, 0, + 68, 88, 66, 67, 152, 192, + 203, 71, 86, 80, 184, 94, + 47, 161, 87, 71, 136, 207, + 121, 6, 1, 0, 0, 0, + 164, 6, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 172, 0, 0, 0, 120, 1, 0, 0, 44, 2, 0, 0, - 172, 6, 0, 0, 82, 68, + 8, 6, 0, 0, 82, 68, 69, 70, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -158,7 +143,7 @@ const BYTE g_ellipsoidDepthGS[] = 0, 0, 185, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 6, 0, 0, 0, 15, 11, + 6, 0, 0, 0, 15, 3, 0, 0, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, @@ -193,8 +178,8 @@ const BYTE g_ellipsoidDepthGS[] = 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 83, 72, - 69, 88, 120, 4, 0, 0, - 80, 0, 2, 0, 30, 1, + 69, 88, 212, 3, 0, 0, + 80, 0, 2, 0, 245, 0, 0, 0, 106, 8, 0, 1, 95, 0, 0, 4, 242, 16, 32, 0, 1, 0, 0, 0, @@ -231,52 +216,52 @@ const BYTE g_ellipsoidDepthGS[] = 101, 0, 0, 3, 242, 32, 16, 0, 4, 0, 0, 0, 94, 0, 0, 2, 4, 0, - 0, 0, 49, 0, 0, 8, - 18, 0, 16, 0, 0, 0, - 0, 0, 58, 16, 32, 0, + 0, 0, 49, 0, 0, 12, + 50, 0, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 0, 0, + 0, 0, 0, 0, 70, 16, + 32, 128, 129, 0, 0, 0, 0, 0, 0, 0, 6, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 31, 0, - 4, 3, 10, 0, 16, 0, - 0, 0, 0, 0, 62, 0, - 0, 1, 21, 0, 0, 1, - 49, 0, 0, 8, 18, 0, + 0, 0, 60, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, - 10, 16, 32, 0, 0, 0, - 0, 0, 6, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 191, 31, 0, 4, 3, - 10, 0, 16, 0, 0, 0, - 0, 0, 62, 0, 0, 1, - 21, 0, 0, 1, 49, 0, - 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 10, 16, 32, 0, 0, 0, - 0, 0, 6, 0, 0, 0, 31, 0, 4, 3, 10, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 21, 0, - 0, 1, 49, 0, 0, 8, - 18, 0, 16, 0, 0, 0, - 0, 0, 26, 16, 32, 0, - 0, 0, 0, 0, 6, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 191, 31, 0, - 4, 3, 10, 0, 16, 0, - 0, 0, 0, 0, 62, 0, - 0, 1, 21, 0, 0, 1, - 49, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 26, 16, 32, 0, - 0, 0, 0, 0, 6, 0, - 0, 0, 31, 0, 4, 3, - 10, 0, 16, 0, 0, 0, - 0, 0, 62, 0, 0, 1, - 21, 0, 0, 1, 54, 0, + 0, 1, 54, 0, 0, 6, + 50, 32, 16, 0, 0, 0, + 0, 0, 198, 16, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 54, 0, 0, 8, + 194, 32, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 63, + 0, 0, 128, 63, 54, 0, + 0, 6, 242, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 54, 0, + 0, 6, 242, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 32, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 54, 0, + 0, 6, 242, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 32, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 54, 0, + 0, 6, 242, 32, 16, 0, + 4, 0, 0, 0, 70, 30, + 32, 0, 0, 0, 0, 0, + 5, 0, 0, 0, 117, 0, + 0, 3, 0, 0, 17, 0, + 0, 0, 0, 0, 54, 0, 0, 6, 50, 32, 16, 0, - 0, 0, 0, 0, 198, 16, + 0, 0, 0, 0, 134, 16, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, @@ -304,7 +289,7 @@ const BYTE g_ellipsoidDepthGS[] = 17, 0, 0, 0, 0, 0, 54, 0, 0, 6, 50, 32, 16, 0, 0, 0, 0, 0, - 134, 16, 32, 0, 0, 0, + 214, 21, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, 0, 0, @@ -331,7 +316,7 @@ const BYTE g_ellipsoidDepthGS[] = 0, 0, 17, 0, 0, 0, 0, 0, 54, 0, 0, 6, 50, 32, 16, 0, 0, 0, - 0, 0, 214, 21, 32, 0, + 0, 0, 150, 21, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, @@ -356,53 +341,26 @@ const BYTE g_ellipsoidDepthGS[] = 32, 0, 0, 0, 0, 0, 5, 0, 0, 0, 117, 0, 0, 3, 0, 0, 17, 0, - 0, 0, 0, 0, 54, 0, - 0, 6, 50, 32, 16, 0, - 0, 0, 0, 0, 150, 21, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 54, 0, - 0, 8, 194, 32, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 63, 0, 0, 128, 63, - 54, 0, 0, 6, 242, 32, - 16, 0, 1, 0, 0, 0, - 70, 30, 32, 0, 0, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 83, 84, 65, 84, + 148, 0, 0, 0, 34, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 12, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 2, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 3, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 4, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 5, 0, 0, 0, - 117, 0, 0, 3, 0, 0, - 17, 0, 0, 0, 0, 0, - 62, 0, 0, 1, 83, 84, - 65, 84, 148, 0, 0, 0, - 49, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 5, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 0, - 0, 0, 5, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 0, + 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 5, 0, 0, 0, 4, 0, + 1, 0, 0, 0, 5, 0, + 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -410,5 +368,5 @@ const BYTE g_ellipsoidDepthGS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 + 0, 0 }; diff --git a/demo/d3d11/shaders/ellipsoidDepthPS.hlsl b/demo/d3d/shaders/ellipsoidDepthPS.hlsl index b9a8287..ccccc69 100644 --- a/demo/d3d11/shaders/ellipsoidDepthPS.hlsl +++ b/demo/d3d/shaders/ellipsoidDepthPS.hlsl @@ -43,35 +43,23 @@ bool solveQuadratic(float a, float b, float c, out float minT, out float maxT) float sqr(float x) { return x * x; } - -float4 ellipsoidDepthPS(FluidGeoOut input - , out float gl_FragDepth : SV_DEPTH -) : SV_TARGET +float ellipsoidDepthPS(FluidGeoOut input , out float depthOut : SV_DEPTH) : SV_TARGET { - const float4x4 gl_ProjectionMatrix = gParams.projection; - const float4x4 gl_ProjectionMatrixInverse = gParams.projection_inverse; + const float4x4 projectionMatrix = gParams.projection; + const float4x4 projectionMatrixInverse = gParams.inverseProjection; const float3 invViewport = gParams.invViewport; - - float4 gl_FragColor; - float4 gl_FragCoord; - float4 gl_TexCoord[6]; - - gl_FragCoord = input.position; - [unroll] - for (int i = 0; i < 4; i++) - gl_TexCoord[i] = input.texCoord[i]; + const float4 position = input.position; // transform from view space to parameter space //column_major float4x4 invQuadric; - invQuadric._m00_m10_m20_m30 = gl_TexCoord[0]; - invQuadric._m01_m11_m21_m31 = gl_TexCoord[1]; - invQuadric._m02_m12_m22_m32 = gl_TexCoord[2]; - invQuadric._m03_m13_m23_m33 = gl_TexCoord[3]; + invQuadric._m00_m10_m20_m30 = input.invQ0; + invQuadric._m01_m11_m21_m31 = input.invQ1; + invQuadric._m02_m12_m22_m32 = input.invQ2; + invQuadric._m03_m13_m23_m33 = input.invQ3; - //float4 ndcPos = float4(gl_FragCoord.xy * invViewport.xy * float2(2.0, 2.0) - float2(1.0, 1.0), -1.0, 1.0); - float4 ndcPos = float4(gl_FragCoord.x*invViewport.x*2.0f-1.0f, (1.0f-gl_FragCoord.y*invViewport.y)*2.0 - 1.0, 0.0f, 1.0); - float4 viewDir = mul(gl_ProjectionMatrixInverse, ndcPos); + float4 ndcPos = float4(position.x*invViewport.x*2.0f-1.0f, (1.0f-position.y*invViewport.y)*2.0 - 1.0, 0.0f, 1.0); + float4 viewDir = mul(projectionMatrixInverse, ndcPos); // ray to parameter space float4 dir = mul(invQuadric, float4(viewDir.xyz, 0.0)); @@ -85,24 +73,16 @@ float4 ellipsoidDepthPS(FluidGeoOut input float minT; float maxT; - if (solveQuadratic(a, 2.0 * b, c, minT, maxT)) + if (!solveQuadratic(a, 2.0 * b, c, minT, maxT)) + { + discard; + } { float3 eyePos = viewDir.xyz*minT; - float4 ndcPos = mul(gl_ProjectionMatrix, float4(eyePos, 1.0)); + float4 ndcPos = mul(projectionMatrix, float4(eyePos, 1.0)); ndcPos.z /= ndcPos.w; - gl_FragColor = float4(eyePos.z, 1.0, 1.0, 1.0); - gl_FragDepth = ndcPos.z; - - return gl_FragColor; + depthOut = ndcPos.z; + return eyePos.z; } - - // kill pixels outside of ellipsoid - discard; - - - gl_FragColor = 0.0f; - gl_FragDepth = 1.0f; - - return gl_FragColor; } diff --git a/demo/d3d/shaders/ellipsoidDepthPS.hlsl.h b/demo/d3d/shaders/ellipsoidDepthPS.hlsl.h new file mode 100644 index 0000000..7e007a5 --- /dev/null +++ b/demo/d3d/shaders/ellipsoidDepthPS.hlsl.h @@ -0,0 +1,643 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 +// +// +// Buffer Definitions: +// +// cbuffer constBuf +// { +// +// struct FluidShaderConst +// { +// +// float4x4 modelViewProjection; // Offset: 0 +// float4x4 modelView; // Offset: 64 +// float4x4 projection; // Offset: 128 +// float4x4 inverseModelView; // Offset: 192 +// float4x4 inverseProjection; // Offset: 256 +// float4 invTexScale; // Offset: 320 +// float3 invViewport; // Offset: 336 +// float _pad0; // Offset: 348 +// float blurRadiusWorld; // Offset: 352 +// float blurScale; // Offset: 356 +// float blurFalloff; // Offset: 360 +// int debug; // Offset: 364 +// float3 lightPos; // Offset: 368 +// float _pad1; // Offset: 380 +// float3 lightDir; // Offset: 384 +// float _pad2; // Offset: 396 +// float4x4 lightTransform; // Offset: 400 +// float4 color; // Offset: 464 +// float4 clipPosToEye; // Offset: 480 +// float spotMin; // Offset: 496 +// float spotMax; // Offset: 500 +// float ior; // Offset: 504 +// float _pad3; // Offset: 508 +// float4 shadowTaps[12]; // Offset: 512 +// +// } gParams; // Offset: 0 Size: 704 +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// constBuf cbuffer NA NA 0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_POSITION 0 xyzw 0 POS float xy +// TEXCOORD 0 xyzw 1 NONE float xyzw +// TEXCOORD 1 xyzw 2 NONE float xyzw +// TEXCOORD 2 xyzw 3 NONE float xyzw +// TEXCOORD 3 xyzw 4 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_TARGET 0 x 0 TARGET float x +// SV_DEPTH 0 N/A oDepth DEPTH float YES +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer cb0[22], immediateIndexed +dcl_input_ps_siv linear noperspective v0.xy, position +dcl_input_ps linear v1.xyzw +dcl_input_ps linear v2.xyzw +dcl_input_ps linear v3.xyzw +dcl_input_ps linear v4.xyzw +dcl_output o0.x +dcl_output oDepth +dcl_temps 4 +dp2 r0.x, v0.xxxx, cb0[21].xxxx +add r0.x, r0.x, l(-1.000000) +mad r0.y, -v0.y, cb0[21].y, l(1.000000) +mad r0.y, r0.y, l(2.000000), l(-1.000000) +mul r0.yzw, r0.yyyy, cb0[17].xxyz +mad r0.xyz, cb0[16].xyzx, r0.xxxx, r0.yzwy +add r0.xyz, r0.xyzx, cb0[19].xyzx +mul r1.xyzw, r0.yyyy, v2.xyzw +mad r1.xyzw, v1.xyzw, r0.xxxx, r1.xyzw +mad r1.xyzw, v3.xyzw, r0.zzzz, r1.xyzw +dp3 r0.w, r1.xyzx, r1.xyzx +dp3 r1.x, r1.xyzx, v4.xyzx +mad r1.x, -r1.w, v4.w, r1.x +dp3 r1.y, v4.xyzx, v4.xyzx +mad r1.y, -v4.w, v4.w, r1.y +add r1.z, r1.x, r1.x +eq r1.w, r0.w, l(0.000000) +eq r2.x, r1.x, l(0.000000) +and r1.w, r1.w, r2.x +mul r2.x, r0.w, r1.y +mul r2.x, r2.x, l(4.000000) +mad r2.x, r1.z, r1.z, -r2.x +lt r2.y, r2.x, l(0.000000) +not r3.y, r2.y +lt r1.x, r1.x, l(0.000000) +movc r1.x, r1.x, l(-1.000000), l(1.000000) +sqrt r2.x, r2.x +mad r1.x, r1.x, r2.x, r1.z +mul r1.x, r1.x, l(-0.500000) +div r0.w, r1.x, r0.w +div r1.x, r1.y, r1.x +lt r1.y, r1.x, r0.w +movc r3.z, r1.y, r1.x, r0.w +mov r3.xw, l(0,0,0,-1) +movc r1.xy, r2.yyyy, r3.xyxx, r3.zwzz +movc r1.xy, r1.wwww, l(0,-1,0,0), r1.xyxx +not r0.w, r1.y +discard_nz r0.w +mul r0.xyz, r0.xyzx, r1.xxxx +mul r0.yw, r0.yyyy, cb0[9].zzzw +mad r0.xy, cb0[8].zwzz, r0.xxxx, r0.ywyy +mad r0.xy, cb0[10].zwzz, r0.zzzz, r0.xyxx +add r0.xy, r0.xyxx, cb0[11].zwzz +div oDepth, r0.x, r0.y +mov o0.x, r0.z +ret +// Approximately 46 instruction slots used +#endif + +const BYTE g_ellipsoidDepthPS[] = +{ + 68, 88, 66, 67, 108, 237, + 133, 240, 171, 175, 220, 253, + 207, 147, 106, 237, 177, 103, + 173, 51, 1, 0, 0, 0, + 248, 11, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 112, 4, 0, 0, 16, 5, + 0, 0, 100, 5, 0, 0, + 92, 11, 0, 0, 82, 68, + 69, 70, 52, 4, 0, 0, + 1, 0, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 60, 0, 0, 0, 0, 5, + 255, 255, 0, 1, 0, 0, + 0, 4, 0, 0, 82, 68, + 49, 49, 60, 0, 0, 0, + 24, 0, 0, 0, 32, 0, + 0, 0, 40, 0, 0, 0, + 36, 0, 0, 0, 12, 0, + 0, 0, 0, 0, 0, 0, + 92, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 99, 111, 110, 115, + 116, 66, 117, 102, 0, 171, + 171, 171, 92, 0, 0, 0, + 1, 0, 0, 0, 128, 0, + 0, 0, 192, 2, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 168, 0, 0, 0, + 0, 0, 0, 0, 192, 2, + 0, 0, 2, 0, 0, 0, + 220, 3, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 103, 80, 97, 114, 97, 109, + 115, 0, 70, 108, 117, 105, + 100, 83, 104, 97, 100, 101, + 114, 67, 111, 110, 115, 116, + 0, 109, 111, 100, 101, 108, + 86, 105, 101, 119, 80, 114, + 111, 106, 101, 99, 116, 105, + 111, 110, 0, 102, 108, 111, + 97, 116, 52, 120, 52, 0, + 171, 171, 3, 0, 3, 0, + 4, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 213, 0, + 0, 0, 109, 111, 100, 101, + 108, 86, 105, 101, 119, 0, + 112, 114, 111, 106, 101, 99, + 116, 105, 111, 110, 0, 105, + 110, 118, 101, 114, 115, 101, + 77, 111, 100, 101, 108, 86, + 105, 101, 119, 0, 105, 110, + 118, 101, 114, 115, 101, 80, + 114, 111, 106, 101, 99, 116, + 105, 111, 110, 0, 105, 110, + 118, 84, 101, 120, 83, 99, + 97, 108, 101, 0, 102, 108, + 111, 97, 116, 52, 0, 171, + 1, 0, 3, 0, 1, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 72, 1, 0, 0, + 105, 110, 118, 86, 105, 101, + 119, 112, 111, 114, 116, 0, + 102, 108, 111, 97, 116, 51, + 0, 171, 1, 0, 3, 0, + 1, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 128, 1, + 0, 0, 95, 112, 97, 100, + 48, 0, 102, 108, 111, 97, + 116, 0, 0, 0, 3, 0, + 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 178, 1, + 0, 0, 98, 108, 117, 114, + 82, 97, 100, 105, 117, 115, + 87, 111, 114, 108, 100, 0, + 98, 108, 117, 114, 83, 99, + 97, 108, 101, 0, 98, 108, + 117, 114, 70, 97, 108, 108, + 111, 102, 102, 0, 100, 101, + 98, 117, 103, 0, 105, 110, + 116, 0, 0, 0, 2, 0, + 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 8, 2, + 0, 0, 108, 105, 103, 104, + 116, 80, 111, 115, 0, 95, + 112, 97, 100, 49, 0, 108, + 105, 103, 104, 116, 68, 105, + 114, 0, 95, 112, 97, 100, + 50, 0, 108, 105, 103, 104, + 116, 84, 114, 97, 110, 115, + 102, 111, 114, 109, 0, 99, + 111, 108, 111, 114, 0, 99, + 108, 105, 112, 80, 111, 115, + 84, 111, 69, 121, 101, 0, + 115, 112, 111, 116, 77, 105, + 110, 0, 115, 112, 111, 116, + 77, 97, 120, 0, 105, 111, + 114, 0, 95, 112, 97, 100, + 51, 0, 115, 104, 97, 100, + 111, 119, 84, 97, 112, 115, + 0, 171, 171, 171, 1, 0, + 3, 0, 1, 0, 4, 0, + 12, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 72, 1, 0, 0, 193, 0, + 0, 0, 224, 0, 0, 0, + 0, 0, 0, 0, 4, 1, + 0, 0, 224, 0, 0, 0, + 64, 0, 0, 0, 14, 1, + 0, 0, 224, 0, 0, 0, + 128, 0, 0, 0, 25, 1, + 0, 0, 224, 0, 0, 0, + 192, 0, 0, 0, 42, 1, + 0, 0, 224, 0, 0, 0, + 0, 1, 0, 0, 60, 1, + 0, 0, 80, 1, 0, 0, + 64, 1, 0, 0, 116, 1, + 0, 0, 136, 1, 0, 0, + 80, 1, 0, 0, 172, 1, + 0, 0, 184, 1, 0, 0, + 92, 1, 0, 0, 220, 1, + 0, 0, 184, 1, 0, 0, + 96, 1, 0, 0, 236, 1, + 0, 0, 184, 1, 0, 0, + 100, 1, 0, 0, 246, 1, + 0, 0, 184, 1, 0, 0, + 104, 1, 0, 0, 2, 2, + 0, 0, 12, 2, 0, 0, + 108, 1, 0, 0, 48, 2, + 0, 0, 136, 1, 0, 0, + 112, 1, 0, 0, 57, 2, + 0, 0, 184, 1, 0, 0, + 124, 1, 0, 0, 63, 2, + 0, 0, 136, 1, 0, 0, + 128, 1, 0, 0, 72, 2, + 0, 0, 184, 1, 0, 0, + 140, 1, 0, 0, 78, 2, + 0, 0, 224, 0, 0, 0, + 144, 1, 0, 0, 93, 2, + 0, 0, 80, 1, 0, 0, + 208, 1, 0, 0, 99, 2, + 0, 0, 80, 1, 0, 0, + 224, 1, 0, 0, 112, 2, + 0, 0, 184, 1, 0, 0, + 240, 1, 0, 0, 120, 2, + 0, 0, 184, 1, 0, 0, + 244, 1, 0, 0, 128, 2, + 0, 0, 184, 1, 0, 0, + 248, 1, 0, 0, 132, 2, + 0, 0, 184, 1, 0, 0, + 252, 1, 0, 0, 138, 2, + 0, 0, 152, 2, 0, 0, + 0, 2, 0, 0, 5, 0, + 0, 0, 1, 0, 176, 0, + 0, 0, 24, 0, 188, 2, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 176, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, + 171, 171, 73, 83, 71, 78, + 152, 0, 0, 0, 5, 0, + 0, 0, 8, 0, 0, 0, + 128, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 3, 0, 0, + 140, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 15, 0, 0, + 140, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 15, 15, 0, 0, + 140, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 15, 15, 0, 0, + 140, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 4, 0, + 0, 0, 15, 15, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 76, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 1, 14, 0, 0, 66, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 255, 255, 255, 255, + 1, 14, 0, 0, 83, 86, + 95, 84, 65, 82, 71, 69, + 84, 0, 83, 86, 95, 68, + 69, 80, 84, 72, 0, 171, + 83, 72, 69, 88, 240, 5, + 0, 0, 80, 0, 0, 0, + 124, 1, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 100, 32, 0, 4, 50, 16, + 16, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 2, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 3, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 4, 0, 0, 0, 101, 0, + 0, 3, 18, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 2, 1, 192, 0, 0, + 104, 0, 0, 2, 4, 0, + 0, 0, 15, 0, 0, 8, + 18, 0, 16, 0, 0, 0, + 0, 0, 6, 16, 16, 0, + 0, 0, 0, 0, 6, 128, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 0, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 191, 50, 0, 0, 11, + 34, 0, 16, 0, 0, 0, + 0, 0, 26, 16, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 26, 128, 32, 0, + 0, 0, 0, 0, 21, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 50, 0, + 0, 9, 34, 0, 16, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 64, 1, 64, 0, 0, + 0, 0, 128, 191, 56, 0, + 0, 8, 226, 0, 16, 0, + 0, 0, 0, 0, 86, 5, + 16, 0, 0, 0, 0, 0, + 6, 137, 32, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 8, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 56, 0, 0, 7, 242, 0, + 16, 0, 1, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 2, 0, 0, 0, 50, 0, + 0, 9, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 1, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 9, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 3, 0, 0, 0, + 166, 10, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 18, + 16, 0, 4, 0, 0, 0, + 50, 0, 0, 10, 18, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 58, 16, 16, 0, 4, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 16, 0, + 0, 7, 34, 0, 16, 0, + 1, 0, 0, 0, 70, 18, + 16, 0, 4, 0, 0, 0, + 70, 18, 16, 0, 4, 0, + 0, 0, 50, 0, 0, 10, + 34, 0, 16, 0, 1, 0, + 0, 0, 58, 16, 16, 128, + 65, 0, 0, 0, 4, 0, + 0, 0, 58, 16, 16, 0, + 4, 0, 0, 0, 26, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 7, 66, 0, + 16, 0, 1, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 24, 0, + 0, 7, 130, 0, 16, 0, + 1, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 24, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 7, 130, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 7, 18, 0, 16, 0, + 2, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 26, 0, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 10, 0, 16, 0, + 2, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 64, + 50, 0, 0, 10, 18, 0, + 16, 0, 2, 0, 0, 0, + 42, 0, 16, 0, 1, 0, + 0, 0, 42, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 128, 65, 0, 0, 0, + 2, 0, 0, 0, 49, 0, + 0, 7, 34, 0, 16, 0, + 2, 0, 0, 0, 10, 0, + 16, 0, 2, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 59, 0, 0, 5, + 34, 0, 16, 0, 3, 0, + 0, 0, 26, 0, 16, 0, + 2, 0, 0, 0, 49, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 55, 0, 0, 9, + 18, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 191, + 1, 64, 0, 0, 0, 0, + 128, 63, 75, 0, 0, 5, + 18, 0, 16, 0, 2, 0, + 0, 0, 10, 0, 16, 0, + 2, 0, 0, 0, 50, 0, + 0, 9, 18, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 10, 0, 16, 0, 2, 0, + 0, 0, 42, 0, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 191, 14, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 14, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 26, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 49, 0, + 0, 7, 34, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 55, 0, 0, 9, + 66, 0, 16, 0, 3, 0, + 0, 0, 26, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 8, + 146, 0, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 55, 0, + 0, 9, 50, 0, 16, 0, + 1, 0, 0, 0, 86, 5, + 16, 0, 2, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 230, 10, 16, 0, + 3, 0, 0, 0, 55, 0, + 0, 12, 50, 0, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 0, 16, 0, + 1, 0, 0, 0, 59, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 1, 0, 0, 0, + 13, 0, 4, 3, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 8, 162, 0, 16, 0, + 0, 0, 0, 0, 86, 5, + 16, 0, 0, 0, 0, 0, + 166, 142, 32, 0, 0, 0, + 0, 0, 9, 0, 0, 0, + 50, 0, 0, 10, 50, 0, + 16, 0, 0, 0, 0, 0, + 230, 138, 32, 0, 0, 0, + 0, 0, 8, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 214, 5, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 10, 50, 0, 16, 0, + 0, 0, 0, 0, 230, 138, + 32, 0, 0, 0, 0, 0, + 10, 0, 0, 0, 166, 10, + 16, 0, 0, 0, 0, 0, + 70, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 8, + 50, 0, 16, 0, 0, 0, + 0, 0, 70, 0, 16, 0, + 0, 0, 0, 0, 230, 138, + 32, 0, 0, 0, 0, 0, + 11, 0, 0, 0, 14, 0, + 0, 6, 1, 192, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 18, 32, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 148, 0, 0, 0, + 46, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 35, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/demo/d3d/shaders/ellipsoidDepthVS.hlsl b/demo/d3d/shaders/ellipsoidDepthVS.hlsl new file mode 100644 index 0000000..f26317e --- /dev/null +++ b/demo/d3d/shaders/ellipsoidDepthVS.hlsl @@ -0,0 +1,118 @@ +#include "shaderCommon.h" + +cbuffer constBuf : register(b0) +{ + FluidShaderConst gParams; +}; + +// returns 1.0 for x==0.0 (unlike glsl) +float Sign(float x) { return x < 0.0 ? -1.0 : 1.0; } + +bool solveQuadratic(float a, float b, float c, out float minT, out float maxT) +{ +#if 0 + // for debugging + minT = -0.5; + maxT = 0.5; + return true; +#else + //minT = 0.0f; + //maxT = 0.0f; +#endif + + if (a == 0.0 && b == 0.0) + { + minT = maxT = 0.0; + return false; + } + + float discriminant = b*b - 4.0*a*c; + + if (discriminant < 0.0) + { + return false; + } + + float t = -0.5*(b + Sign(b)*sqrt(discriminant)); + minT = t / a; + maxT = c / t; + + if (minT > maxT) + { + float tmp = minT; + minT = maxT; + maxT = tmp; + } + + return true; +} + +float DotInvW(float4 a, float4 b) { return a.x*b.x + a.y*b.y + a.z*b.z - a.w*b.w; } + +FluidVertexOut ellipsoidDepthVS(FluidVertexIn input, uint instance : SV_VertexID) +{ + const float4 q1 = input.q1; + const float4 q2 = input.q2; + const float4 q3 = input.q3; + + const float4x4 modelViewProjectionMatrix = gParams.modelViewProjection; + const float4x4 modelViewMatrixInverse = gParams.inverseModelView; + + float3 worldPos = input.position.xyz; + + // construct quadric matrix + float4x4 q; + q._m00_m10_m20_m30 = float4(q1.xyz*q1.w, 0.0); + q._m01_m11_m21_m31 = float4(q2.xyz*q2.w, 0.0); + q._m02_m12_m22_m32 = float4(q3.xyz*q3.w, 0.0); + q._m03_m13_m23_m33 = float4(worldPos, 1.0); + + // transforms a normal to parameter space (inverse transpose of (q*modelview)^-T) + float4x4 invClip = mul(modelViewProjectionMatrix, q); + + // solve for the right hand bounds in homogenous clip space + float a1 = DotInvW(invClip[3], invClip[3]); + float b1 = -2.0f*DotInvW(invClip[0], invClip[3]); + float c1 = DotInvW(invClip[0], invClip[0]); + + float xmin; + float xmax; + solveQuadratic(a1, b1, c1, xmin, xmax); + + // solve for the right hand bounds in homogenous clip space + float a2 = DotInvW(invClip[3], invClip[3]); + float b2 = -2.0f*DotInvW(invClip[1], invClip[3]); + float c2 = DotInvW(invClip[1], invClip[1]); + + float ymin; + float ymax; + solveQuadratic(a2, b2, c2, ymin, ymax); + + FluidVertexOut output; + output.position = float4(worldPos.xyz, 1.0); + output.bounds = float4(xmin, xmax, ymin, ymax); + + // construct inverse quadric matrix (used for ray-casting in parameter space) + float4x4 invq; + invq._m00_m10_m20_m30 = float4(q1.xyz / q1.w, 0.0); + invq._m01_m11_m21_m31 = float4(q2.xyz / q2.w, 0.0); + invq._m02_m12_m22_m32 = float4(q3.xyz / q3.w, 0.0); + invq._m03_m13_m23_m33 = float4(0.0, 0.0, 0.0, 1.0); + + invq = transpose(invq); + invq._m03_m13_m23_m33 = -(mul(invq, output.position)); + + // transform a point from view space to parameter space + invq = mul(invq, modelViewMatrixInverse); + + // pass down + output.invQ0 = invq._m00_m10_m20_m30; + output.invQ1 = invq._m01_m11_m21_m31; + output.invQ2 = invq._m02_m12_m22_m32; + output.invQ3 = invq._m03_m13_m23_m33; + + // compute ndc pos for frustrum culling in GS + float4 projPos = mul(modelViewProjectionMatrix, float4(worldPos.xyz, 1.0)); + output.ndcPos = projPos / projPos.w; + return output; +} diff --git a/demo/d3d11/shaders/ellipsoidDepthVS.hlsl.h b/demo/d3d/shaders/ellipsoidDepthVS.hlsl.h index d1dd741..719d17d 100644 --- a/demo/d3d11/shaders/ellipsoidDepthVS.hlsl.h +++ b/demo/d3d/shaders/ellipsoidDepthVS.hlsl.h @@ -11,11 +11,11 @@ // struct FluidShaderConst // { // -// float4x4 modelviewprojection; // Offset: 0 -// float4x4 modelview; // Offset: 64 +// float4x4 modelViewProjection; // Offset: 0 +// float4x4 modelView; // Offset: 64 // float4x4 projection; // Offset: 128 -// float4x4 modelview_inverse; // Offset: 192 -// float4x4 projection_inverse; // Offset: 256 +// float4x4 inverseModelView; // Offset: 192 +// float4x4 inverseProjection; // Offset: 256 // float4 invTexScale; // Offset: 320 // float3 invViewport; // Offset: 336 // float _pad0; // Offset: 348 @@ -169,29 +169,28 @@ mul r0.xyzw, v0.yyyy, cb0[1].xyzw mad r0.xyzw, cb0[0].xyzw, v0.xxxx, r0.xyzw mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw add r0.xyzw, r0.xyzw, cb0[3].xyzw -div o6.xyz, r0.xyzx, r0.wwww -mov o6.w, r0.w +div o6.xyzw, r0.xyzw, r0.wwww ret -// Approximately 85 instruction slots used +// Approximately 84 instruction slots used #endif const BYTE g_ellipsoidDepthVS[] = { - 68, 88, 66, 67, 1, 86, - 214, 204, 57, 184, 18, 6, - 20, 42, 129, 16, 226, 241, - 71, 198, 1, 0, 0, 0, - 208, 17, 0, 0, 5, 0, + 68, 88, 66, 67, 251, 213, + 215, 144, 39, 19, 119, 132, + 9, 110, 41, 184, 9, 243, + 116, 11, 1, 0, 0, 0, + 184, 17, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, - 116, 4, 0, 0, 24, 5, - 0, 0, 228, 5, 0, 0, - 52, 17, 0, 0, 82, 68, - 69, 70, 56, 4, 0, 0, + 112, 4, 0, 0, 20, 5, + 0, 0, 224, 5, 0, 0, + 28, 17, 0, 0, 82, 68, + 69, 70, 52, 4, 0, 0, 1, 0, 0, 0, 104, 0, 0, 0, 1, 0, 0, 0, 60, 0, 0, 0, 0, 5, 254, 255, 0, 1, 0, 0, - 4, 4, 0, 0, 82, 68, + 0, 4, 0, 0, 82, 68, 49, 49, 60, 0, 0, 0, 24, 0, 0, 0, 32, 0, 0, 0, 40, 0, 0, 0, @@ -211,7 +210,7 @@ const BYTE g_ellipsoidDepthVS[] = 0, 0, 168, 0, 0, 0, 0, 0, 0, 0, 192, 2, 0, 0, 2, 0, 0, 0, - 224, 3, 0, 0, 0, 0, + 220, 3, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, @@ -220,7 +219,7 @@ const BYTE g_ellipsoidDepthVS[] = 100, 83, 104, 97, 100, 101, 114, 67, 111, 110, 115, 116, 0, 109, 111, 100, 101, 108, - 118, 105, 101, 119, 112, 114, + 86, 105, 101, 119, 80, 114, 111, 106, 101, 99, 116, 105, 111, 110, 0, 102, 108, 111, 97, 116, 52, 120, 52, 0, @@ -231,312 +230,276 @@ const BYTE g_ellipsoidDepthVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 213, 0, 0, 0, 109, 111, 100, 101, - 108, 118, 105, 101, 119, 0, + 108, 86, 105, 101, 119, 0, 112, 114, 111, 106, 101, 99, - 116, 105, 111, 110, 0, 109, - 111, 100, 101, 108, 118, 105, - 101, 119, 95, 105, 110, 118, - 101, 114, 115, 101, 0, 112, + 116, 105, 111, 110, 0, 105, + 110, 118, 101, 114, 115, 101, + 77, 111, 100, 101, 108, 86, + 105, 101, 119, 0, 105, 110, + 118, 101, 114, 115, 101, 80, 114, 111, 106, 101, 99, 116, - 105, 111, 110, 95, 105, 110, - 118, 101, 114, 115, 101, 0, - 105, 110, 118, 84, 101, 120, - 83, 99, 97, 108, 101, 0, - 102, 108, 111, 97, 116, 52, - 0, 171, 171, 171, 1, 0, - 3, 0, 1, 0, 4, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 74, 1, 0, 0, 105, 110, - 118, 86, 105, 101, 119, 112, - 111, 114, 116, 0, 102, 108, - 111, 97, 116, 51, 0, 171, + 105, 111, 110, 0, 105, 110, + 118, 84, 101, 120, 83, 99, + 97, 108, 101, 0, 102, 108, + 111, 97, 116, 52, 0, 171, 1, 0, 3, 0, 1, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 132, 1, 0, 0, - 95, 112, 97, 100, 48, 0, - 102, 108, 111, 97, 116, 0, - 0, 0, 3, 0, 1, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 182, 1, 0, 0, - 98, 108, 117, 114, 82, 97, - 100, 105, 117, 115, 87, 111, - 114, 108, 100, 0, 98, 108, - 117, 114, 83, 99, 97, 108, - 101, 0, 98, 108, 117, 114, - 70, 97, 108, 108, 111, 102, - 102, 0, 100, 101, 98, 117, - 103, 0, 105, 110, 116, 0, - 0, 0, 2, 0, 1, 0, - 1, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 72, 1, 0, 0, + 105, 110, 118, 86, 105, 101, + 119, 112, 111, 114, 116, 0, + 102, 108, 111, 97, 116, 51, + 0, 171, 1, 0, 3, 0, + 1, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 128, 1, + 0, 0, 95, 112, 97, 100, + 48, 0, 102, 108, 111, 97, + 116, 0, 0, 0, 3, 0, + 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 178, 1, + 0, 0, 98, 108, 117, 114, + 82, 97, 100, 105, 117, 115, + 87, 111, 114, 108, 100, 0, + 98, 108, 117, 114, 83, 99, + 97, 108, 101, 0, 98, 108, + 117, 114, 70, 97, 108, 108, + 111, 102, 102, 0, 100, 101, + 98, 117, 103, 0, 105, 110, + 116, 0, 0, 0, 2, 0, + 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 8, 2, + 0, 0, 108, 105, 103, 104, + 116, 80, 111, 115, 0, 95, + 112, 97, 100, 49, 0, 108, + 105, 103, 104, 116, 68, 105, + 114, 0, 95, 112, 97, 100, + 50, 0, 108, 105, 103, 104, + 116, 84, 114, 97, 110, 115, + 102, 111, 114, 109, 0, 99, + 111, 108, 111, 114, 0, 99, + 108, 105, 112, 80, 111, 115, + 84, 111, 69, 121, 101, 0, + 115, 112, 111, 116, 77, 105, + 110, 0, 115, 112, 111, 116, + 77, 97, 120, 0, 105, 111, + 114, 0, 95, 112, 97, 100, + 51, 0, 115, 104, 97, 100, + 111, 119, 84, 97, 112, 115, + 0, 171, 171, 171, 1, 0, + 3, 0, 1, 0, 4, 0, + 12, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 72, 1, 0, 0, 193, 0, + 0, 0, 224, 0, 0, 0, + 0, 0, 0, 0, 4, 1, + 0, 0, 224, 0, 0, 0, + 64, 0, 0, 0, 14, 1, + 0, 0, 224, 0, 0, 0, + 128, 0, 0, 0, 25, 1, + 0, 0, 224, 0, 0, 0, + 192, 0, 0, 0, 42, 1, + 0, 0, 224, 0, 0, 0, + 0, 1, 0, 0, 60, 1, + 0, 0, 80, 1, 0, 0, + 64, 1, 0, 0, 116, 1, + 0, 0, 136, 1, 0, 0, + 80, 1, 0, 0, 172, 1, + 0, 0, 184, 1, 0, 0, + 92, 1, 0, 0, 220, 1, + 0, 0, 184, 1, 0, 0, + 96, 1, 0, 0, 236, 1, + 0, 0, 184, 1, 0, 0, + 100, 1, 0, 0, 246, 1, + 0, 0, 184, 1, 0, 0, + 104, 1, 0, 0, 2, 2, 0, 0, 12, 2, 0, 0, - 108, 105, 103, 104, 116, 80, - 111, 115, 0, 95, 112, 97, - 100, 49, 0, 108, 105, 103, - 104, 116, 68, 105, 114, 0, - 95, 112, 97, 100, 50, 0, - 108, 105, 103, 104, 116, 84, - 114, 97, 110, 115, 102, 111, - 114, 109, 0, 99, 111, 108, - 111, 114, 0, 99, 108, 105, - 112, 80, 111, 115, 84, 111, - 69, 121, 101, 0, 115, 112, - 111, 116, 77, 105, 110, 0, - 115, 112, 111, 116, 77, 97, - 120, 0, 105, 111, 114, 0, - 95, 112, 97, 100, 51, 0, - 115, 104, 97, 100, 111, 119, - 84, 97, 112, 115, 0, 171, - 171, 171, 1, 0, 3, 0, - 1, 0, 4, 0, 12, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 74, 1, - 0, 0, 193, 0, 0, 0, - 224, 0, 0, 0, 0, 0, - 0, 0, 4, 1, 0, 0, - 224, 0, 0, 0, 64, 0, - 0, 0, 14, 1, 0, 0, - 224, 0, 0, 0, 128, 0, - 0, 0, 25, 1, 0, 0, - 224, 0, 0, 0, 192, 0, - 0, 0, 43, 1, 0, 0, - 224, 0, 0, 0, 0, 1, - 0, 0, 62, 1, 0, 0, - 84, 1, 0, 0, 64, 1, - 0, 0, 120, 1, 0, 0, - 140, 1, 0, 0, 80, 1, - 0, 0, 176, 1, 0, 0, - 188, 1, 0, 0, 92, 1, - 0, 0, 224, 1, 0, 0, - 188, 1, 0, 0, 96, 1, - 0, 0, 240, 1, 0, 0, - 188, 1, 0, 0, 100, 1, - 0, 0, 250, 1, 0, 0, - 188, 1, 0, 0, 104, 1, - 0, 0, 6, 2, 0, 0, - 16, 2, 0, 0, 108, 1, - 0, 0, 52, 2, 0, 0, - 140, 1, 0, 0, 112, 1, - 0, 0, 61, 2, 0, 0, - 188, 1, 0, 0, 124, 1, - 0, 0, 67, 2, 0, 0, - 140, 1, 0, 0, 128, 1, - 0, 0, 76, 2, 0, 0, - 188, 1, 0, 0, 140, 1, - 0, 0, 82, 2, 0, 0, - 224, 0, 0, 0, 144, 1, - 0, 0, 97, 2, 0, 0, - 84, 1, 0, 0, 208, 1, - 0, 0, 103, 2, 0, 0, - 84, 1, 0, 0, 224, 1, - 0, 0, 116, 2, 0, 0, - 188, 1, 0, 0, 240, 1, - 0, 0, 124, 2, 0, 0, - 188, 1, 0, 0, 244, 1, - 0, 0, 132, 2, 0, 0, - 188, 1, 0, 0, 248, 1, - 0, 0, 136, 2, 0, 0, - 188, 1, 0, 0, 252, 1, - 0, 0, 142, 2, 0, 0, - 156, 2, 0, 0, 0, 2, - 0, 0, 5, 0, 0, 0, - 1, 0, 176, 0, 0, 0, - 24, 0, 192, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 176, 0, - 0, 0, 77, 105, 99, 114, - 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, - 100, 101, 114, 32, 67, 111, - 109, 112, 105, 108, 101, 114, - 32, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, - 51, 56, 52, 0, 171, 171, - 73, 83, 71, 78, 156, 0, - 0, 0, 5, 0, 0, 0, - 8, 0, 0, 0, 128, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 7, 0, 0, 137, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 15, 15, 0, 0, 139, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, - 15, 15, 0, 0, 141, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, - 15, 15, 0, 0, 143, 0, - 0, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, - 1, 0, 0, 0, 80, 79, - 83, 73, 84, 73, 79, 78, - 0, 85, 0, 86, 0, 87, - 0, 83, 86, 95, 86, 101, - 114, 116, 101, 120, 73, 68, - 0, 171, 79, 83, 71, 78, - 196, 0, 0, 0, 7, 0, + 108, 1, 0, 0, 48, 2, + 0, 0, 136, 1, 0, 0, + 112, 1, 0, 0, 57, 2, + 0, 0, 184, 1, 0, 0, + 124, 1, 0, 0, 63, 2, + 0, 0, 136, 1, 0, 0, + 128, 1, 0, 0, 72, 2, + 0, 0, 184, 1, 0, 0, + 140, 1, 0, 0, 78, 2, + 0, 0, 224, 0, 0, 0, + 144, 1, 0, 0, 93, 2, + 0, 0, 80, 1, 0, 0, + 208, 1, 0, 0, 99, 2, + 0, 0, 80, 1, 0, 0, + 224, 1, 0, 0, 112, 2, + 0, 0, 184, 1, 0, 0, + 240, 1, 0, 0, 120, 2, + 0, 0, 184, 1, 0, 0, + 244, 1, 0, 0, 128, 2, + 0, 0, 184, 1, 0, 0, + 248, 1, 0, 0, 132, 2, + 0, 0, 184, 1, 0, 0, + 252, 1, 0, 0, 138, 2, + 0, 0, 152, 2, 0, 0, + 0, 2, 0, 0, 5, 0, + 0, 0, 1, 0, 176, 0, + 0, 0, 24, 0, 188, 2, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 176, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, + 171, 171, 73, 83, 71, 78, + 156, 0, 0, 0, 5, 0, 0, 0, 8, 0, 0, 0, - 176, 0, 0, 0, 0, 0, + 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 185, 0, 0, 0, 0, 0, + 0, 0, 15, 7, 0, 0, + 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 15, 0, 0, 0, - 185, 0, 0, 0, 1, 0, + 0, 0, 15, 15, 0, 0, + 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, - 185, 0, 0, 0, 2, 0, + 0, 0, 15, 15, 0, 0, + 141, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, - 0, 0, 15, 0, 0, 0, - 185, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 4, 0, - 0, 0, 15, 0, 0, 0, - 185, 0, 0, 0, 4, 0, + 0, 0, 15, 15, 0, 0, + 143, 0, 0, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 1, 0, 0, 0, 4, 0, + 0, 0, 1, 0, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 85, 0, 86, + 0, 87, 0, 83, 86, 95, + 86, 101, 114, 116, 101, 120, + 73, 68, 0, 171, 79, 83, + 71, 78, 196, 0, 0, 0, + 7, 0, 0, 0, 8, 0, + 0, 0, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 5, 0, - 0, 0, 15, 0, 0, 0, - 185, 0, 0, 0, 5, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 185, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 6, 0, - 0, 0, 15, 0, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 84, 69, 88, - 67, 79, 79, 82, 68, 0, - 171, 171, 83, 72, 69, 88, - 72, 11, 0, 0, 80, 0, - 1, 0, 210, 2, 0, 0, - 106, 8, 0, 1, 89, 0, - 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 16, 0, - 0, 0, 95, 0, 0, 3, - 114, 16, 16, 0, 0, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 1, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 2, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 3, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 0, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 1, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 2, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 3, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 4, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 5, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 6, 0, - 0, 0, 104, 0, 0, 2, - 4, 0, 0, 0, 54, 0, - 0, 5, 114, 32, 16, 0, - 0, 0, 0, 0, 70, 18, - 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 130, 32, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 185, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 15, 0, + 0, 0, 185, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 15, 0, + 0, 0, 185, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 4, 0, 0, 0, 15, 0, + 0, 0, 185, 0, 0, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 5, 0, 0, 0, 15, 0, + 0, 0, 185, 0, 0, 0, + 5, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 6, 0, 0, 0, 15, 0, + 0, 0, 80, 79, 83, 73, + 84, 73, 79, 78, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 171, 171, 83, 72, + 69, 88, 52, 11, 0, 0, + 80, 0, 1, 0, 205, 2, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 95, 0, + 0, 3, 114, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 2, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 3, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 3, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 4, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 5, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 6, 0, 0, 0, 104, 0, + 0, 2, 4, 0, 0, 0, + 54, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 7, - 114, 0, 16, 0, 0, 0, - 0, 0, 246, 31, 16, 0, - 2, 0, 0, 0, 70, 18, + 70, 18, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 31, 16, 0, 2, 0, 0, 0, - 56, 0, 0, 8, 242, 0, - 16, 0, 1, 0, 0, 0, - 86, 5, 16, 0, 0, 0, - 0, 0, 54, 132, 32, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 50, 0, 0, 10, + 70, 18, 16, 0, 2, 0, + 0, 0, 56, 0, 0, 8, 242, 0, 16, 0, 1, 0, - 0, 0, 54, 132, 32, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 1, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 0, 0, 0, 0, - 54, 132, 32, 0, 0, 0, - 0, 0, 2, 0, 0, 0, - 166, 10, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 56, 0, - 0, 7, 18, 0, 16, 0, - 1, 0, 0, 0, 58, 0, + 0, 0, 86, 5, 16, 0, + 0, 0, 0, 0, 54, 132, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 242, 0, 16, 0, + 1, 0, 0, 0, 54, 132, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, + 70, 14, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 10, 242, 0, 16, 0, 0, 0, - 0, 0, 6, 2, 16, 0, + 0, 0, 54, 132, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 166, 10, 16, 0, 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, - 246, 31, 16, 0, 1, 0, - 0, 0, 6, 25, 16, 0, - 1, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 2, 0, 0, 0, 166, 10, + 56, 0, 0, 7, 18, 0, 16, 0, 1, 0, 0, 0, - 54, 132, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 2, 0, 0, 0, - 54, 132, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 86, 5, 16, 0, 1, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 2, 0, 0, 0, 54, 132, - 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 246, 15, - 16, 0, 1, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 50, 0, 0, 9, - 18, 0, 16, 0, 1, 0, + 58, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 2, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 50, 0, 0, 9, - 242, 0, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 6, 2, - 16, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 242, 0, 16, 0, + 0, 0, 0, 0, 6, 2, + 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 246, 31, 16, 0, - 3, 0, 0, 0, 6, 25, - 16, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 6, 25, + 16, 0, 1, 0, 0, 0, 56, 0, 0, 8, 242, 0, 16, 0, 2, 0, 0, 0, 166, 10, 16, 0, 1, 0, @@ -568,351 +531,383 @@ const BYTE g_ellipsoidDepthVS[] = 6, 2, 16, 0, 2, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 2, 0, 0, 0, 86, 21, - 16, 0, 0, 0, 0, 0, - 54, 132, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 2, 0, 0, 0, - 54, 132, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 6, 16, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 50, 0, + 0, 7, 226, 0, 16, 0, + 1, 0, 0, 0, 246, 31, + 16, 0, 3, 0, 0, 0, + 6, 25, 16, 0, 3, 0, + 0, 0, 56, 0, 0, 8, + 242, 0, 16, 0, 2, 0, + 0, 0, 166, 10, 16, 0, + 1, 0, 0, 0, 54, 132, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 50, 0, 0, 10, 242, 0, 16, 0, 2, 0, 0, 0, 54, 132, 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 166, 26, - 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 86, 5, + 16, 0, 1, 0, 0, 0, 70, 14, 16, 0, 2, 0, - 0, 0, 0, 0, 0, 8, + 0, 0, 50, 0, 0, 10, 242, 0, 16, 0, 2, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 54, 132, - 32, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 50, 0, - 0, 10, 18, 0, 16, 0, - 1, 0, 0, 0, 58, 0, - 16, 128, 65, 0, 0, 0, - 2, 0, 0, 0, 58, 0, + 0, 0, 54, 132, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 246, 15, 16, 0, + 1, 0, 0, 0, 70, 14, 16, 0, 2, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 128, - 65, 0, 0, 0, 2, 0, + 50, 0, 0, 9, 18, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 0, 2, 0, + 0, 0, 58, 0, 16, 0, + 2, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 50, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 2, 0, 0, 0, 6, 2, 16, 0, 2, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, - 56, 0, 0, 10, 226, 0, - 16, 0, 1, 0, 0, 0, - 86, 12, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, + 56, 0, 0, 8, 242, 0, + 16, 0, 2, 0, 0, 0, + 86, 21, 16, 0, 0, 0, + 0, 0, 54, 132, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 50, 0, 0, 10, + 242, 0, 16, 0, 2, 0, + 0, 0, 54, 132, 32, 0, 0, 0, 0, 0, 0, 0, - 0, 192, 0, 0, 128, 64, - 0, 0, 0, 192, 56, 0, - 0, 7, 50, 0, 16, 0, - 2, 0, 0, 0, 214, 5, + 0, 0, 6, 16, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 10, 242, 0, + 16, 0, 2, 0, 0, 0, + 54, 132, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 166, 26, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 0, 0, + 0, 8, 242, 0, 16, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 54, 132, 32, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 50, 0, 0, 10, 18, 0, 16, 0, 1, 0, 0, 0, + 58, 0, 16, 128, 65, 0, + 0, 0, 2, 0, 0, 0, + 58, 0, 16, 0, 2, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 128, 65, 0, 0, 0, + 2, 0, 0, 0, 6, 2, + 16, 0, 2, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 10, + 226, 0, 16, 0, 1, 0, + 0, 0, 86, 12, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 192, 0, 0, + 128, 64, 0, 0, 0, 192, + 56, 0, 0, 7, 50, 0, + 16, 0, 2, 0, 0, 0, 214, 5, 16, 0, 1, 0, + 0, 0, 214, 5, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 34, 0, 16, 0, + 2, 0, 0, 0, 42, 0, + 16, 128, 65, 0, 0, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 26, 0, 16, 0, 2, 0, 0, 0, 50, 0, 0, 10, - 34, 0, 16, 0, 2, 0, + 66, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 128, 65, 0, 0, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 26, 0, - 16, 0, 2, 0, 0, 0, - 50, 0, 0, 10, 66, 0, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 128, 65, 0, - 0, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 2, 0, 0, 0, 75, 0, - 0, 5, 18, 0, 16, 0, - 2, 0, 0, 0, 26, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 10, 0, 16, 0, 2, 0, 0, 0, - 29, 0, 0, 7, 34, 0, + 75, 0, 0, 5, 18, 0, 16, 0, 2, 0, 0, 0, 26, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 49, 0, - 0, 10, 194, 0, 16, 0, - 2, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 128, 0, 0, 0, 128, - 86, 13, 16, 0, 0, 0, - 0, 0, 55, 0, 0, 15, - 194, 0, 16, 0, 2, 0, - 0, 0, 166, 14, 16, 0, - 2, 0, 0, 0, 2, 64, + 0, 0, 29, 0, 0, 7, + 34, 0, 16, 0, 2, 0, + 0, 0, 26, 0, 16, 0, + 2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, + 49, 0, 0, 10, 194, 0, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 128, 191, 0, 0, 128, 191, + 0, 0, 0, 128, 0, 0, + 0, 128, 86, 13, 16, 0, + 0, 0, 0, 0, 55, 0, + 0, 15, 194, 0, 16, 0, + 2, 0, 0, 0, 166, 14, + 16, 0, 2, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 128, 63, 0, 0, - 128, 63, 50, 0, 0, 9, - 130, 0, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, - 2, 0, 0, 0, 10, 0, + 0, 0, 128, 191, 0, 0, + 128, 191, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 63, 50, 0, + 0, 9, 130, 0, 16, 0, + 1, 0, 0, 0, 58, 0, 16, 0, 2, 0, 0, 0, - 58, 0, 16, 0, 1, 0, - 0, 0, 56, 0, 0, 7, - 130, 0, 16, 0, 1, 0, + 10, 0, 16, 0, 2, 0, 0, 0, 58, 0, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 191, - 14, 0, 0, 7, 130, 0, - 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 14, 0, - 0, 7, 66, 0, 16, 0, - 3, 0, 0, 0, 10, 0, + 1, 0, 0, 0, 56, 0, + 0, 7, 130, 0, 16, 0, + 1, 0, 0, 0, 58, 0, 16, 0, 1, 0, 0, 0, - 58, 0, 16, 0, 1, 0, - 0, 0, 49, 0, 0, 7, - 18, 0, 16, 0, 1, 0, - 0, 0, 42, 0, 16, 0, - 3, 0, 0, 0, 58, 0, + 1, 64, 0, 0, 0, 0, + 0, 191, 14, 0, 0, 7, + 130, 0, 16, 0, 3, 0, + 0, 0, 58, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 14, 0, 0, 7, 66, 0, 16, 0, 3, 0, 0, 0, - 55, 0, 0, 9, 146, 0, - 16, 0, 1, 0, 0, 0, - 6, 0, 16, 0, 1, 0, - 0, 0, 166, 14, 16, 0, - 3, 0, 0, 0, 246, 11, + 10, 0, 16, 0, 1, 0, + 0, 0, 58, 0, 16, 0, + 1, 0, 0, 0, 49, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 42, 0, 16, 0, 3, 0, 0, 0, - 1, 0, 0, 7, 146, 0, - 16, 0, 1, 0, 0, 0, - 6, 12, 16, 0, 1, 0, - 0, 0, 86, 5, 16, 0, - 2, 0, 0, 0, 24, 0, - 0, 10, 178, 0, 16, 0, - 2, 0, 0, 0, 70, 12, - 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 128, - 0, 0, 0, 0, 0, 0, - 0, 128, 1, 0, 0, 7, - 162, 0, 16, 0, 0, 0, - 0, 0, 86, 13, 16, 0, - 2, 0, 0, 0, 6, 0, + 58, 0, 16, 0, 3, 0, + 0, 0, 55, 0, 0, 9, + 146, 0, 16, 0, 1, 0, + 0, 0, 6, 0, 16, 0, + 1, 0, 0, 0, 166, 14, + 16, 0, 3, 0, 0, 0, + 246, 11, 16, 0, 3, 0, + 0, 0, 1, 0, 0, 7, + 146, 0, 16, 0, 1, 0, + 0, 0, 6, 12, 16, 0, + 1, 0, 0, 0, 86, 5, 16, 0, 2, 0, 0, 0, - 55, 0, 0, 12, 194, 32, - 16, 0, 1, 0, 0, 0, - 246, 15, 16, 0, 0, 0, + 24, 0, 0, 10, 178, 0, + 16, 0, 2, 0, 0, 0, + 70, 12, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 0, 0, 0, 0, + 0, 0, 0, 128, 1, 0, + 0, 7, 162, 0, 16, 0, + 0, 0, 0, 0, 86, 13, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 2, 0, + 0, 0, 55, 0, 0, 12, + 194, 32, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 12, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 6, 12, 16, 0, 1, 0, + 0, 0, 75, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 1, 0, 0, 0, 29, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 42, 0, 16, 0, 1, 0, 0, 0, - 75, 0, 0, 5, 130, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 29, 0, 0, 7, - 18, 0, 16, 0, 1, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 130, 0, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 50, 0, 0, 9, 130, 0, + 2, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 2, 0, + 26, 0, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 7, + 130, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 1, 0, 0, 0, - 56, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 191, 14, 0, - 0, 7, 50, 0, 16, 0, - 2, 0, 0, 0, 230, 10, - 16, 0, 0, 0, 0, 0, - 54, 15, 16, 0, 0, 0, - 0, 0, 49, 0, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 2, 0, 0, 0, 26, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 191, + 14, 0, 0, 7, 50, 0, 16, 0, 2, 0, 0, 0, - 55, 0, 0, 9, 82, 0, - 16, 0, 0, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 6, 1, 16, 0, - 2, 0, 0, 0, 86, 4, + 230, 10, 16, 0, 0, 0, + 0, 0, 54, 15, 16, 0, + 0, 0, 0, 0, 49, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, 16, 0, 2, 0, 0, 0, - 1, 0, 0, 7, 82, 0, - 16, 0, 0, 0, 0, 0, - 6, 2, 16, 0, 0, 0, + 26, 0, 16, 0, 2, 0, + 0, 0, 55, 0, 0, 9, + 82, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, - 1, 0, 0, 0, 55, 0, - 0, 12, 50, 32, 16, 0, - 1, 0, 0, 0, 86, 5, + 0, 0, 0, 0, 6, 1, + 16, 0, 2, 0, 0, 0, + 86, 4, 16, 0, 2, 0, + 0, 0, 1, 0, 0, 7, + 82, 0, 16, 0, 0, 0, + 0, 0, 6, 2, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 1, 0, 0, 0, + 55, 0, 0, 12, 50, 32, + 16, 0, 1, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 134, 0, 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, + 54, 0, 0, 7, 130, 32, + 16, 0, 2, 0, 0, 0, + 58, 128, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 14, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 246, 31, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 6, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 134, 0, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 7, 130, 32, 16, 0, - 2, 0, 0, 0, 58, 128, - 32, 128, 65, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 2, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 12, 0, 0, 0, 14, 0, 0, 7, - 114, 0, 16, 0, 0, 0, + 114, 0, 16, 0, 1, 0, 0, 0, 70, 18, 16, 0, - 1, 0, 0, 0, 246, 31, - 16, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 246, 31, + 16, 0, 2, 0, 0, 0, 16, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 0, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, 0, 0, 70, 18, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, + 1, 0, 0, 0, 58, 0, 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 17, 0, - 0, 8, 18, 32, 16, 0, + 1, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, 2, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, + 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 12, 0, 0, 0, 14, 0, 0, 7, 114, 0, - 16, 0, 1, 0, 0, 0, - 70, 18, 16, 0, 2, 0, + 16, 0, 2, 0, 0, 0, + 70, 18, 16, 0, 3, 0, 0, 0, 246, 31, 16, 0, - 2, 0, 0, 0, 16, 0, + 3, 0, 0, 0, 16, 0, 0, 7, 130, 0, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, 70, 18, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, - 130, 0, 16, 0, 1, 0, + 130, 0, 16, 0, 2, 0, 0, 0, 58, 0, 16, 128, - 65, 0, 0, 0, 1, 0, + 65, 0, 0, 0, 2, 0, 0, 0, 17, 0, 0, 8, - 34, 32, 16, 0, 2, 0, + 66, 32, 16, 0, 2, 0, 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 70, 142, + 2, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 14, 0, - 0, 7, 114, 0, 16, 0, - 2, 0, 0, 0, 70, 18, - 16, 0, 3, 0, 0, 0, - 246, 31, 16, 0, 3, 0, - 0, 0, 16, 0, 0, 7, - 130, 0, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 70, 18, - 16, 0, 0, 0, 0, 0, - 54, 0, 0, 6, 130, 0, - 16, 0, 2, 0, 0, 0, - 58, 0, 16, 128, 65, 0, - 0, 0, 2, 0, 0, 0, - 17, 0, 0, 8, 66, 32, - 16, 0, 2, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 12, 0, - 0, 0, 54, 0, 0, 7, - 130, 32, 16, 0, 3, 0, - 0, 0, 58, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 13, 0, 0, 0, - 17, 0, 0, 8, 18, 32, - 16, 0, 3, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, + 12, 0, 0, 0, 54, 0, + 0, 7, 130, 32, 16, 0, + 3, 0, 0, 0, 58, 128, + 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 17, 0, 0, 8, - 34, 32, 16, 0, 3, 0, + 18, 32, 16, 0, 3, 0, 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 70, 142, + 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 13, 0, 0, 0, 17, 0, - 0, 8, 66, 32, 16, 0, + 0, 8, 34, 32, 16, 0, 3, 0, 0, 0, 70, 14, - 16, 0, 2, 0, 0, 0, + 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 13, 0, 0, 0, - 17, 0, 0, 8, 18, 32, - 16, 0, 4, 0, 0, 0, - 70, 14, 16, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 3, 0, 0, 0, + 70, 14, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 14, 0, + 0, 0, 0, 0, 13, 0, 0, 0, 17, 0, 0, 8, - 18, 32, 16, 0, 5, 0, + 18, 32, 16, 0, 4, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 17, 0, - 0, 8, 34, 32, 16, 0, - 4, 0, 0, 0, 70, 14, - 16, 0, 1, 0, 0, 0, + 14, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 5, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 14, 0, 0, 0, + 0, 0, 15, 0, 0, 0, 17, 0, 0, 8, 34, 32, - 16, 0, 5, 0, 0, 0, + 16, 0, 4, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 15, 0, + 0, 0, 0, 0, 14, 0, 0, 0, 17, 0, 0, 8, - 66, 32, 16, 0, 4, 0, + 34, 32, 16, 0, 5, 0, 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 70, 142, + 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, - 14, 0, 0, 0, 17, 0, + 15, 0, 0, 0, 17, 0, 0, 8, 66, 32, 16, 0, - 5, 0, 0, 0, 70, 14, + 4, 0, 0, 0, 70, 14, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 15, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 5, 0, 0, 0, + 70, 14, 16, 0, 2, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 54, 0, 0, 7, + 130, 32, 16, 0, 4, 0, + 0, 0, 58, 128, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 14, 0, 0, 0, 54, 0, 0, 7, 130, 32, - 16, 0, 4, 0, 0, 0, + 16, 0, 5, 0, 0, 0, 58, 128, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, - 14, 0, 0, 0, 54, 0, - 0, 7, 130, 32, 16, 0, - 5, 0, 0, 0, 58, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 56, 0, 0, 8, - 242, 0, 16, 0, 0, 0, - 0, 0, 86, 21, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 50, 0, + 15, 0, 0, 0, 56, 0, + 0, 8, 242, 0, 16, 0, + 0, 0, 0, 0, 86, 21, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 50, 0, 0, 10, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 6, 16, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 50, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 16, + 2, 0, 0, 0, 166, 26, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 10, + 0, 0, 0, 0, 0, 8, 242, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 166, 26, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 8, 242, 0, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 14, 0, 0, 7, - 114, 32, 16, 0, 6, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 246, 15, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 14, 0, + 0, 7, 242, 32, 16, 0, + 6, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 130, 32, - 16, 0, 6, 0, 0, 0, - 58, 0, 16, 0, 0, 0, + 246, 15, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 148, 0, - 0, 0, 85, 0, 0, 0, + 0, 0, 84, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 70, 0, 0, 0, 0, 0, @@ -925,7 +920,7 @@ const BYTE g_ellipsoidDepthVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 5, 0, + 5, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/demo/d3d11/shaders/imguiPS.hlsl b/demo/d3d/shaders/imguiPS.hlsl index f51a21b..f51a21b 100644 --- a/demo/d3d11/shaders/imguiPS.hlsl +++ b/demo/d3d/shaders/imguiPS.hlsl diff --git a/demo/d3d11/shaders/imguiPS.hlsl.h b/demo/d3d/shaders/imguiPS.hlsl.h index 92aa84a..92aa84a 100644 --- a/demo/d3d11/shaders/imguiPS.hlsl.h +++ b/demo/d3d/shaders/imguiPS.hlsl.h diff --git a/demo/d3d11/shaders/imguiVS.hlsl b/demo/d3d/shaders/imguiVS.hlsl index 6116ee1..6116ee1 100644 --- a/demo/d3d11/shaders/imguiVS.hlsl +++ b/demo/d3d/shaders/imguiVS.hlsl diff --git a/demo/d3d11/shaders/imguiVS.hlsl.h b/demo/d3d/shaders/imguiVS.hlsl.h index 7249cec..7249cec 100644 --- a/demo/d3d11/shaders/imguiVS.hlsl.h +++ b/demo/d3d/shaders/imguiVS.hlsl.h diff --git a/demo/d3d/shaders/meshAsyncComputeBenchPS.hlsl b/demo/d3d/shaders/meshAsyncComputeBenchPS.hlsl new file mode 100644 index 0000000..1d8b9d5 --- /dev/null +++ b/demo/d3d/shaders/meshAsyncComputeBenchPS.hlsl @@ -0,0 +1,3 @@ +#define FLX_ASYNC_COMPUTE_BENCHMARK_ENABLE 1 + +#include "meshPS.hlsl" diff --git a/demo/d3d/shaders/meshAsyncComputeBenchPS.hlsl.h b/demo/d3d/shaders/meshAsyncComputeBenchPS.hlsl.h new file mode 100644 index 0000000..8223a67 --- /dev/null +++ b/demo/d3d/shaders/meshAsyncComputeBenchPS.hlsl.h @@ -0,0 +1,1558 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 +// +// +// Buffer Definitions: +// +// cbuffer constBuf +// { +// +// struct MeshShaderConst +// { +// +// float4x4 modelViewProjection; // Offset: 0 +// float4x4 modelView; // Offset: 64 +// float4x4 objectTransform; // Offset: 128 +// float4x4 lightTransform; // Offset: 192 +// float4 clipPlane; // Offset: 256 +// float4 fogColor; // Offset: 272 +// float4 color; // Offset: 288 +// float4 secondaryColor; // Offset: 304 +// float4 shadowTaps[12]; // Offset: 320 +// float3 lightPos; // Offset: 512 +// float _pad0; // Offset: 524 +// float3 lightDir; // Offset: 528 +// float _pad1; // Offset: 540 +// float bias; // Offset: 544 +// float expand; // Offset: 548 +// float spotMin; // Offset: 552 +// float spotMax; // Offset: 556 +// int grid; // Offset: 560 +// int tex; // Offset: 564 +// int colorArray; // Offset: 568 +// int increaseGfxLoadForAsyncComputeTesting;// Offset: 572 +// +// } gParams; // Offset: 0 Size: 576 +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// shadowSampler sampler_c NA NA 0 1 +// shadowTexture texture float 2d 0 1 +// constBuf cbuffer NA NA 0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_POSITION 0 xyzw 0 POS float +// TEXCOORD 0 xyz 1 NONE float xyz +// TEXCOORD 1 xyzw 2 NONE float xyzw +// TEXCOORD 2 xyz 3 NONE float +// TEXCOORD 3 xyz 4 NONE float xyz +// TEXCOORD 4 xyzw 5 NONE float xyz +// TEXCOORD 5 xy 6 NONE float +// TEXCOORD 6 xyzw 7 NONE float xyz +// TEXCOORD 7 xyzw 8 NONE float z +// SV_IsFrontFace 0 x 9 FFACE uint x +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer cb0[36], immediateIndexed +dcl_sampler s0, mode_comparison +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xyz +dcl_input_ps linear v2.xyzw +dcl_input_ps linear v4.xyz +dcl_input_ps linear v5.xyz +dcl_input_ps linear v7.xyz +dcl_input_ps linear v8.z +dcl_input_ps_sgv v9.x, is_front_face +dcl_output o0.xyzw +dcl_temps 6 +div r0.xyz, v2.xyzx, v2.wwww +mad r1.xyz, r0.xyzx, l(0.500000, 0.500000, 1.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000) +lt r0.z, r1.x, l(0.000000) +lt r0.w, l(1.000000), r1.x +or r0.z, r0.w, r0.z +add r0.w, -cb0[20].y, l(1.000000) +mul r2.x, cb0[20].x, l(0.002000) +mul r2.y, r0.w, l(0.002000) +add r1.w, -r1.y, l(1.000000) +add r2.xy, r1.xwxx, r2.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z +add r2.x, -cb0[21].y, l(1.000000) +mul r3.x, cb0[21].x, l(0.002000) +mul r3.y, r2.x, l(0.002000) +add r2.xy, r1.xwxx, r3.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r2.x, r2.xyxx, t0.xxxx, s0, r1.z +add r2.y, -cb0[22].y, l(1.000000) +mul r3.x, cb0[22].x, l(0.002000) +mul r3.y, r2.y, l(0.002000) +add r2.yz, r1.xxwx, r3.xxyx +sample_c_indexable(texture2d)(float,float,float,float) r2.y, r2.yzyy, t0.xxxx, s0, r1.z +add r2.z, -cb0[23].y, l(1.000000) +mul r3.x, cb0[23].x, l(0.002000) +mul r3.y, r2.z, l(0.002000) +add r2.zw, r1.xxxw, r3.xxxy +sample_c_indexable(texture2d)(float,float,float,float) r2.z, r2.zwzz, t0.xxxx, s0, r1.z +add r2.w, -cb0[24].y, l(1.000000) +mul r3.x, cb0[24].x, l(0.002000) +mul r3.y, r2.w, l(0.002000) +add r3.xy, r1.xwxx, r3.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r2.w, r3.xyxx, t0.xxxx, s0, r1.z +add r3.x, -cb0[25].y, l(1.000000) +mul r4.x, cb0[25].x, l(0.002000) +mul r4.y, r3.x, l(0.002000) +add r3.xy, r1.xwxx, r4.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r3.x, r3.xyxx, t0.xxxx, s0, r1.z +add r3.y, -cb0[26].y, l(1.000000) +mul r4.x, cb0[26].x, l(0.002000) +mul r4.y, r3.y, l(0.002000) +add r3.yz, r1.xxwx, r4.xxyx +sample_c_indexable(texture2d)(float,float,float,float) r3.y, r3.yzyy, t0.xxxx, s0, r1.z +add r3.z, -cb0[27].y, l(1.000000) +mul r4.x, cb0[27].x, l(0.002000) +mul r4.y, r3.z, l(0.002000) +add r3.zw, r1.xxxw, r4.xxxy +sample_c_indexable(texture2d)(float,float,float,float) r3.z, r3.zwzz, t0.xxxx, s0, r1.z +add r3.w, -cb0[28].y, l(1.000000) +mul r4.x, cb0[28].x, l(0.002000) +mul r4.y, r3.w, l(0.002000) +add r4.xy, r1.xwxx, r4.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r3.w, r4.xyxx, t0.xxxx, s0, r1.z +add r4.x, -cb0[29].y, l(1.000000) +mul r5.x, cb0[29].x, l(0.002000) +mul r5.y, r4.x, l(0.002000) +add r4.xy, r1.xwxx, r5.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r4.x, r4.xyxx, t0.xxxx, s0, r1.z +add r4.y, -cb0[30].y, l(1.000000) +mul r5.x, cb0[30].x, l(0.002000) +mul r5.y, r4.y, l(0.002000) +add r4.yz, r1.xxwx, r5.xxyx +sample_c_indexable(texture2d)(float,float,float,float) r4.y, r4.yzyy, t0.xxxx, s0, r1.z +add r4.z, -cb0[31].y, l(1.000000) +mul r5.x, cb0[31].x, l(0.002000) +mul r5.y, r4.z, l(0.002000) +add r1.xw, r1.xxxw, r5.xxxy +sample_c_indexable(texture2d)(float,float,float,float) r1.x, r1.xwxx, t0.xxxx, s0, r1.z +if_z r0.z + lt r0.z, r1.y, l(0.000000) + lt r1.y, l(1.000000), r1.y + or r0.z, r0.z, r1.y + if_z r0.z + add r0.z, r0.w, r2.x + add r0.z, r2.y, r0.z + add r0.z, r2.z, r0.z + add r0.z, r2.w, r0.z + add r0.z, r3.x, r0.z + add r0.z, r3.y, r0.z + add r0.z, r3.z, r0.z + add r0.z, r3.w, r0.z + add r0.z, r4.x, r0.z + add r0.z, r4.y, r0.z + add r0.z, r1.x, r0.z + mul r0.z, r0.z, l(0.083333) + else + mov r0.z, l(1.000000) + endif +else + mov r0.z, l(1.000000) +endif +dp2 r0.x, r0.xyxx, r0.xyxx +add r0.y, -cb0[34].w, cb0[34].z +add r0.x, r0.x, -cb0[34].w +div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y +mul_sat r0.x, r0.y, r0.x +mad r0.y, r0.x, l(-2.000000), l(3.000000) +mul r0.x, r0.x, r0.x +mul r0.x, r0.x, r0.y +max r0.xz, r0.xxzx, l(0.050000, 0.000000, 0.500000, 0.000000) +movc r1.xyz, v9.xxxx, v1.xyzx, -v1.xyzx +movc r2.xyz, v9.xxxx, v5.xyzx, v7.xyzx +ine r0.y, cb0[35].x, l(0) +lt r0.w, l(0.995000), r1.y +and r0.w, r0.w, r0.y +if_nz r0.w + deriv_rtx_coarse r3.xy, v4.xzxx + deriv_rty_coarse r3.zw, v4.xxxz + max r3.xy, |r3.zwzz|, |r3.xyxx| + max r0.w, r3.y, r3.x + mad r3.xy, -r0.wwww, l(0.500000, 0.500000, 0.000000, 0.000000), v4.xzxx + mad r3.zw, r0.wwww, l(0.000000, 0.000000, 0.500000, 0.500000), v4.xxxz + mul r4.xy, r3.zwzz, l(0.500000, 0.500000, 0.000000, 0.000000) + round_ni r4.xy, r4.xyxx + mad r3.zw, r3.zzzw, l(0.000000, 0.000000, 0.500000, 0.500000), -r4.xxxy + add r3.zw, r3.zzzw, l(0.000000, 0.000000, -0.500000, -0.500000) + max r3.zw, r3.zzzw, l(0.000000, 0.000000, 0.000000, 0.000000) + mad r3.zw, r3.zzzw, l(0.000000, 0.000000, 2.000000, 2.000000), r4.xxxy + mul r4.xy, r3.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000) + round_ni r4.xy, r4.xyxx + mad r3.xy, r3.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), -r4.xyxx + add r3.xy, r3.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000) + max r3.xy, r3.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000) + mad r3.xy, r3.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), r4.xyxx + add r3.xy, -r3.xyxx, r3.zwzz + div r3.xy, r3.xyxx, r0.wwww + add r3.zw, -r3.xxxy, l(0.000000, 0.000000, 1.000000, 1.000000) + mul r0.w, r3.w, r3.z + mad r0.w, r3.x, r3.y, r0.w + mad r0.w, -r0.w, l(0.250000), l(1.000000) + mul r3.xyz, r0.wwww, r2.xyzx +else + lt r0.w, l(0.995000), |r1.z| + and r0.y, r0.w, r0.y + deriv_rtx_coarse r4.xy, v4.yxyy + deriv_rty_coarse r4.zw, v4.yyyx + max r4.xy, |r4.zwzz|, |r4.xyxx| + max r0.w, r4.y, r4.x + mad r4.xy, -r0.wwww, l(0.500000, 0.500000, 0.000000, 0.000000), v4.yxyy + mad r4.zw, r0.wwww, l(0.000000, 0.000000, 0.500000, 0.500000), v4.yyyx + mul r5.xy, r4.zwzz, l(0.500000, 0.500000, 0.000000, 0.000000) + round_ni r5.xy, r5.xyxx + mad r4.zw, r4.zzzw, l(0.000000, 0.000000, 0.500000, 0.500000), -r5.xxxy + add r4.zw, r4.zzzw, l(0.000000, 0.000000, -0.500000, -0.500000) + max r4.zw, r4.zzzw, l(0.000000, 0.000000, 0.000000, 0.000000) + mad r4.zw, r4.zzzw, l(0.000000, 0.000000, 2.000000, 2.000000), r5.xxxy + mul r5.xy, r4.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000) + round_ni r5.xy, r5.xyxx + mad r4.xy, r4.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), -r5.xyxx + add r4.xy, r4.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000) + max r4.xy, r4.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000) + mad r4.xy, r4.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), r5.xyxx + add r4.xy, -r4.xyxx, r4.zwzz + div r4.xy, r4.xyxx, r0.wwww + add r4.zw, -r4.xxxy, l(0.000000, 0.000000, 1.000000, 1.000000) + mul r0.w, r4.w, r4.z + mad r0.w, r4.x, r4.y, r0.w + mad r0.w, -r0.w, l(0.250000), l(1.000000) + mul r4.xyz, r0.wwww, r2.xyzx + movc r3.xyz, r0.yyyy, r4.xyzx, r2.xyzx +endif +dp3 r0.y, cb0[33].xyzx, r1.xyzx +mul r0.z, r0.z, -r0.y +max r0.z, r0.z, l(0.000000) +mul r1.xyz, r0.zzzz, r3.xyzx +mul r2.xyz, r3.xyzx, l(4.000000, 4.000000, 4.000000, 0.000000) +mad r0.yzw, r0.yyyy, l(0.000000, -0.500000, -0.500000, -1.000000), l(0.000000, 0.500000, 0.500000, 0.000000) +mad r0.yzw, r0.yyzw, l(0.000000, 0.020000, 0.012500, 0.007500), l(0.000000, 0.025000, 0.025000, 0.030000) +mul r0.yzw, r0.yyzw, r2.xxyz +mul r0.yzw, r0.xxxx, r0.yyzw +mad r0.xyz, r1.xyzx, r0.xxxx, r0.yzwy +mul r0.w, v8.z, cb0[17].w +mul r0.w, r0.w, l(1.442695) +exp r0.w, r0.w +add r0.xyz, r0.xyzx, -cb0[17].xyzx +mad r0.xyz, r0.wwww, r0.xyzx, cb0[17].xyzx +log r0.xyz, |r0.xyzx| +mul r0.xyz, r0.xyzx, l(0.454545, 0.454545, 0.454545, 0.000000) +exp o0.xyz, r0.xyzx +mov o0.w, l(1.000000) +ret +// Approximately 179 instruction slots used +#endif + +const BYTE g_meshPS[] = +{ + 68, 88, 66, 67, 72, 67, + 173, 99, 108, 111, 205, 171, + 203, 27, 188, 233, 104, 15, + 95, 167, 1, 0, 0, 0, + 40, 30, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 148, 4, 0, 0, 184, 5, + 0, 0, 236, 5, 0, 0, + 140, 29, 0, 0, 82, 68, + 69, 70, 88, 4, 0, 0, + 1, 0, 0, 0, 196, 0, + 0, 0, 3, 0, 0, 0, + 60, 0, 0, 0, 0, 5, + 255, 255, 0, 1, 0, 0, + 36, 4, 0, 0, 82, 68, + 49, 49, 60, 0, 0, 0, + 24, 0, 0, 0, 32, 0, + 0, 0, 40, 0, 0, 0, + 36, 0, 0, 0, 12, 0, + 0, 0, 0, 0, 0, 0, + 156, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 170, 0, 0, 0, + 2, 0, 0, 0, 5, 0, + 0, 0, 4, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 184, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 115, 104, 97, 100, 111, 119, + 83, 97, 109, 112, 108, 101, + 114, 0, 115, 104, 97, 100, + 111, 119, 84, 101, 120, 116, + 117, 114, 101, 0, 99, 111, + 110, 115, 116, 66, 117, 102, + 0, 171, 171, 171, 184, 0, + 0, 0, 1, 0, 0, 0, + 220, 0, 0, 0, 64, 2, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 4, 1, + 0, 0, 0, 0, 0, 0, + 64, 2, 0, 0, 2, 0, + 0, 0, 0, 4, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 103, 80, 97, 114, + 97, 109, 115, 0, 77, 101, + 115, 104, 83, 104, 97, 100, + 101, 114, 67, 111, 110, 115, + 116, 0, 109, 111, 100, 101, + 108, 86, 105, 101, 119, 80, + 114, 111, 106, 101, 99, 116, + 105, 111, 110, 0, 102, 108, + 111, 97, 116, 52, 120, 52, + 0, 171, 171, 171, 3, 0, + 3, 0, 4, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 1, 0, 0, 109, 111, + 100, 101, 108, 86, 105, 101, + 119, 0, 111, 98, 106, 101, + 99, 116, 84, 114, 97, 110, + 115, 102, 111, 114, 109, 0, + 108, 105, 103, 104, 116, 84, + 114, 97, 110, 115, 102, 111, + 114, 109, 0, 99, 108, 105, + 112, 80, 108, 97, 110, 101, + 0, 102, 108, 111, 97, 116, + 52, 0, 171, 171, 1, 0, + 3, 0, 1, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 147, 1, 0, 0, 102, 111, + 103, 67, 111, 108, 111, 114, + 0, 99, 111, 108, 111, 114, + 0, 115, 101, 99, 111, 110, + 100, 97, 114, 121, 67, 111, + 108, 111, 114, 0, 115, 104, + 97, 100, 111, 119, 84, 97, + 112, 115, 0, 171, 171, 171, + 1, 0, 3, 0, 1, 0, + 4, 0, 12, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 147, 1, 0, 0, + 108, 105, 103, 104, 116, 80, + 111, 115, 0, 102, 108, 111, + 97, 116, 51, 0, 1, 0, + 3, 0, 1, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 25, 2, 0, 0, 95, 112, + 97, 100, 48, 0, 102, 108, + 111, 97, 116, 0, 0, 0, + 3, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 74, 2, 0, 0, 108, 105, + 103, 104, 116, 68, 105, 114, + 0, 95, 112, 97, 100, 49, + 0, 98, 105, 97, 115, 0, + 101, 120, 112, 97, 110, 100, + 0, 115, 112, 111, 116, 77, + 105, 110, 0, 115, 112, 111, + 116, 77, 97, 120, 0, 103, + 114, 105, 100, 0, 105, 110, + 116, 0, 0, 0, 2, 0, + 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 164, 2, + 0, 0, 116, 101, 120, 0, + 99, 111, 108, 111, 114, 65, + 114, 114, 97, 121, 0, 105, + 110, 99, 114, 101, 97, 115, + 101, 71, 102, 120, 76, 111, + 97, 100, 70, 111, 114, 65, + 115, 121, 110, 99, 67, 111, + 109, 112, 117, 116, 101, 84, + 101, 115, 116, 105, 110, 103, + 0, 171, 171, 171, 28, 1, + 0, 0, 60, 1, 0, 0, + 0, 0, 0, 0, 96, 1, + 0, 0, 60, 1, 0, 0, + 64, 0, 0, 0, 106, 1, + 0, 0, 60, 1, 0, 0, + 128, 0, 0, 0, 122, 1, + 0, 0, 60, 1, 0, 0, + 192, 0, 0, 0, 137, 1, + 0, 0, 156, 1, 0, 0, + 0, 1, 0, 0, 192, 1, + 0, 0, 156, 1, 0, 0, + 16, 1, 0, 0, 201, 1, + 0, 0, 156, 1, 0, 0, + 32, 1, 0, 0, 207, 1, + 0, 0, 156, 1, 0, 0, + 48, 1, 0, 0, 222, 1, + 0, 0, 236, 1, 0, 0, + 64, 1, 0, 0, 16, 2, + 0, 0, 32, 2, 0, 0, + 0, 2, 0, 0, 68, 2, + 0, 0, 80, 2, 0, 0, + 12, 2, 0, 0, 116, 2, + 0, 0, 32, 2, 0, 0, + 16, 2, 0, 0, 125, 2, + 0, 0, 80, 2, 0, 0, + 28, 2, 0, 0, 131, 2, + 0, 0, 80, 2, 0, 0, + 32, 2, 0, 0, 136, 2, + 0, 0, 80, 2, 0, 0, + 36, 2, 0, 0, 143, 2, + 0, 0, 80, 2, 0, 0, + 40, 2, 0, 0, 151, 2, + 0, 0, 80, 2, 0, 0, + 44, 2, 0, 0, 159, 2, + 0, 0, 168, 2, 0, 0, + 48, 2, 0, 0, 204, 2, + 0, 0, 168, 2, 0, 0, + 52, 2, 0, 0, 208, 2, + 0, 0, 168, 2, 0, 0, + 56, 2, 0, 0, 219, 2, + 0, 0, 168, 2, 0, 0, + 60, 2, 0, 0, 5, 0, + 0, 0, 1, 0, 144, 0, + 0, 0, 21, 0, 4, 3, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 12, 1, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, + 171, 171, 73, 83, 71, 78, + 28, 1, 0, 0, 10, 0, + 0, 0, 8, 0, 0, 0, + 248, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 4, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 7, 7, 0, 0, + 4, 1, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 15, 15, 0, 0, + 4, 1, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 7, 0, 0, 0, + 4, 1, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 4, 0, + 0, 0, 7, 7, 0, 0, + 4, 1, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 5, 0, + 0, 0, 15, 7, 0, 0, + 4, 1, 0, 0, 5, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 6, 0, + 0, 0, 3, 0, 0, 0, + 4, 1, 0, 0, 6, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 7, 0, + 0, 0, 15, 7, 0, 0, + 4, 1, 0, 0, 7, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 8, 0, + 0, 0, 15, 4, 0, 0, + 13, 1, 0, 0, 0, 0, + 0, 0, 9, 0, 0, 0, + 1, 0, 0, 0, 9, 0, + 0, 0, 1, 1, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 73, 115, 70, 114, 111, 110, + 116, 70, 97, 99, 101, 0, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 65, 82, 71, 69, + 84, 0, 171, 171, 83, 72, + 69, 88, 152, 23, 0, 0, + 80, 0, 0, 0, 230, 5, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 36, 0, 0, 0, 90, 8, + 0, 3, 0, 96, 16, 0, + 0, 0, 0, 0, 88, 24, + 0, 4, 0, 112, 16, 0, + 0, 0, 0, 0, 85, 85, + 0, 0, 98, 16, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 98, 16, 0, 3, + 242, 16, 16, 0, 2, 0, + 0, 0, 98, 16, 0, 3, + 114, 16, 16, 0, 4, 0, + 0, 0, 98, 16, 0, 3, + 114, 16, 16, 0, 5, 0, + 0, 0, 98, 16, 0, 3, + 114, 16, 16, 0, 7, 0, + 0, 0, 98, 16, 0, 3, + 66, 16, 16, 0, 8, 0, + 0, 0, 99, 8, 0, 4, + 18, 16, 16, 0, 9, 0, + 0, 0, 9, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 104, 0, 0, 2, 6, 0, + 0, 0, 14, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 246, 31, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 15, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 63, 0, 0, + 0, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 63, + 0, 0, 0, 63, 0, 0, + 0, 0, 0, 0, 0, 0, + 49, 0, 0, 7, 66, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 49, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 10, 0, 16, 0, 1, 0, + 0, 0, 60, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 130, 0, + 16, 0, 0, 0, 0, 0, + 26, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 20, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 8, 18, 0, + 16, 0, 2, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 20, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 56, 0, 0, 7, + 34, 0, 16, 0, 2, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 0, 0, 0, 8, 130, 0, + 16, 0, 1, 0, 0, 0, + 26, 0, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 0, 0, 0, 7, + 50, 0, 16, 0, 2, 0, + 0, 0, 198, 0, 16, 0, + 1, 0, 0, 0, 70, 0, + 16, 0, 2, 0, 0, 0, + 70, 0, 0, 141, 194, 0, + 0, 128, 67, 85, 21, 0, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 0, 16, 0, + 2, 0, 0, 0, 6, 112, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 1, 0, 0, 0, 0, 0, + 0, 9, 18, 0, 16, 0, + 2, 0, 0, 0, 26, 128, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 21, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 8, 18, 0, 16, 0, + 3, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 56, 0, 0, 7, 34, 0, + 16, 0, 3, 0, 0, 0, + 10, 0, 16, 0, 2, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 0, 0, + 0, 7, 50, 0, 16, 0, + 2, 0, 0, 0, 198, 0, + 16, 0, 1, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 70, 0, 0, 141, + 194, 0, 0, 128, 67, 85, + 21, 0, 18, 0, 16, 0, + 2, 0, 0, 0, 70, 0, + 16, 0, 2, 0, 0, 0, + 6, 112, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 9, 34, 0, + 16, 0, 2, 0, 0, 0, + 26, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 22, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 8, 18, 0, + 16, 0, 3, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 56, 0, 0, 7, + 34, 0, 16, 0, 3, 0, + 0, 0, 26, 0, 16, 0, + 2, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 0, 0, 0, 7, 98, 0, + 16, 0, 2, 0, 0, 0, + 6, 3, 16, 0, 1, 0, + 0, 0, 6, 1, 16, 0, + 3, 0, 0, 0, 70, 0, + 0, 141, 194, 0, 0, 128, + 67, 85, 21, 0, 34, 0, + 16, 0, 2, 0, 0, 0, + 150, 5, 16, 0, 2, 0, + 0, 0, 6, 112, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 42, 0, 16, 0, 1, 0, + 0, 0, 0, 0, 0, 9, + 66, 0, 16, 0, 2, 0, + 0, 0, 26, 128, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 23, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 8, + 18, 0, 16, 0, 3, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 56, 0, + 0, 7, 34, 0, 16, 0, + 3, 0, 0, 0, 42, 0, + 16, 0, 2, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 0, 0, 0, 7, + 194, 0, 16, 0, 2, 0, + 0, 0, 6, 12, 16, 0, + 1, 0, 0, 0, 6, 4, + 16, 0, 3, 0, 0, 0, + 70, 0, 0, 141, 194, 0, + 0, 128, 67, 85, 21, 0, + 66, 0, 16, 0, 2, 0, + 0, 0, 230, 10, 16, 0, + 2, 0, 0, 0, 6, 112, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 1, 0, 0, 0, 0, 0, + 0, 9, 130, 0, 16, 0, + 2, 0, 0, 0, 26, 128, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 24, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 8, 18, 0, 16, 0, + 3, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 56, 0, 0, 7, 34, 0, + 16, 0, 3, 0, 0, 0, + 58, 0, 16, 0, 2, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 0, 0, + 0, 7, 50, 0, 16, 0, + 3, 0, 0, 0, 198, 0, + 16, 0, 1, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 70, 0, 0, 141, + 194, 0, 0, 128, 67, 85, + 21, 0, 130, 0, 16, 0, + 2, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, + 6, 112, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 9, 18, 0, + 16, 0, 3, 0, 0, 0, + 26, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 25, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 8, 18, 0, + 16, 0, 4, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 56, 0, 0, 7, + 34, 0, 16, 0, 4, 0, + 0, 0, 10, 0, 16, 0, + 3, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 0, 0, 0, 7, 50, 0, + 16, 0, 3, 0, 0, 0, + 198, 0, 16, 0, 1, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 70, 0, + 0, 141, 194, 0, 0, 128, + 67, 85, 21, 0, 18, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 6, 112, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 42, 0, 16, 0, 1, 0, + 0, 0, 0, 0, 0, 9, + 34, 0, 16, 0, 3, 0, + 0, 0, 26, 128, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 26, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 8, + 18, 0, 16, 0, 4, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 26, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 56, 0, + 0, 7, 34, 0, 16, 0, + 4, 0, 0, 0, 26, 0, + 16, 0, 3, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 0, 0, 0, 7, + 98, 0, 16, 0, 3, 0, + 0, 0, 6, 3, 16, 0, + 1, 0, 0, 0, 6, 1, + 16, 0, 4, 0, 0, 0, + 70, 0, 0, 141, 194, 0, + 0, 128, 67, 85, 21, 0, + 34, 0, 16, 0, 3, 0, + 0, 0, 150, 5, 16, 0, + 3, 0, 0, 0, 6, 112, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 1, 0, 0, 0, 0, 0, + 0, 9, 66, 0, 16, 0, + 3, 0, 0, 0, 26, 128, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 27, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 8, 18, 0, 16, 0, + 4, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 27, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 56, 0, 0, 7, 34, 0, + 16, 0, 4, 0, 0, 0, + 42, 0, 16, 0, 3, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 0, 0, + 0, 7, 194, 0, 16, 0, + 3, 0, 0, 0, 6, 12, + 16, 0, 1, 0, 0, 0, + 6, 4, 16, 0, 4, 0, + 0, 0, 70, 0, 0, 141, + 194, 0, 0, 128, 67, 85, + 21, 0, 66, 0, 16, 0, + 3, 0, 0, 0, 230, 10, + 16, 0, 3, 0, 0, 0, + 6, 112, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 9, 130, 0, + 16, 0, 3, 0, 0, 0, + 26, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 8, 18, 0, + 16, 0, 4, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 28, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 56, 0, 0, 7, + 34, 0, 16, 0, 4, 0, + 0, 0, 58, 0, 16, 0, + 3, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 0, 0, 0, 7, 50, 0, + 16, 0, 4, 0, 0, 0, + 198, 0, 16, 0, 1, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 70, 0, + 0, 141, 194, 0, 0, 128, + 67, 85, 21, 0, 130, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 4, 0, + 0, 0, 6, 112, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 42, 0, 16, 0, 1, 0, + 0, 0, 0, 0, 0, 9, + 18, 0, 16, 0, 4, 0, + 0, 0, 26, 128, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 29, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 8, + 18, 0, 16, 0, 5, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 29, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 56, 0, + 0, 7, 34, 0, 16, 0, + 5, 0, 0, 0, 10, 0, + 16, 0, 4, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 0, 0, 0, 7, + 50, 0, 16, 0, 4, 0, + 0, 0, 198, 0, 16, 0, + 1, 0, 0, 0, 70, 0, + 16, 0, 5, 0, 0, 0, + 70, 0, 0, 141, 194, 0, + 0, 128, 67, 85, 21, 0, + 18, 0, 16, 0, 4, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 6, 112, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 1, 0, 0, 0, 0, 0, + 0, 9, 34, 0, 16, 0, + 4, 0, 0, 0, 26, 128, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 30, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 8, 18, 0, 16, 0, + 5, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 30, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 56, 0, 0, 7, 34, 0, + 16, 0, 5, 0, 0, 0, + 26, 0, 16, 0, 4, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 0, 0, + 0, 7, 98, 0, 16, 0, + 4, 0, 0, 0, 6, 3, + 16, 0, 1, 0, 0, 0, + 6, 1, 16, 0, 5, 0, + 0, 0, 70, 0, 0, 141, + 194, 0, 0, 128, 67, 85, + 21, 0, 34, 0, 16, 0, + 4, 0, 0, 0, 150, 5, + 16, 0, 4, 0, 0, 0, + 6, 112, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 9, 66, 0, + 16, 0, 4, 0, 0, 0, + 26, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 31, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 8, 18, 0, + 16, 0, 5, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 31, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 56, 0, 0, 7, + 34, 0, 16, 0, 5, 0, + 0, 0, 42, 0, 16, 0, + 4, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 0, 0, 0, 7, 146, 0, + 16, 0, 1, 0, 0, 0, + 6, 12, 16, 0, 1, 0, + 0, 0, 6, 4, 16, 0, + 5, 0, 0, 0, 70, 0, + 0, 141, 194, 0, 0, 128, + 67, 85, 21, 0, 18, 0, + 16, 0, 1, 0, 0, 0, + 198, 0, 16, 0, 1, 0, + 0, 0, 6, 112, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 42, 0, 16, 0, 1, 0, + 0, 0, 31, 0, 0, 3, + 42, 0, 16, 0, 0, 0, + 0, 0, 49, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 49, 0, 0, 7, 34, 0, + 16, 0, 1, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 26, 0, 16, 0, + 1, 0, 0, 0, 60, 0, + 0, 7, 66, 0, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 26, 0, 16, 0, 1, 0, + 0, 0, 31, 0, 0, 3, + 42, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 2, 0, 0, 0, + 0, 0, 0, 7, 66, 0, + 16, 0, 0, 0, 0, 0, + 26, 0, 16, 0, 2, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 7, 66, 0, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 2, 0, 0, 0, + 42, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 2, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 66, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 3, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 7, 66, 0, 16, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 3, 0, 0, 0, + 42, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 3, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 66, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 3, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 7, 66, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 4, 0, 0, 0, + 42, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 4, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 66, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 66, 0, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 171, 170, + 170, 61, 18, 0, 0, 1, + 54, 0, 0, 5, 66, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 21, 0, 0, 1, + 18, 0, 0, 1, 54, 0, + 0, 5, 66, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 21, 0, 0, 1, 15, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 0, + 16, 0, 0, 0, 0, 0, + 70, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 10, + 34, 0, 16, 0, 0, 0, + 0, 0, 58, 128, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 34, 0, 0, 0, + 42, 128, 32, 0, 0, 0, + 0, 0, 34, 0, 0, 0, + 0, 0, 0, 9, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 58, 128, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 34, 0, 0, 0, + 14, 0, 0, 10, 34, 0, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 128, 63, 26, 0, 16, 0, + 0, 0, 0, 0, 56, 32, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 34, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 192, + 1, 64, 0, 0, 0, 0, + 64, 64, 56, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 52, 0, + 0, 10, 82, 0, 16, 0, + 0, 0, 0, 0, 6, 2, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 205, 204, + 76, 61, 0, 0, 0, 0, + 0, 0, 0, 63, 0, 0, + 0, 0, 55, 0, 0, 10, + 114, 0, 16, 0, 1, 0, + 0, 0, 6, 16, 16, 0, + 9, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 18, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 55, 0, 0, 9, 114, 0, + 16, 0, 2, 0, 0, 0, + 6, 16, 16, 0, 9, 0, + 0, 0, 70, 18, 16, 0, + 5, 0, 0, 0, 70, 18, + 16, 0, 7, 0, 0, 0, + 39, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 35, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 49, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 82, 184, 126, 63, 26, 0, + 16, 0, 1, 0, 0, 0, + 1, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 31, 0, + 4, 3, 58, 0, 16, 0, + 0, 0, 0, 0, 122, 0, + 0, 5, 50, 0, 16, 0, + 3, 0, 0, 0, 134, 16, + 16, 0, 4, 0, 0, 0, + 124, 0, 0, 5, 194, 0, + 16, 0, 3, 0, 0, 0, + 6, 24, 16, 0, 4, 0, + 0, 0, 52, 0, 0, 9, + 50, 0, 16, 0, 3, 0, + 0, 0, 230, 10, 16, 128, + 129, 0, 0, 0, 3, 0, + 0, 0, 70, 0, 16, 128, + 129, 0, 0, 0, 3, 0, + 0, 0, 52, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 3, 0, 0, 0, 10, 0, + 16, 0, 3, 0, 0, 0, + 50, 0, 0, 13, 50, 0, + 16, 0, 3, 0, 0, 0, + 246, 15, 16, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 134, 16, 16, 0, + 4, 0, 0, 0, 50, 0, + 0, 12, 194, 0, 16, 0, + 3, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 63, 0, 0, + 0, 63, 6, 24, 16, 0, + 4, 0, 0, 0, 56, 0, + 0, 10, 50, 0, 16, 0, + 4, 0, 0, 0, 230, 10, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 65, 0, 0, 5, + 50, 0, 16, 0, 4, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 50, 0, + 0, 13, 194, 0, 16, 0, + 3, 0, 0, 0, 166, 14, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 63, 0, 0, + 0, 63, 6, 4, 16, 128, + 65, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 10, + 194, 0, 16, 0, 3, 0, + 0, 0, 166, 14, 16, 0, + 3, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 191, 0, 0, 0, 191, + 52, 0, 0, 10, 194, 0, + 16, 0, 3, 0, 0, 0, + 166, 14, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 194, 0, 16, 0, + 3, 0, 0, 0, 166, 14, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 64, 0, 0, + 0, 64, 6, 4, 16, 0, + 4, 0, 0, 0, 56, 0, + 0, 10, 50, 0, 16, 0, + 4, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 65, 0, 0, 5, + 50, 0, 16, 0, 4, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 50, 0, + 0, 13, 50, 0, 16, 0, + 3, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 0, 16, 128, + 65, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 10, + 50, 0, 16, 0, 3, 0, + 0, 0, 70, 0, 16, 0, + 3, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 191, + 0, 0, 0, 191, 0, 0, + 0, 0, 0, 0, 0, 0, + 52, 0, 0, 10, 50, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 50, 0, 16, 0, + 3, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 64, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 0, 0, + 0, 8, 50, 0, 16, 0, + 3, 0, 0, 0, 70, 0, + 16, 128, 65, 0, 0, 0, + 3, 0, 0, 0, 230, 10, + 16, 0, 3, 0, 0, 0, + 14, 0, 0, 7, 50, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 11, 194, 0, 16, 0, + 3, 0, 0, 0, 6, 4, + 16, 128, 65, 0, 0, 0, + 3, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 56, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 3, 0, + 0, 0, 42, 0, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 9, 130, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 3, 0, 0, 0, + 26, 0, 16, 0, 3, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 10, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 62, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 7, + 114, 0, 16, 0, 3, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 18, 0, 0, 1, 49, 0, + 0, 8, 130, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 82, 184, 126, 63, + 42, 0, 16, 128, 129, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 7, 34, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 122, 0, + 0, 5, 50, 0, 16, 0, + 4, 0, 0, 0, 22, 21, + 16, 0, 4, 0, 0, 0, + 124, 0, 0, 5, 194, 0, + 16, 0, 4, 0, 0, 0, + 86, 17, 16, 0, 4, 0, + 0, 0, 52, 0, 0, 9, + 50, 0, 16, 0, 4, 0, + 0, 0, 230, 10, 16, 128, + 129, 0, 0, 0, 4, 0, + 0, 0, 70, 0, 16, 128, + 129, 0, 0, 0, 4, 0, + 0, 0, 52, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 4, 0, 0, 0, 10, 0, + 16, 0, 4, 0, 0, 0, + 50, 0, 0, 13, 50, 0, + 16, 0, 4, 0, 0, 0, + 246, 15, 16, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 22, 21, 16, 0, + 4, 0, 0, 0, 50, 0, + 0, 12, 194, 0, 16, 0, + 4, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 63, 0, 0, + 0, 63, 86, 17, 16, 0, + 4, 0, 0, 0, 56, 0, + 0, 10, 50, 0, 16, 0, + 5, 0, 0, 0, 230, 10, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 65, 0, 0, 5, + 50, 0, 16, 0, 5, 0, + 0, 0, 70, 0, 16, 0, + 5, 0, 0, 0, 50, 0, + 0, 13, 194, 0, 16, 0, + 4, 0, 0, 0, 166, 14, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 63, 0, 0, + 0, 63, 6, 4, 16, 128, + 65, 0, 0, 0, 5, 0, + 0, 0, 0, 0, 0, 10, + 194, 0, 16, 0, 4, 0, + 0, 0, 166, 14, 16, 0, + 4, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 191, 0, 0, 0, 191, + 52, 0, 0, 10, 194, 0, + 16, 0, 4, 0, 0, 0, + 166, 14, 16, 0, 4, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 194, 0, 16, 0, + 4, 0, 0, 0, 166, 14, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 64, 0, 0, + 0, 64, 6, 4, 16, 0, + 5, 0, 0, 0, 56, 0, + 0, 10, 50, 0, 16, 0, + 5, 0, 0, 0, 70, 0, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 65, 0, 0, 5, + 50, 0, 16, 0, 5, 0, + 0, 0, 70, 0, 16, 0, + 5, 0, 0, 0, 50, 0, + 0, 13, 50, 0, 16, 0, + 4, 0, 0, 0, 70, 0, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 0, 16, 128, + 65, 0, 0, 0, 5, 0, + 0, 0, 0, 0, 0, 10, + 50, 0, 16, 0, 4, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 191, + 0, 0, 0, 191, 0, 0, + 0, 0, 0, 0, 0, 0, + 52, 0, 0, 10, 50, 0, + 16, 0, 4, 0, 0, 0, + 70, 0, 16, 0, 4, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 50, 0, 16, 0, + 4, 0, 0, 0, 70, 0, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 64, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 0, 16, 0, + 5, 0, 0, 0, 0, 0, + 0, 8, 50, 0, 16, 0, + 4, 0, 0, 0, 70, 0, + 16, 128, 65, 0, 0, 0, + 4, 0, 0, 0, 230, 10, + 16, 0, 4, 0, 0, 0, + 14, 0, 0, 7, 50, 0, + 16, 0, 4, 0, 0, 0, + 70, 0, 16, 0, 4, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 11, 194, 0, 16, 0, + 4, 0, 0, 0, 6, 4, + 16, 128, 65, 0, 0, 0, + 4, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 56, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 4, 0, + 0, 0, 42, 0, 16, 0, + 4, 0, 0, 0, 50, 0, + 0, 9, 130, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 4, 0, 0, 0, + 26, 0, 16, 0, 4, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 10, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 62, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 7, + 114, 0, 16, 0, 4, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 55, 0, 0, 9, 114, 0, + 16, 0, 3, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 21, 0, 0, 1, 16, 0, + 0, 8, 34, 0, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 33, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 8, 66, 0, + 16, 0, 0, 0, 0, 0, + 42, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 52, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 1, 0, 0, 0, + 166, 10, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 56, 0, + 0, 10, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 64, 0, 0, 128, 64, + 0, 0, 128, 64, 0, 0, + 0, 0, 50, 0, 0, 15, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 5, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 191, 0, 0, + 0, 191, 0, 0, 128, 191, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 63, + 0, 0, 0, 63, 0, 0, + 0, 0, 50, 0, 0, 15, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 14, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 11, 215, 163, 60, 206, 204, + 76, 60, 148, 194, 245, 59, + 2, 64, 0, 0, 0, 0, + 0, 0, 205, 204, 204, 60, + 205, 204, 204, 60, 143, 194, + 245, 60, 56, 0, 0, 7, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 14, 16, 0, + 0, 0, 0, 0, 6, 9, + 16, 0, 2, 0, 0, 0, + 56, 0, 0, 7, 226, 0, + 16, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 86, 14, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 9, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 130, 0, 16, 0, + 0, 0, 0, 0, 42, 16, + 16, 0, 8, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 56, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 59, 170, 184, 63, 25, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 47, 0, + 0, 6, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 128, 129, 0, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 47, 186, + 232, 62, 47, 186, 232, 62, + 47, 186, 232, 62, 0, 0, + 0, 0, 25, 0, 0, 5, + 114, 32, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 130, 32, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 62, 0, 0, 1, 83, 84, + 65, 84, 148, 0, 0, 0, + 179, 0, 0, 0, 6, 0, + 0, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 146, 0, + 0, 0, 1, 0, 0, 0, + 4, 0, 0, 0, 4, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 12, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/demo/d3d11/shaders/meshPS.hlsl b/demo/d3d/shaders/meshPS.hlsl index db28d60..a78d249 100644 --- a/demo/d3d11/shaders/meshPS.hlsl +++ b/demo/d3d/shaders/meshPS.hlsl @@ -6,13 +6,12 @@ cbuffer constBuf : register(b0) }; Texture2D<float> shadowTexture : register(t0); // shadow map - SamplerComparisonState shadowSampler : register(s0); // texture sample used to sample depth from shadow texture in this sample // sample shadow map -float shadowSample(float4 gl_TexCoord[8]) +float shadowSample(float4 lightOffsetPosition) { - float3 pos = float3(gl_TexCoord[1].xyz / gl_TexCoord[1].w); + float3 pos = float3(lightOffsetPosition.xyz / lightOffsetPosition.w); float3 uvw = (pos.xyz * float3(0.5, 0.5, 1.0)) + float3(0.5, 0.5, 0.0); // user clip @@ -34,7 +33,7 @@ float shadowSample(float4 gl_TexCoord[8]) { float2 shadowTaps = gParams.shadowTaps[i].xy; shadowTaps.y = 1.0f - shadowTaps.y; - s += shadowTexture.SampleCmpLevelZero(shadowSampler, uvw.xy + shadowTaps * radius, uvw.z); + s += shadowTexture.SampleCmp(shadowSampler, uvw.xy + shadowTaps * radius, uvw.z); } s /= numTaps; @@ -64,13 +63,6 @@ float checker(float2 uv) float4 meshPS(MeshVertexOut input, bool isFrontFace : SV_IsFrontFace) : SV_TARGET { - float4 gl_FragColor; - float4 gl_TexCoord[8]; - - [unroll] - for (int i = 0; i < 8; i++) - gl_TexCoord[i] = input.texCoord[i]; - const float4 fogColor = gParams.fogColor; const float3 lightDir = gParams.lightDir; const float3 lightPos = gParams.lightPos; @@ -80,28 +72,29 @@ float4 meshPS(MeshVertexOut input, bool isFrontFace : SV_IsFrontFace) : SV_TARGE const int tex = gParams.tex; // calculate lighting - float shadow = max(shadowSample(gl_TexCoord), 0.5); - - float3 lVec = normalize(gl_TexCoord[3].xyz - (lightPos)); - float3 lPos = float3(gl_TexCoord[1].xyz / gl_TexCoord[1].w); + float shadow = max(shadowSample(input.lightOffsetPosition), 0.5); + //float shadow = 0.5f; + + float3 lVec = normalize(input.worldPosition - lightPos); + float3 lPos = float3(input.lightOffsetPosition.xyz / input.lightOffsetPosition.w); float attenuation = max(smoothstep(spotMax, spotMin, dot(lPos.xy, lPos.xy)), 0.05); - float3 n = gl_TexCoord[0].xyz; - float3 color = gl_TexCoord[4].xyz; + float3 n = input.worldNormal; + float3 color = input.color.xyz; if (!isFrontFace) { - color = gl_TexCoord[6].xyz; + color = input.secondaryColor.xyz; n *= -1.0f; } if (grid && (n.y > 0.995)) { - color *= 1.0 - 0.25 * checker(float2(gl_TexCoord[3].x, gl_TexCoord[3].z)); + color *= 1.0 - 0.25 * checker(float2(input.worldPosition.x, input.worldPosition.z)); } else if (grid && abs(n.z) > 0.995) { - color *= 1.0 - 0.25 * checker(float2(gl_TexCoord[3].y, gl_TexCoord[3].x)); + color *= 1.0 - 0.25 * checker(float2(input.worldPosition.y, input.worldPosition.x)); } if (tex) @@ -119,12 +112,12 @@ float4 meshPS(MeshVertexOut input, bool isFrontFace : SV_IsFrontFace) : SV_TARGE //float3 ambient = 4.0 * color * lerp(dark, light, -dot(lightDir, n) * 0.5 + 0.5) * attenuation; float3 ambient = 4.0 * color * lerp(dark, light, -dot(lightDir, n) * float3(0.5, 0.5, 1.0) + float3(0.5, 0.5, 0.0)) * attenuation; - float3 fog = lerp(fogColor.xyz, diffuse + ambient, exp(gl_TexCoord[7].z * fogColor.w)); + float3 fog = lerp(fogColor.xyz, diffuse + ambient, exp(input.viewPosition.z * fogColor.w)); - //gl_FragColor = float4(pow(fog, float3(1.0 / 2.2)), 1.0); + //outColor = float4(pow(fog, float3(1.0 / 2.2)), 1.0); const float tmp = 1.0 / 2.2; - gl_FragColor = float4(pow(abs(fog), float3(tmp, tmp, tmp)), 1.0); - - return gl_FragColor; + float4 outColor = float4(pow(abs(fog), float3(tmp, tmp, tmp)), 1.0); + + return outColor; } diff --git a/demo/d3d11/shaders/meshPS.hlsl.h b/demo/d3d/shaders/meshPS.hlsl.h index 9bbb118..8223a67 100644 --- a/demo/d3d11/shaders/meshPS.hlsl.h +++ b/demo/d3d/shaders/meshPS.hlsl.h @@ -11,8 +11,8 @@ // struct MeshShaderConst // { // -// float4x4 modelviewprojection; // Offset: 0 -// float4x4 modelview; // Offset: 64 +// float4x4 modelViewProjection; // Offset: 0 +// float4x4 modelView; // Offset: 64 // float4x4 objectTransform; // Offset: 128 // float4x4 lightTransform; // Offset: 192 // float4 clipPlane; // Offset: 256 @@ -31,7 +31,7 @@ // int grid; // Offset: 560 // int tex; // Offset: 564 // int colorArray; // Offset: 568 -// int _pad2; // Offset: 572 +// int increaseGfxLoadForAsyncComputeTesting;// Offset: 572 // // } gParams; // Offset: 0 Size: 576 // @@ -53,12 +53,12 @@ // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_POSITION 0 xyzw 0 POS float -// TEXCOORD 0 xyzw 1 NONE float xyz +// TEXCOORD 0 xyz 1 NONE float xyz // TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float -// TEXCOORD 3 xyzw 4 NONE float xyz +// TEXCOORD 2 xyz 3 NONE float +// TEXCOORD 3 xyz 4 NONE float xyz // TEXCOORD 4 xyzw 5 NONE float xyz -// TEXCOORD 5 xyzw 6 NONE float +// TEXCOORD 5 xy 6 NONE float // TEXCOORD 6 xyzw 7 NONE float xyz // TEXCOORD 7 xyzw 8 NONE float z // SV_IsFrontFace 0 x 9 FFACE uint x @@ -89,83 +89,83 @@ mad r1.xyz, r0.xyzx, l(0.500000, 0.500000, 1.000000, 0.000000), l(0.500000, 0.50 lt r0.z, r1.x, l(0.000000) lt r0.w, l(1.000000), r1.x or r0.z, r0.w, r0.z +add r0.w, -cb0[20].y, l(1.000000) +mul r2.x, cb0[20].x, l(0.002000) +mul r2.y, r0.w, l(0.002000) +add r1.w, -r1.y, l(1.000000) +add r2.xy, r1.xwxx, r2.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z +add r2.x, -cb0[21].y, l(1.000000) +mul r3.x, cb0[21].x, l(0.002000) +mul r3.y, r2.x, l(0.002000) +add r2.xy, r1.xwxx, r3.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r2.x, r2.xyxx, t0.xxxx, s0, r1.z +add r2.y, -cb0[22].y, l(1.000000) +mul r3.x, cb0[22].x, l(0.002000) +mul r3.y, r2.y, l(0.002000) +add r2.yz, r1.xxwx, r3.xxyx +sample_c_indexable(texture2d)(float,float,float,float) r2.y, r2.yzyy, t0.xxxx, s0, r1.z +add r2.z, -cb0[23].y, l(1.000000) +mul r3.x, cb0[23].x, l(0.002000) +mul r3.y, r2.z, l(0.002000) +add r2.zw, r1.xxxw, r3.xxxy +sample_c_indexable(texture2d)(float,float,float,float) r2.z, r2.zwzz, t0.xxxx, s0, r1.z +add r2.w, -cb0[24].y, l(1.000000) +mul r3.x, cb0[24].x, l(0.002000) +mul r3.y, r2.w, l(0.002000) +add r3.xy, r1.xwxx, r3.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r2.w, r3.xyxx, t0.xxxx, s0, r1.z +add r3.x, -cb0[25].y, l(1.000000) +mul r4.x, cb0[25].x, l(0.002000) +mul r4.y, r3.x, l(0.002000) +add r3.xy, r1.xwxx, r4.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r3.x, r3.xyxx, t0.xxxx, s0, r1.z +add r3.y, -cb0[26].y, l(1.000000) +mul r4.x, cb0[26].x, l(0.002000) +mul r4.y, r3.y, l(0.002000) +add r3.yz, r1.xxwx, r4.xxyx +sample_c_indexable(texture2d)(float,float,float,float) r3.y, r3.yzyy, t0.xxxx, s0, r1.z +add r3.z, -cb0[27].y, l(1.000000) +mul r4.x, cb0[27].x, l(0.002000) +mul r4.y, r3.z, l(0.002000) +add r3.zw, r1.xxxw, r4.xxxy +sample_c_indexable(texture2d)(float,float,float,float) r3.z, r3.zwzz, t0.xxxx, s0, r1.z +add r3.w, -cb0[28].y, l(1.000000) +mul r4.x, cb0[28].x, l(0.002000) +mul r4.y, r3.w, l(0.002000) +add r4.xy, r1.xwxx, r4.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r3.w, r4.xyxx, t0.xxxx, s0, r1.z +add r4.x, -cb0[29].y, l(1.000000) +mul r5.x, cb0[29].x, l(0.002000) +mul r5.y, r4.x, l(0.002000) +add r4.xy, r1.xwxx, r5.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r4.x, r4.xyxx, t0.xxxx, s0, r1.z +add r4.y, -cb0[30].y, l(1.000000) +mul r5.x, cb0[30].x, l(0.002000) +mul r5.y, r4.y, l(0.002000) +add r4.yz, r1.xxwx, r5.xxyx +sample_c_indexable(texture2d)(float,float,float,float) r4.y, r4.yzyy, t0.xxxx, s0, r1.z +add r4.z, -cb0[31].y, l(1.000000) +mul r5.x, cb0[31].x, l(0.002000) +mul r5.y, r4.z, l(0.002000) +add r1.xw, r1.xxxw, r5.xxxy +sample_c_indexable(texture2d)(float,float,float,float) r1.x, r1.xwxx, t0.xxxx, s0, r1.z if_z r0.z lt r0.z, r1.y, l(0.000000) - lt r0.w, l(1.000000), r1.y - or r0.z, r0.w, r0.z + lt r1.y, l(1.000000), r1.y + or r0.z, r0.z, r1.y if_z r0.z - add r0.z, -cb0[20].y, l(1.000000) - mul r2.x, cb0[20].x, l(0.002000) - mul r2.y, r0.z, l(0.002000) - add r1.w, -r1.y, l(1.000000) - add r0.zw, r1.xxxw, r2.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.z, r0.zwzz, t0.xxxx, s0, r1.z - add r0.w, -cb0[21].y, l(1.000000) - mul r2.x, cb0[21].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[22].y, l(1.000000) - mul r2.x, cb0[22].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[23].y, l(1.000000) - mul r2.x, cb0[23].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[24].y, l(1.000000) - mul r2.x, cb0[24].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[25].y, l(1.000000) - mul r2.x, cb0[25].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[26].y, l(1.000000) - mul r2.x, cb0[26].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[27].y, l(1.000000) - mul r2.x, cb0[27].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[28].y, l(1.000000) - mul r2.x, cb0[28].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[29].y, l(1.000000) - mul r2.x, cb0[29].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[30].y, l(1.000000) - mul r2.x, cb0[30].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[31].y, l(1.000000) - mul r2.x, cb0[31].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r1.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r1.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z + add r0.z, r0.w, r2.x + add r0.z, r2.y, r0.z + add r0.z, r2.z, r0.z + add r0.z, r2.w, r0.z + add r0.z, r3.x, r0.z + add r0.z, r3.y, r0.z + add r0.z, r3.z, r0.z + add r0.z, r3.w, r0.z + add r0.z, r4.x, r0.z + add r0.z, r4.y, r0.z + add r0.z, r1.x, r0.z mul r0.z, r0.z, l(0.083333) else mov r0.z, l(1.000000) @@ -268,21 +268,21 @@ ret const BYTE g_meshPS[] = { - 68, 88, 66, 67, 162, 143, - 63, 83, 112, 221, 166, 253, - 12, 109, 97, 84, 15, 129, - 226, 222, 1, 0, 0, 0, - 8, 30, 0, 0, 5, 0, + 68, 88, 66, 67, 72, 67, + 173, 99, 108, 111, 205, 171, + 203, 27, 188, 233, 104, 15, + 95, 167, 1, 0, 0, 0, + 40, 30, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, - 116, 4, 0, 0, 152, 5, - 0, 0, 204, 5, 0, 0, - 108, 29, 0, 0, 82, 68, - 69, 70, 56, 4, 0, 0, + 148, 4, 0, 0, 184, 5, + 0, 0, 236, 5, 0, 0, + 140, 29, 0, 0, 82, 68, + 69, 70, 88, 4, 0, 0, 1, 0, 0, 0, 196, 0, 0, 0, 3, 0, 0, 0, 60, 0, 0, 0, 0, 5, 255, 255, 0, 1, 0, 0, - 4, 4, 0, 0, 82, 68, + 36, 4, 0, 0, 82, 68, 49, 49, 60, 0, 0, 0, 24, 0, 0, 0, 32, 0, 0, 0, 40, 0, 0, 0, @@ -317,7 +317,7 @@ const BYTE g_meshPS[] = 0, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 64, 2, 0, 0, 2, 0, - 0, 0, 224, 3, 0, 0, + 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, @@ -326,7 +326,7 @@ const BYTE g_meshPS[] = 115, 104, 83, 104, 97, 100, 101, 114, 67, 111, 110, 115, 116, 0, 109, 111, 100, 101, - 108, 118, 105, 101, 119, 112, + 108, 86, 105, 101, 119, 80, 114, 111, 106, 101, 99, 116, 105, 111, 110, 0, 102, 108, 111, 97, 116, 52, 120, 52, @@ -337,7 +337,7 @@ const BYTE g_meshPS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 1, 0, 0, 109, 111, - 100, 101, 108, 118, 105, 101, + 100, 101, 108, 86, 105, 101, 119, 0, 111, 98, 106, 101, 99, 116, 84, 114, 97, 110, 115, 102, 111, 114, 109, 0, @@ -399,254 +399,212 @@ const BYTE g_meshPS[] = 0, 0, 0, 0, 164, 2, 0, 0, 116, 101, 120, 0, 99, 111, 108, 111, 114, 65, - 114, 114, 97, 121, 0, 95, - 112, 97, 100, 50, 0, 171, - 171, 171, 28, 1, 0, 0, - 60, 1, 0, 0, 0, 0, - 0, 0, 96, 1, 0, 0, - 60, 1, 0, 0, 64, 0, - 0, 0, 106, 1, 0, 0, - 60, 1, 0, 0, 128, 0, - 0, 0, 122, 1, 0, 0, - 60, 1, 0, 0, 192, 0, - 0, 0, 137, 1, 0, 0, - 156, 1, 0, 0, 0, 1, - 0, 0, 192, 1, 0, 0, - 156, 1, 0, 0, 16, 1, - 0, 0, 201, 1, 0, 0, - 156, 1, 0, 0, 32, 1, - 0, 0, 207, 1, 0, 0, - 156, 1, 0, 0, 48, 1, - 0, 0, 222, 1, 0, 0, - 236, 1, 0, 0, 64, 1, - 0, 0, 16, 2, 0, 0, - 32, 2, 0, 0, 0, 2, - 0, 0, 68, 2, 0, 0, - 80, 2, 0, 0, 12, 2, - 0, 0, 116, 2, 0, 0, - 32, 2, 0, 0, 16, 2, - 0, 0, 125, 2, 0, 0, - 80, 2, 0, 0, 28, 2, - 0, 0, 131, 2, 0, 0, - 80, 2, 0, 0, 32, 2, - 0, 0, 136, 2, 0, 0, - 80, 2, 0, 0, 36, 2, - 0, 0, 143, 2, 0, 0, - 80, 2, 0, 0, 40, 2, - 0, 0, 151, 2, 0, 0, - 80, 2, 0, 0, 44, 2, - 0, 0, 159, 2, 0, 0, - 168, 2, 0, 0, 48, 2, - 0, 0, 204, 2, 0, 0, - 168, 2, 0, 0, 52, 2, - 0, 0, 208, 2, 0, 0, - 168, 2, 0, 0, 56, 2, - 0, 0, 219, 2, 0, 0, - 168, 2, 0, 0, 60, 2, - 0, 0, 5, 0, 0, 0, - 1, 0, 144, 0, 0, 0, - 21, 0, 228, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 12, 1, - 0, 0, 77, 105, 99, 114, - 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, - 100, 101, 114, 32, 67, 111, - 109, 112, 105, 108, 101, 114, - 32, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, - 51, 56, 52, 0, 171, 171, - 73, 83, 71, 78, 28, 1, - 0, 0, 10, 0, 0, 0, - 8, 0, 0, 0, 248, 0, + 114, 114, 97, 121, 0, 105, + 110, 99, 114, 101, 97, 115, + 101, 71, 102, 120, 76, 111, + 97, 100, 70, 111, 114, 65, + 115, 121, 110, 99, 67, 111, + 109, 112, 117, 116, 101, 84, + 101, 115, 116, 105, 110, 103, + 0, 171, 171, 171, 28, 1, + 0, 0, 60, 1, 0, 0, + 0, 0, 0, 0, 96, 1, + 0, 0, 60, 1, 0, 0, + 64, 0, 0, 0, 106, 1, + 0, 0, 60, 1, 0, 0, + 128, 0, 0, 0, 122, 1, + 0, 0, 60, 1, 0, 0, + 192, 0, 0, 0, 137, 1, + 0, 0, 156, 1, 0, 0, + 0, 1, 0, 0, 192, 1, + 0, 0, 156, 1, 0, 0, + 16, 1, 0, 0, 201, 1, + 0, 0, 156, 1, 0, 0, + 32, 1, 0, 0, 207, 1, + 0, 0, 156, 1, 0, 0, + 48, 1, 0, 0, 222, 1, + 0, 0, 236, 1, 0, 0, + 64, 1, 0, 0, 16, 2, + 0, 0, 32, 2, 0, 0, + 0, 2, 0, 0, 68, 2, + 0, 0, 80, 2, 0, 0, + 12, 2, 0, 0, 116, 2, + 0, 0, 32, 2, 0, 0, + 16, 2, 0, 0, 125, 2, + 0, 0, 80, 2, 0, 0, + 28, 2, 0, 0, 131, 2, + 0, 0, 80, 2, 0, 0, + 32, 2, 0, 0, 136, 2, + 0, 0, 80, 2, 0, 0, + 36, 2, 0, 0, 143, 2, + 0, 0, 80, 2, 0, 0, + 40, 2, 0, 0, 151, 2, + 0, 0, 80, 2, 0, 0, + 44, 2, 0, 0, 159, 2, + 0, 0, 168, 2, 0, 0, + 48, 2, 0, 0, 204, 2, + 0, 0, 168, 2, 0, 0, + 52, 2, 0, 0, 208, 2, + 0, 0, 168, 2, 0, 0, + 56, 2, 0, 0, 219, 2, + 0, 0, 168, 2, 0, 0, + 60, 2, 0, 0, 5, 0, + 0, 0, 1, 0, 144, 0, + 0, 0, 21, 0, 4, 3, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 12, 1, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, + 171, 171, 73, 83, 71, 78, + 28, 1, 0, 0, 10, 0, + 0, 0, 8, 0, 0, 0, + 248, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 7, 7, 0, 0, + 4, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 4, 1, + 3, 0, 0, 0, 2, 0, + 0, 0, 15, 15, 0, 0, + 4, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 15, 7, 0, 0, 4, 1, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, - 15, 15, 0, 0, 4, 1, - 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, - 15, 0, 0, 0, 4, 1, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 4, 0, 0, 0, - 15, 7, 0, 0, 4, 1, - 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 5, 0, 0, 0, - 15, 7, 0, 0, 4, 1, - 0, 0, 5, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 6, 0, 0, 0, - 15, 0, 0, 0, 4, 1, - 0, 0, 6, 0, 0, 0, - 0, 0, 0, 0, 3, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 7, 0, 0, 0, - 15, 7, 0, 0, 4, 1, - 0, 0, 7, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 8, 0, 0, 0, - 15, 4, 0, 0, 13, 1, + 4, 1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, - 9, 0, 0, 0, 1, 0, - 0, 0, 9, 0, 0, 0, - 1, 1, 0, 0, 83, 86, - 95, 80, 79, 83, 73, 84, - 73, 79, 78, 0, 84, 69, - 88, 67, 79, 79, 82, 68, - 0, 83, 86, 95, 73, 115, - 70, 114, 111, 110, 116, 70, - 97, 99, 101, 0, 79, 83, - 71, 78, 44, 0, 0, 0, - 1, 0, 0, 0, 8, 0, - 0, 0, 32, 0, 0, 0, + 3, 0, 0, 0, 4, 0, + 0, 0, 7, 7, 0, 0, + 4, 1, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 5, 0, + 0, 0, 15, 7, 0, 0, + 4, 1, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 83, 86, 95, 84, - 65, 82, 71, 69, 84, 0, - 171, 171, 83, 72, 69, 88, - 152, 23, 0, 0, 80, 0, - 0, 0, 230, 5, 0, 0, - 106, 8, 0, 1, 89, 0, - 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 36, 0, - 0, 0, 90, 8, 0, 3, - 0, 96, 16, 0, 0, 0, - 0, 0, 88, 24, 0, 4, - 0, 112, 16, 0, 0, 0, - 0, 0, 85, 85, 0, 0, - 98, 16, 0, 3, 114, 16, - 16, 0, 1, 0, 0, 0, - 98, 16, 0, 3, 242, 16, - 16, 0, 2, 0, 0, 0, - 98, 16, 0, 3, 114, 16, - 16, 0, 4, 0, 0, 0, - 98, 16, 0, 3, 114, 16, - 16, 0, 5, 0, 0, 0, - 98, 16, 0, 3, 114, 16, - 16, 0, 7, 0, 0, 0, - 98, 16, 0, 3, 66, 16, - 16, 0, 8, 0, 0, 0, - 99, 8, 0, 4, 18, 16, - 16, 0, 9, 0, 0, 0, - 9, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 104, 0, - 0, 2, 6, 0, 0, 0, - 14, 0, 0, 7, 114, 0, - 16, 0, 0, 0, 0, 0, - 70, 18, 16, 0, 2, 0, - 0, 0, 246, 31, 16, 0, - 2, 0, 0, 0, 50, 0, - 0, 15, 114, 0, 16, 0, - 1, 0, 0, 0, 70, 2, + 4, 1, 0, 0, 6, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 7, 0, + 0, 0, 15, 7, 0, 0, + 4, 1, 0, 0, 7, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 8, 0, + 0, 0, 15, 4, 0, 0, + 13, 1, 0, 0, 0, 0, + 0, 0, 9, 0, 0, 0, + 1, 0, 0, 0, 9, 0, + 0, 0, 1, 1, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 73, 115, 70, 114, 111, 110, + 116, 70, 97, 99, 101, 0, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 65, 82, 71, 69, + 84, 0, 171, 171, 83, 72, + 69, 88, 152, 23, 0, 0, + 80, 0, 0, 0, 230, 5, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 36, 0, 0, 0, 90, 8, + 0, 3, 0, 96, 16, 0, + 0, 0, 0, 0, 88, 24, + 0, 4, 0, 112, 16, 0, + 0, 0, 0, 0, 85, 85, + 0, 0, 98, 16, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 98, 16, 0, 3, + 242, 16, 16, 0, 2, 0, + 0, 0, 98, 16, 0, 3, + 114, 16, 16, 0, 4, 0, + 0, 0, 98, 16, 0, 3, + 114, 16, 16, 0, 5, 0, + 0, 0, 98, 16, 0, 3, + 114, 16, 16, 0, 7, 0, + 0, 0, 98, 16, 0, 3, + 66, 16, 16, 0, 8, 0, + 0, 0, 99, 8, 0, 4, + 18, 16, 16, 0, 9, 0, + 0, 0, 9, 0, 0, 0, + 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 63, 0, 0, 0, 63, - 0, 0, 128, 63, 0, 0, + 104, 0, 0, 2, 6, 0, + 0, 0, 14, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 246, 31, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 15, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 63, 0, 0, - 0, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 49, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 1, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 0, 49, 0, 0, 7, - 130, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 10, 0, - 16, 0, 1, 0, 0, 0, - 60, 0, 0, 7, 66, 0, + 0, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 63, + 0, 0, 0, 63, 0, 0, + 0, 0, 0, 0, 0, 0, + 49, 0, 0, 7, 66, 0, 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 0, 0, 0, 0, 31, 0, - 0, 3, 42, 0, 16, 0, - 0, 0, 0, 0, 49, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 1, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 0, 49, 0, 0, 7, - 130, 0, 16, 0, 0, 0, + 10, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 26, 0, - 16, 0, 1, 0, 0, 0, - 60, 0, 0, 7, 66, 0, + 0, 0, 0, 0, 49, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 10, 0, 16, 0, 1, 0, + 0, 0, 60, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 0, 0, 0, 0, 31, 0, - 0, 3, 42, 0, 16, 0, + 0, 0, 0, 9, 130, 0, + 16, 0, 0, 0, 0, 0, + 26, 128, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 0, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 20, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 2, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, 20, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, - 16, 0, 2, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 8, 130, 0, 16, 0, - 1, 0, 0, 0, 26, 0, - 16, 128, 65, 0, 0, 0, - 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, - 0, 0, 0, 7, 194, 0, - 16, 0, 0, 0, 0, 0, - 6, 12, 16, 0, 1, 0, - 0, 0, 6, 4, 16, 0, - 2, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 66, 0, - 16, 0, 0, 0, 0, 0, - 230, 10, 16, 0, 0, 0, - 0, 0, 6, 112, 16, 0, - 0, 0, 0, 0, 0, 96, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 21, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 21, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 18, 0, + 16, 0, 2, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 20, 0, 0, 0, 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, + 3, 59, 56, 0, 0, 7, + 34, 0, 16, 0, 2, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 0, 0, 0, 8, 130, 0, + 16, 0, 1, 0, 0, 0, + 26, 0, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 0, 0, 0, 7, 50, 0, 16, 0, 2, 0, 0, 0, 198, 0, 16, 0, 1, 0, 0, 0, 70, 0, 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, + 70, 0, 0, 141, 194, 0, 0, 128, 67, 85, 21, 0, 130, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, @@ -655,891 +613,938 @@ const BYTE g_meshPS[] = 0, 96, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 22, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 22, 0, + 0, 9, 18, 0, 16, 0, + 2, 0, 0, 0, 26, 128, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 21, 0, 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 8, 18, 0, 16, 0, + 3, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 56, 0, 0, 7, 34, 0, + 16, 0, 3, 0, 0, 0, + 10, 0, 16, 0, 2, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 0, 0, + 0, 7, 50, 0, 16, 0, + 2, 0, 0, 0, 198, 0, + 16, 0, 1, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 70, 0, 0, 141, + 194, 0, 0, 128, 67, 85, + 21, 0, 18, 0, 16, 0, + 2, 0, 0, 0, 70, 0, + 16, 0, 2, 0, 0, 0, + 6, 112, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 9, 34, 0, + 16, 0, 2, 0, 0, 0, + 26, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 22, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 8, 18, 0, + 16, 0, 3, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, + 3, 59, 56, 0, 0, 7, + 34, 0, 16, 0, 3, 0, + 0, 0, 26, 0, 16, 0, + 2, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 0, 0, 0, 7, 98, 0, 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, + 6, 3, 16, 0, 1, 0, + 0, 0, 6, 1, 16, 0, + 3, 0, 0, 0, 70, 0, + 0, 141, 194, 0, 0, 128, + 67, 85, 21, 0, 34, 0, + 16, 0, 2, 0, 0, 0, + 150, 5, 16, 0, 2, 0, + 0, 0, 6, 112, 16, 0, + 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, + 42, 0, 16, 0, 1, 0, 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, + 66, 0, 16, 0, 2, 0, 0, 0, 26, 128, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, + 18, 0, 16, 0, 3, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 23, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 56, 0, 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 42, 0, + 16, 0, 2, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, + 194, 0, 16, 0, 2, 0, + 0, 0, 6, 12, 16, 0, + 1, 0, 0, 0, 6, 4, + 16, 0, 3, 0, 0, 0, + 70, 0, 0, 141, 194, 0, 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, + 66, 0, 16, 0, 2, 0, + 0, 0, 230, 10, 16, 0, 2, 0, 0, 0, 6, 112, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 24, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, + 0, 9, 130, 0, 16, 0, + 2, 0, 0, 0, 26, 128, + 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 25, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 25, 0, + 0, 0, 128, 63, 56, 0, + 0, 8, 18, 0, 16, 0, + 3, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 56, 0, 0, 7, 34, 0, + 16, 0, 3, 0, 0, 0, + 58, 0, 16, 0, 2, 0, 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, + 111, 18, 3, 59, 0, 0, + 0, 7, 50, 0, 16, 0, + 3, 0, 0, 0, 198, 0, + 16, 0, 1, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 70, 0, 0, 141, + 194, 0, 0, 128, 67, 85, + 21, 0, 130, 0, 16, 0, + 2, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, + 6, 112, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 9, 18, 0, + 16, 0, 3, 0, 0, 0, + 26, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 25, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 8, 18, 0, + 16, 0, 4, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, + 3, 59, 56, 0, 0, 7, + 34, 0, 16, 0, 4, 0, + 0, 0, 10, 0, 16, 0, + 3, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 0, 0, 0, 7, 50, 0, + 16, 0, 3, 0, 0, 0, + 198, 0, 16, 0, 1, 0, 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, + 4, 0, 0, 0, 70, 0, + 0, 141, 194, 0, 0, 128, + 67, 85, 21, 0, 18, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 6, 112, 16, 0, + 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, + 42, 0, 16, 0, 1, 0, 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, + 34, 0, 16, 0, 3, 0, 0, 0, 26, 128, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, + 18, 0, 16, 0, 4, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 26, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 56, 0, 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 26, 0, + 16, 0, 3, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, + 98, 0, 16, 0, 3, 0, + 0, 0, 6, 3, 16, 0, + 1, 0, 0, 0, 6, 1, + 16, 0, 4, 0, 0, 0, + 70, 0, 0, 141, 194, 0, 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, + 34, 0, 16, 0, 3, 0, + 0, 0, 150, 5, 16, 0, + 3, 0, 0, 0, 6, 112, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 27, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, + 0, 9, 66, 0, 16, 0, + 3, 0, 0, 0, 26, 128, + 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 8, 18, 0, 16, 0, + 4, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 27, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 56, 0, 0, 7, 34, 0, + 16, 0, 4, 0, 0, 0, + 42, 0, 16, 0, 3, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 0, 0, + 0, 7, 194, 0, 16, 0, + 3, 0, 0, 0, 6, 12, + 16, 0, 1, 0, 0, 0, + 6, 4, 16, 0, 4, 0, + 0, 0, 70, 0, 0, 141, + 194, 0, 0, 128, 67, 85, + 21, 0, 66, 0, 16, 0, + 3, 0, 0, 0, 230, 10, + 16, 0, 3, 0, 0, 0, + 6, 112, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 9, 130, 0, + 16, 0, 3, 0, 0, 0, + 26, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 8, 18, 0, + 16, 0, 4, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 28, 0, 0, 0, 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, + 3, 59, 56, 0, 0, 7, + 34, 0, 16, 0, 4, 0, + 0, 0, 58, 0, 16, 0, + 3, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 0, 0, 0, 7, 50, 0, + 16, 0, 4, 0, 0, 0, + 198, 0, 16, 0, 1, 0, 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, + 4, 0, 0, 0, 70, 0, + 0, 141, 194, 0, 0, 128, + 67, 85, 21, 0, 130, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 4, 0, + 0, 0, 6, 112, 16, 0, + 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, + 42, 0, 16, 0, 1, 0, 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, + 18, 0, 16, 0, 4, 0, 0, 0, 26, 128, 32, 128, 65, 0, 0, 0, 0, 0, - 0, 0, 28, 0, 0, 0, + 0, 0, 29, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, + 18, 0, 16, 0, 5, 0, 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 28, 0, + 0, 0, 0, 0, 29, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 56, 0, 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, + 5, 0, 0, 0, 10, 0, + 16, 0, 4, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, + 50, 0, 16, 0, 4, 0, 0, 0, 198, 0, 16, 0, 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, + 16, 0, 5, 0, 0, 0, + 70, 0, 0, 141, 194, 0, 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, + 18, 0, 16, 0, 4, 0, 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, + 4, 0, 0, 0, 6, 112, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, + 0, 9, 34, 0, 16, 0, + 4, 0, 0, 0, 26, 128, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 30, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 8, 18, 0, 16, 0, + 5, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 30, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 56, 0, 0, 7, 34, 0, + 16, 0, 5, 0, 0, 0, + 26, 0, 16, 0, 4, 0, + 0, 0, 1, 64, 0, 0, + 111, 18, 3, 59, 0, 0, + 0, 7, 98, 0, 16, 0, + 4, 0, 0, 0, 6, 3, + 16, 0, 1, 0, 0, 0, + 6, 1, 16, 0, 5, 0, + 0, 0, 70, 0, 0, 141, + 194, 0, 0, 128, 67, 85, + 21, 0, 34, 0, 16, 0, + 4, 0, 0, 0, 150, 5, + 16, 0, 4, 0, 0, 0, + 6, 112, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 9, 66, 0, + 16, 0, 4, 0, 0, 0, + 26, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 31, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 8, 18, 0, + 16, 0, 5, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 31, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 56, 0, 0, 7, + 34, 0, 16, 0, 5, 0, + 0, 0, 42, 0, 16, 0, + 4, 0, 0, 0, 1, 64, + 0, 0, 111, 18, 3, 59, + 0, 0, 0, 7, 146, 0, + 16, 0, 1, 0, 0, 0, + 6, 12, 16, 0, 1, 0, + 0, 0, 6, 4, 16, 0, + 5, 0, 0, 0, 70, 0, + 0, 141, 194, 0, 0, 128, + 67, 85, 21, 0, 18, 0, + 16, 0, 1, 0, 0, 0, + 198, 0, 16, 0, 1, 0, + 0, 0, 6, 112, 16, 0, + 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, + 42, 0, 16, 0, 1, 0, + 0, 0, 31, 0, 0, 3, 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 29, 0, 0, 0, + 0, 0, 49, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 49, 0, 0, 7, 34, 0, + 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 29, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, + 128, 63, 26, 0, 16, 0, + 1, 0, 0, 0, 60, 0, + 0, 7, 66, 0, 16, 0, + 0, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, + 26, 0, 16, 0, 1, 0, + 0, 0, 31, 0, 0, 3, + 42, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 10, 0, 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, + 0, 0, 0, 7, 66, 0, 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, + 26, 0, 16, 0, 2, 0, 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 2, 0, 0, 0, 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 30, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 30, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, + 0, 0, 0, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 2, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, + 0, 0, 0, 7, 66, 0, 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, + 10, 0, 16, 0, 3, 0, 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 3, 0, 0, 0, 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 31, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 31, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, + 0, 0, 0, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 3, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 1, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 1, 0, 0, 0, 6, 112, + 0, 0, 0, 7, 66, 0, 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, + 58, 0, 16, 0, 3, 0, 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 4, 0, 0, 0, 42, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, + 0, 0, 0, 0, 0, 7, 66, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 4, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 66, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 171, 170, 170, 61, + 0, 0, 0, 0, 56, 0, + 0, 7, 66, 0, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 171, 170, + 170, 61, 18, 0, 0, 1, + 54, 0, 0, 5, 66, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 21, 0, 0, 1, 18, 0, 0, 1, 54, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, - 21, 0, 0, 1, 18, 0, - 0, 1, 54, 0, 0, 5, - 66, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 21, 0, - 0, 1, 15, 0, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, + 21, 0, 0, 1, 15, 0, + 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, - 0, 0, 0, 10, 34, 0, + 70, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 10, + 34, 0, 16, 0, 0, 0, + 0, 0, 58, 128, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 34, 0, 0, 0, + 42, 128, 32, 0, 0, 0, + 0, 0, 34, 0, 0, 0, + 0, 0, 0, 9, 18, 0, 16, 0, 0, 0, 0, 0, - 58, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 42, 128, - 32, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 0, 0, - 0, 9, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 58, 128, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 34, 0, 0, 0, + 14, 0, 0, 10, 34, 0, 16, 0, 0, 0, 0, 0, - 58, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 14, 0, - 0, 10, 34, 0, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 63, 0, 0, + 2, 64, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, - 26, 0, 16, 0, 0, 0, - 0, 0, 56, 32, 0, 7, + 0, 0, 128, 63, 0, 0, + 128, 63, 26, 0, 16, 0, + 0, 0, 0, 0, 56, 32, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 34, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 192, + 1, 64, 0, 0, 0, 0, + 64, 64, 56, 0, 0, 7, 18, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, + 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, - 50, 0, 0, 9, 34, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 192, 1, 64, - 0, 0, 0, 0, 64, 64, 56, 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 52, 0, + 0, 10, 82, 0, 16, 0, + 0, 0, 0, 0, 6, 2, 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 52, 0, 0, 10, - 82, 0, 16, 0, 0, 0, - 0, 0, 6, 2, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 205, 204, 76, 61, - 0, 0, 0, 0, 0, 0, - 0, 63, 0, 0, 0, 0, - 55, 0, 0, 10, 114, 0, + 2, 64, 0, 0, 205, 204, + 76, 61, 0, 0, 0, 0, + 0, 0, 0, 63, 0, 0, + 0, 0, 55, 0, 0, 10, + 114, 0, 16, 0, 1, 0, + 0, 0, 6, 16, 16, 0, + 9, 0, 0, 0, 70, 18, 16, 0, 1, 0, 0, 0, + 70, 18, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 55, 0, 0, 9, 114, 0, + 16, 0, 2, 0, 0, 0, 6, 16, 16, 0, 9, 0, 0, 0, 70, 18, 16, 0, - 1, 0, 0, 0, 70, 18, - 16, 128, 65, 0, 0, 0, - 1, 0, 0, 0, 55, 0, - 0, 9, 114, 0, 16, 0, - 2, 0, 0, 0, 6, 16, - 16, 0, 9, 0, 0, 0, - 70, 18, 16, 0, 5, 0, - 0, 0, 70, 18, 16, 0, - 7, 0, 0, 0, 39, 0, - 0, 8, 34, 0, 16, 0, - 0, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 35, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 49, 0, 0, 7, 130, 0, + 5, 0, 0, 0, 70, 18, + 16, 0, 7, 0, 0, 0, + 39, 0, 0, 8, 34, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 82, 184, - 126, 63, 26, 0, 16, 0, - 1, 0, 0, 0, 1, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 35, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 49, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 82, 184, 126, 63, 26, 0, + 16, 0, 1, 0, 0, 0, + 1, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 31, 0, 4, 3, 58, 0, 16, 0, 0, 0, - 0, 0, 122, 0, 0, 5, - 50, 0, 16, 0, 3, 0, - 0, 0, 134, 16, 16, 0, - 4, 0, 0, 0, 124, 0, - 0, 5, 194, 0, 16, 0, - 3, 0, 0, 0, 6, 24, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 31, 0, + 4, 3, 58, 0, 16, 0, + 0, 0, 0, 0, 122, 0, + 0, 5, 50, 0, 16, 0, + 3, 0, 0, 0, 134, 16, 16, 0, 4, 0, 0, 0, - 52, 0, 0, 9, 50, 0, + 124, 0, 0, 5, 194, 0, 16, 0, 3, 0, 0, 0, - 230, 10, 16, 128, 129, 0, - 0, 0, 3, 0, 0, 0, - 70, 0, 16, 128, 129, 0, - 0, 0, 3, 0, 0, 0, - 52, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 3, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 50, 0, - 0, 13, 50, 0, 16, 0, - 3, 0, 0, 0, 246, 15, - 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, + 6, 24, 16, 0, 4, 0, + 0, 0, 52, 0, 0, 9, + 50, 0, 16, 0, 3, 0, + 0, 0, 230, 10, 16, 128, + 129, 0, 0, 0, 3, 0, + 0, 0, 70, 0, 16, 128, + 129, 0, 0, 0, 3, 0, + 0, 0, 52, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 3, 0, 0, 0, 10, 0, + 16, 0, 3, 0, 0, 0, + 50, 0, 0, 13, 50, 0, + 16, 0, 3, 0, 0, 0, + 246, 15, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, - 134, 16, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 12, - 194, 0, 16, 0, 3, 0, - 0, 0, 246, 15, 16, 0, - 0, 0, 0, 0, 2, 64, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, + 0, 0, 134, 16, 16, 0, + 4, 0, 0, 0, 50, 0, + 0, 12, 194, 0, 16, 0, + 3, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 63, 0, 0, + 0, 63, 6, 24, 16, 0, + 4, 0, 0, 0, 56, 0, + 0, 10, 50, 0, 16, 0, + 4, 0, 0, 0, 230, 10, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, - 6, 24, 16, 0, 4, 0, - 0, 0, 56, 0, 0, 10, + 0, 0, 0, 0, 0, 0, + 0, 0, 65, 0, 0, 5, 50, 0, 16, 0, 4, 0, - 0, 0, 230, 10, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 50, 0, + 0, 13, 194, 0, 16, 0, + 3, 0, 0, 0, 166, 14, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 65, 0, 0, 5, 50, 0, - 16, 0, 4, 0, 0, 0, - 70, 0, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 13, + 0, 0, 0, 63, 0, 0, + 0, 63, 6, 4, 16, 128, + 65, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 10, 194, 0, 16, 0, 3, 0, 0, 0, 166, 14, 16, 0, 3, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 63, 0, 0, 0, 63, - 6, 4, 16, 128, 65, 0, - 0, 0, 4, 0, 0, 0, - 0, 0, 0, 10, 194, 0, + 0, 191, 0, 0, 0, 191, + 52, 0, 0, 10, 194, 0, 16, 0, 3, 0, 0, 0, 166, 14, 16, 0, 3, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 191, - 0, 0, 0, 191, 52, 0, - 0, 10, 194, 0, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 194, 0, 16, 0, 3, 0, 0, 0, 166, 14, 16, 0, 3, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 64, 0, 0, + 0, 64, 6, 4, 16, 0, + 4, 0, 0, 0, 56, 0, + 0, 10, 50, 0, 16, 0, + 4, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, - 0, 0, 50, 0, 0, 12, - 194, 0, 16, 0, 3, 0, - 0, 0, 166, 14, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 64, 0, 0, 0, 64, - 6, 4, 16, 0, 4, 0, - 0, 0, 56, 0, 0, 10, + 0, 0, 65, 0, 0, 5, 50, 0, 16, 0, 4, 0, 0, 0, 70, 0, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, + 4, 0, 0, 0, 50, 0, + 0, 13, 50, 0, 16, 0, + 3, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, - 65, 0, 0, 5, 50, 0, - 16, 0, 4, 0, 0, 0, - 70, 0, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 13, + 0, 0, 70, 0, 16, 128, + 65, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 10, 50, 0, 16, 0, 3, 0, 0, 0, 70, 0, 16, 0, 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, + 0, 0, 0, 0, 0, 191, + 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 0, - 70, 0, 16, 128, 65, 0, - 0, 0, 4, 0, 0, 0, - 0, 0, 0, 10, 50, 0, + 52, 0, 0, 10, 50, 0, 16, 0, 3, 0, 0, 0, 70, 0, 16, 0, 3, 0, 0, 0, 2, 64, 0, 0, - 0, 0, 0, 191, 0, 0, - 0, 191, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 0, - 0, 10, 50, 0, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 50, 0, 16, 0, 3, 0, 0, 0, 70, 0, 16, 0, 3, 0, 0, 0, 2, 64, 0, 0, 0, 0, + 0, 64, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 50, 0, 0, 12, - 50, 0, 16, 0, 3, 0, 0, 0, 70, 0, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 64, - 0, 0, 0, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 70, 0, 16, 0, 4, 0, - 0, 0, 0, 0, 0, 8, - 50, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 128, - 65, 0, 0, 0, 3, 0, - 0, 0, 230, 10, 16, 0, - 3, 0, 0, 0, 14, 0, - 0, 7, 50, 0, 16, 0, + 4, 0, 0, 0, 0, 0, + 0, 8, 50, 0, 16, 0, 3, 0, 0, 0, 70, 0, + 16, 128, 65, 0, 0, 0, + 3, 0, 0, 0, 230, 10, 16, 0, 3, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 11, - 194, 0, 16, 0, 3, 0, - 0, 0, 6, 4, 16, 128, - 65, 0, 0, 0, 3, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 63, 56, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 3, 0, - 0, 0, 50, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 26, 0, + 14, 0, 0, 7, 50, 0, 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 10, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 62, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 7, 114, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 11, 194, 0, 16, 0, + 3, 0, 0, 0, 6, 4, + 16, 128, 65, 0, 0, 0, + 3, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 56, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 3, 0, + 0, 0, 42, 0, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 9, 130, 0, 16, 0, + 0, 0, 0, 0, 10, 0, 16, 0, 3, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 18, 0, - 0, 1, 49, 0, 0, 8, - 130, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 82, 184, 126, 63, 42, 0, - 16, 128, 129, 0, 0, 0, - 1, 0, 0, 0, 1, 0, - 0, 7, 34, 0, 16, 0, + 26, 0, 16, 0, 3, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 10, 130, 0, 16, 0, 0, 0, 0, 0, 58, 0, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 62, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 7, + 114, 0, 16, 0, 3, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 18, 0, 0, 1, 49, 0, + 0, 8, 130, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 82, 184, 126, 63, + 42, 0, 16, 128, 129, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 7, 34, 0, 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 122, 0, 0, 5, + 58, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 122, 0, + 0, 5, 50, 0, 16, 0, + 4, 0, 0, 0, 22, 21, + 16, 0, 4, 0, 0, 0, + 124, 0, 0, 5, 194, 0, + 16, 0, 4, 0, 0, 0, + 86, 17, 16, 0, 4, 0, + 0, 0, 52, 0, 0, 9, 50, 0, 16, 0, 4, 0, - 0, 0, 22, 21, 16, 0, - 4, 0, 0, 0, 124, 0, - 0, 5, 194, 0, 16, 0, - 4, 0, 0, 0, 86, 17, + 0, 0, 230, 10, 16, 128, + 129, 0, 0, 0, 4, 0, + 0, 0, 70, 0, 16, 128, + 129, 0, 0, 0, 4, 0, + 0, 0, 52, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 4, 0, 0, 0, 10, 0, 16, 0, 4, 0, 0, 0, - 52, 0, 0, 9, 50, 0, + 50, 0, 0, 13, 50, 0, 16, 0, 4, 0, 0, 0, - 230, 10, 16, 128, 129, 0, - 0, 0, 4, 0, 0, 0, - 70, 0, 16, 128, 129, 0, - 0, 0, 4, 0, 0, 0, - 52, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 4, 0, - 0, 0, 10, 0, 16, 0, - 4, 0, 0, 0, 50, 0, - 0, 13, 50, 0, 16, 0, - 4, 0, 0, 0, 246, 15, - 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, + 246, 15, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, - 22, 21, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 12, - 194, 0, 16, 0, 4, 0, - 0, 0, 246, 15, 16, 0, - 0, 0, 0, 0, 2, 64, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, + 0, 0, 22, 21, 16, 0, + 4, 0, 0, 0, 50, 0, + 0, 12, 194, 0, 16, 0, + 4, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 63, 0, 0, + 0, 63, 86, 17, 16, 0, + 4, 0, 0, 0, 56, 0, + 0, 10, 50, 0, 16, 0, + 5, 0, 0, 0, 230, 10, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, - 86, 17, 16, 0, 4, 0, - 0, 0, 56, 0, 0, 10, + 0, 0, 0, 0, 0, 0, + 0, 0, 65, 0, 0, 5, 50, 0, 16, 0, 5, 0, - 0, 0, 230, 10, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, + 0, 0, 70, 0, 16, 0, + 5, 0, 0, 0, 50, 0, + 0, 13, 194, 0, 16, 0, + 4, 0, 0, 0, 166, 14, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 65, 0, 0, 5, 50, 0, - 16, 0, 5, 0, 0, 0, - 70, 0, 16, 0, 5, 0, - 0, 0, 50, 0, 0, 13, + 0, 0, 0, 63, 0, 0, + 0, 63, 6, 4, 16, 128, + 65, 0, 0, 0, 5, 0, + 0, 0, 0, 0, 0, 10, 194, 0, 16, 0, 4, 0, 0, 0, 166, 14, 16, 0, 4, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 63, 0, 0, 0, 63, - 6, 4, 16, 128, 65, 0, - 0, 0, 5, 0, 0, 0, - 0, 0, 0, 10, 194, 0, + 0, 191, 0, 0, 0, 191, + 52, 0, 0, 10, 194, 0, 16, 0, 4, 0, 0, 0, 166, 14, 16, 0, 4, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 191, - 0, 0, 0, 191, 52, 0, - 0, 10, 194, 0, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 194, 0, 16, 0, 4, 0, 0, 0, 166, 14, 16, 0, 4, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 64, 0, 0, + 0, 64, 6, 4, 16, 0, + 5, 0, 0, 0, 56, 0, + 0, 10, 50, 0, 16, 0, + 5, 0, 0, 0, 70, 0, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, - 0, 0, 50, 0, 0, 12, - 194, 0, 16, 0, 4, 0, - 0, 0, 166, 14, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 64, 0, 0, 0, 64, - 6, 4, 16, 0, 5, 0, - 0, 0, 56, 0, 0, 10, + 0, 0, 65, 0, 0, 5, 50, 0, 16, 0, 5, 0, 0, 0, 70, 0, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, + 5, 0, 0, 0, 50, 0, + 0, 13, 50, 0, 16, 0, + 4, 0, 0, 0, 70, 0, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, - 65, 0, 0, 5, 50, 0, - 16, 0, 5, 0, 0, 0, - 70, 0, 16, 0, 5, 0, - 0, 0, 50, 0, 0, 13, + 0, 0, 70, 0, 16, 128, + 65, 0, 0, 0, 5, 0, + 0, 0, 0, 0, 0, 10, 50, 0, 16, 0, 4, 0, 0, 0, 70, 0, 16, 0, 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, + 0, 0, 0, 0, 0, 191, + 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 0, - 70, 0, 16, 128, 65, 0, - 0, 0, 5, 0, 0, 0, - 0, 0, 0, 10, 50, 0, + 52, 0, 0, 10, 50, 0, 16, 0, 4, 0, 0, 0, 70, 0, 16, 0, 4, 0, 0, 0, 2, 64, 0, 0, - 0, 0, 0, 191, 0, 0, - 0, 191, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 0, - 0, 10, 50, 0, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 50, 0, 16, 0, 4, 0, 0, 0, 70, 0, 16, 0, 4, 0, 0, 0, 2, 64, 0, 0, 0, 0, + 0, 64, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 50, 0, 0, 12, - 50, 0, 16, 0, 4, 0, 0, 0, 70, 0, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 64, - 0, 0, 0, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 70, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 8, - 50, 0, 16, 0, 4, 0, - 0, 0, 70, 0, 16, 128, - 65, 0, 0, 0, 4, 0, - 0, 0, 230, 10, 16, 0, - 4, 0, 0, 0, 14, 0, - 0, 7, 50, 0, 16, 0, + 5, 0, 0, 0, 0, 0, + 0, 8, 50, 0, 16, 0, 4, 0, 0, 0, 70, 0, + 16, 128, 65, 0, 0, 0, + 4, 0, 0, 0, 230, 10, 16, 0, 4, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 11, - 194, 0, 16, 0, 4, 0, - 0, 0, 6, 4, 16, 128, - 65, 0, 0, 0, 4, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 63, 56, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 4, 0, 0, 0, - 42, 0, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 4, 0, 0, 0, 26, 0, + 14, 0, 0, 7, 50, 0, 16, 0, 4, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 10, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 62, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 7, 114, 0, - 16, 0, 4, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 55, 0, - 0, 9, 114, 0, 16, 0, - 3, 0, 0, 0, 86, 5, + 70, 0, 16, 0, 4, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 11, 194, 0, 16, 0, + 4, 0, 0, 0, 6, 4, + 16, 128, 65, 0, 0, 0, + 4, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 56, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 4, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 21, 0, - 0, 1, 16, 0, 0, 8, - 34, 0, 16, 0, 0, 0, - 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 33, 0, + 58, 0, 16, 0, 4, 0, + 0, 0, 42, 0, 16, 0, + 4, 0, 0, 0, 50, 0, + 0, 9, 130, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 4, 0, 0, 0, + 26, 0, 16, 0, 4, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 10, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 62, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 7, + 114, 0, 16, 0, 4, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 55, 0, 0, 9, 114, 0, + 16, 0, 3, 0, 0, 0, + 86, 5, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 56, 0, - 0, 8, 66, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 52, 0, 0, 7, 66, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 21, 0, 0, 1, 16, 0, + 0, 8, 34, 0, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 33, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 8, 66, 0, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 56, 0, - 0, 7, 114, 0, 16, 0, - 1, 0, 0, 0, 166, 10, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 3, 0, - 0, 0, 56, 0, 0, 10, - 114, 0, 16, 0, 2, 0, + 0, 0, 26, 0, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 52, 0, 0, 7, + 66, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 1, 0, 0, 0, + 166, 10, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 64, + 3, 0, 0, 0, 56, 0, + 0, 10, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 64, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, - 128, 64, 0, 0, 0, 0, - 50, 0, 0, 15, 226, 0, - 16, 0, 0, 0, 0, 0, - 86, 5, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 191, 0, 0, 0, 191, - 0, 0, 128, 191, 2, 64, + 0, 0, 50, 0, 0, 15, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 5, 16, 0, + 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 191, 0, 0, + 0, 191, 0, 0, 128, 191, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, - 0, 63, 0, 0, 0, 0, - 50, 0, 0, 15, 226, 0, - 16, 0, 0, 0, 0, 0, - 86, 14, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 11, 215, - 163, 60, 206, 204, 76, 60, - 148, 194, 245, 59, 2, 64, + 0, 0, 50, 0, 0, 15, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 14, 16, 0, + 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, - 205, 204, 204, 60, 205, 204, - 204, 60, 143, 194, 245, 60, + 11, 215, 163, 60, 206, 204, + 76, 60, 148, 194, 245, 59, + 2, 64, 0, 0, 0, 0, + 0, 0, 205, 204, 204, 60, + 205, 204, 204, 60, 143, 194, + 245, 60, 56, 0, 0, 7, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 14, 16, 0, + 0, 0, 0, 0, 6, 9, + 16, 0, 2, 0, 0, 0, 56, 0, 0, 7, 226, 0, 16, 0, 0, 0, 0, 0, - 86, 14, 16, 0, 0, 0, - 0, 0, 6, 9, 16, 0, - 2, 0, 0, 0, 56, 0, - 0, 7, 226, 0, 16, 0, - 0, 0, 0, 0, 6, 0, - 16, 0, 0, 0, 0, 0, - 86, 14, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 9, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 6, 0, - 16, 0, 0, 0, 0, 0, - 150, 7, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 8, - 130, 0, 16, 0, 0, 0, - 0, 0, 42, 16, 16, 0, - 8, 0, 0, 0, 58, 128, - 32, 0, 0, 0, 0, 0, - 17, 0, 0, 0, 56, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 59, 170, - 184, 63, 25, 0, 0, 5, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 86, 14, 16, 0, + 0, 0, 0, 0, 50, 0, 0, 9, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 130, 0, 16, 0, + 0, 0, 0, 0, 42, 16, + 16, 0, 8, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 56, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, - 70, 130, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 17, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 0, 0, 0, 0, 246, 15, + 58, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 59, 170, 184, 63, 25, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, - 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 17, 0, - 0, 0, 47, 0, 0, 6, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 128, - 129, 0, 0, 0, 0, 0, - 0, 0, 56, 0, 0, 10, - 114, 0, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 47, 186, 232, 62, - 47, 186, 232, 62, 47, 186, - 232, 62, 0, 0, 0, 0, - 25, 0, 0, 5, 114, 32, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 47, 0, + 0, 6, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 128, 129, 0, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, - 130, 32, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 62, 0, - 0, 1, 83, 84, 65, 84, - 148, 0, 0, 0, 179, 0, - 0, 0, 6, 0, 0, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 146, 0, 0, 0, - 1, 0, 0, 0, 4, 0, - 0, 0, 4, 0, 0, 0, - 3, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 47, 186, + 232, 62, 47, 186, 232, 62, + 47, 186, 232, 62, 0, 0, + 0, 0, 25, 0, 0, 5, + 114, 32, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 130, 32, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 62, 0, 0, 1, 83, 84, + 65, 84, 148, 0, 0, 0, + 179, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 146, 0, + 0, 0, 1, 0, 0, 0, + 4, 0, 0, 0, 4, 0, + 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1549,5 +1554,5 @@ const BYTE g_meshPS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 + 0, 0, 0, 0 }; diff --git a/demo/d3d11/shaders/meshShadowPS.hlsl b/demo/d3d/shaders/meshShadowPS.hlsl index cb60c22..96d7371 100644 --- a/demo/d3d11/shaders/meshShadowPS.hlsl +++ b/demo/d3d/shaders/meshShadowPS.hlsl @@ -5,7 +5,8 @@ cbuffer constBuf : register(b0) MeshShaderConst gParams; }; -float4 meshPS_Shadow(MeshVertexOut input) : SV_TARGET + +void meshPS_Shadow(MeshVertexOut input) { - return float4(0.0, 0.0, 0.0, 1.0); } + diff --git a/demo/d3d11/shaders/meshShadowPS.hlsl.h b/demo/d3d/shaders/meshShadowPS.hlsl.h index 3794f61..f921264 100644 --- a/demo/d3d11/shaders/meshShadowPS.hlsl.h +++ b/demo/d3d/shaders/meshShadowPS.hlsl.h @@ -9,12 +9,12 @@ // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_POSITION 0 xyzw 0 POS float -// TEXCOORD 0 xyzw 1 NONE float +// TEXCOORD 0 xyz 1 NONE float // TEXCOORD 1 xyzw 2 NONE float -// TEXCOORD 2 xyzw 3 NONE float -// TEXCOORD 3 xyzw 4 NONE float +// TEXCOORD 2 xyz 3 NONE float +// TEXCOORD 3 xyz 4 NONE float // TEXCOORD 4 xyzw 5 NONE float -// TEXCOORD 5 xyzw 6 NONE float +// TEXCOORD 5 xy 6 NONE float // TEXCOORD 6 xyzw 7 NONE float // TEXCOORD 7 xyzw 8 NONE float // @@ -23,27 +23,24 @@ // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// +// no Output ps_5_0 dcl_globalFlags refactoringAllowed -dcl_output o0.xyzw -mov o0.xyzw, l(0,0,0,1.000000) ret -// Approximately 2 instruction slots used +// Approximately 1 instruction slots used #endif const BYTE g_meshPS_Shadow[] = { - 68, 88, 66, 67, 106, 78, - 82, 142, 162, 137, 138, 82, - 3, 68, 165, 116, 56, 116, - 165, 11, 1, 0, 0, 0, - 192, 2, 0, 0, 5, 0, + 68, 88, 66, 67, 92, 14, + 98, 50, 73, 255, 171, 211, + 114, 130, 157, 79, 70, 204, + 106, 183, 1, 0, 0, 0, + 112, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 172, 0, 0, 0, 172, 1, - 0, 0, 224, 1, 0, 0, - 36, 2, 0, 0, 82, 68, + 0, 0, 188, 1, 0, 0, + 212, 1, 0, 0, 82, 68, 69, 70, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -73,7 +70,7 @@ const BYTE g_meshPS_Shadow[] = 0, 0, 236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, + 1, 0, 0, 0, 7, 0, 0, 0, 236, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, @@ -81,11 +78,11 @@ const BYTE g_meshPS_Shadow[] = 0, 0, 236, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 0, + 3, 0, 0, 0, 7, 0, 0, 0, 236, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 4, 0, 0, 0, 15, 0, + 4, 0, 0, 0, 7, 0, 0, 0, 236, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, @@ -93,7 +90,7 @@ const BYTE g_meshPS_Shadow[] = 0, 0, 236, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 6, 0, 0, 0, 15, 0, + 6, 0, 0, 0, 3, 0, 0, 0, 236, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, @@ -107,32 +104,19 @@ const BYTE g_meshPS_Shadow[] = 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71, 78, - 44, 0, 0, 0, 1, 0, + 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 83, 86, 95, 84, 65, 82, - 71, 69, 84, 0, 171, 171, - 83, 72, 69, 88, 60, 0, + 83, 72, 69, 88, 16, 0, 0, 0, 80, 0, 0, 0, - 15, 0, 0, 0, 106, 8, - 0, 1, 101, 0, 0, 3, - 242, 32, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 8, - 242, 32, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, + 4, 0, 0, 0, 106, 8, + 0, 1, 62, 0, 0, 1, + 83, 84, 65, 84, 148, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 128, 63, 62, 0, - 0, 1, 83, 84, 65, 84, - 148, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -140,7 +124,6 @@ const BYTE g_meshPS_Shadow[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -152,5 +135,5 @@ const BYTE g_meshPS_Shadow[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 + 0, 0, 0, 0, 0, 0 }; diff --git a/demo/d3d/shaders/meshVS.hlsl b/demo/d3d/shaders/meshVS.hlsl new file mode 100644 index 0000000..d2fa9e5 --- /dev/null +++ b/demo/d3d/shaders/meshVS.hlsl @@ -0,0 +1,35 @@ +#include "shaderCommon.h" + +cbuffer constBuf : register(b0) +{ + MeshShaderConst gParams; +}; + +MeshVertexOut meshVS(MeshVertexIn input) +{ + const float4x4 modelViewProjectionMatrix = gParams.modelViewProjection; + const float4x4 modelViewMatrix = gParams.modelView; + const float4x4 objectTransform = gParams.objectTransform; + const float4x4 lightTransform = gParams.lightTransform; + + float3 n = normalize(mul(objectTransform, float4(input.normal, 0.0)).xyz); + float3 p = mul(objectTransform, float4(input.position.xyz, 1.0)).xyz; + + // calculate window-space point size + MeshVertexOut output; + output.position = mul(modelViewProjectionMatrix, float4(p + gParams.expand * n, 1.0)); + + output.worldNormal = n; + output.lightOffsetPosition = mul(lightTransform, float4(p + n * gParams.bias, 1.0)); + output.viewLightDir = mul(modelViewMatrix, float4(gParams.lightDir, 0.0)); + output.worldPosition = p; + if (gParams.colorArray) + output.color = input.color; + else + output.color = gParams.color; + output.texCoord = float2(input.texCoord.x, 1.0f - input.texCoord.y); // flip the y component of uv (glsl to hlsl conversion) + output.secondaryColor = gParams.secondaryColor; + output.viewPosition = mul(modelViewMatrix, float4(input.position.xyz, 1.0)); + + return output; +} diff --git a/demo/d3d11/shaders/meshVS.hlsl.h b/demo/d3d/shaders/meshVS.hlsl.h index cc314af..15198ae 100644 --- a/demo/d3d11/shaders/meshVS.hlsl.h +++ b/demo/d3d/shaders/meshVS.hlsl.h @@ -11,8 +11,8 @@ // struct MeshShaderConst // { // -// float4x4 modelviewprojection; // Offset: 0 -// float4x4 modelview; // Offset: 64 +// float4x4 modelViewProjection; // Offset: 0 +// float4x4 modelView; // Offset: 64 // float4x4 objectTransform; // Offset: 128 // float4x4 lightTransform; // Offset: 192 // float4 clipPlane; // Offset: 256 @@ -31,7 +31,7 @@ // int grid; // Offset: 560 // int tex; // Offset: 564 // int colorArray; // Offset: 568 -// int _pad2; // Offset: 572 +// int increaseGfxLoadForAsyncComputeTesting;// Offset: 572 // // } gParams; // Offset: 0 Size: 576 // @@ -61,12 +61,12 @@ // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_POSITION 0 xyzw 0 POS float xyzw -// TEXCOORD 0 xyzw 1 NONE float xyzw +// TEXCOORD 0 xyz 1 NONE float xyz // TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float xyzw -// TEXCOORD 3 xyzw 4 NONE float xyzw +// TEXCOORD 2 xyz 3 NONE float xyz +// TEXCOORD 3 xyz 4 NONE float xyz // TEXCOORD 4 xyzw 5 NONE float xyzw -// TEXCOORD 5 xyzw 6 NONE float xyzw +// TEXCOORD 5 xy 6 NONE float xy // TEXCOORD 6 xyzw 7 NONE float xyzw // TEXCOORD 7 xyzw 8 NONE float xyzw // @@ -78,12 +78,12 @@ dcl_input v1.xyz dcl_input v2.xy dcl_input v3.xyzw dcl_output_siv o0.xyzw, position -dcl_output o1.xyzw +dcl_output o1.xyz dcl_output o2.xyzw -dcl_output o3.xyzw -dcl_output o4.xyzw +dcl_output o3.xyz +dcl_output o4.xyz dcl_output o5.xyzw -dcl_output o6.xyzw +dcl_output o6.xy dcl_output o7.xyzw dcl_output o8.xyzw dcl_temps 4 @@ -105,44 +105,41 @@ add o0.xyzw, r2.xyzw, cb0[3].xyzw mov o1.xyz, r0.xyzx mad r0.xyz, r0.xyzx, cb0[34].xxxx, r1.xyzx mov o4.xyz, r1.xyzx -mov o1.w, l(0) mul r1.xyzw, r0.yyyy, cb0[13].xyzw mad r1.xyzw, cb0[12].xyzw, r0.xxxx, r1.xyzw mad r0.xyzw, cb0[14].xyzw, r0.zzzz, r1.xyzw add o2.xyzw, r0.xyzw, cb0[15].xyzw -mul r0.xyzw, cb0[5].xyzw, cb0[33].yyyy -mad r0.xyzw, cb0[4].xyzw, cb0[33].xxxx, r0.xyzw -mad o3.xyzw, cb0[6].xyzw, cb0[33].zzzz, r0.xyzw -mov o4.w, l(0) +mul r0.xyz, cb0[5].xyzx, cb0[33].yyyy +mad r0.xyz, cb0[4].xyzx, cb0[33].xxxx, r0.xyzx +mad o3.xyz, cb0[6].xyzx, cb0[33].zzzz, r0.xyzx movc o5.xyzw, cb0[35].zzzz, v3.xyzw, cb0[18].xyzw mad o6.xy, v2.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000), l(0.000000, 1.000000, 0.000000, 0.000000) -mov o6.zw, l(0,0,0,0) mov o7.xyzw, cb0[19].xyzw mul r0.xyzw, v0.yyyy, cb0[5].xyzw mad r0.xyzw, cb0[4].xyzw, v0.xxxx, r0.xyzw mad r0.xyzw, cb0[6].xyzw, v0.zzzz, r0.xyzw add o8.xyzw, r0.xyzw, cb0[7].xyzw ret -// Approximately 36 instruction slots used +// Approximately 33 instruction slots used #endif const BYTE g_meshVS[] = { - 68, 88, 66, 67, 128, 165, - 34, 49, 122, 47, 91, 168, - 78, 217, 246, 213, 221, 36, - 22, 221, 1, 0, 0, 0, - 204, 11, 0, 0, 5, 0, + 68, 88, 66, 67, 224, 200, + 225, 174, 179, 134, 152, 85, + 252, 211, 193, 254, 28, 42, + 106, 184, 1, 0, 0, 0, + 164, 11, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, - 24, 4, 0, 0, 168, 4, - 0, 0, 168, 5, 0, 0, - 48, 11, 0, 0, 82, 68, - 69, 70, 220, 3, 0, 0, + 56, 4, 0, 0, 200, 4, + 0, 0, 200, 5, 0, 0, + 8, 11, 0, 0, 82, 68, + 69, 70, 252, 3, 0, 0, 1, 0, 0, 0, 104, 0, 0, 0, 1, 0, 0, 0, 60, 0, 0, 0, 0, 5, 254, 255, 0, 1, 0, 0, - 168, 3, 0, 0, 82, 68, + 200, 3, 0, 0, 82, 68, 49, 49, 60, 0, 0, 0, 24, 0, 0, 0, 32, 0, 0, 0, 40, 0, 0, 0, @@ -162,7 +159,7 @@ const BYTE g_meshVS[] = 0, 0, 168, 0, 0, 0, 0, 0, 0, 0, 64, 2, 0, 0, 2, 0, 0, 0, - 132, 3, 0, 0, 0, 0, + 164, 3, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, @@ -170,8 +167,8 @@ const BYTE g_meshVS[] = 115, 0, 77, 101, 115, 104, 83, 104, 97, 100, 101, 114, 67, 111, 110, 115, 116, 0, - 109, 111, 100, 101, 108, 118, - 105, 101, 119, 112, 114, 111, + 109, 111, 100, 101, 108, 86, + 105, 101, 119, 80, 114, 111, 106, 101, 99, 116, 105, 111, 110, 0, 102, 108, 111, 97, 116, 52, 120, 52, 0, 171, @@ -182,7 +179,7 @@ const BYTE g_meshVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 212, 0, 0, 0, 109, 111, 100, 101, - 108, 118, 105, 101, 119, 0, + 108, 86, 105, 101, 119, 0, 111, 98, 106, 101, 99, 116, 84, 114, 97, 110, 115, 102, 111, 114, 109, 0, 108, 105, @@ -244,268 +241,270 @@ const BYTE g_meshVS[] = 0, 0, 72, 2, 0, 0, 116, 101, 120, 0, 99, 111, 108, 111, 114, 65, 114, 114, - 97, 121, 0, 95, 112, 97, - 100, 50, 0, 171, 171, 171, - 192, 0, 0, 0, 224, 0, - 0, 0, 0, 0, 0, 0, - 4, 1, 0, 0, 224, 0, - 0, 0, 64, 0, 0, 0, - 14, 1, 0, 0, 224, 0, - 0, 0, 128, 0, 0, 0, - 30, 1, 0, 0, 224, 0, - 0, 0, 192, 0, 0, 0, - 45, 1, 0, 0, 64, 1, - 0, 0, 0, 1, 0, 0, - 100, 1, 0, 0, 64, 1, - 0, 0, 16, 1, 0, 0, - 109, 1, 0, 0, 64, 1, - 0, 0, 32, 1, 0, 0, - 115, 1, 0, 0, 64, 1, - 0, 0, 48, 1, 0, 0, - 130, 1, 0, 0, 144, 1, - 0, 0, 64, 1, 0, 0, - 180, 1, 0, 0, 196, 1, - 0, 0, 0, 2, 0, 0, - 232, 1, 0, 0, 244, 1, - 0, 0, 12, 2, 0, 0, - 24, 2, 0, 0, 196, 1, - 0, 0, 16, 2, 0, 0, - 33, 2, 0, 0, 244, 1, - 0, 0, 28, 2, 0, 0, - 39, 2, 0, 0, 244, 1, - 0, 0, 32, 2, 0, 0, - 44, 2, 0, 0, 244, 1, - 0, 0, 36, 2, 0, 0, - 51, 2, 0, 0, 244, 1, - 0, 0, 40, 2, 0, 0, - 59, 2, 0, 0, 244, 1, + 97, 121, 0, 105, 110, 99, + 114, 101, 97, 115, 101, 71, + 102, 120, 76, 111, 97, 100, + 70, 111, 114, 65, 115, 121, + 110, 99, 67, 111, 109, 112, + 117, 116, 101, 84, 101, 115, + 116, 105, 110, 103, 0, 171, + 171, 171, 192, 0, 0, 0, + 224, 0, 0, 0, 0, 0, + 0, 0, 4, 1, 0, 0, + 224, 0, 0, 0, 64, 0, + 0, 0, 14, 1, 0, 0, + 224, 0, 0, 0, 128, 0, + 0, 0, 30, 1, 0, 0, + 224, 0, 0, 0, 192, 0, + 0, 0, 45, 1, 0, 0, + 64, 1, 0, 0, 0, 1, + 0, 0, 100, 1, 0, 0, + 64, 1, 0, 0, 16, 1, + 0, 0, 109, 1, 0, 0, + 64, 1, 0, 0, 32, 1, + 0, 0, 115, 1, 0, 0, + 64, 1, 0, 0, 48, 1, + 0, 0, 130, 1, 0, 0, + 144, 1, 0, 0, 64, 1, + 0, 0, 180, 1, 0, 0, + 196, 1, 0, 0, 0, 2, + 0, 0, 232, 1, 0, 0, + 244, 1, 0, 0, 12, 2, + 0, 0, 24, 2, 0, 0, + 196, 1, 0, 0, 16, 2, + 0, 0, 33, 2, 0, 0, + 244, 1, 0, 0, 28, 2, + 0, 0, 39, 2, 0, 0, + 244, 1, 0, 0, 32, 2, 0, 0, 44, 2, 0, 0, - 67, 2, 0, 0, 76, 2, - 0, 0, 48, 2, 0, 0, - 112, 2, 0, 0, 76, 2, - 0, 0, 52, 2, 0, 0, - 116, 2, 0, 0, 76, 2, - 0, 0, 56, 2, 0, 0, - 127, 2, 0, 0, 76, 2, - 0, 0, 60, 2, 0, 0, - 5, 0, 0, 0, 1, 0, - 144, 0, 0, 0, 21, 0, - 136, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 176, 0, 0, 0, - 77, 105, 99, 114, 111, 115, - 111, 102, 116, 32, 40, 82, - 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, - 114, 32, 67, 111, 109, 112, - 105, 108, 101, 114, 32, 54, - 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, - 52, 0, 171, 171, 73, 83, - 71, 78, 136, 0, 0, 0, - 4, 0, 0, 0, 8, 0, - 0, 0, 104, 0, 0, 0, + 244, 1, 0, 0, 36, 2, + 0, 0, 51, 2, 0, 0, + 244, 1, 0, 0, 40, 2, + 0, 0, 59, 2, 0, 0, + 244, 1, 0, 0, 44, 2, + 0, 0, 67, 2, 0, 0, + 76, 2, 0, 0, 48, 2, + 0, 0, 112, 2, 0, 0, + 76, 2, 0, 0, 52, 2, + 0, 0, 116, 2, 0, 0, + 76, 2, 0, 0, 56, 2, + 0, 0, 127, 2, 0, 0, + 76, 2, 0, 0, 60, 2, + 0, 0, 5, 0, 0, 0, + 1, 0, 144, 0, 0, 0, + 21, 0, 168, 2, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 176, 0, + 0, 0, 77, 105, 99, 114, + 111, 115, 111, 102, 116, 32, + 40, 82, 41, 32, 72, 76, + 83, 76, 32, 83, 104, 97, + 100, 101, 114, 32, 67, 111, + 109, 112, 105, 108, 101, 114, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 171, 171, + 73, 83, 71, 78, 136, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 7, 7, - 0, 0, 113, 0, 0, 0, + 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 7, 7, - 0, 0, 120, 0, 0, 0, + 7, 7, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 3, 3, - 0, 0, 129, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 15, - 0, 0, 80, 79, 83, 73, - 84, 73, 79, 78, 0, 78, - 79, 82, 77, 65, 76, 0, - 84, 69, 88, 67, 79, 79, - 82, 68, 0, 67, 79, 76, - 79, 82, 0, 171, 79, 83, - 71, 78, 248, 0, 0, 0, - 9, 0, 0, 0, 8, 0, - 0, 0, 224, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 129, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 4, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 5, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 5, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 6, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 6, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 80, 79, + 83, 73, 84, 73, 79, 78, + 0, 78, 79, 82, 77, 65, + 76, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 67, + 79, 76, 79, 82, 0, 171, + 79, 83, 71, 78, 248, 0, + 0, 0, 9, 0, 0, 0, + 8, 0, 0, 0, 224, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 236, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 8, 0, 0, 236, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 0, 0, 0, 236, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, - 7, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 7, 0, 0, 0, 0, 0, + 7, 8, 0, 0, 236, 0, 0, 0, 3, 0, 0, 0, - 8, 0, 0, 0, 15, 0, - 0, 0, 83, 86, 95, 80, - 79, 83, 73, 84, 73, 79, - 78, 0, 84, 69, 88, 67, - 79, 79, 82, 68, 0, 171, - 171, 171, 83, 72, 69, 88, - 128, 5, 0, 0, 80, 0, - 1, 0, 96, 1, 0, 0, - 106, 8, 0, 1, 89, 0, - 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 36, 0, - 0, 0, 95, 0, 0, 3, - 114, 16, 16, 0, 0, 0, - 0, 0, 95, 0, 0, 3, - 114, 16, 16, 0, 1, 0, - 0, 0, 95, 0, 0, 3, - 50, 16, 16, 0, 2, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 3, 0, - 0, 0, 103, 0, 0, 4, - 242, 32, 16, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 1, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 2, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 3, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 4, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 5, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 6, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 7, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 8, 0, 0, 0, - 104, 0, 0, 2, 4, 0, - 0, 0, 56, 0, 0, 8, - 114, 0, 16, 0, 0, 0, - 0, 0, 86, 21, 16, 0, - 1, 0, 0, 0, 70, 130, + 0, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 7, 8, 0, 0, 236, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 5, 0, 0, 0, + 15, 0, 0, 0, 236, 0, + 0, 0, 5, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 6, 0, 0, 0, + 3, 12, 0, 0, 236, 0, + 0, 0, 6, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 7, 0, 0, 0, + 15, 0, 0, 0, 236, 0, + 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 8, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 80, 79, 83, 73, 84, + 73, 79, 78, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 171, 171, 83, 72, + 69, 88, 56, 5, 0, 0, + 80, 0, 1, 0, 78, 1, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, - 9, 0, 0, 0, 50, 0, + 36, 0, 0, 0, 95, 0, + 0, 3, 114, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 3, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 114, 32, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 2, 0, + 0, 0, 101, 0, 0, 3, + 114, 32, 16, 0, 3, 0, + 0, 0, 101, 0, 0, 3, + 114, 32, 16, 0, 4, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 5, 0, + 0, 0, 101, 0, 0, 3, + 50, 32, 16, 0, 6, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 7, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 8, 0, + 0, 0, 104, 0, 0, 2, + 4, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 0, 0, 0, 0, 86, 21, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 9, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 8, 0, 0, 0, + 6, 16, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 50, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, - 8, 0, 0, 0, 6, 16, + 10, 0, 0, 0, 166, 26, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 10, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 10, 0, - 0, 0, 166, 26, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, - 16, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 68, 0, - 0, 5, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, + 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 114, 0, + 68, 0, 0, 5, 130, 0, 16, 0, 0, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 8, 114, 0, 16, 0, - 1, 0, 0, 0, 86, 21, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, - 70, 130, 32, 0, 0, 0, - 0, 0, 9, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 1, 0, 0, 0, + 86, 21, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 9, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 6, 16, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, 50, 0, 0, 10, 114, 0, 16, 0, 1, 0, 0, 0, 70, 130, 32, 0, 0, 0, - 0, 0, 8, 0, 0, 0, - 6, 16, 16, 0, 0, 0, + 0, 0, 10, 0, 0, 0, + 166, 26, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 1, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 166, 26, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 0, 0, 0, 8, - 114, 0, 16, 0, 1, 0, + 1, 0, 0, 0, 0, 0, + 0, 8, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 11, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 2, 0, 0, 0, + 86, 133, 32, 0, 0, 0, + 0, 0, 34, 0, 0, 0, + 70, 2, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 11, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 2, 0, 0, 0, 86, 133, - 32, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 56, 0, 0, 8, - 242, 0, 16, 0, 3, 0, - 0, 0, 86, 5, 16, 0, - 2, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 50, 0, + 1, 0, 0, 0, 56, 0, + 0, 8, 242, 0, 16, 0, + 3, 0, 0, 0, 86, 5, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 50, 0, 0, 10, 242, 0, + 16, 0, 3, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 2, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 50, 0, 0, 10, 242, 0, 16, 0, - 3, 0, 0, 0, 70, 142, + 2, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 0, + 2, 0, 0, 0, 166, 10, 16, 0, 2, 0, 0, 0, 70, 14, 16, 0, 3, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 2, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 166, 10, 16, 0, - 2, 0, 0, 0, 70, 14, - 16, 0, 3, 0, 0, 0, - 0, 0, 0, 8, 242, 32, + 0, 0, 0, 0, 0, 8, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 54, 0, + 0, 5, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 54, 0, 0, 5, - 114, 32, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 0, 0, 0, 0, 70, 2, + 50, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, - 6, 128, 32, 0, 0, 0, - 0, 0, 34, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 5, - 114, 32, 16, 0, 4, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 34, 0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, + 0, 5, 114, 32, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, 56, 0, 0, 8, 242, 0, 16, 0, 1, 0, 0, 0, 86, 5, 16, 0, 0, 0, @@ -530,97 +529,88 @@ const BYTE g_meshVS[] = 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 15, 0, 0, 0, - 56, 0, 0, 9, 242, 0, + 56, 0, 0, 9, 114, 0, 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, + 70, 130, 32, 0, 0, 0, 0, 0, 5, 0, 0, 0, 86, 133, 32, 0, 0, 0, 0, 0, 33, 0, 0, 0, - 50, 0, 0, 11, 242, 0, + 50, 0, 0, 11, 114, 0, 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, + 70, 130, 32, 0, 0, 0, 0, 0, 4, 0, 0, 0, 6, 128, 32, 0, 0, 0, 0, 0, 33, 0, 0, 0, - 70, 14, 16, 0, 0, 0, + 70, 2, 16, 0, 0, 0, 0, 0, 50, 0, 0, 11, - 242, 32, 16, 0, 3, 0, - 0, 0, 70, 142, 32, 0, + 114, 32, 16, 0, 3, 0, + 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, 6, 0, 0, 0, 166, 138, 32, 0, 0, 0, 0, 0, 33, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, - 4, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 55, 0, 0, 11, 242, 32, - 16, 0, 5, 0, 0, 0, - 166, 138, 32, 0, 0, 0, - 0, 0, 35, 0, 0, 0, - 70, 30, 16, 0, 3, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 18, 0, - 0, 0, 50, 0, 0, 15, - 50, 32, 16, 0, 6, 0, - 0, 0, 70, 16, 16, 0, - 2, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, - 0, 0, 0, 0, 0, 0, - 0, 0, 54, 0, 0, 8, - 194, 32, 16, 0, 6, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 55, 0, + 0, 11, 242, 32, 16, 0, + 5, 0, 0, 0, 166, 138, + 32, 0, 0, 0, 0, 0, + 35, 0, 0, 0, 70, 30, + 16, 0, 3, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 18, 0, 0, 0, + 50, 0, 0, 15, 50, 32, + 16, 0, 6, 0, 0, 0, + 70, 16, 16, 0, 2, 0, 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 191, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, + 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 54, 0, - 0, 6, 242, 32, 16, 0, - 7, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 19, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 0, 0, 0, 0, 86, 21, - 16, 0, 0, 0, 0, 0, + 54, 0, 0, 6, 242, 32, + 16, 0, 7, 0, 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 5, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 56, 0, 0, 8, 242, 0, + 16, 0, 0, 0, 0, 0, + 86, 21, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 50, 0, 0, 10, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 6, 16, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, 50, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 6, 16, 16, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 166, 26, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 166, 26, + 0, 0, 0, 0, 0, 0, + 0, 8, 242, 32, 16, 0, + 8, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 8, - 242, 32, 16, 0, 8, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 7, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, - 148, 0, 0, 0, 36, 0, - 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 13, 0, - 0, 0, 28, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 148, 0, 0, 0, + 33, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, + 13, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 0, 0, - 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -631,5 +621,5 @@ const BYTE g_meshVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 + 0, 0, 0, 0 }; diff --git a/demo/d3d/shaders/passThroughVS.hlsl b/demo/d3d/shaders/passThroughVS.hlsl new file mode 100644 index 0000000..f8005d7 --- /dev/null +++ b/demo/d3d/shaders/passThroughVS.hlsl @@ -0,0 +1,14 @@ +#include "shaderCommon.h" + +cbuffer constBuf : register(b0) +{ + FluidShaderConst gParams; +}; + +PassthroughVertexOut passThroughVS(MeshVertexIn input) +{ + PassthroughVertexOut output; + output.position = float4(input.position, 1.0f); + output.texCoord = input.texCoord; + return output; +} diff --git a/demo/d3d11/shaders/passThroughVS.hlsl.h b/demo/d3d/shaders/passThroughVS.hlsl.h index 4b1b2cf..3ff9109 100644 --- a/demo/d3d11/shaders/passThroughVS.hlsl.h +++ b/demo/d3d/shaders/passThroughVS.hlsl.h @@ -8,8 +8,10 @@ // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xy 0 NONE float xy -// TEXCOORD 0 xy 1 NONE float xy +// POSITION 0 xyz 0 NONE float xyz +// NORMAL 0 xyz 1 NONE float +// TEXCOORD 0 xy 2 NONE float xy +// COLOR 0 xyzw 3 NONE float // // // Output signature: @@ -21,28 +23,28 @@ // vs_5_0 dcl_globalFlags refactoringAllowed -dcl_input v0.xy -dcl_input v1.xy +dcl_input v0.xyz +dcl_input v2.xy dcl_output_siv o0.xyzw, position dcl_output o1.xy -mov o0.xy, v0.xyxx -mov o0.zw, l(0,0,0,1.000000) -mov o1.xy, v1.xyxx +mov o0.xyz, v0.xyzx +mov o0.w, l(1.000000) +mov o1.xy, v2.xyxx ret // Approximately 4 instruction slots used #endif const BYTE g_passThroughVS[] = { - 68, 88, 66, 67, 187, 133, - 114, 171, 205, 36, 113, 9, - 245, 108, 33, 122, 172, 89, - 138, 214, 1, 0, 0, 0, - 136, 2, 0, 0, 5, 0, + 68, 88, 66, 67, 185, 168, + 119, 184, 113, 66, 215, 46, + 63, 211, 78, 140, 226, 35, + 139, 164, 1, 0, 0, 0, + 184, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, - 172, 0, 0, 0, 0, 1, - 0, 0, 88, 1, 0, 0, - 236, 1, 0, 0, 82, 68, + 172, 0, 0, 0, 60, 1, + 0, 0, 148, 1, 0, 0, + 28, 2, 0, 0, 82, 68, 69, 70, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -63,20 +65,30 @@ const BYTE g_passThroughVS[] = 46, 51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, - 71, 78, 76, 0, 0, 0, - 2, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 0, + 71, 78, 136, 0, 0, 0, + 4, 0, 0, 0, 8, 0, + 0, 0, 104, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 7, 7, + 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 3, 3, - 0, 0, 65, 0, 0, 0, + 1, 0, 0, 0, 7, 0, + 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 3, 3, + 2, 0, 0, 0, 3, 3, + 0, 0, 129, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 15, 0, 0, 0, 80, 79, 83, 73, - 84, 73, 79, 78, 0, 84, - 69, 88, 67, 79, 79, 82, - 68, 0, 171, 171, 79, 83, + 84, 73, 79, 78, 0, 78, + 79, 82, 77, 65, 76, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 67, 79, 76, + 79, 82, 0, 171, 79, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, @@ -92,29 +104,27 @@ const BYTE g_passThroughVS[] = 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 83, 72, 69, 88, - 140, 0, 0, 0, 80, 0, - 1, 0, 35, 0, 0, 0, + 128, 0, 0, 0, 80, 0, + 1, 0, 32, 0, 0, 0, 106, 8, 0, 1, 95, 0, - 0, 3, 50, 16, 16, 0, + 0, 3, 114, 16, 16, 0, 0, 0, 0, 0, 95, 0, 0, 3, 50, 16, 16, 0, - 1, 0, 0, 0, 103, 0, + 2, 0, 0, 0, 103, 0, 0, 4, 242, 32, 16, 0, 0, 0, 0, 0, 1, 0, 0, 0, 101, 0, 0, 3, 50, 32, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, - 50, 32, 16, 0, 0, 0, - 0, 0, 70, 16, 16, 0, + 114, 32, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, 0, 0, 0, 0, 54, 0, - 0, 8, 194, 32, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, + 0, 5, 130, 32, 16, 0, + 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 54, 0, 0, 5, 50, 32, 16, 0, 1, 0, 0, 0, - 70, 16, 16, 0, 1, 0, + 70, 16, 16, 0, 2, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 148, 0, 0, 0, 4, 0, 0, 0, diff --git a/demo/d3d/shaders/pointGS.hlsl b/demo/d3d/shaders/pointGS.hlsl new file mode 100644 index 0000000..4d654af --- /dev/null +++ b/demo/d3d/shaders/pointGS.hlsl @@ -0,0 +1,68 @@ +#include "shaderCommon.h" + +cbuffer constBuf : register(b0) +{ + PointShaderConst gParams; +}; + +static const float2 corners[4] = +{ + float2(0.0, 1.0), float2(0.0, 0.0), float2(1.0, 1.0), float2(1.0, 0.0) +}; + +[maxvertexcount(4)] +void pointGS(point PointVertexOut input[1], inout TriangleStream<PointGeoOut> triStream) +{ + const float4x4 modelViewMatrix = gParams.modelView; + const float pointRadius = gParams.pointRadius; + const float pointScale = gParams.pointScale; + const float4x4 lightTransform = gParams.lightTransform; + const float3 lightDir = gParams.lightDir.xyz; + const int mode = gParams.mode; + + const float4 viewPosition = input[0].viewPosition; + const float density = input[0].density; + const unsigned int phase = input[0].phase; + const float4 modelPosition = input[0].modelPosition; + + //float spriteSize = (pointRadius / viewPos.z); + const float spriteSize = pointRadius * 2; + + PointGeoOut output; + for (int i = 0; i < 4; ++i) + { + const float2 corner = corners[i]; + float4 eyePos = viewPosition; // start with point position + eyePos.xy += spriteSize * (corner - float2(0.5, 0.5)); // add corner position + output.position = mul(gParams.projection, eyePos); // complete transformation + + // use corner as texCoord, flip the y component of uv (glsl to hlsl conversion) + output.texCoord = float2(corner.x, 1.0f - corner.y); + output.lightOffsetPosition = mul(lightTransform, float4(modelPosition.xyz - lightDir * pointRadius * 2.0, 1.0)); + output.viewLightDir = mul(modelViewMatrix, float4(lightDir, 0.0)).xyz; + + if (mode == 1) + { + // density visualization + if (density < 0.0f) + output.reflectance = float4(lerp(float3(0.1, 0.1, 1.0), float3(0.1, 1.0, 1.0), -density), 0); + else + output.reflectance = float4(lerp(float3(1.0, 1.0, 1.0), float3(0.1, 0.2, 1.0), density), 0); + } + else if (mode == 2) + { + //gl_PointSize *= clamp(inPosition.w * 0.25, 0.0f, 1.0); + float tmp = clamp(modelPosition.w * 0.05, 0.0f, 1.0); + output.reflectance = float4(tmp, tmp, tmp, tmp); + } + else + { + output.reflectance = float4(lerp(gParams.colors[phase % 8].xyz * 2.0, float3(1.0, 1.0, 1.0), 0.1), 0); + } + + output.modelPosition= modelPosition.xyz; + output.viewPosition = viewPosition.xyz; + + triStream.Append(output); + } +} diff --git a/demo/d3d11/shaders/pointGS.hlsl.h b/demo/d3d/shaders/pointGS.hlsl.h index afc1b76..46806ac 100644 --- a/demo/d3d11/shaders/pointGS.hlsl.h +++ b/demo/d3d/shaders/pointGS.hlsl.h @@ -11,7 +11,7 @@ // struct PointShaderConst // { // -// float4x4 modelview; // Offset: 0 +// float4x4 modelView; // Offset: 0 // float4x4 projection; // Offset: 64 // float4x4 lightTransform; // Offset: 128 // float4 colors[8]; // Offset: 192 @@ -55,12 +55,12 @@ // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_POSITION 0 xyzw 0 POS float xyzw -// TEXCOORD 0 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy // TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float xyzw +// TEXCOORD 2 xyz 3 NONE float xyz // TEXCOORD 3 xyzw 4 NONE float xyzw -// TEXCOORD 4 xyzw 5 NONE float xyzw -// TEXCOORD 5 xyzw 6 NONE float xyzw +// TEXCOORD 4 xyz 5 NONE float xyz +// TEXCOORD 5 xyz 6 NONE float xyz // gs_5_0 dcl_globalFlags refactoringAllowed @@ -74,19 +74,17 @@ dcl_input v[1][1].x dcl_input v[1][2].x dcl_input v[1][3].xyzw dcl_temps 8 -dcl_indexableTemp x0[6], 4 dcl_inputprimitive point dcl_stream m0 dcl_outputtopology trianglestrip dcl_output_siv o0.xyzw, position -dcl_output o1.xyzw +dcl_output o1.xy dcl_output o2.xyzw -dcl_output o3.xyzw +dcl_output o3.xyz dcl_output o4.xyzw -dcl_output o5.xyzw -dcl_output o6.xyzw +dcl_output o5.xyz +dcl_output o6.xyz dcl_maxout 4 -mov x0[3].w, l(0) add r0.x, cb0[34].x, cb0[34].x mul r0.yzw, cb0[33].xxyz, cb0[34].xxxx mad r0.yzw, -r0.yyzw, l(0.000000, 2.000000, 2.000000, 2.000000), v[0][3].xxyz @@ -94,72 +92,69 @@ mul r1.xyzw, r0.zzzz, cb0[9].xyzw mad r1.xyzw, cb0[8].xyzw, r0.yyyy, r1.xyzw mad r1.xyzw, cb0[10].xyzw, r0.wwww, r1.xyzw add r1.xyzw, r1.xyzw, cb0[11].xyzw -mul r2.xyzw, cb0[1].xyzw, cb0[33].yyyy -mad r2.xyzw, cb0[0].xyzw, cb0[33].xxxx, r2.xyzw -mad r2.xyzw, cb0[2].xyzw, cb0[33].zzzz, r2.xyzw -lt r0.y, v[0][1].x, l(0.000000) -mad r3.xyz, v[0][1].xxxx, l(0.000000, -0.900000, 0.000000, 0.000000), l(0.100000, 0.100000, 1.000000, 0.000000) -mad r4.xyz, v[0][1].xxxx, l(-0.900000, -0.800000, 0.000000, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000) -ieq r0.zw, l(0, 0, 1, 2), cb0[35].xxxx -mul r3.w, l(0.050000), v[0][3].w -mov_sat r5.xyz, r3.wwww -and r3.w, l(7), v[0][2].x -add r6.xyz, cb0[r3.w + 12].xyzx, cb0[r3.w + 12].xyzx -mad r7.xyz, -cb0[r3.w + 12].xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000) -mad r6.xyz, r7.xyzx, l(0.100000, 0.100000, 0.100000, 0.000000), r6.xyzx -movc r3.xyz, r0.yyyy, r3.xyzx, r4.xyzx -mov r0.y, l(0) +mul r0.yzw, cb0[1].xxyz, cb0[33].yyyy +mad r0.yzw, cb0[0].xxyz, cb0[33].xxxx, r0.yyzw +mad r0.yzw, cb0[2].xxyz, cb0[33].zzzz, r0.yyzw +lt r2.x, v[0][1].x, l(0.000000) +mad r2.yzw, v[0][1].xxxx, l(0.000000, -0.900000, -0.800000, 0.000000), l(0.000000, 1.000000, 1.000000, 1.000000) +mov r3.xz, l(0.100000,0,1.000000,0) +mad r3.y, v[0][1].x, l(-0.900000), l(0.100000) +movc r2.xyz, r2.xxxx, r3.xyzx, r2.yzwy +mov r2.w, l(0) +ieq r3.xy, l(1, 2, 0, 0), cb0[35].xxxx +mul r3.z, l(0.050000), v[0][3].w +mov_sat r4.xyzw, r3.zzzz +and r3.z, l(7), v[0][2].x +add r5.xyz, cb0[r3.z + 12].xyzx, cb0[r3.z + 12].xyzx +mad r6.xyz, -cb0[r3.z + 12].xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000) +mad r5.xyz, r6.xyzx, l(0.100000, 0.100000, 0.100000, 0.000000), r5.xyzx +mov r5.w, l(0) +mov r3.z, l(0) loop - ige r3.w, r0.y, l(4) + ige r3.w, r3.z, l(4) breakc_nz r3.w - add r4.xy, l(-0.500000, -0.500000, 0.000000, 0.000000), icb[r0.y + 0].xyxx - mad r4.xy, r0.xxxx, r4.xyxx, v[0][0].xyxx - mul r7.xyzw, r4.yyyy, cb0[5].xyzw - mad r4.xyzw, cb0[4].xyzw, r4.xxxx, r7.xyzw - mad r4.xyzw, cb0[6].xyzw, v[0][0].zzzz, r4.xyzw - mad r4.xyzw, cb0[7].xyzw, v[0][0].wwww, r4.xyzw - add r3.w, l(1.000000), -icb[r0.y + 0].y - if_nz r0.z - mov r7.xyz, r3.xyzx + add r6.xy, l(-0.500000, -0.500000, 0.000000, 0.000000), icb[r3.z + 0].xyxx + mad r6.xy, r0.xxxx, r6.xyxx, v[0][0].xyxx + mul r7.xyzw, r6.yyyy, cb0[5].xyzw + mad r6.xyzw, cb0[4].xyzw, r6.xxxx, r7.xyzw + mad r6.xyzw, cb0[6].xyzw, v[0][0].zzzz, r6.xyzw + mad r6.xyzw, cb0[7].xyzw, v[0][0].wwww, r6.xyzw + add r3.w, l(1.000000), -icb[r3.z + 0].y + if_nz r3.x + mov r7.xyzw, r2.xyzw else - if_nz r0.w - mov x0[3].w, r5.z - mov r7.xyz, r5.xyzx + if_nz r3.y + mov r7.xyzw, r4.xyzw else - mov r7.xyz, r6.xyzx + mov r7.xyzw, r5.xyzw endif endif - mov r5.w, x0[3].w - mov o0.xyzw, r4.xyzw - mov o1.x, icb[r0.y + 0].x + mov o0.xyzw, r6.xyzw + mov o1.x, icb[r3.z + 0].x mov o1.y, r3.w - mov o1.zw, l(0,0,0,0) mov o2.xyzw, r1.xyzw - mov o3.xyzw, r2.xyzw - mov o4.xyz, r7.xyzx - mov o4.w, r5.w + mov o3.xyz, r0.yzwy + mov o4.xyzw, r7.xyzw mov o5.xyz, v[0][3].xyzx - mov o5.w, l(0) mov o6.xyz, v[0][0].xyzx - mov o6.w, l(0) emit_stream m0 - iadd r0.y, r0.y, l(1) + iadd r3.z, r3.z, l(1) endloop ret -// Approximately 60 instruction slots used +// Approximately 56 instruction slots used #endif const BYTE g_pointGS[] = { - 68, 88, 66, 67, 83, 238, - 66, 156, 86, 118, 105, 62, - 85, 224, 176, 224, 229, 4, - 226, 151, 1, 0, 0, 0, - 188, 13, 0, 0, 5, 0, + 68, 88, 66, 67, 225, 171, + 155, 174, 109, 180, 8, 136, + 18, 164, 43, 168, 152, 216, + 179, 151, 1, 0, 0, 0, + 56, 13, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 176, 3, 0, 0, 64, 4, 0, 0, 44, 5, 0, 0, - 32, 13, 0, 0, 82, 68, + 156, 12, 0, 0, 82, 68, 69, 70, 116, 3, 0, 0, 1, 0, 0, 0, 104, 0, 0, 0, 1, 0, 0, 0, @@ -194,7 +189,7 @@ const BYTE g_pointGS[] = 116, 83, 104, 97, 100, 101, 114, 67, 111, 110, 115, 116, 0, 109, 111, 100, 101, 108, - 118, 105, 101, 119, 0, 102, + 86, 105, 101, 119, 0, 102, 108, 111, 97, 116, 52, 120, 52, 0, 3, 0, 3, 0, 4, 0, 4, 0, 0, 0, @@ -343,7 +338,7 @@ const BYTE g_pointGS[] = 0, 0, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, + 1, 0, 0, 0, 3, 12, 0, 0, 0, 0, 0, 0, 216, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, @@ -353,7 +348,7 @@ const BYTE g_pointGS[] = 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, - 15, 0, 0, 0, 0, 0, + 7, 8, 0, 0, 0, 0, 0, 0, 216, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, @@ -362,18 +357,18 @@ const BYTE g_pointGS[] = 216, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 5, 0, - 0, 0, 15, 0, 0, 0, + 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 216, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 6, 0, 0, 0, - 15, 0, 0, 0, 83, 86, + 7, 8, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 83, 72, - 69, 88, 236, 7, 0, 0, - 80, 0, 2, 0, 251, 1, + 69, 88, 104, 7, 0, 0, + 80, 0, 2, 0, 218, 1, 0, 0, 106, 8, 0, 1, 53, 24, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, @@ -401,161 +396,165 @@ const BYTE g_pointGS[] = 0, 4, 242, 16, 32, 0, 1, 0, 0, 0, 3, 0, 0, 0, 104, 0, 0, 2, - 8, 0, 0, 0, 105, 0, - 0, 4, 0, 0, 0, 0, - 6, 0, 0, 0, 4, 0, - 0, 0, 93, 8, 0, 1, - 143, 0, 0, 3, 0, 0, - 17, 0, 0, 0, 0, 0, - 92, 40, 0, 1, 103, 0, - 0, 4, 242, 32, 16, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 1, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 2, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 3, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 4, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 5, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 6, 0, - 0, 0, 94, 0, 0, 2, - 4, 0, 0, 0, 54, 0, - 0, 6, 130, 48, 32, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 64, 0, 0, + 8, 0, 0, 0, 93, 8, + 0, 1, 143, 0, 0, 3, + 0, 0, 17, 0, 0, 0, + 0, 0, 92, 40, 0, 1, + 103, 0, 0, 4, 242, 32, + 16, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 114, 32, 16, 0, + 3, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 4, 0, 0, 0, 101, 0, + 0, 3, 114, 32, 16, 0, + 5, 0, 0, 0, 101, 0, + 0, 3, 114, 32, 16, 0, + 6, 0, 0, 0, 94, 0, + 0, 2, 4, 0, 0, 0, + 0, 0, 0, 9, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 34, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 34, 0, 0, 0, + 56, 0, 0, 9, 226, 0, + 16, 0, 0, 0, 0, 0, + 6, 137, 32, 0, 0, 0, + 0, 0, 33, 0, 0, 0, + 6, 128, 32, 0, 0, 0, + 0, 0, 34, 0, 0, 0, + 50, 0, 0, 14, 226, 0, + 16, 0, 0, 0, 0, 0, + 86, 14, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, - 0, 9, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 56, 0, - 0, 9, 226, 0, 16, 0, - 0, 0, 0, 0, 6, 137, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 64, + 0, 0, 0, 64, 0, 0, + 0, 64, 6, 25, 32, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 56, 0, 0, 8, + 242, 0, 16, 0, 1, 0, + 0, 0, 166, 10, 16, 0, + 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, - 33, 0, 0, 0, 6, 128, + 9, 0, 0, 0, 50, 0, + 0, 10, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 50, 0, - 0, 14, 226, 0, 16, 0, - 0, 0, 0, 0, 86, 14, - 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 64, 0, 0, - 0, 64, 0, 0, 0, 64, - 6, 25, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 56, 0, 0, 8, 242, 0, - 16, 0, 1, 0, 0, 0, - 166, 10, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 9, 0, + 8, 0, 0, 0, 86, 5, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, 0, 0, 50, 0, 0, 10, 242, 0, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 86, 5, 16, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 1, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 10, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 8, 242, 0, 16, 0, - 1, 0, 0, 0, 70, 14, + 0, 0, 0, 8, 242, 0, 16, 0, 1, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 11, 0, 0, 0, - 56, 0, 0, 9, 242, 0, - 16, 0, 2, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 86, 133, 32, 0, 0, 0, - 0, 0, 33, 0, 0, 0, - 50, 0, 0, 11, 242, 0, - 16, 0, 2, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 6, 128, 32, 0, 0, 0, - 0, 0, 33, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 50, 0, 0, 11, - 242, 0, 16, 0, 2, 0, + 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 166, 138, 32, 0, + 0, 0, 0, 0, 11, 0, + 0, 0, 56, 0, 0, 9, + 226, 0, 16, 0, 0, 0, + 0, 0, 6, 137, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 86, 133, 32, 0, 0, 0, 0, 0, 33, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 49, 0, - 0, 8, 34, 0, 16, 0, - 0, 0, 0, 0, 10, 16, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 50, 0, 0, 16, 114, 0, - 16, 0, 3, 0, 0, 0, - 6, 16, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 102, 102, 102, 191, + 0, 0, 50, 0, 0, 11, + 226, 0, 16, 0, 0, 0, + 0, 0, 6, 137, 32, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 205, 204, 204, 61, 205, 204, - 204, 61, 0, 0, 128, 63, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 33, 0, + 0, 0, 86, 14, 16, 0, 0, 0, 0, 0, 50, 0, - 0, 16, 114, 0, 16, 0, - 4, 0, 0, 0, 6, 16, + 0, 11, 226, 0, 16, 0, + 0, 0, 0, 0, 6, 137, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 166, 138, 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 2, 64, - 0, 0, 102, 102, 102, 191, - 205, 204, 76, 191, 0, 0, + 33, 0, 0, 0, 86, 14, + 16, 0, 0, 0, 0, 0, + 49, 0, 0, 8, 18, 0, + 16, 0, 2, 0, 0, 0, + 10, 16, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 16, + 226, 0, 16, 0, 2, 0, + 0, 0, 6, 16, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 102, 102, + 102, 191, 205, 204, 76, 191, + 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, + 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, + 54, 0, 0, 8, 82, 0, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 205, 204, + 204, 61, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, + 0, 0, 50, 0, 0, 10, + 34, 0, 16, 0, 3, 0, + 0, 0, 10, 16, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 102, 102, 102, 191, 1, 64, + 0, 0, 205, 204, 204, 61, + 55, 0, 0, 9, 114, 0, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 150, 7, + 16, 0, 2, 0, 0, 0, + 54, 0, 0, 5, 130, 0, + 16, 0, 2, 0, 0, 0, + 1, 64, 0, 0, 0, 0, 0, 0, 32, 0, 0, 11, - 194, 0, 16, 0, 0, 0, + 50, 0, 16, 0, 3, 0, 0, 0, 2, 64, 0, 0, + 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 2, 0, 0, 0, 6, 128, + 0, 0, 0, 0, 6, 128, 32, 0, 0, 0, 0, 0, 35, 0, 0, 0, 56, 0, - 0, 8, 130, 0, 16, 0, + 0, 8, 66, 0, 16, 0, 3, 0, 0, 0, 1, 64, 0, 0, 205, 204, 76, 61, 58, 16, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 54, 32, 0, 5, 114, 0, - 16, 0, 5, 0, 0, 0, - 246, 15, 16, 0, 3, 0, + 54, 32, 0, 5, 242, 0, + 16, 0, 4, 0, 0, 0, + 166, 10, 16, 0, 3, 0, 0, 0, 1, 0, 0, 8, - 130, 0, 16, 0, 3, 0, + 66, 0, 16, 0, 3, 0, 0, 0, 1, 64, 0, 0, 7, 0, 0, 0, 10, 16, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 13, 114, 0, 16, 0, - 6, 0, 0, 0, 70, 130, + 5, 0, 0, 0, 70, 130, 32, 6, 0, 0, 0, 0, - 12, 0, 0, 0, 58, 0, + 12, 0, 0, 0, 42, 0, 16, 0, 3, 0, 0, 0, 70, 130, 32, 6, 0, 0, 0, 0, 12, 0, 0, 0, - 58, 0, 16, 0, 3, 0, + 42, 0, 16, 0, 3, 0, 0, 0, 50, 0, 0, 19, - 114, 0, 16, 0, 7, 0, + 114, 0, 16, 0, 6, 0, 0, 0, 70, 130, 32, 134, 65, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, - 58, 0, 16, 0, 3, 0, + 42, 0, 16, 0, 3, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 0, 0, 64, @@ -564,168 +563,142 @@ const BYTE g_pointGS[] = 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 0, 50, 0, 0, 12, 114, 0, - 16, 0, 6, 0, 0, 0, - 70, 2, 16, 0, 7, 0, + 16, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 6, 0, 0, 0, 2, 64, 0, 0, 205, 204, 204, 61, 205, 204, 204, 61, 205, 204, 204, 61, 0, 0, 0, 0, 70, 2, - 16, 0, 6, 0, 0, 0, - 55, 0, 0, 9, 114, 0, - 16, 0, 3, 0, 0, 0, - 86, 5, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 70, 2, - 16, 0, 4, 0, 0, 0, - 54, 0, 0, 5, 34, 0, - 16, 0, 0, 0, 0, 0, + 16, 0, 5, 0, 0, 0, + 54, 0, 0, 5, 130, 0, + 16, 0, 5, 0, 0, 0, 1, 64, 0, 0, 0, 0, - 0, 0, 48, 0, 0, 1, - 33, 0, 0, 7, 130, 0, - 16, 0, 3, 0, 0, 0, - 26, 0, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 66, 0, 16, 0, 3, 0, 0, 0, 1, 64, 0, 0, - 4, 0, 0, 0, 3, 0, - 4, 3, 58, 0, 16, 0, - 3, 0, 0, 0, 0, 0, - 0, 11, 50, 0, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 191, - 0, 0, 0, 191, 0, 0, - 0, 0, 0, 0, 0, 0, - 70, 144, 144, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 10, 50, 0, - 16, 0, 4, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 4, 0, 0, 0, 70, 16, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 7, 0, 0, 0, 86, 5, - 16, 0, 4, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 5, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 4, 0, 0, 0, - 70, 142, 32, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 1, 33, 0, 0, 7, + 130, 0, 16, 0, 3, 0, + 0, 0, 42, 0, 16, 0, + 3, 0, 0, 0, 1, 64, 0, 0, 4, 0, 0, 0, - 6, 0, 16, 0, 4, 0, - 0, 0, 70, 14, 16, 0, - 7, 0, 0, 0, 50, 0, - 0, 11, 242, 0, 16, 0, - 4, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 166, 26, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 4, 0, 0, 0, + 3, 0, 4, 3, 58, 0, + 16, 0, 3, 0, 0, 0, + 0, 0, 0, 11, 50, 0, + 16, 0, 6, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 191, 0, 0, 0, 191, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 144, 144, 0, + 42, 0, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 10, + 50, 0, 16, 0, 6, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 0, + 16, 0, 6, 0, 0, 0, + 70, 16, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 242, 0, + 16, 0, 7, 0, 0, 0, + 86, 5, 16, 0, 6, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 50, 0, 0, 10, + 242, 0, 16, 0, 6, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 6, 0, 16, 0, + 6, 0, 0, 0, 70, 14, + 16, 0, 7, 0, 0, 0, 50, 0, 0, 11, 242, 0, - 16, 0, 4, 0, 0, 0, + 16, 0, 6, 0, 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 7, 0, 0, 0, - 246, 31, 32, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 166, 26, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 4, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 3, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 26, 144, - 144, 128, 65, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 31, 0, 4, 3, - 42, 0, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, - 114, 0, 16, 0, 7, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 18, 0, - 0, 1, 31, 0, 4, 3, - 58, 0, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 6, - 130, 48, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 5, 0, - 0, 0, 54, 0, 0, 5, - 114, 0, 16, 0, 7, 0, - 0, 0, 70, 2, 16, 0, - 5, 0, 0, 0, 18, 0, - 0, 1, 54, 0, 0, 5, - 114, 0, 16, 0, 7, 0, - 0, 0, 70, 2, 16, 0, - 6, 0, 0, 0, 21, 0, - 0, 1, 21, 0, 0, 1, - 54, 0, 0, 6, 130, 0, + 70, 14, 16, 0, 6, 0, + 0, 0, 50, 0, 0, 11, + 242, 0, 16, 0, 6, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 7, 0, + 0, 0, 246, 31, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 6, 0, 0, 0, 0, 0, + 0, 9, 130, 0, 16, 0, + 3, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 26, 144, 144, 128, 65, 0, + 0, 0, 42, 0, 16, 0, + 3, 0, 0, 0, 31, 0, + 4, 3, 10, 0, 16, 0, + 3, 0, 0, 0, 54, 0, + 0, 5, 242, 0, 16, 0, + 7, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 18, 0, 0, 1, 31, 0, + 4, 3, 26, 0, 16, 0, + 3, 0, 0, 0, 54, 0, + 0, 5, 242, 0, 16, 0, + 7, 0, 0, 0, 70, 14, + 16, 0, 4, 0, 0, 0, + 18, 0, 0, 1, 54, 0, + 0, 5, 242, 0, 16, 0, + 7, 0, 0, 0, 70, 14, 16, 0, 5, 0, 0, 0, - 58, 48, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 4, 0, - 0, 0, 54, 0, 0, 6, - 18, 32, 16, 0, 1, 0, - 0, 0, 10, 144, 144, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, - 34, 32, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, + 21, 0, 0, 1, 21, 0, + 0, 1, 54, 0, 0, 5, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 6, 0, 0, 0, 54, 0, + 0, 6, 18, 32, 16, 0, + 1, 0, 0, 0, 10, 144, + 144, 0, 42, 0, 16, 0, 3, 0, 0, 0, 54, 0, - 0, 8, 194, 32, 16, 0, - 1, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, + 0, 5, 34, 32, 16, 0, + 1, 0, 0, 0, 58, 0, + 16, 0, 3, 0, 0, 0, 54, 0, 0, 5, 242, 32, 16, 0, 2, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, - 242, 32, 16, 0, 3, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 54, 0, - 0, 5, 114, 32, 16, 0, - 4, 0, 0, 0, 70, 2, - 16, 0, 7, 0, 0, 0, - 54, 0, 0, 5, 130, 32, - 16, 0, 4, 0, 0, 0, - 58, 0, 16, 0, 5, 0, - 0, 0, 54, 0, 0, 6, - 114, 32, 16, 0, 5, 0, - 0, 0, 70, 18, 32, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 54, 0, 0, 5, - 130, 32, 16, 0, 5, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 54, 0, - 0, 6, 114, 32, 16, 0, - 6, 0, 0, 0, 70, 18, - 32, 0, 0, 0, 0, 0, + 114, 32, 16, 0, 3, 0, + 0, 0, 150, 7, 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, - 6, 0, 0, 0, 1, 64, + 0, 5, 242, 32, 16, 0, + 4, 0, 0, 0, 70, 14, + 16, 0, 7, 0, 0, 0, + 54, 0, 0, 6, 114, 32, + 16, 0, 5, 0, 0, 0, + 70, 18, 32, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 54, 0, 0, 6, 114, 32, + 16, 0, 6, 0, 0, 0, + 70, 18, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 0, 0, 3, 0, 0, 17, 0, 0, 0, 0, 0, - 30, 0, 0, 7, 34, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, + 30, 0, 0, 7, 66, 0, + 16, 0, 3, 0, 0, 0, + 42, 0, 16, 0, 3, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 22, 0, 0, 1, 62, 0, 0, 1, 83, 84, 65, 84, 148, 0, - 0, 0, 60, 0, 0, 0, + 0, 0, 56, 0, 0, 0, 8, 0, 0, 0, 4, 0, 0, 0, 11, 0, 0, 0, 24, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 5, 0, 0, 0, 1, 0, + 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, diff --git a/demo/d3d/shaders/pointPS.hlsl b/demo/d3d/shaders/pointPS.hlsl new file mode 100644 index 0000000..62c8ab4 --- /dev/null +++ b/demo/d3d/shaders/pointPS.hlsl @@ -0,0 +1,81 @@ +#include "shaderCommon.h" + +cbuffer constBuf : register(b0) +{ + PointShaderConst gParams; +}; + +Texture2D<float> shadowTexture : register(t0); // shadow map + +SamplerComparisonState shadowSampler : register(s0); // texture sample used to sample depth from shadow texture in this sample + +float sqr(float x) { return x * x; } + +float shadowSample(float4 lightOffsetPosition) +{ + float3 pos = float3(lightOffsetPosition.xyz / lightOffsetPosition.w); + //float3 uvw = (pos.xyz * 0.5) + vec3(0.5); + float3 uvw = (pos.xyz * float3(0.5, 0.5, 1.0)) + float3(0.5, 0.5, 0.0); + + // user clip + if (uvw.x < 0.0 || uvw.x > 1.0) + return 1.0; + if (uvw.y < 0.0 || uvw.y > 1.0) + return 1.0; + + float s = 0.0; + float radius = 0.002; + + // flip uv y-coordinate + uvw.y = 1.0f - uvw.y; + + [unroll] + for (int i = 0; i < 8; i++) + { + float2 shadowTaps = gParams.shadowTaps[i].xy; + shadowTaps.y = 1.0f - shadowTaps.y; + + //s += shadow2D(shadowTex, vec3(uvw.xy + shadowTaps[i] * radius, uvw.z)).r; + s += shadowTexture.SampleCmp(shadowSampler, uvw.xy + shadowTaps * radius, uvw.z); + } + s /= 8.0; + + return s; +} + +float4 pointPS(PointGeoOut input) : SV_TARGET +{ + const float spotMin = gParams.spotMin; + const float spotMax = gParams.spotMax; + + // calculate normal from texture coordinates + float3 normal; + normal.xy = input.texCoord * float2(2.0, -2.0) + float2(-1.0, 1.0); + float mag = dot(normal.xy, normal.xy); + if (mag > 1.0) + { + discard; // kill pixels outside circle + } + + normal.z = sqrt(1.0 - mag); + + if (gParams.mode == 2) + { + float alpha = normal.z * input.reflectance.w; + return float4(input.reflectance.xyz * alpha, alpha); + } + + // calculate lighting + float shadow = shadowSample(input.lightOffsetPosition); + + float3 lPos = float3(input.lightOffsetPosition.xyz / input.lightOffsetPosition.w); + float attenuation = max(smoothstep(spotMax, spotMin, dot(lPos.xy, lPos.xy)), 0.05); + + float3 diffuse = float3(0.9, 0.9, 0.9); + float3 reflectance = input.reflectance.xyz; + + float3 lo = diffuse * reflectance * max(0.0, sqr(-dot(input.viewLightDir, normal) * 0.5 + 0.5)) * max(0.2, shadow) * attenuation; + + const float tmp = 1.0 / 2.2; + return float4(pow(abs(lo), float3(tmp, tmp, tmp)), 1.0); +} diff --git a/demo/d3d11/shaders/pointPS.hlsl.h b/demo/d3d/shaders/pointPS.hlsl.h index 843b166..1320e1d 100644 --- a/demo/d3d11/shaders/pointPS.hlsl.h +++ b/demo/d3d/shaders/pointPS.hlsl.h @@ -11,7 +11,7 @@ // struct PointShaderConst // { // -// float4x4 modelview; // Offset: 0 +// float4x4 modelView; // Offset: 0 // float4x4 projection; // Offset: 64 // float4x4 lightTransform; // Offset: 128 // float4 colors[8]; // Offset: 192 @@ -47,12 +47,12 @@ // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_POSITION 0 xyzw 0 POS float -// TEXCOORD 0 xyzw 1 NONE float xy +// TEXCOORD 0 xy 1 NONE float xy // TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float xyz +// TEXCOORD 2 xyz 3 NONE float xyz // TEXCOORD 3 xyzw 4 NONE float xyzw -// TEXCOORD 4 xyzw 5 NONE float -// TEXCOORD 5 xyzw 6 NONE float +// TEXCOORD 4 xyz 5 NONE float +// TEXCOORD 5 xyz 6 NONE float // // // Output signature: @@ -71,7 +71,7 @@ dcl_input_ps linear v2.xyzw dcl_input_ps linear v3.xyz dcl_input_ps linear v4.xyzw dcl_output o0.xyzw -dcl_temps 4 +dcl_temps 6 mad r0.xy, v1.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000) dp2 r0.x, r0.xyxx, r0.xyxx lt r0.y, l(1.000000), r0.x @@ -90,59 +90,59 @@ mad r2.xyz, r1.xyzx, l(0.500000, 0.500000, 1.000000, 0.000000), l(0.500000, 0.50 lt r0.w, r2.x, l(0.000000) lt r1.z, l(1.000000), r2.x or r0.w, r0.w, r1.z +add r1.z, -cb0[20].y, l(1.000000) +mul r3.x, cb0[20].x, l(0.002000) +mul r3.y, r1.z, l(0.002000) +add r2.w, -r2.y, l(1.000000) +add r1.zw, r2.xxxw, r3.xxxy +sample_c_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z +add r1.w, -cb0[21].y, l(1.000000) +mul r3.x, cb0[21].x, l(0.002000) +mul r3.y, r1.w, l(0.002000) +add r3.xy, r2.xwxx, r3.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r1.w, r3.xyxx, t0.xxxx, s0, r2.z +add r3.x, -cb0[22].y, l(1.000000) +mul r4.x, cb0[22].x, l(0.002000) +mul r4.y, r3.x, l(0.002000) +add r3.xy, r2.xwxx, r4.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r3.x, r3.xyxx, t0.xxxx, s0, r2.z +add r3.y, -cb0[23].y, l(1.000000) +mul r4.x, cb0[23].x, l(0.002000) +mul r4.y, r3.y, l(0.002000) +add r3.yz, r2.xxwx, r4.xxyx +sample_c_indexable(texture2d)(float,float,float,float) r3.y, r3.yzyy, t0.xxxx, s0, r2.z +add r3.z, -cb0[24].y, l(1.000000) +mul r4.x, cb0[24].x, l(0.002000) +mul r4.y, r3.z, l(0.002000) +add r3.zw, r2.xxxw, r4.xxxy +sample_c_indexable(texture2d)(float,float,float,float) r3.z, r3.zwzz, t0.xxxx, s0, r2.z +add r3.w, -cb0[25].y, l(1.000000) +mul r4.x, cb0[25].x, l(0.002000) +mul r4.y, r3.w, l(0.002000) +add r4.xy, r2.xwxx, r4.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r3.w, r4.xyxx, t0.xxxx, s0, r2.z +add r4.x, -cb0[26].y, l(1.000000) +mul r5.x, cb0[26].x, l(0.002000) +mul r5.y, r4.x, l(0.002000) +add r4.xy, r2.xwxx, r5.xyxx +sample_c_indexable(texture2d)(float,float,float,float) r4.x, r4.xyxx, t0.xxxx, s0, r2.z +add r4.y, -cb0[27].y, l(1.000000) +mul r5.x, cb0[27].x, l(0.002000) +mul r5.y, r4.y, l(0.002000) +add r2.xw, r2.xxxw, r5.xxxy +sample_c_indexable(texture2d)(float,float,float,float) r2.x, r2.xwxx, t0.xxxx, s0, r2.z if_z r0.w lt r0.w, r2.y, l(0.000000) - lt r1.z, l(1.000000), r2.y - or r0.w, r0.w, r1.z + lt r2.y, l(1.000000), r2.y + or r0.w, r0.w, r2.y if_z r0.w - add r0.w, -cb0[20].y, l(1.000000) - mul r3.x, cb0[20].x, l(0.002000) - mul r3.y, r0.w, l(0.002000) - add r2.w, -r2.y, l(1.000000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r1.zwzz, t0.xxxx, s0, r2.z - add r1.z, -cb0[21].y, l(1.000000) - mul r3.x, cb0[21].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - add r1.z, -cb0[22].y, l(1.000000) - mul r3.x, cb0[22].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - add r1.z, -cb0[23].y, l(1.000000) - mul r3.x, cb0[23].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - add r1.z, -cb0[24].y, l(1.000000) - mul r3.x, cb0[24].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - add r1.z, -cb0[25].y, l(1.000000) - mul r3.x, cb0[25].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - add r1.z, -cb0[26].y, l(1.000000) - mul r3.x, cb0[26].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - add r1.z, -cb0[27].y, l(1.000000) - mul r3.x, cb0[27].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z + add r0.w, r1.w, r1.z + add r0.w, r3.x, r0.w + add r0.w, r3.y, r0.w + add r0.w, r3.z, r0.w + add r0.w, r3.w, r0.w + add r0.w, r4.x, r0.w + add r0.w, r2.x, r0.w mul r0.w, r0.w, l(0.125000) else mov r0.w, l(1.000000) @@ -178,10 +178,10 @@ ret const BYTE g_pointPS[] = { - 68, 88, 66, 67, 43, 46, - 192, 8, 211, 105, 212, 151, - 103, 8, 148, 62, 30, 192, - 144, 175, 1, 0, 0, 0, + 68, 88, 66, 67, 132, 161, + 61, 72, 143, 190, 218, 225, + 129, 194, 219, 86, 52, 88, + 26, 5, 1, 0, 0, 0, 244, 17, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 12, 4, 0, 0, 220, 4, @@ -236,7 +236,7 @@ const BYTE g_pointPS[] = 105, 110, 116, 83, 104, 97, 100, 101, 114, 67, 111, 110, 115, 116, 0, 109, 111, 100, - 101, 108, 118, 105, 101, 119, + 101, 108, 86, 105, 101, 119, 0, 102, 108, 111, 97, 116, 52, 120, 52, 0, 3, 0, 3, 0, 4, 0, 4, 0, @@ -360,7 +360,7 @@ const BYTE g_pointPS[] = 0, 0, 188, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 3, + 1, 0, 0, 0, 3, 3, 0, 0, 188, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, @@ -368,7 +368,7 @@ const BYTE g_pointPS[] = 0, 0, 188, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 7, + 3, 0, 0, 0, 7, 7, 0, 0, 188, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, @@ -376,11 +376,11 @@ const BYTE g_pointPS[] = 0, 0, 188, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 5, 0, 0, 0, 15, 0, + 5, 0, 0, 0, 7, 0, 0, 0, 188, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 6, 0, 0, 0, 15, 0, + 6, 0, 0, 0, 7, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, @@ -415,7 +415,7 @@ const BYTE g_pointPS[] = 4, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, - 0, 2, 4, 0, 0, 0, + 0, 2, 6, 0, 0, 0, 50, 0, 0, 15, 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, @@ -496,26 +496,8 @@ const BYTE g_pointPS[] = 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 1, 0, 0, 0, - 31, 0, 0, 3, 58, 0, - 16, 0, 0, 0, 0, 0, - 49, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 49, 0, - 0, 7, 66, 0, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 26, 0, 16, 0, 2, 0, - 0, 0, 60, 0, 0, 7, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, + 0, 0, 0, 9, 66, 0, 16, 0, 1, 0, 0, 0, - 31, 0, 0, 3, 58, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, 26, 128, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 1, 64, @@ -527,8 +509,8 @@ const BYTE g_pointPS[] = 1, 64, 0, 0, 111, 18, 3, 59, 56, 0, 0, 7, 34, 0, 16, 0, 3, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, + 0, 0, 42, 0, 16, 0, + 1, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 0, 0, 0, 8, 130, 0, 16, 0, 2, 0, 0, 0, @@ -540,16 +522,16 @@ const BYTE g_pointPS[] = 0, 0, 6, 12, 16, 0, 2, 0, 0, 0, 6, 4, 16, 0, 3, 0, 0, 0, - 71, 0, 0, 141, 194, 0, + 70, 0, 0, 141, 194, 0, 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, + 66, 0, 16, 0, 1, 0, 0, 0, 230, 10, 16, 0, 1, 0, 0, 0, 6, 112, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 2, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, + 0, 9, 130, 0, 16, 0, 1, 0, 0, 0, 26, 128, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 21, 0, @@ -562,231 +544,249 @@ const BYTE g_pointPS[] = 0, 0, 111, 18, 3, 59, 56, 0, 0, 7, 34, 0, 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, + 58, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, + 0, 7, 50, 0, 16, 0, + 3, 0, 0, 0, 198, 0, 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, + 70, 0, 16, 0, 3, 0, + 0, 0, 70, 0, 0, 141, 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, + 21, 0, 130, 0, 16, 0, + 1, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, 6, 112, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 2, 0, 0, 0, - 0, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 22, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 18, 0, + 16, 0, 3, 0, 0, 0, + 26, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 8, 18, 0, + 16, 0, 4, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 56, 0, 0, 7, + 34, 0, 16, 0, 4, 0, + 0, 0, 10, 0, 16, 0, + 3, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, + 0, 0, 0, 7, 50, 0, 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, - 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, - 6, 112, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 2, 0, 0, 0, - 0, 0, 0, 7, 130, 0, + 198, 0, 16, 0, 2, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 70, 0, + 0, 141, 194, 0, 0, 128, + 67, 85, 21, 0, 18, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 6, 112, 16, 0, + 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, + 42, 0, 16, 0, 2, 0, + 0, 0, 0, 0, 0, 9, + 34, 0, 16, 0, 3, 0, + 0, 0, 26, 128, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 23, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 8, + 18, 0, 16, 0, 4, 0, + 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 23, 0, 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 23, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, + 111, 18, 3, 59, 56, 0, + 0, 7, 34, 0, 16, 0, + 4, 0, 0, 0, 26, 0, 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, - 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, - 6, 112, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 2, 0, 0, 0, - 0, 0, 0, 7, 130, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 0, 0, 0, 7, + 98, 0, 16, 0, 3, 0, + 0, 0, 6, 3, 16, 0, + 2, 0, 0, 0, 6, 1, + 16, 0, 4, 0, 0, 0, + 70, 0, 0, 141, 194, 0, + 0, 128, 67, 85, 21, 0, + 34, 0, 16, 0, 3, 0, + 0, 0, 150, 5, 16, 0, + 3, 0, 0, 0, 6, 112, 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, + 0, 96, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 0, 0, 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, + 3, 0, 0, 0, 26, 128, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 56, 0, 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, + 4, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 24, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 56, 0, 0, 7, 34, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, + 16, 0, 4, 0, 0, 0, + 42, 0, 16, 0, 3, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 0, 0, 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, + 3, 0, 0, 0, 6, 12, 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, + 6, 4, 16, 0, 4, 0, + 0, 0, 70, 0, 0, 141, 194, 0, 0, 128, 67, 85, 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 230, 10, + 16, 0, 3, 0, 0, 0, 6, 112, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 2, 0, 0, 0, - 0, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 25, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 130, 0, + 16, 0, 3, 0, 0, 0, + 26, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 8, 18, 0, + 16, 0, 4, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 56, 0, 0, 7, + 34, 0, 16, 0, 4, 0, + 0, 0, 58, 0, 16, 0, + 3, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, + 0, 0, 0, 7, 50, 0, + 16, 0, 4, 0, 0, 0, + 198, 0, 16, 0, 2, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 70, 0, + 0, 141, 194, 0, 0, 128, + 67, 85, 21, 0, 130, 0, 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, + 70, 0, 16, 0, 4, 0, + 0, 0, 6, 112, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 42, 0, 16, 0, 2, 0, + 0, 0, 0, 0, 0, 9, + 18, 0, 16, 0, 4, 0, + 0, 0, 26, 128, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 26, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 8, + 18, 0, 16, 0, 5, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 26, 0, 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, - 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, - 6, 112, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 2, 0, 0, 0, - 0, 0, 0, 7, 130, 0, + 111, 18, 3, 59, 56, 0, + 0, 7, 34, 0, 16, 0, + 5, 0, 0, 0, 10, 0, + 16, 0, 4, 0, 0, 0, + 1, 64, 0, 0, 111, 18, + 3, 59, 0, 0, 0, 7, + 50, 0, 16, 0, 4, 0, + 0, 0, 198, 0, 16, 0, + 2, 0, 0, 0, 70, 0, + 16, 0, 5, 0, 0, 0, + 70, 0, 0, 141, 194, 0, + 0, 128, 67, 85, 21, 0, + 18, 0, 16, 0, 4, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 6, 112, 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, + 0, 96, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, + 2, 0, 0, 0, 0, 0, + 0, 9, 34, 0, 16, 0, + 4, 0, 0, 0, 26, 128, 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 26, 0, + 0, 0, 0, 0, 27, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 56, 0, 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, + 5, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, - 26, 0, 0, 0, 1, 64, + 27, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 56, 0, 0, 7, 34, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, + 16, 0, 5, 0, 0, 0, + 26, 0, 16, 0, 4, 0, 0, 0, 1, 64, 0, 0, 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, + 0, 7, 146, 0, 16, 0, + 2, 0, 0, 0, 6, 12, 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, + 6, 4, 16, 0, 5, 0, + 0, 0, 70, 0, 0, 141, 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, + 21, 0, 18, 0, 16, 0, + 2, 0, 0, 0, 198, 0, + 16, 0, 2, 0, 0, 0, 6, 112, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 2, 0, 0, 0, + 31, 0, 0, 3, 58, 0, + 16, 0, 0, 0, 0, 0, + 49, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 26, 0, 16, 0, 2, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 49, 0, + 0, 7, 34, 0, 16, 0, + 2, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 26, 0, 16, 0, 2, 0, + 0, 0, 60, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 2, 0, 0, 0, + 31, 0, 0, 3, 58, 0, + 16, 0, 0, 0, 0, 0, 0, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, + 58, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 1, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 27, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 27, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 10, 0, 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, - 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, - 6, 112, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 2, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 26, 0, 16, 0, + 3, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, 0, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, + 42, 0, 16, 0, 3, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 3, 0, 0, 0, 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 4, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 2, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, @@ -920,7 +920,7 @@ const BYTE g_pointPS[] = 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 148, 0, 0, 0, 101, 0, 0, 0, - 4, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 75, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, diff --git a/demo/d3d/shaders/pointShadowPS.hlsl b/demo/d3d/shaders/pointShadowPS.hlsl new file mode 100644 index 0000000..d8fcff8 --- /dev/null +++ b/demo/d3d/shaders/pointShadowPS.hlsl @@ -0,0 +1,17 @@ +#include "shaderCommon.h" + +cbuffer constBuf : register(b0) +{ + PointShaderConst gParams; +}; + +void pointShadowPS(PointGeoOut input) +{ + // calculate normal from texture coordinates + float2 normal = input.texCoord.xy - float2(0.5, 0.5); + float mag = dot(normal.xy, normal.xy); + if (mag > 0.5 * 0.5) + { + discard; // kill pixels outside circle + } +} diff --git a/demo/d3d/shaders/pointShadowPS.hlsl.h b/demo/d3d/shaders/pointShadowPS.hlsl.h new file mode 100644 index 0000000..ee3c121 --- /dev/null +++ b/demo/d3d/shaders/pointShadowPS.hlsl.h @@ -0,0 +1,157 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_POSITION 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 xyzw 2 NONE float +// TEXCOORD 2 xyz 3 NONE float +// TEXCOORD 3 xyzw 4 NONE float +// TEXCOORD 4 xyz 5 NONE float +// TEXCOORD 5 xyz 6 NONE float +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// no Output +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_input_ps linear v1.xy +dcl_temps 1 +add r0.xy, v1.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000) +dp2 r0.x, r0.xyxx, r0.xyxx +lt r0.x, l(0.250000), r0.x +discard_nz r0.x +ret +// Approximately 5 instruction slots used +#endif + +const BYTE g_pointShadowPS[] = +{ + 68, 88, 66, 67, 124, 19, + 253, 39, 130, 123, 235, 41, + 10, 2, 21, 191, 153, 200, + 242, 4, 1, 0, 0, 0, + 192, 2, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 172, 0, 0, 0, 124, 1, + 0, 0, 140, 1, 0, 0, + 36, 2, 0, 0, 82, 68, + 69, 70, 112, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 60, 0, 0, 0, 0, 5, + 255, 255, 0, 1, 0, 0, + 60, 0, 0, 0, 82, 68, + 49, 49, 60, 0, 0, 0, + 24, 0, 0, 0, 32, 0, + 0, 0, 40, 0, 0, 0, + 36, 0, 0, 0, 12, 0, + 0, 0, 0, 0, 0, 0, + 77, 105, 99, 114, 111, 115, + 111, 102, 116, 32, 40, 82, + 41, 32, 72, 76, 83, 76, + 32, 83, 104, 97, 100, 101, + 114, 32, 67, 111, 109, 112, + 105, 108, 101, 114, 32, 54, + 46, 51, 46, 57, 54, 48, + 48, 46, 49, 54, 51, 56, + 52, 0, 171, 171, 73, 83, + 71, 78, 200, 0, 0, 0, + 7, 0, 0, 0, 8, 0, + 0, 0, 176, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 188, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 3, 3, + 0, 0, 188, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 15, 0, + 0, 0, 188, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 7, 0, + 0, 0, 188, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 4, 0, 0, 0, 15, 0, + 0, 0, 188, 0, 0, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 5, 0, 0, 0, 7, 0, + 0, 0, 188, 0, 0, 0, + 5, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 6, 0, 0, 0, 7, 0, + 0, 0, 83, 86, 95, 80, + 79, 83, 73, 84, 73, 79, + 78, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 171, + 171, 171, 79, 83, 71, 78, + 8, 0, 0, 0, 0, 0, + 0, 0, 8, 0, 0, 0, + 83, 72, 69, 88, 144, 0, + 0, 0, 80, 0, 0, 0, + 36, 0, 0, 0, 106, 8, + 0, 1, 98, 16, 0, 3, + 50, 16, 16, 0, 1, 0, + 0, 0, 104, 0, 0, 2, + 1, 0, 0, 0, 0, 0, + 0, 10, 50, 0, 16, 0, + 0, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 191, 0, 0, 0, 191, + 0, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 70, 0, 16, 0, + 0, 0, 0, 0, 70, 0, + 16, 0, 0, 0, 0, 0, + 49, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 62, 10, 0, 16, 0, + 0, 0, 0, 0, 13, 0, + 4, 3, 10, 0, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 83, 84, 65, 84, + 148, 0, 0, 0, 5, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/demo/d3d11/shaders/pointVS.hlsl b/demo/d3d/shaders/pointVS.hlsl index 6ab4b6c..ecd1e38 100644 --- a/demo/d3d11/shaders/pointVS.hlsl +++ b/demo/d3d/shaders/pointVS.hlsl @@ -7,20 +7,19 @@ cbuffer constBuf : register(b0) PointVertexOut pointVS(PointVertexIn input, uint instance : SV_VertexID) { - const float4 gl_Vertex = input.position; - const float4x4 gl_ModelViewMatrix = gParams.modelview; + const float4 modelPosition = input.position; + const float4x4 modelViewMatrix = gParams.modelView; float density = input.density; int phase = input.phase; // calculate window-space point size - float4 viewPos = mul(gl_ModelViewMatrix, float4(gl_Vertex.xyz, 1.0)); + float4 viewPos = mul(modelViewMatrix, float4(modelPosition.xyz, 1.0)); PointVertexOut output; - output.position = viewPos; + output.viewPosition = viewPos; output.density = density; output.phase = phase; - output.vertex = gl_Vertex; - + output.modelPosition = modelPosition; return output; } diff --git a/demo/d3d11/shaders/pointVS.hlsl.h b/demo/d3d/shaders/pointVS.hlsl.h index b78b3f1..5051a59 100644 --- a/demo/d3d11/shaders/pointVS.hlsl.h +++ b/demo/d3d/shaders/pointVS.hlsl.h @@ -11,7 +11,7 @@ // struct PointShaderConst // { // -// float4x4 modelview; // Offset: 0 +// float4x4 modelView; // Offset: 0 // float4x4 projection; // Offset: 64 // float4x4 lightTransform; // Offset: 128 // float4 colors[8]; // Offset: 192 @@ -83,10 +83,10 @@ ret const BYTE g_pointVS[] = { - 68, 88, 66, 67, 195, 164, - 148, 248, 252, 197, 222, 222, - 84, 139, 94, 6, 43, 78, - 110, 120, 1, 0, 0, 0, + 68, 88, 66, 67, 214, 36, + 191, 126, 186, 99, 189, 31, + 31, 225, 65, 123, 198, 88, + 217, 159, 1, 0, 0, 0, 192, 6, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 176, 3, 0, 0, 68, 4, @@ -126,7 +126,7 @@ const BYTE g_pointVS[] = 116, 83, 104, 97, 100, 101, 114, 67, 111, 110, 115, 116, 0, 109, 111, 100, 101, 108, - 118, 105, 101, 119, 0, 102, + 86, 105, 101, 119, 0, 102, 108, 111, 97, 116, 52, 120, 52, 0, 3, 0, 3, 0, 4, 0, 4, 0, 0, 0, diff --git a/demo/d3d11/shaders/shaderCommon.h b/demo/d3d/shaders/shaderCommon.h index 176c97d..2a9cc67 100644 --- a/demo/d3d11/shaders/shaderCommon.h +++ b/demo/d3d/shaders/shaderCommon.h @@ -1,7 +1,7 @@ struct MeshShaderConst { - float4x4 modelviewprojection; - float4x4 modelview; + float4x4 modelViewProjection; + float4x4 modelView; float4x4 objectTransform; float4x4 lightTransform; @@ -25,12 +25,12 @@ struct MeshShaderConst int grid; int tex; int colorArray; - int _pad2; + int increaseGfxLoadForAsyncComputeTesting; }; struct DebugRenderConst { - float4x4 modelview; + float4x4 modelView; float4x4 projection; }; @@ -49,14 +49,22 @@ struct MeshVertexOut float4 position : SV_POSITION; //float3 normal : NORMAL; //float4 color : COLOR; - float4 texCoord[8] : TEXCOORD; //float clipDistance[1] : CLIP_DISTANCE; + + float3 worldNormal: TEXCOORD0; ///< Normal in world space + float4 lightOffsetPosition: TEXCOORD1; ///< Position in light space (offset slightly) + float3 viewLightDir: TEXCOORD2; ///< Light direction in view space + float3 worldPosition: TEXCOORD3; ///< Position in worldspace + float4 color: TEXCOORD4; ///< Color + float2 texCoord: TEXCOORD5; ///< Tex coords + float4 secondaryColor: TEXCOORD6; ///< Secondary color + float4 viewPosition: TEXCOORD7; ///< Position in view space }; #endif struct PointShaderConst { - float4x4 modelview; + float4x4 modelView; float4x4 projection; float4x4 lightTransform; @@ -87,26 +95,33 @@ struct PointVertexIn struct PointVertexOut { - float4 position : POSITION; + float4 viewPosition : POSITION; float density : DENSITY; int phase : PHASE; - float4 vertex : VERTEX; + float4 modelPosition : VERTEX; }; struct PointGeoOut { float4 position : SV_POSITION; - float4 texCoord[6] : TEXCOORD; + + float2 texCoord: TEXCOORD0; + float4 lightOffsetPosition: TEXCOORD1; + float3 viewLightDir: TEXCOORD2; //< Light direction in view space + float4 reflectance: TEXCOORD3; + float3 modelPosition: TEXCOORD4; ///< Model space position + float3 viewPosition : TEXCOORD5; ///< View space position }; + #endif struct FluidShaderConst { - float4x4 modelviewprojection; - float4x4 modelview; + float4x4 modelViewProjection; + float4x4 modelView; float4x4 projection; // ogl projection - float4x4 modelview_inverse; - float4x4 projection_inverse; // ogl inverse projection + float4x4 inverseModelView; + float4x4 inverseProjection; // ogl inverse projection float4 invTexScale; @@ -149,25 +164,27 @@ struct FluidVertexIn struct FluidVertexOut { float4 position : POSITION; - float4 texCoord[6] : TEXCOORD; + float4 bounds: TEXCOORD0; // xmin, xmax, ymin, ymax + float4 invQ0: TEXCOORD1; + float4 invQ1: TEXCOORD2; + float4 invQ2: TEXCOORD3; + float4 invQ3: TEXCOORD4; + float4 ndcPos: TEXCOORD5; /// Position in normalized device coordinates (ie /w) }; struct FluidGeoOut { float4 position : SV_POSITION; - float4 texCoord[4] : TEXCOORD; -}; - -struct PassthroughVertexIn -{ - float2 position : POSITION; - float2 texCoord : TEXCOORD; + float4 invQ0 : TEXCOORD0; + float4 invQ1 : TEXCOORD1; + float4 invQ2 : TEXCOORD2; + float4 invQ3 : TEXCOORD3; }; struct PassthroughVertexOut { float4 position : SV_POSITION; - float2 texCoord[1] : TEXCOORD; + float2 texCoord : TEXCOORD; }; #endif @@ -204,7 +221,7 @@ struct DiffuseShaderConst struct DiffuseVertexIn { float4 position : POSITION; // lifetime in w - float4 velocity : VELOCITY; + float4 velocity : VELOCITY; // holding velocity in u }; struct DiffuseVertexOut @@ -229,7 +246,7 @@ struct DiffuseGeometryOut float4 lightDir : LIGHTDIR; float4 color : COLOR; - float4 uv : UV; + float2 uv : UV; }; diff --git a/demo/d3d/shadersDemoContext.cpp b/demo/d3d/shadersDemoContext.cpp new file mode 100644 index 0000000..d1e7c99 --- /dev/null +++ b/demo/d3d/shadersDemoContext.cpp @@ -0,0 +1,184 @@ +// to fix min max windows macros +#define NOMINMAX + +// SDL +#include <SDL_syswm.h> + +// This +#include "shadersDemoContext.h" + +DemoContext* s_context = NULL; + +void SetDemoContext(DemoContext* context) +{ + s_context = context; +} + +DemoContext* GetDemoContext() +{ + return s_context; +} + +void ReshapeRender(SDL_Window* window) +{ + int width, height; + SDL_GetWindowSize(window, &width, &height); + s_context->onSizeChanged(width, height, false); +} + +void DestroyRender() +{ + if (s_context) + { + delete s_context; + s_context = nullptr; + } +} + +void StartFrame(Vec4 colorIn) { s_context->startFrame(colorIn); } +void EndFrame() { s_context->endFrame(); } +void PresentFrame(bool fullSync) { s_context->presentFrame(fullSync); } + +void FlushGraphicsAndWait() { s_context->flushGraphicsAndWait(); } + +void ReadFrame(int* backbuffer, int width, int height) +{ + assert(0); +} + +void GetViewRay(int x, int y, Vec3& origin, Vec3& dir) { return s_context->getViewRay(x, y, origin, dir); } + +void SetFillMode(bool wire) { s_context->setFillMode(wire); } + +void SetCullMode(bool enabled) { s_context->setCullMode(enabled); } + +void SetView(Matrix44 view, Matrix44 projection) { return s_context->setView(view, projection); } + +FluidRenderer* CreateFluidRenderer(uint32_t width, uint32_t height) { return s_context->createFluidRenderer(width, height); } + +void DestroyFluidRenderer(FluidRenderer* renderer) { return s_context->destroyFluidRenderer(renderer); } + +FluidRenderBuffers* CreateFluidRenderBuffers(int numParticles, bool enableInterop) { return s_context->createFluidRenderBuffers(numParticles, enableInterop); } + +void UpdateFluidRenderBuffers(FluidRenderBuffers* buffers, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices) +{ + s_context->updateFluidRenderBuffers(buffers, particles, densities, anisotropy1, anisotropy2, anisotropy3, numParticles, indices, numIndices); +} + +void UpdateFluidRenderBuffers(FluidRenderBuffers* buffers, NvFlexSolver* flex, bool anisotropy, bool density) { return s_context->updateFluidRenderBuffers(buffers, flex, anisotropy, density); } + +void DestroyFluidRenderBuffers(FluidRenderBuffers* buffers) { return s_context->destroyFluidRenderBuffers(buffers); } + +ShadowMap* ShadowCreate() { return s_context->shadowCreate(); } + +void ShadowDestroy(ShadowMap* map) { s_context->shadowDestroy(map); } + +void ShadowBegin(ShadowMap* map) { s_context->shadowBegin(map); } + +void ShadowEnd() { s_context->shadowEnd(); } + + +void BindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float bias, Vec4 fogColor) +{ + s_context->bindSolidShader(lightPos, lightTarget, lightTransform, shadowMap, bias, fogColor); +} + +void UnbindSolidShader() { s_context->unbindSolidShader(); } + +void DrawMesh(const Mesh* m, Vec3 color) { s_context->drawMesh(m, color); } + +void DrawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex, float expand, bool twosided, bool smooth) +{ + s_context->drawCloth(positions, normals, uvs, indices, numTris, numPositions, colorIndex, expand, twosided, smooth); +} + +void DrawRope(Vec4* positions, int* indices, int numIndices, float radius, int color) +{ + s_context->drawRope(positions, indices, numIndices, radius, color); +} + +void DrawPlane(const Vec4& p, bool color) { s_context->drawPlane(p, color); } + +void DrawPlanes(Vec4* planes, int n, float bias) { s_context->drawPlanes(planes, n, bias); } + +GpuMesh* CreateGpuMesh(const Mesh* m) +{ + return m ? s_context->createGpuMesh(m) : nullptr; +} + +void DestroyGpuMesh(GpuMesh* m) { s_context->destroyGpuMesh(m); } + +void DrawGpuMesh(GpuMesh* m, const Matrix44& xform, const Vec3& color) { s_context->drawGpuMesh(m, xform, color); } + +void DrawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const Vec3& color) { s_context->drawGpuMeshInstances(m, xforms, n, color); } + +void DrawPoints(FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, bool showDensity) +{ + s_context->drawPoints(buffers, n, offset, radius, screenWidth, screenAspect, fov, lightPos, lightTarget, lightTransform, shadowTex, showDensity); +} + +void RenderEllipsoids(FluidRenderer* renderer, FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, Vec4 color, float blur, float ior, bool debug) +{ + s_context->renderEllipsoids(renderer, buffers, n, offset, radius, screenWidth, screenAspect, fov, lightPos, lightTarget, lightTransform, shadowMap, color, blur, ior, debug); +} + +DiffuseRenderBuffers* CreateDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop) { return s_context->createDiffuseRenderBuffers(numDiffuseParticles, enableInterop); } + +void DestroyDiffuseRenderBuffers(DiffuseRenderBuffers* buffers) { return s_context->destroyDiffuseRenderBuffers(buffers); } + +void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, Vec4* diffusePositions, Vec4* diffuseVelocities, int numDiffuseParticles) +{ + s_context->updateDiffuseRenderBuffers(buffers, diffusePositions, diffuseVelocities, numDiffuseParticles); +} + +void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, NvFlexSolver* solver) { return s_context->updateDiffuseRenderBuffers(buffers, solver); } + +int GetNumDiffuseRenderParticles(DiffuseRenderBuffers* buffers) { return s_context->getNumDiffuseRenderParticles(buffers); } + +void RenderDiffuse(FluidRenderer* render, DiffuseRenderBuffers* buffers, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadowEnabled, bool front) +{ + s_context->drawDiffuse(render, buffers, n, radius, screenWidth, screenAspect, fov, color, lightPos, lightTarget, lightTransform, shadowMap, motionBlur, inscatter, outscatter, shadowEnabled, front); +} + +void BeginLines() { s_context->beginLines(); } + +void DrawLine(const Vec3& p, const Vec3& q, const Vec4& color) { s_context->drawLine(p, q, color); } + +void EndLines() { s_context->endLines(); } + +void BeginPoints(float size) {} +void DrawPoint(const Vec3& p, const Vec4& color) {} +void EndPoints() {} + +float RendererGetDeviceTimestamps(unsigned long long* begin, unsigned long long* end, unsigned long long* freq) +{ + return s_context->rendererGetDeviceTimestamps(begin, end, freq); +} + +void* GetGraphicsCommandQueue() { return s_context->getGraphicsCommandQueue(); } +void GraphicsTimerBegin() { s_context->graphicsTimerBegin(); } +void GraphicsTimerEnd() { s_context->graphicsTimerEnd(); } + +void StartGpuWork() { s_context->startGpuWork(); } +void EndGpuWork() { s_context->endGpuWork(); } + +void DrawImguiGraph() { return s_context->drawImguiGraph(); } + +void GetRenderDevice(void** deviceOut, void** contextOut) { return s_context->getRenderDevice(deviceOut, contextOut); } + +void InitRender(const RenderInitOptions& options) +{ + if (!s_context) + { + assert(false && "A context has not been set with SetDemoContext!"); + return; + } + if (!s_context->initialize(options)) + { + assert(!"Unable to initialize context!"); + delete s_context; + s_context = nullptr; + return; + } +} + diff --git a/demo/d3d/shadersDemoContext.h b/demo/d3d/shadersDemoContext.h new file mode 100644 index 0000000..030dee6 --- /dev/null +++ b/demo/d3d/shadersDemoContext.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#include "../shaders.h" + +#include "demoContext.h" + +// This file implements the Shaders.h 'interface' through the DemoContext interface + +void SetDemoContext(DemoContext* context); +DemoContext* GetDemoContext(); + diff --git a/demo/d3d11/appD3D11Ctx.cpp b/demo/d3d11/appD3D11Ctx.cpp index 85129e5..2d6b721 100644 --- a/demo/d3d11/appD3D11Ctx.cpp +++ b/demo/d3d11/appD3D11Ctx.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. * * NVIDIA CORPORATION and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation @@ -25,45 +25,56 @@ #include <SDL_video.h> #include <SDL_syswm.h> -AppGraphProfiler* appGraphCreateProfiler(AppGraphCtx* ctx); -void appGraphProfilerFrameBegin(AppGraphProfiler* profiler); -void appGraphProfilerFrameEnd(AppGraphProfiler* profiler); -void appGraphProfilerEnable(AppGraphProfiler* profiler, bool enabled); -void appGraphProfilerBegin(AppGraphProfiler* profiler, const char* label); -void appGraphProfilerEnd(AppGraphProfiler* profiler, const char* label); -bool appGraphProfilerGet(AppGraphProfiler* profiler, const char** plabel, float* cpuTime, float* gpuTime, int index); -void appGraphReleaseProfiler(AppGraphProfiler* profiler); +namespace +{ + // COM object release utilities + template <class T> + void inline COMRelease(T& t) + { + if (t) t->Release(); + t = nullptr; + } + + template <class T> + void inline COMRelease(T& t, UINT arraySize) + { + for (UINT i = 0; i < arraySize; i++) + { + if (t[i]) t[i]->Release(); + t[i] = nullptr; + } + } +} -AppGraphCtx::AppGraphCtx() +AppGraphProfilerD3D11* appGraphCreateProfilerD3D11(AppGraphCtx* ctx); +void appGraphProfilerD3D11FrameBegin(AppGraphProfilerD3D11* profiler); +void appGraphProfilerD3D11FrameEnd(AppGraphProfilerD3D11* profiler); +void appGraphProfilerD3D11Enable(AppGraphProfilerD3D11* profiler, bool enabled); +void appGraphProfilerD3D11Begin(AppGraphProfilerD3D11* profiler, const char* label); +void appGraphProfilerD3D11End(AppGraphProfilerD3D11* profiler, const char* label); +bool appGraphProfilerD3D11Get(AppGraphProfilerD3D11* profiler, const char** plabel, float* cpuTime, float* gpuTime, int index); +void appGraphReleaseProfiler(AppGraphProfilerD3D11* profiler); + +AppGraphCtxD3D11::AppGraphCtxD3D11() { - m_profiler = appGraphCreateProfiler(this); - memset(&m_viewport, 0, sizeof(m_viewport)); + m_profiler = appGraphCreateProfilerD3D11(cast_from_AppGraphCtxD3D11(this)); } -AppGraphCtx::~AppGraphCtx() +AppGraphCtxD3D11::~AppGraphCtxD3D11() { - AppGraphCtxReleaseRenderTarget(this); - - COMRelease(m_swapChain); - COMRelease(m_backBuffer); - COMRelease(m_rtv); - COMRelease(m_depthStencil); - COMRelease(m_dsv); - COMRelease(m_depthSRV); - COMRelease(m_depthState); - COMRelease(m_blendState); - COMRelease(m_resolvedTarget); - COMRelease(m_resolvedTargetSRV); - COMRelease(m_deviceContext); + AppGraphCtxReleaseRenderTargetD3D11(cast_from_AppGraphCtxD3D11(this)); + COMRelease(m_device); + COMRelease(m_deviceContext); + COMRelease(m_depthState); appGraphReleaseProfiler(m_profiler); m_profiler = nullptr; } -AppGraphCtx* AppGraphCtxCreate(int deviceID) +AppGraphCtx* AppGraphCtxCreateD3D11(int deviceID) { - AppGraphCtx* context = new AppGraphCtx; + AppGraphCtxD3D11* context = new AppGraphCtxD3D11; HRESULT hr = S_OK; @@ -148,30 +159,71 @@ AppGraphCtx* AppGraphCtxCreate(int deviceID) return nullptr; } - // create blend state - D3D11_BLEND_DESC blendStateDesc = {}; - blendStateDesc.RenderTarget[0].BlendEnable = TRUE; - blendStateDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; - blendStateDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; - blendStateDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; - blendStateDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; - blendStateDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO; - blendStateDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; - blendStateDesc.RenderTarget[0].RenderTargetWriteMask = 0x0f; - - if (hr = context->m_device->CreateBlendState(&blendStateDesc, &context->m_blendState)) + return cast_from_AppGraphCtxD3D11(context); +} + +void AppGraphCtxInitRenderTargetD3D11(AppGraphCtx* context, SDL_Window* window, bool fullscreen, int numMSAASamples); + +bool AppGraphCtxUpdateSizeD3D11(AppGraphCtx* contextIn, SDL_Window* window, bool fullscreen, int numMSAASamples) +{ + auto context = cast_to_AppGraphCtxD3D11(contextIn); + + // TODO: fix iflip fullscreen support + fullscreen = false; + + bool sizeChanged = false; + int width, height; + SDL_GetWindowSize(window, &width, &height); + + // sync with window + { + HWND hWnd = nullptr; + // get Windows handle to this SDL window + SDL_SysWMinfo winInfo; + SDL_VERSION(&winInfo.version); + if (SDL_GetWindowWMInfo(window, &winInfo)) + { + if (winInfo.subsystem == SDL_SYSWM_WINDOWS) + { + hWnd = winInfo.info.win.window; + } + } + context->m_hWnd = hWnd; + context->m_fullscreen = fullscreen; + + HRESULT hr = S_OK; + + if (context->m_winW != width || context->m_winH != height) + { + context->m_winW = width; + context->m_winH = height; + sizeChanged = true; + context->m_valid = (context->m_winW != 0 && context->m_winH != 0); + } + } + + if (sizeChanged) { - delete context; - return nullptr; + const bool wasValid = context->m_valid; + // Release + AppGraphCtxReleaseRenderTargetD3D11(cast_from_AppGraphCtxD3D11(context)); + // If was valid recreate it + if (wasValid) + { + // Reset the size (the release sets it, to 0,0) + context->m_winW = width; + context->m_winH = height; + // + AppGraphCtxInitRenderTargetD3D11(cast_from_AppGraphCtxD3D11(context), window, fullscreen, numMSAASamples); + } } - return context; + return context->m_valid; } -void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool fullscreen, int samples) +void AppGraphCtxInitRenderTargetD3D11(AppGraphCtx* contextIn, SDL_Window* window, bool fullscreen, int numMSAASamples) { - // TODO: fix iflip fullscreen support - fullscreen = false; + auto context = cast_to_AppGraphCtxD3D11(contextIn); HWND hWnd = nullptr; // get Windows handle to this SDL window @@ -187,15 +239,11 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool context->m_hWnd = hWnd; context->m_fullscreen = fullscreen; - HRESULT hr = S_OK; - - RECT rc; - GetClientRect(context->m_hWnd, &rc); - UINT width = rc.right - rc.left; - UINT height = rc.bottom - rc.top; + // Desired size + int width, height; + SDL_GetWindowSize(window, &width, &height); - context->m_winW = width; - context->m_winH = height; + HRESULT hr = S_OK; // enumerate devices IDXGIFactory1* pFactory = NULL; @@ -207,15 +255,15 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool DXGI_SWAP_CHAIN_DESC desc; ZeroMemory(&desc, sizeof(desc)); desc.BufferCount = 1; - desc.BufferDesc.Width = context->m_winW; - desc.BufferDesc.Height = context->m_winH; + desc.BufferDesc.Width = width; + desc.BufferDesc.Height = height; desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; desc.BufferDesc.RefreshRate.Numerator = 0; desc.BufferDesc.RefreshRate.Denominator = 0; desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; // DXGI_SWAP_EFFECT_FLIP_DISCARD; desc.OutputWindow = context->m_hWnd; - desc.SampleDesc.Count = samples; + desc.SampleDesc.Count = numMSAASamples; desc.SampleDesc.Quality = 0; desc.Windowed = TRUE; // m_fullscreen ? FALSE : TRUE; desc.Flags = 0u; @@ -249,8 +297,8 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool // configure scissor and viewport { - context->m_viewport.Width = float(context->m_winW); - context->m_viewport.Height = float(context->m_winH); + context->m_viewport.Width = float(width); + context->m_viewport.Height = float(height); context->m_viewport.MaxDepth = 1.f; } @@ -282,7 +330,7 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool texDesc.MipLevels = 1; texDesc.ArraySize = 1; texDesc.Format = DXGI_FORMAT_R32_TYPELESS; // DXGI_FORMAT_R24G8_TYPELESS - texDesc.SampleDesc.Count = samples; + texDesc.SampleDesc.Count = numMSAASamples; texDesc.SampleDesc.Quality = 0u; texDesc.Usage = D3D11_USAGE_DEFAULT; texDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE; @@ -296,7 +344,7 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool D3D11_DEPTH_STENCIL_VIEW_DESC viewDesc = {}; viewDesc.Format = DXGI_FORMAT_D32_FLOAT; - viewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMS; + viewDesc.ViewDimension = (numMSAASamples > 1) ? D3D11_DSV_DIMENSION_TEXTURE2DMS : D3D11_DSV_DIMENSION_TEXTURE2D; viewDesc.Flags = 0u; viewDesc.Texture2D.MipSlice = 0; @@ -307,7 +355,7 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; srvDesc.Format = DXGI_FORMAT_R32_FLOAT; - srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS; + srvDesc.ViewDimension = (numMSAASamples > 1) ? D3D11_SRV_DIMENSION_TEXTURE2DMS : D3D11_SRV_DIMENSION_TEXTURE2D; srvDesc.Texture2D.MipLevels = 1; srvDesc.Texture2D.MostDetailedMip = 0; @@ -316,42 +364,12 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool return; } } - - // resolved texture target (for refraction / scene sampling) - { - D3D11_TEXTURE2D_DESC texDesc = {}; - texDesc.Width = width; - texDesc.Height = height; - texDesc.MipLevels = 1; - texDesc.ArraySize = 1; - texDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - texDesc.SampleDesc.Count = 1; - texDesc.SampleDesc.Quality = 0u; - texDesc.Usage = D3D11_USAGE_DEFAULT; - texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE; - texDesc.CPUAccessFlags = 0; - texDesc.MiscFlags = 0; - - if (hr = context->m_device->CreateTexture2D(&texDesc, nullptr, &context->m_resolvedTarget)) - { - return; - } - - D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; - srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; - srvDesc.Texture2D.MipLevels = 1; - srvDesc.Texture2D.MostDetailedMip = 0; - - if (hr = context->m_device->CreateShaderResourceView(context->m_resolvedTarget, &srvDesc, &context->m_resolvedTargetSRV)) - { - return; - } - } } -void AppGraphCtxReleaseRenderTarget(AppGraphCtx* context) +void AppGraphCtxReleaseRenderTargetD3D11(AppGraphCtx* contextIn) { + auto context = cast_to_AppGraphCtxD3D11(contextIn); + if (context->m_swapChain == nullptr) { return; @@ -361,68 +379,78 @@ void AppGraphCtxReleaseRenderTarget(AppGraphCtx* context) context->m_swapChain->GetFullscreenState(&bFullscreen, nullptr); if (bFullscreen == TRUE) context->m_swapChain->SetFullscreenState(FALSE, nullptr); - COMRelease(context->m_swapChain); COMRelease(context->m_backBuffer); + COMRelease(context->m_swapChain); COMRelease(context->m_rtv); COMRelease(context->m_depthStencil); COMRelease(context->m_dsv); COMRelease(context->m_depthSRV); - COMRelease(context->m_resolvedTarget); - COMRelease(context->m_resolvedTargetSRV); + + context->m_valid = false; + context->m_winW = 0u; + context->m_winH = 0u; } -void AppGraphCtxRelease(AppGraphCtx* context) +void AppGraphCtxReleaseD3D11(AppGraphCtx* context) { if (context == nullptr) return; - delete context; + delete cast_to_AppGraphCtxD3D11(context); } -void AppGraphCtxResolveFrame(AppGraphCtx* context) +void AppGraphCtxFrameStartD3D11(AppGraphCtx* contextIn, AppGraphColor clearColor) { - context->m_deviceContext->ResolveSubresource(context->m_resolvedTarget, 0, context->m_backBuffer, 0, DXGI_FORMAT_R8G8B8A8_UNORM); -} + auto context = cast_to_AppGraphCtxD3D11(contextIn); -void AppGraphCtxFrameStart(AppGraphCtx* context, float clearColor[4]) -{ - appGraphProfilerFrameBegin(context->m_profiler); + appGraphProfilerD3D11FrameBegin(context->m_profiler); context->m_deviceContext->RSSetViewports(1, &context->m_viewport); context->m_deviceContext->RSSetScissorRects(0, nullptr); context->m_deviceContext->OMSetRenderTargets(1, &context->m_rtv, context->m_dsv); - context->m_deviceContext->ClearRenderTargetView(context->m_rtv, clearColor); + context->m_deviceContext->ClearRenderTargetView(context->m_rtv, &clearColor.r); context->m_deviceContext->ClearDepthStencilView(context->m_dsv, D3D11_CLEAR_DEPTH, 1.f, 0u); context->m_deviceContext->OMSetDepthStencilState(context->m_depthState, 0u); } -void AppGraphCtxFramePresent(AppGraphCtx* context, bool fullsync) +void AppGraphCtxFramePresentD3D11(AppGraphCtx* contextIn, bool fullsync) { + auto context = cast_to_AppGraphCtxD3D11(contextIn); + context->m_swapChain->Present(fullsync, 0); - - appGraphProfilerFrameEnd(context->m_profiler); + + appGraphProfilerD3D11FrameEnd(context->m_profiler); } -void AppGraphCtxProfileEnable(AppGraphCtx* context, bool enabled) +void AppGraphCtxWaitForFramesD3D11(AppGraphCtx* context, unsigned int maxFramesInFlight) { - appGraphProfilerEnable(context->m_profiler, enabled); + // TODO: Implement } -void AppGraphCtxProfileBegin(AppGraphCtx* context, const char* label) +void AppGraphCtxProfileEnableD3D11(AppGraphCtx* contextIn, bool enabled) { - appGraphProfilerBegin(context->m_profiler, label); + auto context = cast_to_AppGraphCtxD3D11(contextIn); + appGraphProfilerD3D11Enable(context->m_profiler, enabled); } -void AppGraphCtxProfileEnd(AppGraphCtx* context, const char* label) +void AppGraphCtxProfileBeginD3D11(AppGraphCtx* contextIn, const char* label) { - appGraphProfilerEnd(context->m_profiler, label); + auto context = cast_to_AppGraphCtxD3D11(contextIn); + appGraphProfilerD3D11Begin(context->m_profiler, label); } -bool AppGraphCtxProfileGet(AppGraphCtx* context, const char** plabel, float* cpuTime, float* gpuTime, int index) +void AppGraphCtxProfileEndD3D11(AppGraphCtx* contextIn, const char* label) { - return appGraphProfilerGet(context->m_profiler, plabel, cpuTime, gpuTime, index); + auto context = cast_to_AppGraphCtxD3D11(contextIn); + appGraphProfilerD3D11End(context->m_profiler, label); +} + +bool AppGraphCtxProfileGetD3D11(AppGraphCtx* contextIn, const char** plabel, float* cpuTime, float* gpuTime, int index) +{ + auto context = cast_to_AppGraphCtxD3D11(contextIn); + return appGraphProfilerD3D11Get(context->m_profiler, plabel, cpuTime, gpuTime, index); } // ******************************* Profiler ********************************* @@ -544,9 +572,9 @@ namespace }; } -struct AppGraphProfiler +struct AppGraphProfilerD3D11 { - AppGraphCtx* m_context; + AppGraphCtxD3D11* m_context; int m_state = 0; bool m_enabled = false; @@ -563,30 +591,30 @@ struct AppGraphProfiler TimerValue m_timerValues[m_timersCap]; int m_timerValuesSize = 0; - AppGraphProfiler(AppGraphCtx* context); - ~AppGraphProfiler(); + AppGraphProfilerD3D11(AppGraphCtx* context); + ~AppGraphProfilerD3D11(); }; -AppGraphProfiler::AppGraphProfiler(AppGraphCtx* context) : m_context(context) +AppGraphProfilerD3D11::AppGraphProfilerD3D11(AppGraphCtx* context) : m_context(cast_to_AppGraphCtxD3D11(context)) { } -AppGraphProfiler::~AppGraphProfiler() +AppGraphProfilerD3D11::~AppGraphProfilerD3D11() { COMRelease(m_disjoint); } -AppGraphProfiler* appGraphCreateProfiler(AppGraphCtx* ctx) +AppGraphProfilerD3D11* appGraphCreateProfilerD3D11(AppGraphCtx* ctx) { - return new AppGraphProfiler(ctx); + return new AppGraphProfilerD3D11(ctx); } -void appGraphReleaseProfiler(AppGraphProfiler* profiler) +void appGraphReleaseProfiler(AppGraphProfilerD3D11* profiler) { delete profiler; } -void appGraphProfilerFrameBegin(AppGraphProfiler* p) +void appGraphProfilerD3D11FrameBegin(AppGraphProfilerD3D11* p) { p->m_frameTime = (float)p->m_frameTimer.getDeltaTime(); @@ -611,7 +639,7 @@ void appGraphProfilerFrameBegin(AppGraphProfiler* p) } } -void appGraphProfilerFrameEnd(AppGraphProfiler* p) +void appGraphProfilerD3D11FrameEnd(AppGraphProfilerD3D11* p) { if (p->m_state == 1) { @@ -623,12 +651,12 @@ void appGraphProfilerFrameEnd(AppGraphProfiler* p) } } -void appGraphProfilerEnable(AppGraphProfiler* p, bool enabled) +void appGraphProfilerD3D11Enable(AppGraphProfilerD3D11* p, bool enabled) { p->m_enabled = enabled; } -void appGraphProfilerBegin(AppGraphProfiler* p, const char* label) +void appGraphProfilerD3D11Begin(AppGraphProfilerD3D11* p, const char* label) { if (p->m_state == 1 && p->m_timersSize < p->m_timersCap) { @@ -652,7 +680,7 @@ void appGraphProfilerBegin(AppGraphProfiler* p, const char* label) } } -void appGraphProfilerEnd(AppGraphProfiler* p, const char* label) +void appGraphProfilerD3D11End(AppGraphProfilerD3D11* p, const char* label) { if (p->m_state == 1) { @@ -676,7 +704,7 @@ void appGraphProfilerEnd(AppGraphProfiler* p, const char* label) } } -bool appGraphProfilerFlush(AppGraphProfiler* p) +bool appGraphProfilerD3D11Flush(AppGraphProfilerD3D11* p) { if (p->m_state == 2) { @@ -735,9 +763,9 @@ bool appGraphProfilerFlush(AppGraphProfiler* p) return false; } -bool appGraphProfilerGet(AppGraphProfiler* p, const char** plabel, float* cpuTime, float* gpuTime, int index) +bool appGraphProfilerD3D11Get(AppGraphProfilerD3D11* p, const char** plabel, float* cpuTime, float* gpuTime, int index) { - appGraphProfilerFlush(p); + appGraphProfilerD3D11Flush(p); { if (index < p->m_timerValuesSize) { @@ -755,7 +783,8 @@ bool appGraphProfilerGet(AppGraphProfiler* p, const char** plabel, float* cpuTim return false; } -size_t AppGraphCtxDedicatedVideoMemory(AppGraphCtx* context) +size_t AppGraphCtxDedicatedVideoMemoryD3D11(AppGraphCtx* contextIn) { + auto context = cast_to_AppGraphCtxD3D11(contextIn); return context->m_dedicatedVideoMemory; -} +}
\ No newline at end of file diff --git a/demo/d3d11/appD3D11Ctx.h b/demo/d3d11/appD3D11Ctx.h index 071952e..80a71f8 100644 --- a/demo/d3d11/appD3D11Ctx.h +++ b/demo/d3d11/appD3D11Ctx.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. * * NVIDIA CORPORATION and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation @@ -10,44 +10,26 @@ #pragma once +#include "../d3d/appGraphCtx.h" + #include <windows.h> #include <d3d11.h> +struct AppGraphProfilerD3D11; -template <class T> -void inline COMRelease(T& t) -{ - if (t) t->Release(); - t = nullptr; -} - -template <class T> -void inline COMRelease(T& t, UINT arraySize) -{ - for (UINT i = 0; i < arraySize; i++) - { - if (t[i]) t[i]->Release(); - t[i] = nullptr; - } -} - - - -struct SDL_Window; -struct AppGraphProfiler; - -struct AppGraphCtx +struct AppGraphCtxD3D11 { HWND m_hWnd = nullptr; int m_winW = 0; int m_winH = 0; bool m_fullscreen = false; + bool m_valid = false; size_t m_dedicatedVideoMemory = 0u; // D3D11 objects - D3D11_VIEWPORT m_viewport; + D3D11_VIEWPORT m_viewport = {}; ID3D11Device* m_device = nullptr; ID3D11DeviceContext* m_deviceContext = nullptr; IDXGISwapChain* m_swapChain = nullptr; @@ -57,37 +39,43 @@ struct AppGraphCtx ID3D11DepthStencilView* m_dsv = nullptr; ID3D11ShaderResourceView* m_depthSRV = nullptr; ID3D11DepthStencilState* m_depthState = nullptr; - ID3D11BlendState* m_blendState = nullptr; + + AppGraphProfilerD3D11* m_profiler = nullptr; - ID3D11Texture2D* m_resolvedTarget = nullptr; - ID3D11ShaderResourceView* m_resolvedTargetSRV = nullptr; + AppGraphCtxD3D11(); + ~AppGraphCtxD3D11(); +}; - AppGraphProfiler* m_profiler = nullptr; +inline AppGraphCtxD3D11* cast_to_AppGraphCtxD3D11(AppGraphCtx* appctx) +{ + return (AppGraphCtxD3D11*)(appctx); +} - AppGraphCtx(); - ~AppGraphCtx(); -}; +inline AppGraphCtx* cast_from_AppGraphCtxD3D11(AppGraphCtxD3D11* appctx) +{ + return (AppGraphCtx*)(appctx); +} -AppGraphCtx* AppGraphCtxCreate(int deviceID); +APP_GRAPH_CTX_API AppGraphCtx* AppGraphCtxCreateD3D11(int deviceID); -void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool fullscreen, int); +APP_GRAPH_CTX_API bool AppGraphCtxUpdateSizeD3D11(AppGraphCtx* context, SDL_Window* window, bool fullscreen, int numMSAASamples); -void AppGraphCtxReleaseRenderTarget(AppGraphCtx* context); +APP_GRAPH_CTX_API void AppGraphCtxReleaseRenderTargetD3D11(AppGraphCtx* context); -void AppGraphCtxRelease(AppGraphCtx* context); +APP_GRAPH_CTX_API void AppGraphCtxReleaseD3D11(AppGraphCtx* context); -void AppGraphCtxFrameStart(AppGraphCtx* context, float clearColor[4]); +APP_GRAPH_CTX_API void AppGraphCtxFrameStartD3D11(AppGraphCtx* context, AppGraphColor clearColor); -void AppGraphCtxFramePresent(AppGraphCtx* context, bool fullsync); +APP_GRAPH_CTX_API void AppGraphCtxFramePresentD3D11(AppGraphCtx* context, bool fullsync); -void AppGraphCtxResolveFrame(AppGraphCtx* context); +APP_GRAPH_CTX_API void AppGraphCtxWaitForFramesD3D11(AppGraphCtx* context, unsigned int maxFramesInFlight); -void AppGraphCtxProfileEnable(AppGraphCtx* context, bool enabled); +APP_GRAPH_CTX_API void AppGraphCtxProfileEnableD3D11(AppGraphCtx* context, bool enabled); -void AppGraphCtxProfileBegin(AppGraphCtx* context, const char* label); +APP_GRAPH_CTX_API void AppGraphCtxProfileBeginD3D11(AppGraphCtx* context, const char* label); -void AppGraphCtxProfileEnd(AppGraphCtx* context, const char* label); +APP_GRAPH_CTX_API void AppGraphCtxProfileEndD3D11(AppGraphCtx* context, const char* label); -bool AppGraphCtxProfileGet(AppGraphCtx* context, const char** plabel, float* cpuTime, float* gpuTime, int index); +APP_GRAPH_CTX_API bool AppGraphCtxProfileGetD3D11(AppGraphCtx* context, const char** plabel, float* cpuTime, float* gpuTime, int index); -size_t AppGraphCtxDedicatedVideoMemory(AppGraphCtx* context);
\ No newline at end of file +APP_GRAPH_CTX_API size_t AppGraphCtxDedicatedVideoMemoryD3D11(AppGraphCtx* context); diff --git a/demo/d3d11/debugLineRender.h b/demo/d3d11/debugLineRender.h deleted file mode 100644 index 6132935..0000000 --- a/demo/d3d11/debugLineRender.h +++ /dev/null @@ -1,199 +0,0 @@ -#pragma once - - -#include "shaders/debugLineVS.hlsl.h" -#include "shaders/debugLinePS.hlsl.h" - - -struct DebugVertex -{ - Vec3 position; - Vec4 color; -}; - -struct DebugLineRender -{ - - void Init(ID3D11Device* d, ID3D11DeviceContext* c) - { - device = d; - context = c; - - // create the rasterizer state - { - D3D11_RASTERIZER_DESC desc = {}; - desc.FillMode = D3D11_FILL_SOLID; - desc.CullMode = D3D11_CULL_BACK; - desc.FrontCounterClockwise = TRUE; // This is non-default - desc.DepthBias = 0; - desc.DepthBiasClamp = 0.f; - desc.SlopeScaledDepthBias = 0.f; - desc.DepthClipEnable = TRUE; - desc.ScissorEnable = FALSE; // This is non-default - desc.MultisampleEnable = TRUE; - desc.AntialiasedLineEnable = FALSE; - - device->CreateRasterizerState(&desc, &rasterizerState); - } - - { - D3D11_DEPTH_STENCIL_DESC depthStateDesc = {}; - depthStateDesc.DepthEnable = FALSE; // disable depth test - depthStateDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; - depthStateDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL; - - device->CreateDepthStencilState(&depthStateDesc, &depthStencilState); - } - - // create the input layout - { - D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - - device->CreateInputLayout(inputElementDescs, 2, g_debugLineVS, sizeof(g_debugLineVS), &inputLayout); - } - - // create the blend state - { - D3D11_BLEND_DESC blendDesc = {}; - - blendDesc.AlphaToCoverageEnable = false; - blendDesc.IndependentBlendEnable = false; - blendDesc.RenderTarget[0].BlendEnable = false; - blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; - blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; - blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; - blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA; - blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA; - blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; - blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; - - device->CreateBlendState(&blendDesc, &blendState); - } - - // create the shaders - device->CreateVertexShader(g_debugLineVS, sizeof(g_debugLineVS), nullptr, &vertexShader); - device->CreatePixelShader(g_debugLinePS, sizeof(g_debugLinePS), nullptr, &pixelShader); - - // create a constant buffer - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(Matrix44); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - - device->CreateBuffer(&bufDesc, NULL, &constantBuffer); - } - } - - void Destroy() - { - COMRelease(depthStencilState); - COMRelease(rasterizerState); - COMRelease(inputLayout); - COMRelease(blendState); - COMRelease(vertexShader); - COMRelease(pixelShader); - COMRelease(constantBuffer); - COMRelease(vertexBuffer); - } - - void AddLine(const Vec3& p, const Vec3& q, const Vec4& color) - { - DebugVertex v = { p, color }; - DebugVertex w = { q, color }; - - queued.push_back(v); - queued.push_back(w); - } - - void FlushLines(const Matrix44& viewProj) - { - if (queued.empty()) - return; - - // recreate vertex buffer if not big enough for queued lines - if (vertexBufferSize < int(queued.size())) - { - if (vertexBuffer) - vertexBuffer->Release(); - - D3D11_BUFFER_DESC bufferDesc; - bufferDesc.Usage = D3D11_USAGE_DYNAMIC; - bufferDesc.ByteWidth = UINT(sizeof(DebugVertex)*queued.size()); - bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufferDesc.MiscFlags = 0; - - device->CreateBuffer(&bufferDesc, 0, &vertexBuffer); - - vertexBufferSize = int(queued.size()); - } - - // update vertex buffer - D3D11_MAPPED_SUBRESOURCE res; - context->Map(vertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, &queued[0], sizeof(DebugVertex)*queued.size()); - context->Unmap(vertexBuffer, 0); - - // update constant buffer - { - D3D11_MAPPED_SUBRESOURCE mappedResource = {}; - if (S_OK == context->Map(constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) - { - memcpy(mappedResource.pData, &viewProj, sizeof(viewProj)); - - context->Unmap(constantBuffer, 0u); - } - } - - // configure for line renderering - context->VSSetShader(vertexShader, nullptr, 0u); - context->GSSetShader(nullptr, nullptr, 0u); - context->PSSetShader(pixelShader, nullptr, 0u); - - context->IASetInputLayout(inputLayout); - context->OMSetBlendState(blendState, nullptr, 0xFFFFFFFF); - - context->VSSetConstantBuffers(0, 1, &constantBuffer); - - context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST); - - context->RSSetState(rasterizerState); - - UINT vertexStride = sizeof(DebugVertex); - UINT offset = 0u; - context->IASetVertexBuffers(0, 1, &vertexBuffer, &vertexStride, &offset); - - - // kick - context->Draw(UINT(queued.size()), 0); - - // empty queue - queued.resize(0); - - } - - - std::vector<DebugVertex> queued; - - ID3D11Buffer* vertexBuffer = nullptr; - int vertexBufferSize = 0; - - ID3D11DepthStencilState* depthStencilState = nullptr; - ID3D11RasterizerState* rasterizerState = nullptr; - ID3D11InputLayout* inputLayout = nullptr; - ID3D11BlendState* blendState = nullptr; - ID3D11VertexShader* vertexShader = nullptr; - ID3D11PixelShader* pixelShader = nullptr; - ID3D11Buffer* constantBuffer = nullptr; - - ID3D11Device* device = nullptr; - ID3D11DeviceContext* context = nullptr; - -};
\ No newline at end of file diff --git a/demo/d3d11/debugLineRenderD3D11.cpp b/demo/d3d11/debugLineRenderD3D11.cpp new file mode 100644 index 0000000..2b0b432 --- /dev/null +++ b/demo/d3d11/debugLineRenderD3D11.cpp @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#define NOMINMAX +#include <d3d11.h> + +#include <math.h> + +#include "../d3d/shaders/debugLineVS.hlsl.h" +#include "../d3d/shaders/debugLinePS.hlsl.h" + +// this +#include "debugLineRenderD3D11.h" + +void DebugLineRenderD3D11::init(ID3D11Device* d, ID3D11DeviceContext* c) +{ + m_device = d; + m_context = c; + + // create the rasterizer state + { + D3D11_RASTERIZER_DESC desc = {}; + desc.FillMode = D3D11_FILL_SOLID; + desc.CullMode = D3D11_CULL_BACK; + desc.FrontCounterClockwise = TRUE; // This is non-default + desc.DepthBias = 0; + desc.DepthBiasClamp = 0.f; + desc.SlopeScaledDepthBias = 0.f; + desc.DepthClipEnable = TRUE; + desc.ScissorEnable = FALSE; // This is non-default + desc.MultisampleEnable = TRUE; + desc.AntialiasedLineEnable = FALSE; + + m_device->CreateRasterizerState(&desc, m_rasterizerState.GetAddressOf()); + } + + { + D3D11_DEPTH_STENCIL_DESC depthStateDesc = {}; + depthStateDesc.DepthEnable = FALSE; // disable depth test + depthStateDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; + depthStateDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL; + + m_device->CreateDepthStencilState(&depthStateDesc, m_depthStencilState.GetAddressOf()); + } + + // create the input layout + { + D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + + m_device->CreateInputLayout(inputElementDescs, 2, g_debugLineVS, sizeof(g_debugLineVS), m_inputLayout.GetAddressOf()); + } + + // create the blend state + { + D3D11_BLEND_DESC blendDesc = {}; + + blendDesc.AlphaToCoverageEnable = false; + blendDesc.IndependentBlendEnable = false; + blendDesc.RenderTarget[0].BlendEnable = false; + blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; + blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; + blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA; + blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA; + blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + + m_device->CreateBlendState(&blendDesc, m_blendState.GetAddressOf()); + } + + // create the shaders + m_device->CreateVertexShader(g_debugLineVS, sizeof(g_debugLineVS), nullptr, m_vertexShader.GetAddressOf()); + m_device->CreatePixelShader(g_debugLinePS, sizeof(g_debugLinePS), nullptr, m_pixelShader.GetAddressOf()); + + // create a constant buffer + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = sizeof(Matrix44); + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + + m_device->CreateBuffer(&bufDesc, NULL, m_constantBuffer.GetAddressOf()); + } +} + +void DebugLineRenderD3D11::addLine(const Vec3& p, const Vec3& q, const Vec4& color) +{ + Vertex v = { p, color }; + Vertex w = { q, color }; + + m_queued.push_back(v); + m_queued.push_back(w); +} + +void DebugLineRenderD3D11::flush(const Matrix44& viewProj) +{ + if (m_queued.empty()) + return; + + // recreate vertex buffer if not big enough for queued lines + if (m_vertexBufferSize < int(m_queued.size())) + { + m_vertexBuffer = nullptr; + + D3D11_BUFFER_DESC bufferDesc; + bufferDesc.Usage = D3D11_USAGE_DYNAMIC; + bufferDesc.ByteWidth = UINT(sizeof(Vertex)*m_queued.size()); + bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufferDesc.MiscFlags = 0; + + m_device->CreateBuffer(&bufferDesc, 0, &m_vertexBuffer); + + m_vertexBufferSize = int(m_queued.size()); + } + + // update vertex buffer + D3D11_MAPPED_SUBRESOURCE res; + m_context->Map(m_vertexBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, &m_queued[0], sizeof(Vertex)*m_queued.size()); + m_context->Unmap(m_vertexBuffer.Get(), 0); + + // update constant buffer + { + D3D11_MAPPED_SUBRESOURCE mappedResource = {}; + if (SUCCEEDED(m_context->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) + { + memcpy(mappedResource.pData, &viewProj, sizeof(viewProj)); + m_context->Unmap(m_constantBuffer.Get(), 0u); + } + } + + // configure for line renderering + m_context->VSSetShader(m_vertexShader.Get(), nullptr, 0u); + m_context->GSSetShader(nullptr, nullptr, 0u); + m_context->PSSetShader(m_pixelShader.Get(), nullptr, 0u); + + m_context->IASetInputLayout(m_inputLayout.Get()); + m_context->OMSetBlendState(m_blendState.Get(), nullptr, 0xFFFFFFFF); + + m_context->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + + m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST); + + m_context->RSSetState(m_rasterizerState.Get()); + + UINT vertexStride = sizeof(Vertex); + UINT offset = 0u; + m_context->IASetVertexBuffers(0, 1, m_vertexBuffer.GetAddressOf(), &vertexStride, &offset); + + // kick + m_context->Draw(UINT(m_queued.size()), 0); + + // empty queue + m_queued.resize(0); + +} diff --git a/demo/d3d11/debugLineRenderD3D11.h b/demo/d3d11/debugLineRenderD3D11.h new file mode 100644 index 0000000..1509065 --- /dev/null +++ b/demo/d3d11/debugLineRenderD3D11.h @@ -0,0 +1,42 @@ +#pragma once + +#include <vector> +#include "core/maths.h" + +#include <wrl.h> +using namespace Microsoft::WRL; + +struct DebugLineRenderD3D11 +{ + struct Vertex + { + Vec3 position; + Vec4 color; + }; + + void init(ID3D11Device* d, ID3D11DeviceContext* c); + void addLine(const Vec3& p, const Vec3& q, const Vec4& color); + void flush(const Matrix44& viewProj); + + DebugLineRenderD3D11(): + m_vertexBufferSize(0), + m_device(nullptr), + m_context(nullptr) + {} + + std::vector<Vertex> m_queued; + + ComPtr<ID3D11Buffer> m_vertexBuffer; + int m_vertexBufferSize; + + ComPtr<ID3D11DepthStencilState> m_depthStencilState; + ComPtr<ID3D11RasterizerState> m_rasterizerState; + ComPtr<ID3D11InputLayout> m_inputLayout; + ComPtr<ID3D11BlendState> m_blendState; + ComPtr<ID3D11VertexShader> m_vertexShader; + ComPtr<ID3D11PixelShader> m_pixelShader; + ComPtr<ID3D11Buffer> m_constantBuffer; + + ID3D11Device* m_device; + ID3D11DeviceContext* m_context; +};
\ No newline at end of file diff --git a/demo/d3d11/demoContextD3D11.cpp b/demo/d3d11/demoContextD3D11.cpp new file mode 100644 index 0000000..0eaf0f4 --- /dev/null +++ b/demo/d3d11/demoContextD3D11.cpp @@ -0,0 +1,1147 @@ +#include "core/maths.h" +#include "core/extrude.h" + +#include "shaders.h" + +#include "meshRenderD3D11.h" +#include "pointRenderD3D11.h" +#include "fluidRenderD3D11.h" +#include "diffuseRenderD3D11.h" +#include "debugLineRenderD3D11.h" + +#include "shadowMapD3D11.h" +#include "renderTargetD3D11.h" + +#include "imguiGraphD3D11.h" + +#include "appD3D11Ctx.h" + +#include "../d3d/demoContext.h" +#include "../d3d/loader.h" + +#include <d3d11.h> +#include <d3dcompiler.h> + +#include <cstdlib> + +// this +#include "demoContextD3D11.h" + +namespace +{ +// COM object release utilities +template <class T> +void inline COMRelease(T& t) +{ + if (t) t->Release(); + t = nullptr; +} + +template <class T> +void inline COMRelease(T& t, UINT arraySize) +{ + for (UINT i = 0; i < arraySize; i++) + { + if (t[i]) t[i]->Release(); + t[i] = nullptr; + } +} +} + +extern Colour g_colors[]; +static const int kShadowResolution = 2048; + +DemoContext* CreateDemoContextD3D11() +{ + return new DemoContextD3D11; +} + +DemoContextD3D11::DemoContextD3D11() +{ + m_appGraphCtx = nullptr; + m_appGraphCtxD3D11 = nullptr; + memset(&m_meshDrawParams, 0, sizeof(m_meshDrawParams)); + + m_spotMin = 0.5f; + m_spotMax = 1.0f; + m_shadowBias = 0.075f; + + m_shadowMap = nullptr; + m_immediateMesh = nullptr; + + m_window = nullptr; + + m_msaaSamples = 1; + + m_renderTimerDisjoint = nullptr; + m_renderTimerBegin = nullptr; + m_renderTimerEnd = nullptr; + m_renderCompletionFence = nullptr; + + m_compositeBlendState = nullptr; + + m_fluidResolvedTarget = nullptr; + m_fluidResolvedTargetSRV = nullptr; + + m_debugLineRender = new DebugLineRenderD3D11; + m_meshRenderer = new MeshRendererD3D11; + m_pointRenderer = new PointRendererD3D11; + m_diffuseRenderer = new DiffuseRendererD3D11; +} + +// convert an OpenGL style projection matrix to D3D (clip z range [0, 1]) +Matrix44 ConvertToD3DProjection(const Matrix44& proj) +{ + Matrix44 scale = Matrix44::kIdentity; + scale.columns[2][2] = 0.5f; + + Matrix44 bias = Matrix44::kIdentity; + bias.columns[3][2] = 1.0f; + + return scale*bias*proj; +} + +#define checkDxErrors(err) __checkDxErrors (err, __FILE__, __LINE__) + +inline void __checkDxErrors(HRESULT err, const char *file, const int line) +{ + if (FAILED(err)) + { + char* lpMsgBuf; + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + err, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR)&lpMsgBuf, + 0, NULL); + + fprintf(stdout, "DX Error = %04d \"%s\" from file <%s>, line %i.\n", + err, lpMsgBuf, file, line); + + exit(EXIT_FAILURE); + } +} + +DemoContextD3D11::~DemoContextD3D11() +{ + imguiGraphDestroy(); + + COMRelease(m_renderTimerBegin); + COMRelease(m_renderTimerEnd); + COMRelease(m_renderTimerDisjoint); + COMRelease(m_renderCompletionFence); + + COMRelease(m_compositeBlendState); + + COMRelease(m_fluidResolvedTarget); + COMRelease(m_fluidResolvedTargetSRV); + + delete m_immediateMesh; + delete m_debugLineRender; + delete m_meshRenderer; + delete m_pointRenderer; + delete m_diffuseRenderer; + + // do this first, since it flushes all GPU work + AppGraphCtxReleaseRenderTarget(m_appGraphCtx); + AppGraphCtxRelease(m_appGraphCtx); +} + +bool DemoContextD3D11::initialize(const RenderInitOptions& options) +{ + { + // Load external modules + loadModules(APP_CONTEXT_D3D11); + } + + // must always have at least one sample + m_msaaSamples = Max(1, options.numMsaaSamples); + // create app graph context + m_appGraphCtx = AppGraphCtxCreate(0); + m_appGraphCtxD3D11 = cast_to_AppGraphCtxD3D11(m_appGraphCtx); + + AppGraphCtxUpdateSize(m_appGraphCtx, options.window, options.fullscreen, m_msaaSamples); + _onWindowSizeChanged(m_appGraphCtxD3D11->m_winW, m_appGraphCtxD3D11->m_winH, false); + + //AppGraphCtxInitRenderTarget(m_appGraphCtx, options.window, options.fullscreen, m_msaaSamples); + //gScene = getScene(0); + + AppGraphColor clearVal = { 0.0f, 0.0f, 0.0f, 1.0f }; + AppGraphCtxFrameStart(m_appGraphCtx, clearVal); + + ID3D11Device* device = m_appGraphCtxD3D11->m_device; + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + { + // create imgui, connect to app graph context + ImguiGraphDescD3D11 desc; + desc.device = device; + desc.deviceContext = deviceContext; + desc.winW = m_appGraphCtxD3D11->m_winW; + desc.winH = m_appGraphCtxD3D11->m_winH; + + // Use Dx11 context + const int defaultFontHeight = (options.defaultFontHeight <= 0) ? 15 : options.defaultFontHeight; + + if (!imguiGraphInit("../../data/DroidSans.ttf", float(defaultFontHeight), (ImguiGraphDesc*)&desc)) + { + return false; + } + } + + AppGraphCtxFramePresent(m_appGraphCtx, true); + + m_pointRenderer->init(device, deviceContext); + m_meshRenderer->init(device, deviceContext, options.asyncComputeBenchmark); + m_debugLineRender->init(device, deviceContext); + m_diffuseRenderer->init(device, deviceContext); + + { + // create blend state - used for composite phase of water rendering + D3D11_BLEND_DESC blendStateDesc = {}; + blendStateDesc.RenderTarget[0].BlendEnable = TRUE; + blendStateDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; + blendStateDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; + blendStateDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blendStateDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; + blendStateDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO; + blendStateDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendStateDesc.RenderTarget[0].RenderTargetWriteMask = 0x0f; + + if (FAILED(device->CreateBlendState(&blendStateDesc, &m_compositeBlendState))) + { + return false; + } + } + + // create a mesh for immediate mode rendering + m_immediateMesh = new GpuMeshD3D11(device, deviceContext); + + m_window = options.window; + + D3D11_QUERY_DESC tdesc; + ZeroMemory(&tdesc, sizeof(tdesc)); + tdesc.Query = D3D11_QUERY_TIMESTAMP; + device->CreateQuery(&tdesc, &m_renderTimerBegin); + device->CreateQuery(&tdesc, &m_renderTimerEnd); + + tdesc.Query = D3D11_QUERY_EVENT; + device->CreateQuery(&tdesc, &m_renderCompletionFence); + + ZeroMemory(&tdesc, sizeof(tdesc)); + tdesc.Query = D3D11_QUERY_TIMESTAMP_DISJOINT; + device->CreateQuery(&tdesc, &m_renderTimerDisjoint); + + return true; +} + +void DemoContextD3D11::getRenderDevice(void** deviceOut, void** contextOut) +{ + *deviceOut = m_appGraphCtxD3D11->m_device; + *contextOut = m_appGraphCtxD3D11->m_deviceContext; +} + +void DemoContextD3D11::onSizeChanged(int width, int height, bool minimized) +{ + AppGraphCtxUpdateSize(m_appGraphCtx, m_window, false, m_msaaSamples); + _onWindowSizeChanged(m_appGraphCtxD3D11->m_winW, m_appGraphCtxD3D11->m_winH, false); +} + +void DemoContextD3D11::_onWindowSizeChanged(int width, int height, bool minimized) +{ + if (m_fluidResolvedTarget) + { + D3D11_TEXTURE2D_DESC desc; + m_fluidResolvedTarget->GetDesc(&desc); + if (desc.Width == width && desc.Height == height) + { + return; + } + + COMRelease(m_fluidResolvedTarget); + COMRelease(m_fluidResolvedTargetSRV); + } + + // Recreate... + + ID3D11Device* device = m_appGraphCtxD3D11->m_device; + + // resolved texture target (for refraction / scene sampling) + { + D3D11_TEXTURE2D_DESC texDesc = {}; + texDesc.Width = width; + texDesc.Height = height; + texDesc.MipLevels = 1; + texDesc.ArraySize = 1; + texDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + texDesc.SampleDesc.Count = 1; + texDesc.SampleDesc.Quality = 0u; + texDesc.Usage = D3D11_USAGE_DEFAULT; + texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE; + texDesc.CPUAccessFlags = 0; + texDesc.MiscFlags = 0; + + if (FAILED(device->CreateTexture2D(&texDesc, nullptr, &m_fluidResolvedTarget))) + { + return; + } + + D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; + srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + srvDesc.Texture2D.MipLevels = 1; + srvDesc.Texture2D.MostDetailedMip = 0; + + if (FAILED(device->CreateShaderResourceView(m_fluidResolvedTarget, &srvDesc, &m_fluidResolvedTargetSRV))) + { + return; + } + } +} + +void DemoContextD3D11::startFrame(Vec4 clear) +{ + AppGraphColor clearColor = { clear.x, clear.y, clear.z, clear.w }; + AppGraphCtxFrameStart(m_appGraphCtx, clearColor); + + MeshDrawParamsD3D& meshDrawParams = m_meshDrawParams; + + memset(&meshDrawParams, 0, sizeof(MeshDrawParamsD3D)); + meshDrawParams.renderStage = MESH_DRAW_LIGHT; + meshDrawParams.renderMode = MESH_RENDER_SOLID; + meshDrawParams.cullMode = MESH_CULL_BACK; + meshDrawParams.projection = (XMMATRIX)Matrix44::kIdentity; + meshDrawParams.view = (XMMATRIX)Matrix44::kIdentity; + meshDrawParams.model = DirectX::XMMatrixMultiply( + DirectX::XMMatrixScaling(1.0f, 1.0f, 1.0f), + DirectX::XMMatrixTranslation(0.0f, 0.0f, 0.0f) + ); +} + +void DemoContextD3D11::_flushFrame() +{ + m_appGraphCtxD3D11->m_deviceContext->Flush(); +} + +void DemoContextD3D11::endFrame() +{ + _flushFrame(); + + ImguiGraphDescD3D11 desc; + + desc.device = m_appGraphCtxD3D11->m_device; + desc.deviceContext = m_appGraphCtxD3D11->m_deviceContext; + desc.winW = m_appGraphCtxD3D11->m_winW; + desc.winH = m_appGraphCtxD3D11->m_winH; + + imguiGraphUpdate((ImguiGraphDesc*)&desc); + //m_imguiGraphContext->update(&desc); +} + +void DemoContextD3D11::presentFrame(bool fullsync) +{ + AppGraphCtxFramePresent(m_appGraphCtx, fullsync); +} + +void DemoContextD3D11::getViewRay(int x, int y, Vec3& origin, Vec3& dir) +{ + using namespace DirectX; + + XMVECTOR nearVector = XMVector3Unproject(XMVectorSet(float(x), float(m_appGraphCtxD3D11->m_winH-y), 0.0f, 0.0f), 0.0f, 0.0f, (float)m_appGraphCtxD3D11->m_winW, (float)m_appGraphCtxD3D11->m_winH, 0.0f, 1.0f, (XMMATRIX)m_proj, XMMatrixIdentity(), (XMMATRIX)m_view); + XMVECTOR farVector = XMVector3Unproject(XMVectorSet(float(x), float(m_appGraphCtxD3D11->m_winH-y), 1.0f, 0.0f), 0.0f, 0.0f, (float)m_appGraphCtxD3D11->m_winW, (float)m_appGraphCtxD3D11->m_winH, 0.0f, 1.0f, (XMMATRIX)m_proj, XMMatrixIdentity(), (XMMATRIX)m_view); + + origin = Vec3(XMVectorGetX(nearVector), XMVectorGetY(nearVector), XMVectorGetZ(nearVector)); + XMVECTOR tmp = farVector - nearVector; + dir = Normalize(Vec3(XMVectorGetX(tmp), XMVectorGetY(tmp), XMVectorGetZ(tmp))); +} + +void DemoContextD3D11::setFillMode(bool wire) +{ + m_meshDrawParams.renderMode = wire ? MESH_RENDER_WIREFRAME : MESH_RENDER_SOLID; +} + +void DemoContextD3D11::setCullMode(bool enabled) +{ + m_meshDrawParams.cullMode = enabled ? MESH_CULL_BACK : MESH_CULL_NONE; +} + +void DemoContextD3D11::setView(Matrix44 view, Matrix44 projection) +{ + Matrix44 vp = projection*view; + + m_meshDrawParams.model = (XMMATRIX)Matrix44::kIdentity; + m_meshDrawParams.view = (XMMATRIX)view; + m_meshDrawParams.projection = (XMMATRIX)(ConvertToD3DProjection(projection)); + + m_view = view; + m_proj = ConvertToD3DProjection(projection); +} + +FluidRenderer* DemoContextD3D11::createFluidRenderer(uint32_t width, uint32_t height) +{ + FluidRendererD3D11* renderer = new(_aligned_malloc(sizeof(FluidRendererD3D11), 16)) FluidRendererD3D11; + renderer->init(m_appGraphCtxD3D11->m_device, m_appGraphCtxD3D11->m_deviceContext, width, height); + return (FluidRenderer*)renderer; +} + +void DemoContextD3D11::destroyFluidRenderer(FluidRenderer* rendererIn) +{ + FluidRendererD3D11* renderer = (FluidRendererD3D11*)rendererIn; + renderer->~FluidRendererD3D11(); + _aligned_free(renderer); +} + +FluidRenderBuffers* DemoContextD3D11::createFluidRenderBuffers(int numParticles, bool enableInterop) +{ + FluidRenderBuffersD3D11* buffers = new FluidRenderBuffersD3D11; + buffers->m_numParticles = numParticles; + + ID3D11Device* device = m_appGraphCtxD3D11->m_device; + + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = numParticles*sizeof(Vec4); + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + bufDesc.StructureByteStride = 0; + + device->CreateBuffer(&bufDesc, NULL, &buffers->m_positions); + + device->CreateBuffer(&bufDesc, NULL, &buffers->m_anisotropiesArr[0]); + device->CreateBuffer(&bufDesc, NULL, &buffers->m_anisotropiesArr[1]); + device->CreateBuffer(&bufDesc, NULL, &buffers->m_anisotropiesArr[2]); + + bufDesc.ByteWidth = numParticles*sizeof(float); + device->CreateBuffer(&bufDesc, NULL, &buffers->m_densities); + } + + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = numParticles * sizeof(int); + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + bufDesc.StructureByteStride = 0; + + device->CreateBuffer(&bufDesc, NULL, &buffers->m_indices); + } + + if (enableInterop) + { + extern NvFlexLibrary* g_flexLib; + + buffers->m_positionsBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_positions.Get(), numParticles, sizeof(Vec4)); + buffers->m_densitiesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_densities.Get(), numParticles, sizeof(float)); + buffers->m_indicesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_indices.Get(), numParticles, sizeof(int)); + + buffers->m_anisotropiesBufArr[0] = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_anisotropiesArr[0].Get(), numParticles, sizeof(Vec4)); + buffers->m_anisotropiesBufArr[1] = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_anisotropiesArr[1].Get(), numParticles, sizeof(Vec4)); + buffers->m_anisotropiesBufArr[2] = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_anisotropiesArr[2].Get(), numParticles, sizeof(Vec4)); + } + + return reinterpret_cast<FluidRenderBuffers*>(buffers); +} + +void DemoContextD3D11::updateFluidRenderBuffers(FluidRenderBuffers* buffersIn, NvFlexSolver* solver, bool anisotropy, bool density) +{ + FluidRenderBuffersD3D11& buffers = *reinterpret_cast<FluidRenderBuffersD3D11*>(buffersIn); + if (!anisotropy) + { + // regular particles + NvFlexGetParticles(solver, buffers.m_positionsBuf, NULL); + } + else + { + // fluid buffers + NvFlexGetSmoothParticles(solver, buffers.m_positionsBuf, NULL); + NvFlexGetAnisotropy(solver, buffers.m_anisotropiesBufArr[0], buffers.m_anisotropiesBufArr[1], buffers.m_anisotropiesBufArr[2], NULL); + } + + if (density) + { + NvFlexGetDensities(solver, buffers.m_densitiesBuf, NULL); + } + else + { + NvFlexGetPhases(solver, buffers.m_densitiesBuf, NULL); + } + + NvFlexGetActive(solver, buffers.m_indicesBuf, NULL); +} + +void DemoContextD3D11::updateFluidRenderBuffers(FluidRenderBuffers* buffersIn, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices) +{ + FluidRenderBuffersD3D11& buffers = *reinterpret_cast<FluidRenderBuffersD3D11*>(buffersIn); + D3D11_MAPPED_SUBRESOURCE res; + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + // vertices + if (particles) + { + deviceContext->Map(buffers.m_positions.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, particles, sizeof(Vec4)*numParticles); + deviceContext->Unmap(buffers.m_positions.Get(), 0); + } + + Vec4*const anisotropies[3] = + { + anisotropy1, + anisotropy2, + anisotropy3, + }; + + for (int i = 0; i < 3; i++) + { + const Vec4* anisotropy = anisotropies[i]; + if (anisotropy) + { + deviceContext->Map(buffers.m_anisotropiesArr[i].Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, anisotropy, sizeof(Vec4) * numParticles); + deviceContext->Unmap(buffers.m_anisotropiesArr[i].Get(), 0); + } + } + + if (densities) + { + deviceContext->Map(buffers.m_densities.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, densities, sizeof(float)*numParticles); + deviceContext->Unmap(buffers.m_densities.Get(), 0); + } + + // indices + if (indices) + { + deviceContext->Map(buffers.m_indices.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, indices, sizeof(int)*numIndices); + deviceContext->Unmap(buffers.m_indices.Get(), 0); + } +} + +void DemoContextD3D11::destroyFluidRenderBuffers(FluidRenderBuffers* buffers) +{ + delete reinterpret_cast<FluidRenderBuffersD3D11*>(buffers); +} + +ShadowMap* DemoContextD3D11::shadowCreate() +{ + ShadowMapD3D11* shadowMap = new(_aligned_malloc(sizeof(ShadowMapD3D11), 16)) ShadowMapD3D11; + shadowMap->init(m_appGraphCtxD3D11->m_device, kShadowResolution); + return (ShadowMap*)shadowMap; +} + +void DemoContextD3D11::shadowDestroy(ShadowMap* map) +{ + ShadowMapD3D11* shadowMap = (ShadowMapD3D11*)map; + shadowMap->~ShadowMapD3D11(); + _aligned_free(shadowMap); +} + +void DemoContextD3D11::shadowBegin(ShadowMap* map) +{ + ShadowMapD3D11* shadowMap = (ShadowMapD3D11*)map; + shadowMap->bindAndClear(m_appGraphCtxD3D11->m_deviceContext); + + m_meshDrawParams.renderStage = MESH_DRAW_SHADOW; + m_shadowMap = shadowMap; +} + +void DemoContextD3D11::shadowEnd() +{ + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + // reset to main frame buffer + deviceContext->RSSetViewports(1, &m_appGraphCtxD3D11->m_viewport); + deviceContext->OMSetRenderTargets(1, &m_appGraphCtxD3D11->m_rtv, m_appGraphCtxD3D11->m_dsv); + deviceContext->OMSetDepthStencilState(m_appGraphCtxD3D11->m_depthState, 0u); + deviceContext->ClearDepthStencilView(m_appGraphCtxD3D11->m_dsv, D3D11_CLEAR_DEPTH, 1.0, 0); + + m_meshDrawParams.renderStage = MESH_DRAW_NULL; +} + +void DemoContextD3D11::bindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float bias, Vec4 fogColor) +{ + m_meshDrawParams.renderStage = MESH_DRAW_LIGHT; + + m_meshDrawParams.grid = 0; + m_meshDrawParams.spotMin = m_spotMin; + m_meshDrawParams.spotMax = m_spotMax; + m_meshDrawParams.fogColor = (float4&)fogColor; + + m_meshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; + + ShadowParamsD3D shadow; + RenderParamsUtilD3D::calcShadowParams(lightPos, lightTarget, lightTransform, m_shadowBias, &shadow); + + m_meshDrawParams.lightTransform = shadow.lightTransform; + m_meshDrawParams.lightDir = shadow.lightDir; + m_meshDrawParams.lightPos = shadow.lightPos; + m_meshDrawParams.bias = shadow.bias; + memcpy(m_meshDrawParams.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); + + m_shadowMap = (ShadowMapD3D11*)shadowMap; +} + +void DemoContextD3D11::unbindSolidShader() +{ + m_meshDrawParams.renderStage = MESH_DRAW_NULL; +} + +void DemoContextD3D11::graphicsTimerBegin() +{ + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + deviceContext->Begin(m_renderTimerDisjoint); + deviceContext->End(m_renderTimerBegin); // yes End. +} + +void DemoContextD3D11::graphicsTimerEnd() +{ + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + deviceContext->End(m_renderTimerEnd); + deviceContext->End(m_renderTimerDisjoint); + m_timersSet = true; +} + +float DemoContextD3D11::rendererGetDeviceTimestamps(unsigned long long* begin, unsigned long long* end, unsigned long long* freq) +{ + float renderTime = 0.0f; + + if (m_timersSet) + { + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + D3D11_QUERY_DATA_TIMESTAMP_DISJOINT tsDisjoint; + uint64_t renderBegin = 0; + uint64_t renderEnd = 0; + + while (S_OK != deviceContext->GetData(m_renderTimerDisjoint, &tsDisjoint, sizeof(tsDisjoint), 0)); + while (S_OK != deviceContext->GetData(m_renderTimerBegin, &renderBegin, sizeof(UINT64), 0)); + while (S_OK != deviceContext->GetData(m_renderTimerEnd, &renderEnd, sizeof(UINT64), 0)); + + float renderTime = float(renderEnd - renderBegin) / float(tsDisjoint.Frequency); + + if (begin) *begin = renderBegin; + if (end) *end = renderEnd; + if (freq) *freq = tsDisjoint.Frequency; + } + + return renderTime; +} + +void DemoContextD3D11::drawMesh(const Mesh* m, Vec3 color) +{ + if (m) + { + if (m->m_colours.size()) + { + m_meshDrawParams.colorArray = 1; + m_immediateMesh->updateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, (Vec4*)&m->m_colours[0], (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces())); + } + else + { + m_meshDrawParams.colorArray = 0; + m_immediateMesh->updateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, NULL, (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces())); + } + + m_meshDrawParams.color = (float4&)color; + m_meshDrawParams.secondaryColor = (float4&)color; + m_meshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; + m_meshDrawParams.shadowMap = (ShadowMapD3D*)m_shadowMap; + + m_meshRenderer->draw(m_immediateMesh, &m_meshDrawParams); + + if (m->m_colours.size()) + m_meshDrawParams.colorArray = 0; + + } +} + +void DemoContextD3D11::drawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex, float expand, bool twosided, bool smooth) +{ + if (!numTris) + return; + + m_immediateMesh->updateData(positions, normals, NULL, NULL, indices, numPositions, numTris); + + if (twosided) + SetCullMode(false); + + m_meshDrawParams.bias = 0.0f; + m_meshDrawParams.expand = expand; + + m_meshDrawParams.color = (const float4&)(g_colors[colorIndex + 1] * 1.5f); + m_meshDrawParams.secondaryColor = (const float4&)(g_colors[colorIndex] * 1.5f); + m_meshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; + m_meshDrawParams.shadowMap = (ShadowMapD3D*)m_shadowMap; + + m_meshRenderer->draw(m_immediateMesh, &m_meshDrawParams); + + if (twosided) + setCullMode(true); + + m_meshDrawParams.bias = m_shadowBias; + m_meshDrawParams.expand = 0.0f; +} + +void DemoContextD3D11::drawRope(Vec4* positions, int* indices, int numIndices, float radius, int color) +{ + if (numIndices < 2) + return; + + std::vector<Vec3> vertices; + std::vector<Vec3> normals; + std::vector<int> triangles; + + // flatten curve + std::vector<Vec3> curve(numIndices); + for (int i = 0; i < numIndices; ++i) + curve[i] = Vec3(positions[indices[i]]); + + const int resolution = 8; + const int smoothing = 3; + + vertices.reserve(resolution*numIndices*smoothing); + normals.reserve(resolution*numIndices*smoothing); + triangles.reserve(numIndices*resolution * 6 * smoothing); + + Extrude(&curve[0], int(curve.size()), vertices, normals, triangles, radius, resolution, smoothing); + + m_immediateMesh->updateData(&vertices[0], &normals[0], NULL, NULL, &triangles[0], int(vertices.size()), int(triangles.size())/3); + + setCullMode(false); + + m_meshDrawParams.color = (const float4&)(g_colors[color % 8] * 1.5f); + m_meshDrawParams.secondaryColor = (const float4&)(g_colors[color % 8] * 1.5f); + m_meshDrawParams.objectTransform = (const float4x4&)Matrix44::kIdentity; + m_meshDrawParams.shadowMap = (ShadowMapD3D*)m_shadowMap; + + m_meshRenderer->draw(m_immediateMesh, &m_meshDrawParams); + + setCullMode(true); +} + +void DemoContextD3D11::drawPlane(const Vec4& p, bool color) +{ + std::vector<Vec3> vertices; + std::vector<Vec3> normals; + std::vector<int> indices; + + Vec3 u, v; + BasisFromVector(Vec3(p.x, p.y, p.z), &u, &v); + + Vec3 c = Vec3(p.x, p.y, p.z)*-p.w; + + m_meshDrawParams.shadowMap = (ShadowMapD3D*)m_shadowMap; + + if (color) + m_meshDrawParams.color = (const float4&)(p * 0.5f + Vec4(0.5f, 0.5f, 0.5f, 0.5f)); + + const float kSize = 200.0f; + const int kGrid = 3; + + // draw a grid of quads, otherwise z precision suffers + for (int x = -kGrid; x <= kGrid; ++x) + { + for (int y = -kGrid; y <= kGrid; ++y) + { + Vec3 coff = c + u*float(x)*kSize*2.0f + v*float(y)*kSize*2.0f; + + int indexStart = int(vertices.size()); + + vertices.push_back(Vec3(coff + u*kSize + v*kSize)); + vertices.push_back(Vec3(coff - u*kSize + v*kSize)); + vertices.push_back(Vec3(coff - u*kSize - v*kSize)); + vertices.push_back(Vec3(coff + u*kSize - v*kSize)); + + normals.push_back(Vec3(p.x, p.y, p.z)); + normals.push_back(Vec3(p.x, p.y, p.z)); + normals.push_back(Vec3(p.x, p.y, p.z)); + normals.push_back(Vec3(p.x, p.y, p.z)); + + + indices.push_back(indexStart+0); + indices.push_back(indexStart+1); + indices.push_back(indexStart+2); + + indices.push_back(indexStart+2); + indices.push_back(indexStart+3); + indices.push_back(indexStart+0); + } + } + + m_immediateMesh->updateData(&vertices[0], &normals[0], NULL, NULL, &indices[0], int(vertices.size()), int(indices.size())/3); + m_meshRenderer->draw(m_immediateMesh, &m_meshDrawParams); +} + +void DemoContextD3D11::drawPlanes(Vec4* planes, int n, float bias) +{ + m_meshDrawParams.color = (float4&)Vec4(0.9f, 0.9f, 0.9f, 1.0f); + + m_meshDrawParams.bias = 0.0f; + m_meshDrawParams.grid = 1; + m_meshDrawParams.expand = 0; + + for (int i = 0; i < n; ++i) + { + Vec4 p = planes[i]; + p.w -= bias; + + drawPlane(p, false); + } + + m_meshDrawParams.grid = 0; + m_meshDrawParams.bias = m_shadowBias; + +} + +GpuMesh* DemoContextD3D11::createGpuMesh(const Mesh* m) +{ + GpuMeshD3D11* mesh = new GpuMeshD3D11(m_appGraphCtxD3D11->m_device, m_appGraphCtxD3D11->m_deviceContext); + mesh->updateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, NULL, (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces())); + return (GpuMesh*)mesh; +} + +void DemoContextD3D11::destroyGpuMesh(GpuMesh* m) +{ + delete reinterpret_cast<GpuMeshD3D11*>(m); +} + +void DemoContextD3D11::drawGpuMesh(GpuMesh* meshIn, const Matrix44& xform, const Vec3& color) +{ + if (meshIn) + { + GpuMeshD3D11* mesh = (GpuMeshD3D11*)meshIn; + + MeshDrawParamsD3D params = m_meshDrawParams; + + params.color = (float4&)color; + params.secondaryColor = (float4&)color; + params.objectTransform = (float4x4&)xform; + params.shadowMap = (ShadowMapD3D*)m_shadowMap; + + m_meshRenderer->draw(mesh, ¶ms); + } +} + +void DemoContextD3D11::drawGpuMeshInstances(GpuMesh* meshIn, const Matrix44* xforms, int n, const Vec3& color) +{ + if (meshIn) + { + GpuMeshD3D11* mesh = (GpuMeshD3D11*)meshIn; + + m_meshDrawParams.color = (float4&)color; + m_meshDrawParams.secondaryColor = (float4&)color; + m_meshDrawParams.shadowMap = (ShadowMapD3D*)m_shadowMap; + + // copy params + MeshDrawParamsD3D params(m_meshDrawParams); + + for (int i = 0; i < n; ++i) + { + params.objectTransform = (const float4x4&)xforms[i]; + m_meshRenderer->draw(mesh, ¶ms); + } + } +} + +void DemoContextD3D11::drawPoints(FluidRenderBuffers* buffersIn, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, bool showDensity) +{ + FluidRenderBuffersD3D11& buffers = *reinterpret_cast<FluidRenderBuffersD3D11*>(buffersIn); + if (n == 0) + return; + + PointDrawParamsD3D params; + + params.renderMode = POINT_RENDER_SOLID; + params.cullMode = POINT_CULL_BACK; + params.model = (const XMMATRIX&)Matrix44::kIdentity; + params.view = (const XMMATRIX&)m_view; + params.projection = (const XMMATRIX&)m_proj; + + params.pointRadius = radius; + params.pointScale = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); + params.spotMin = m_spotMin; + params.spotMax = m_spotMax; + + int mode = 0; + if (showDensity) + mode = 1; + if (shadowTex == 0) + mode = 2; + params.mode = mode; + + for (int i = 0; i < 8; i++) + params.colors[i] = *((const float4*)&g_colors[i].r); + + // set shadow parameters + ShadowParamsD3D shadow; + RenderParamsUtilD3D::calcShadowParams(lightPos, lightTarget, lightTransform, m_shadowBias, &shadow); + params.lightTransform = shadow.lightTransform; + params.lightDir = shadow.lightDir; + params.lightPos = shadow.lightPos; + memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); + + if (m_meshDrawParams.renderStage == MESH_DRAW_SHADOW) + { + params.renderStage = POINT_DRAW_SHADOW; + params.mode = 2; + } + else + { + params.renderStage = POINT_DRAW_LIGHT; + } + + params.shadowMap = (ShadowMapD3D*)m_shadowMap; + + m_pointRenderer->draw(¶ms, buffers.m_positions.Get(), buffers.m_densities.Get(), buffers.m_indices.Get(), n, offset); +} + +void DemoContextD3D11::renderEllipsoids(FluidRenderer* rendererIn, FluidRenderBuffers* buffersIn, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, Vec4 color, float blur, float ior, bool debug) +{ + FluidRenderBuffersD3D11& buffers = *reinterpret_cast<FluidRenderBuffersD3D11*>(buffersIn); + FluidRendererD3D11& renderer = *(FluidRendererD3D11*)rendererIn; + if (n == 0) + return; + + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + FluidDrawParamsD3D params; + + params.renderMode = FLUID_RENDER_SOLID; + params.cullMode = FLUID_CULL_BACK; + params.model = (const XMMATRIX&)Matrix44::kIdentity; + params.view = (const XMMATRIX&)m_view; + params.projection = (XMMATRIX&)m_proj; + + params.offset = offset; + params.n = n; + params.renderStage = FLUID_DRAW_LIGHT; + + const float viewHeight = tanf(fov / 2.0f); + params.invViewport = float3(1.0f / screenWidth, screenAspect / screenWidth, 1.0f); + params.invProjection = float3(screenAspect * viewHeight, viewHeight, 1.0f); + + params.shadowMap = (ShadowMapD3D*)m_shadowMap; + + renderer.m_depthTexture.bindAndClear(m_appGraphCtxD3D11->m_deviceContext); + + // draw static shapes into depth buffer + //DrawShapes(); + + renderer.drawEllipsoids(¶ms, &buffers); + + + //--------------------------------------------------------------- + // build smooth depth + + renderer.m_depthSmoothTexture.bindAndClear(deviceContext); + + params.blurRadiusWorld = radius * 0.5f; + params.blurScale = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); + params.invTexScale = float4(1.0f / screenAspect, 1.0f, 0.0f, 0.0f); + params.blurFalloff = blur; + params.debug = debug; + + renderer.drawBlurDepth(¶ms); + + //--------------------------------------------------------------- + // composite + + { + deviceContext->RSSetViewports(1, &m_appGraphCtxD3D11->m_viewport); + deviceContext->RSSetScissorRects(0, nullptr); + + deviceContext->OMSetRenderTargets(1, &m_appGraphCtxD3D11->m_rtv, m_appGraphCtxD3D11->m_dsv); + deviceContext->OMSetDepthStencilState(m_appGraphCtxD3D11->m_depthState, 0u); + + float blendFactor[4] = { 1.0, 1.0, 1.0, 1.0 }; + deviceContext->OMSetBlendState(m_compositeBlendState, blendFactor, 0xffff); + } + + params.invTexScale = (float4&)Vec2(1.0f / screenWidth, screenAspect / screenWidth); + params.clipPosToEye = (float4&)Vec2(tanf(fov*0.5f)*screenAspect, tanf(fov*0.5f)); + params.color = (float4&)color; + params.ior = ior; + params.spotMin = m_spotMin; + params.spotMax = m_spotMax; + params.debug = debug; + + params.lightPos = (const float3&)lightPos; + params.lightDir = (const float3&)-Normalize(lightTarget - lightPos); + params.lightTransform = (const XMMATRIX&)(ConvertToD3DProjection(lightTransform)); + + // Resolve MS back buffer/copy + if (m_msaaSamples > 1) + { + deviceContext->ResolveSubresource(m_fluidResolvedTarget, 0, m_appGraphCtxD3D11->m_backBuffer, 0, DXGI_FORMAT_R8G8B8A8_UNORM); + } + else + { + deviceContext->CopyResource(m_fluidResolvedTarget, m_appGraphCtxD3D11->m_backBuffer); + } + + renderer.drawComposite(¶ms, m_fluidResolvedTargetSRV); + + deviceContext->OMSetBlendState(nullptr, 0, 0xffff); +} + +DiffuseRenderBuffers* DemoContextD3D11::createDiffuseRenderBuffers(int numParticles, bool& enableInterop) +{ + ID3D11Device* device = m_appGraphCtxD3D11->m_device; + DiffuseRenderBuffersD3D11* buffers = new DiffuseRenderBuffersD3D11; + + buffers->m_numParticles = numParticles; + if (numParticles > 0) + { + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = numParticles * sizeof(Vec4); + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + if (enableInterop) + { + bufDesc.CPUAccessFlags = 0; + bufDesc.Usage = D3D11_USAGE_DEFAULT; + bufDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; + } + + device->CreateBuffer(&bufDesc, NULL, buffers->m_positions.ReleaseAndGetAddressOf()); + device->CreateBuffer(&bufDesc, NULL, buffers->m_velocities.ReleaseAndGetAddressOf()); + } + + if (enableInterop) + { + extern NvFlexLibrary* g_flexLib; + + buffers->m_positionsBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_positions.Get(), numParticles, sizeof(Vec4)); + buffers->m_velocitiesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_velocities.Get(), numParticles, sizeof(Vec4)); + + if (buffers->m_positionsBuf == nullptr || + buffers->m_velocitiesBuf == nullptr) + enableInterop = false; + } + } + + return reinterpret_cast<DiffuseRenderBuffers*>(buffers); +} + +void DemoContextD3D11::destroyDiffuseRenderBuffers(DiffuseRenderBuffers* buffers) +{ + delete reinterpret_cast<DiffuseRenderBuffersD3D11*>(buffers); +} + +void DemoContextD3D11::updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffersIn, NvFlexSolver* solver) +{ + DiffuseRenderBuffersD3D11* buffers = reinterpret_cast<DiffuseRenderBuffersD3D11*>(buffersIn); + // diffuse particles + if (buffers->m_numParticles) + { + NvFlexGetDiffuseParticles(solver, buffers->m_positionsBuf, buffers->m_velocitiesBuf, nullptr); + } +} + +void DemoContextD3D11::updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffersIn, Vec4* diffusePositions, Vec4* diffuseVelocities, int numDiffuseParticles) +{ + DiffuseRenderBuffersD3D11& buffers = *reinterpret_cast<DiffuseRenderBuffersD3D11*>(buffersIn); + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + D3D11_MAPPED_SUBRESOURCE res; + + // vertices + if (diffusePositions) + { + deviceContext->Map(buffers.m_positions.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, diffusePositions, sizeof(Vec4)*numDiffuseParticles); + deviceContext->Unmap(buffers.m_positions.Get(), 0); + } + + if (diffuseVelocities) + { + deviceContext->Map(buffers.m_velocities.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, diffuseVelocities, sizeof(Vec4)*numDiffuseParticles); + deviceContext->Unmap(buffers.m_velocities.Get(), 0); + } +} + +void DemoContextD3D11::drawDiffuse(FluidRenderer* renderIn, const DiffuseRenderBuffers* buffersIn, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadowEnabled, bool front) +{ + FluidRendererD3D11* render = (FluidRendererD3D11*)renderIn; + const DiffuseRenderBuffersD3D11& buffers = *reinterpret_cast<const DiffuseRenderBuffersD3D11*>(buffersIn); + if (n == 0) + return; + + DiffuseDrawParamsD3D params; + + params.model = (const XMMATRIX&)Matrix44::kIdentity; + params.view = (const XMMATRIX&)m_view; + params.projection = (const XMMATRIX&)m_proj; + params.diffuseRadius = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); + params.diffuseScale = radius; + params.spotMin = m_spotMin; + params.spotMax = m_spotMax; + params.color = float4(1.0f, 1.0f, 1.0f, 1.0f); + params.motionScale = motionBlur; + + // set shadow parameters + ShadowParamsD3D shadow; + RenderParamsUtilD3D::calcShadowParams(lightPos, lightTarget, lightTransform, m_shadowBias, &shadow); + params.lightTransform = shadow.lightTransform; + params.lightDir = shadow.lightDir; + params.lightPos = shadow.lightPos; + params.shadowMap = (ShadowMapD3D*)m_shadowMap; + + memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); + + m_diffuseRenderer->draw(¶ms, buffers.m_positions.Get(), buffers.m_velocities.Get(), n); + + // reset depth stencil state + m_appGraphCtxD3D11->m_deviceContext->OMSetDepthStencilState(m_appGraphCtxD3D11->m_depthState, 0u); +} + +int DemoContextD3D11::getNumDiffuseRenderParticles(DiffuseRenderBuffers* buffers) +{ + return reinterpret_cast<DiffuseRenderBuffersD3D11*>(buffers)->m_numParticles; +} + +void DemoContextD3D11::beginLines() +{ +} + +void DemoContextD3D11::drawLine(const Vec3& p, const Vec3& q, const Vec4& color) +{ + m_debugLineRender->addLine(p, q, color); +} + +void DemoContextD3D11::endLines() +{ + // draw + Matrix44 projectionViewWorld = ((Matrix44&)(m_meshDrawParams.projection))*((Matrix44&)(m_meshDrawParams.view)); + + m_debugLineRender->flush(projectionViewWorld); +} + +void DemoContextD3D11::startGpuWork() {} +void DemoContextD3D11::endGpuWork() {} + +void DemoContextD3D11::flushGraphicsAndWait() +{ + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + deviceContext->End(m_renderCompletionFence); + while (S_OK != deviceContext->GetData(m_renderCompletionFence, 0, 0, 0)); +} + +void* DemoContextD3D11::getGraphicsCommandQueue() { return NULL; } + +void DemoContextD3D11::drawImguiGraph() +{ + imguiGraphDraw(); +} diff --git a/demo/d3d11/demoContextD3D11.h b/demo/d3d11/demoContextD3D11.h new file mode 100644 index 0000000..e01dfe2 --- /dev/null +++ b/demo/d3d11/demoContextD3D11.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + + +struct DemoContextD3D11 : public DemoContext +{ +public: + + // DemoContext Impl + virtual bool initialize(const RenderInitOptions& options); + virtual void startFrame(Vec4 colorIn); + virtual void endFrame(); + virtual void presentFrame(bool fullsync); + virtual void getViewRay(int x, int y, Vec3& origin, Vec3& dir); + virtual void setView(Matrix44 view, Matrix44 projection); + virtual void renderEllipsoids(FluidRenderer* renderer, FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, Vec4 color, float blur, float ior, bool debug); + virtual void drawMesh(const Mesh* m, Vec3 color); + virtual void drawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex, float expand, bool twosided, bool smooth); + virtual void drawRope(Vec4* positions, int* indices, int numIndices, float radius, int color); + virtual void drawPlane(const Vec4& p, bool color); + virtual void drawPlanes(Vec4* planes, int n, float bias); + virtual void drawPoints(FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowTex, bool showDensity); + virtual void graphicsTimerBegin(); + virtual void graphicsTimerEnd(); + virtual float rendererGetDeviceTimestamps(unsigned long long* begin, unsigned long long* end, unsigned long long* freq); + virtual void bindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, float bias, Vec4 fogColor); + virtual void unbindSolidShader(); + virtual ShadowMap* shadowCreate(); + virtual void shadowDestroy(ShadowMap* map); + virtual void shadowBegin(ShadowMap* map); + virtual void shadowEnd(); + virtual FluidRenderer* createFluidRenderer(uint32_t width, uint32_t height); + virtual void destroyFluidRenderer(FluidRenderer* renderer); + virtual FluidRenderBuffers* createFluidRenderBuffers(int numParticles, bool enableInterop); + virtual void updateFluidRenderBuffers(FluidRenderBuffers* buffers, NvFlexSolver* flex, bool anisotropy, bool density); + virtual void updateFluidRenderBuffers(FluidRenderBuffers* buffers, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices); + virtual void destroyFluidRenderBuffers(FluidRenderBuffers* buffers); + virtual GpuMesh* createGpuMesh(const Mesh* m); + virtual void destroyGpuMesh(GpuMesh* mesh); + virtual void drawGpuMesh(GpuMesh* m, const Matrix44& xform, const Vec3& color); + virtual void drawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const Vec3& color); + virtual DiffuseRenderBuffers* createDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop); + virtual void destroyDiffuseRenderBuffers(DiffuseRenderBuffers* buffers); + virtual void updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, Vec4* diffusePositions, Vec4* diffuseVelocities, int numDiffuseParticles); + virtual void updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, NvFlexSolver* solver); + virtual void drawDiffuse(FluidRenderer* render, const DiffuseRenderBuffers* buffers, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadowEnabled, bool front); + virtual int getNumDiffuseRenderParticles(DiffuseRenderBuffers* buffers); + virtual void beginLines(); + virtual void drawLine(const Vec3& p, const Vec3& q, const Vec4& color); + virtual void endLines(); + virtual void onSizeChanged(int width, int height, bool minimized); + virtual void startGpuWork(); + virtual void endGpuWork(); + virtual void flushGraphicsAndWait(); + virtual void setFillMode(bool wire); + virtual void setCullMode(bool enabled); + virtual void drawImguiGraph(); + virtual void* getGraphicsCommandQueue(); + virtual void getRenderDevice(void** device, void** context); + + DemoContextD3D11(); + virtual ~DemoContextD3D11(); + +protected: + void _flushFrame(); + void _onWindowSizeChanged(int width, int height, bool minimized); + + DebugLineRenderD3D11* m_debugLineRender; + MeshRendererD3D11* m_meshRenderer; + PointRendererD3D11* m_pointRenderer; + DiffuseRendererD3D11* m_diffuseRenderer; + + // Used when blending water in the final 'composite' phase + ID3D11BlendState* m_compositeBlendState; + + // Target texture resolved/copied to for combination rendering from for water surface + ID3D11Texture2D* m_fluidResolvedTarget; + ID3D11ShaderResourceView* m_fluidResolvedTargetSRV; + + AppGraphCtx* m_appGraphCtx; + AppGraphCtxD3D11* m_appGraphCtxD3D11; + + float m_spotMin; + float m_spotMax; + float m_shadowBias; + + MeshDrawParamsD3D m_meshDrawParams; + + Matrix44 m_view; + Matrix44 m_proj; + + ShadowMapD3D11* m_shadowMap; + GpuMeshD3D11* m_immediateMesh; + + SDL_Window* m_window; + + int m_msaaSamples; + + ID3D11Query* m_renderTimerDisjoint; + ID3D11Query* m_renderTimerBegin; + ID3D11Query* m_renderTimerEnd; + ID3D11Query* m_renderCompletionFence; + bool m_timersSet = false; +}; diff --git a/demo/d3d11/diffuseRender.h b/demo/d3d11/diffuseRender.h deleted file mode 100644 index 69517b2..0000000 --- a/demo/d3d11/diffuseRender.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -#pragma once - -#include <DirectXMath.h> - -#include "shadowMap.h" - - -typedef DirectX::XMFLOAT3 float3; -typedef DirectX::XMFLOAT4 float4; -typedef DirectX::XMFLOAT4X4 float4x4; - -struct DiffuseDrawParams -{ - DirectX::XMMATRIX projection; - DirectX::XMMATRIX view; - DirectX::XMMATRIX model; - - float diffuseRadius; // point size in world space - float diffuseScale; // scale to calculate size in pixels - float spotMin; - float spotMax; - float motionScale; - - DirectX::XMMATRIX lightTransform; - float3 lightPos; - float3 lightDir; - - float4 color; - - float4 shadowTaps[12]; - ShadowMap* shadowMap; - - int mode; -}; - - -struct DiffuseRenderer -{ - ID3D11Device* m_device = nullptr; - ID3D11DeviceContext* m_deviceContext = nullptr; - - ID3D11InputLayout* m_inputLayout = nullptr; - - ID3D11VertexShader* m_diffuseVS = nullptr; - ID3D11GeometryShader* m_diffuseGS = nullptr; - ID3D11PixelShader* m_diffusePS = nullptr; - - ID3D11Buffer* m_constantBuffer = nullptr; - ID3D11RasterizerState* m_rasterizerState = nullptr; - - ID3D11BlendState* m_blendState = nullptr; - ID3D11DepthStencilState* m_depthStencilState = nullptr; - - void Init(ID3D11Device* device, ID3D11DeviceContext* deviceContext); - void Destroy(); - - - void Draw(const DiffuseDrawParams* params, ID3D11Buffer* positions, ID3D11Buffer* velocities, ID3D11Buffer* indices, int numParticles); -}; diff --git a/demo/d3d11/diffuseRender.cpp b/demo/d3d11/diffuseRenderD3D11.cpp index 60ced59..846a8bf 100644 --- a/demo/d3d11/diffuseRender.cpp +++ b/demo/d3d11/diffuseRenderD3D11.cpp @@ -21,17 +21,15 @@ #include "appD3D11Ctx.h" -#include "diffuseRender.h" +#include "diffuseRenderD3D11.h" -#include "shaders/diffuseVS.hlsl.h" -#include "shaders/diffuseGS.hlsl.h" -#include "shaders/diffusePS.hlsl.h" +#include "../d3d/shaders/diffuseVS.hlsl.h" +#include "../d3d/shaders/diffuseGS.hlsl.h" +#include "../d3d/shaders/diffusePS.hlsl.h" -#define EXCLUDE_SHADER_STRUCTS 1 -#include "shaders/shaderCommon.h" +#include "../d3d/shaderCommonD3D.h" - -void DiffuseRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) +void DiffuseRendererD3D11::init(ID3D11Device* device, ID3D11DeviceContext* context) { m_device = device; m_deviceContext = context; @@ -48,9 +46,9 @@ void DiffuseRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) } // create the shaders - m_device->CreateVertexShader(g_diffuseVS, sizeof(g_diffuseVS), nullptr, &m_diffuseVS); - m_device->CreateGeometryShader(g_diffuseGS, sizeof(g_diffuseGS), nullptr, &m_diffuseGS); - m_device->CreatePixelShader(g_diffusePS, sizeof(g_diffusePS), nullptr, &m_diffusePS); + m_device->CreateVertexShader(g_diffuseVS, sizeof(g_diffuseVS), nullptr, &m_diffuseVs); + m_device->CreateGeometryShader(g_diffuseGS, sizeof(g_diffuseGS), nullptr, &m_diffuseGs); + m_device->CreatePixelShader(g_diffusePS, sizeof(g_diffusePS), nullptr, &m_diffusePs); { D3D11_BLEND_DESC blendDesc = {}; @@ -80,7 +78,7 @@ void DiffuseRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) // create a constant buffer { D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(DiffuseShaderConst); // 64 * sizeof(float); + bufDesc.ByteWidth = sizeof(Hlsl::DiffuseShaderConst); // 64 * sizeof(float); bufDesc.Usage = D3D11_USAGE_DYNAMIC; bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; @@ -107,77 +105,43 @@ void DiffuseRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) } } -void DiffuseRenderer::Destroy() -{ - COMRelease(m_inputLayout); - COMRelease(m_diffuseVS); - COMRelease(m_diffuseGS); - COMRelease(m_diffusePS); - COMRelease(m_constantBuffer); - COMRelease(m_rasterizerState); - COMRelease(m_blendState); - COMRelease(m_depthStencilState); -} - - - -void DiffuseRenderer::Draw(const DiffuseDrawParams* params, ID3D11Buffer* positions, ID3D11Buffer* velocities, ID3D11Buffer* indices, int numParticles) +void DiffuseRendererD3D11::draw(const DiffuseDrawParamsD3D* params, ID3D11Buffer* positions, ID3D11Buffer* velocities, int numParticles) { using namespace DirectX; - ID3D11DeviceContext* deviceContext = m_deviceContext; // update constant buffer { D3D11_MAPPED_SUBRESOURCE mappedResource = { 0 }; - if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) + if (SUCCEEDED(deviceContext->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) { - DiffuseShaderConst cParams; - - cParams.modelViewProjection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection)); - cParams.modelView = (float4x4&)XMMatrixMultiply(params->model, params->view); - cParams.projection = (float4x4&)params->projection; - - cParams.motionBlurScale = params->motionScale; - cParams.diffuseRadius = params->diffuseRadius; - cParams.diffuseScale = params->diffuseScale; - cParams.spotMin = params->spotMin; - cParams.spotMax = params->spotMax; - - cParams.lightTransform = (float4x4&)params->lightTransform; - cParams.lightPos = params->lightPos; - cParams.lightDir = params->lightDir; - cParams.color = params->color; - - - memcpy(cParams.shadowTaps, params->shadowTaps, sizeof(cParams.shadowTaps)); - - memcpy(mappedResource.pData, &cParams, sizeof(DiffuseShaderConst)); - - deviceContext->Unmap(m_constantBuffer, 0u); + Hlsl::DiffuseShaderConst constBuf; + RenderParamsUtilD3D::calcDiffuseConstantBuffer(*params, constBuf); + memcpy(mappedResource.pData, &constBuf, sizeof(Hlsl::DiffuseShaderConst)); + deviceContext->Unmap(m_constantBuffer.Get(), 0u); } } - deviceContext->VSSetShader(m_diffuseVS, nullptr, 0u); - deviceContext->GSSetShader(m_diffuseGS, nullptr, 0u); - deviceContext->PSSetShader(m_diffusePS, nullptr, 0u); + deviceContext->VSSetShader(m_diffuseVs.Get(), nullptr, 0u); + deviceContext->GSSetShader(m_diffuseGs.Get(), nullptr, 0u); + deviceContext->PSSetShader(m_diffusePs.Get(), nullptr, 0u); if (params->shadowMap) { - ShadowMap* shadowMap = (ShadowMap*)params->shadowMap; + ShadowMapD3D11* shadowMap = (ShadowMapD3D11*)params->shadowMap; - ID3D11ShaderResourceView* ppSRV[1] = { shadowMap->m_depthSrv.Get() }; - deviceContext->PSSetShaderResources(0, 1, ppSRV); - ID3D11SamplerState* ppSS[1] = { shadowMap->m_linearSampler.Get() }; - deviceContext->PSSetSamplers(0, 1, ppSS); + ID3D11ShaderResourceView* srvs[1] = { shadowMap->m_depthSrv.Get() }; + deviceContext->PSSetShaderResources(0, 1, srvs); + ID3D11SamplerState* samps[1] = { shadowMap->m_linearSampler.Get() }; + deviceContext->PSSetSamplers(0, 1, samps); } - deviceContext->IASetInputLayout(m_inputLayout); + deviceContext->IASetInputLayout(m_inputLayout.Get()); deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); - deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->GSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer); + deviceContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->GSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->PSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); ID3D11Buffer* vertexBuffers[2] = { @@ -194,24 +158,25 @@ void DiffuseRenderer::Draw(const DiffuseDrawParams* params, ID3D11Buffer* positi unsigned int vertexBufferOffsets[2] = { 0 }; deviceContext->IASetVertexBuffers(0, 2, vertexBuffers, vertexBufferStrides, vertexBufferOffsets); - deviceContext->IASetIndexBuffer(indices, DXGI_FORMAT_R32_UINT, 0u); + deviceContext->IASetIndexBuffer(NV_NULL, DXGI_FORMAT_R32_UINT, 0u); - deviceContext->OMSetBlendState(m_blendState, nullptr, 0xFFFFFFFF); - deviceContext->OMSetDepthStencilState(m_depthStencilState, 0u); + deviceContext->OMSetBlendState(m_blendState.Get(), nullptr, 0xFFFFFFFF); + deviceContext->OMSetDepthStencilState(m_depthStencilState.Get(), 0u); float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); if (depthSign < 0.f) { - deviceContext->RSSetState(m_rasterizerState); + deviceContext->RSSetState(m_rasterizerState.Get()); } - deviceContext->DrawIndexed(numParticles, 0, 0); + deviceContext->Draw(numParticles, 0); if (depthSign < 0.f) { deviceContext->RSSetState(nullptr); } + deviceContext->GSSetShader(nullptr, nullptr, 0u); deviceContext->OMSetDepthStencilState(nullptr, 0u); deviceContext->OMSetBlendState(nullptr, nullptr, 0xFFFFFFFF); } diff --git a/demo/d3d11/diffuseRenderD3D11.h b/demo/d3d11/diffuseRenderD3D11.h new file mode 100644 index 0000000..cf4231e --- /dev/null +++ b/demo/d3d11/diffuseRenderD3D11.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#include <DirectXMath.h> + +#include "shadowMapD3D11.h" +#include "../include/NvFlex.h" +#include "../d3d/renderParamsD3D.h" +#include "shaders.h" + +#include <wrl.h> +using namespace Microsoft::WRL; + +// vertex buffers for diffuse particles +struct DiffuseRenderBuffersD3D11 +{ + DiffuseRenderBuffersD3D11() : + m_positionsBuf(nullptr), + m_velocitiesBuf(nullptr) + { + m_numParticles = 0; + } + + ~DiffuseRenderBuffersD3D11() + { + if (m_numParticles > 0) + { + NvFlexUnregisterD3DBuffer(m_positionsBuf); + NvFlexUnregisterD3DBuffer(m_velocitiesBuf); + } + } + + int m_numParticles; + + ComPtr<ID3D11Buffer> m_positions; + ComPtr<ID3D11Buffer> m_velocities; + + NvFlexBuffer* m_positionsBuf; + NvFlexBuffer* m_velocitiesBuf; +}; + +struct DiffuseRendererD3D11 +{ + void init(ID3D11Device* device, ID3D11DeviceContext* deviceContext); + + void draw(const DiffuseDrawParamsD3D* params, ID3D11Buffer* positions, ID3D11Buffer* velocities, int numParticles); + + DiffuseRendererD3D11(): + m_device(nullptr), + m_deviceContext(nullptr) + {} + + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceContext; + + ComPtr<ID3D11InputLayout> m_inputLayout; + + ComPtr<ID3D11VertexShader> m_diffuseVs; + ComPtr<ID3D11GeometryShader> m_diffuseGs; + ComPtr<ID3D11PixelShader> m_diffusePs; + + ComPtr<ID3D11Buffer> m_constantBuffer; + ComPtr<ID3D11RasterizerState> m_rasterizerState; + + ComPtr<ID3D11BlendState> m_blendState; + ComPtr<ID3D11DepthStencilState> m_depthStencilState; +}; diff --git a/demo/d3d11/fluidRender.cpp b/demo/d3d11/fluidRender.cpp deleted file mode 100644 index f9dd767..0000000 --- a/demo/d3d11/fluidRender.cpp +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -//direct3d headers - -#define NOMINMAX - -#include <d3d11.h> - -// include the Direct3D Library file -#pragma comment (lib, "d3d11.lib") - -#include <math.h> - -#include "appD3D11Ctx.h" - -#include "fluidRender.h" - -#include "shaders/ellipsoidDepthVS.hlsl.h" -#include "shaders/ellipsoidDepthGS.hlsl.h" -#include "shaders/ellipsoidDepthPS.hlsl.h" -#include "shaders/passThroughVS.hlsl.h" -#include "shaders/blurDepthPS.hlsl.h" -#include "shaders/compositePS.hlsl.h" - -#define EXCLUDE_SHADER_STRUCTS 1 -#include "shaders/shaderCommon.h" - -#include "renderTarget.h" -#include "shadowMap.h" - -#include "shaders.h" - -typedef DirectX::XMFLOAT2 float2; - -using namespace DirectX; - - -struct PassthroughVertex -{ - float x, y; - float u, v; -}; - -void FluidRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context, int width, int height) -{ - mSceneWidth = width; - mSceneHeight = height; - - mDepthTex.Init(device, width, height); - mDepthSmoothTex.Init(device, width, height, false); - - m_device = device; - m_deviceContext = context; - - // create the input layout - { - D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "U", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "V", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 2, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "W", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 3, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - - m_device->CreateInputLayout(inputElementDescs, 4, g_ellipsoidDepthVS, sizeof(g_ellipsoidDepthVS), &m_ellipsoidDepthLayout); - } - - // create the shaders - m_device->CreateVertexShader(g_ellipsoidDepthVS, sizeof(g_ellipsoidDepthVS), nullptr, &m_ellipsoidDepthVS); - m_device->CreateGeometryShader(g_ellipsoidDepthGS, sizeof(g_ellipsoidDepthGS), nullptr, &m_ellipsoidDepthGS); - m_device->CreatePixelShader(g_ellipsoidDepthPS, sizeof(g_ellipsoidDepthPS), nullptr, &m_ellipsoidDepthPS); - - // create the input layout - { - D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - - m_device->CreateInputLayout(inputElementDescs, 2, g_passThroughVS, sizeof(g_passThroughVS), &m_passThroughLayout); - } - - // pass through shader - m_device->CreateVertexShader(g_passThroughVS, sizeof(g_passThroughVS), nullptr, &m_passThroughVS); - - // full screen pixel shaders - m_device->CreatePixelShader(g_blurDepthPS, sizeof(g_blurDepthPS), nullptr, &m_blurDepthPS); - m_device->CreatePixelShader(g_compositePS, sizeof(g_compositePS), nullptr, &m_compositePS); - - // create a constant buffer - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(FluidShaderConst); // 64 * sizeof(float); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - - m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer); - } - - // create the rastersizer state - for (int i = 0; i < NUM_FLUID_RENDER_MODES; i++) - { - for (int j = 0; j < NUM_FLUID_CULL_MODES; j++) - - { - D3D11_RASTERIZER_DESC desc = {}; - desc.FillMode = (D3D11_FILL_MODE)(D3D11_FILL_WIREFRAME + i); - desc.CullMode = (D3D11_CULL_MODE)(D3D11_CULL_NONE + j); - desc.FrontCounterClockwise = TRUE; // This is non-default - desc.DepthBias = 0; - desc.DepthBiasClamp = 0.f; - desc.SlopeScaledDepthBias = 0.f; - desc.DepthClipEnable = TRUE; - desc.ScissorEnable = FALSE; - desc.MultisampleEnable = FALSE; - desc.AntialiasedLineEnable = FALSE; - - m_device->CreateRasterizerState(&desc, &m_rasterizerStateRH[i][j]); - } - } - - CreateScreenQuad(); -} - -void FluidRenderer::Destroy() -{ - COMRelease(m_ellipsoidDepthLayout); - COMRelease(m_ellipsoidDepthVS); - COMRelease(m_ellipsoidDepthGS); - COMRelease(m_ellipsoidDepthPS); - - COMRelease(m_passThroughLayout); - COMRelease(m_passThroughVS); - - COMRelease(m_blurDepthPS); - COMRelease(m_compositePS); - - COMRelease(m_constantBuffer); - - for (int i = 0; i < NUM_FLUID_RENDER_MODES; i++) - for (int j = 0; j < NUM_FLUID_CULL_MODES; j++) - COMRelease(m_rasterizerStateRH[i][j]); - - COMRelease(m_quadVertexBuffer); - COMRelease(m_quadIndexBuffer); -} - -void FluidRenderer::CreateScreenQuad() -{ - // create an index buffer - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = 4*sizeof(UINT); - bufDesc.Usage = D3D11_USAGE_IMMUTABLE; - bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; - bufDesc.CPUAccessFlags = DXGI_CPU_ACCESS_NONE; - bufDesc.MiscFlags = 0; - - unsigned int quad_indices[4] = { 0, 1, 3, 2 }; - - D3D11_SUBRESOURCE_DATA data = { 0 }; - data.pSysMem = quad_indices; - - m_device->CreateBuffer(&bufDesc, &data, &m_quadIndexBuffer); - } - - // create a vertex buffer - { - - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = 4*sizeof(PassthroughVertex); - bufDesc.Usage = D3D11_USAGE_IMMUTABLE; - bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bufDesc.CPUAccessFlags = DXGI_CPU_ACCESS_NONE; - bufDesc.MiscFlags = 0; - - D3D11_SUBRESOURCE_DATA data = { 0 }; - - - float4 vertices[4] = - { - float4(-1.0f, -1.0f, 0.0f, 0.0f), - float4(1.0f, -1.0f, 1.0f, 0.0f), - float4(1.0f, 1.0f, 1.0f, 1.0f), - float4(-1.0f, 1.0f, 0.0f, 1.0f), - }; - - data.pSysMem = vertices; - - m_device->CreateBuffer(&bufDesc, &data, &m_quadVertexBuffer); - } -} - -void FluidRenderer::DrawEllipsoids(const FluidDrawParams* params, const FluidRenderBuffers* buffers) -{ - ID3D11DeviceContext* deviceContext = m_deviceContext; - - // update constant buffer - { - - D3D11_BUFFER_DESC desc; - m_constantBuffer->GetDesc(&desc); - - D3D11_MAPPED_SUBRESOURCE mappedResource = {}; - if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) - { - FluidShaderConst cParams; - - cParams.modelviewprojection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection)); - cParams.projection = (float4x4&)params->projection; - cParams.modelview_inverse = (float4x4&)XMMatrixInverse(nullptr, XMMatrixMultiply(params->model, params->view)); - cParams.projection_inverse = (float4x4&)XMMatrixInverse(nullptr, params->projection); - - //cParams.invTexScale = invTexScale; - //cParams.invProjection = invProjection; - cParams.invViewport = params->invViewport; - - - cParams.blurRadiusWorld = params->blurRadiusWorld; - cParams.blurScale = params->blurScale; - cParams.blurFalloff = params->blurFalloff; - cParams.debug = params->debug; - - memcpy(mappedResource.pData, &cParams, sizeof(FluidShaderConst)); - - deviceContext->Unmap(m_constantBuffer, 0u); - } - } - - deviceContext->VSSetShader(m_ellipsoidDepthVS, nullptr, 0u); - deviceContext->GSSetShader(m_ellipsoidDepthGS, nullptr, 0u); - deviceContext->PSSetShader(m_ellipsoidDepthPS, nullptr, 0u); - - deviceContext->IASetInputLayout(m_ellipsoidDepthLayout); - deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); - - deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->GSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer); - - ID3D11Buffer* vertexBuffers[4] = - { - buffers->mPositionVBO, - buffers->mAnisotropyVBO[0], - buffers->mAnisotropyVBO[1], - buffers->mAnisotropyVBO[2] - }; - - unsigned int vertexBufferStrides[4] = - { - sizeof(float4), - sizeof(float4), - sizeof(float4), - sizeof(float4) - }; - - unsigned int vertexBufferOffsets[4] = { 0 }; - - deviceContext->IASetVertexBuffers(0, 4, vertexBuffers, vertexBufferStrides, vertexBufferOffsets); - deviceContext->IASetIndexBuffer(buffers->mIndices, DXGI_FORMAT_R32_UINT, 0u); - - float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); - if (depthSign < 0.f) - { - deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]); - } - - deviceContext->DrawIndexed(params->n, params->offset, 0); - - if (depthSign < 0.f) - { - deviceContext->RSSetState(nullptr); - } -} - -void FluidRenderer::DrawBlurDepth(const FluidDrawParams* params) -{ - ID3D11DeviceContext* deviceContext = m_deviceContext; - - // update constant buffer - { - D3D11_MAPPED_SUBRESOURCE mappedResource = {}; - if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) - { - FluidShaderConst cParams; - - cParams.modelviewprojection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection)); - cParams.projection = (float4x4&)params->projection; - cParams.modelview_inverse = (float4x4&)XMMatrixInverse(nullptr, XMMatrixMultiply(params->model, params->view)); - cParams.projection_inverse = (float4x4&)XMMatrixInverse(nullptr, params->projection); - - //cParams.invTexScale = params->invTexScale; - //cParams.invViewport = params->invViewport; - //cParams.invProjection = params->invProjection; - - cParams.blurRadiusWorld = params->blurRadiusWorld; - cParams.blurScale = params->blurScale; - cParams.blurFalloff = params->blurFalloff; - cParams.debug = params->debug; - - memcpy(mappedResource.pData, &cParams, sizeof(FluidShaderConst)); - - deviceContext->Unmap(m_constantBuffer, 0u); - } - } - - deviceContext->VSSetShader(m_passThroughVS, nullptr, 0u); - deviceContext->GSSetShader(nullptr, nullptr, 0u); - deviceContext->PSSetShader(m_blurDepthPS, nullptr, 0u); - - ID3D11ShaderResourceView* ppSRV[1] = { mDepthTex.m_backSrv.Get() }; - deviceContext->PSSetShaderResources(0, 1, ppSRV); - - deviceContext->IASetInputLayout(m_passThroughLayout); - deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); - - deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer); - - UINT vertexStride = sizeof(PassthroughVertex); - UINT offset = 0u; - deviceContext->IASetVertexBuffers(0, 1, &m_quadVertexBuffer, &vertexStride, &offset); - deviceContext->IASetIndexBuffer(m_quadIndexBuffer, DXGI_FORMAT_R32_UINT, 0u); - - float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); - if (depthSign < 0.f) - { - deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]); - } - - deviceContext->DrawIndexed((UINT)4, 0, 0); - - if (depthSign < 0.f) - { - deviceContext->RSSetState(nullptr); - } -} - -void FluidRenderer::DrawComposite(const FluidDrawParams* params, ID3D11ShaderResourceView* sceneMap) -{ - ID3D11DeviceContext* deviceContext = m_deviceContext; - - // update constant buffer - { - D3D11_MAPPED_SUBRESOURCE mappedResource = {}; - if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) - { - FluidShaderConst cParams; - - cParams.modelviewprojection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection)); - cParams.modelview = (float4x4&)XMMatrixMultiply(params->model, params->view); - cParams.projection = (float4x4&)params->projection; - cParams.modelview_inverse = (float4x4&)XMMatrixInverse(nullptr, XMMatrixMultiply(params->model, params->view)); - cParams.projection_inverse = (float4x4&)XMMatrixInverse(nullptr, params->projection); - - cParams.lightTransform = (float4x4&)params->lightTransform; - - cParams.invTexScale = params->invTexScale; - - //cParams.invViewport = params->invViewport; - //cParams.invProjection = params->invProjection; - - cParams.blurRadiusWorld = params->blurRadiusWorld; - cParams.blurScale = params->blurScale; - cParams.blurFalloff = params->blurFalloff; - cParams.debug = params->debug; - - cParams.clipPosToEye = params->clipPosToEye; - cParams.color = params->color; - cParams.ior = params->ior; - cParams.spotMin = params->spotMin; - cParams.spotMax = params->spotMax; - - cParams.lightPos = params->lightPos; - cParams.lightDir = params->lightDir; - - memcpy(mappedResource.pData, &cParams, sizeof(FluidShaderConst)); - - deviceContext->Unmap(m_constantBuffer, 0u); - - const float2 taps[] = - { - float2(-0.326212f,-0.40581f), float2(-0.840144f,-0.07358f), - float2(-0.695914f,0.457137f), float2(-0.203345f,0.620716f), - float2(0.96234f,-0.194983f), float2(0.473434f,-0.480026f), - float2(0.519456f,0.767022f), float2(0.185461f,-0.893124f), - float2(0.507431f,0.064425f), float2(0.89642f,0.412458f), - float2(-0.32194f,-0.932615f), float2(-0.791559f,-0.59771f) - }; - memcpy(cParams.shadowTaps, taps, sizeof(taps)); - } - } - - deviceContext->VSSetShader(m_passThroughVS, nullptr, 0u); - deviceContext->GSSetShader(nullptr, nullptr, 0u); - deviceContext->PSSetShader(m_compositePS, nullptr, 0u); - - - RenderTarget* depthMap = &mDepthSmoothTex; - ShadowMap* shadowMap = (ShadowMap*)params->shadowMap; - - ID3D11ShaderResourceView* ppSRV[3] = - { - depthMap->m_backSrv.Get(), - sceneMap, - shadowMap->m_depthSrv.Get() - - }; - deviceContext->PSSetShaderResources(0, 3, ppSRV); - - ID3D11SamplerState* ppSS[2] = - { - depthMap->m_linearSampler.Get() , - shadowMap->m_linearSampler.Get() - }; - deviceContext->PSSetSamplers(0, 2, ppSS); - - - deviceContext->IASetInputLayout(m_passThroughLayout); - deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); - - deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer); - - UINT vertexStride = sizeof(PassthroughVertex); - UINT offset = 0u; - deviceContext->IASetVertexBuffers(0, 1, &m_quadVertexBuffer, &vertexStride, &offset); - deviceContext->IASetIndexBuffer(m_quadIndexBuffer, DXGI_FORMAT_R32_UINT, 0u); - - float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); - if (depthSign < 0.f) - { - deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]); - } - - deviceContext->DrawIndexed((UINT)4, 0, 0); - - if (depthSign < 0.f) - { - deviceContext->RSSetState(nullptr); - } - - // reset srvs - ID3D11ShaderResourceView* zero[3] = { NULL, NULL, NULL }; - deviceContext->PSSetShaderResources(0, 3, zero); -} - diff --git a/demo/d3d11/fluidRender.h b/demo/d3d11/fluidRender.h deleted file mode 100644 index 43fee4b..0000000 --- a/demo/d3d11/fluidRender.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -#pragma once - -#include <DirectXMath.h> - -#include <d3d11.h> - -#include "renderTarget.h" -#include "shadowMap.h" - -struct FluidRenderBuffers; - -enum FluidRenderMode -{ - FLUID_RENDER_WIREFRAME, - FLUID_RENDER_SOLID, - NUM_FLUID_RENDER_MODES -}; - -enum FluidCullMode -{ - FLUID_CULL_NONE, - FLUID_CULL_FRONT, - FLUID_CULL_BACK, - NUM_FLUID_CULL_MODES -}; - -enum FluidDrawStage -{ - FLUID_DRAW_NULL, - FLUID_DRAW_SHADOW, - FLUID_DRAW_REFLECTION, - FLUID_DRAW_LIGHT -}; - -typedef DirectX::XMFLOAT3 float3; -typedef DirectX::XMFLOAT4 float4; -typedef DirectX::XMFLOAT4X4 float4x4; - -struct FluidDrawParams -{ - FluidRenderMode renderMode; - FluidCullMode cullMode; - FluidDrawStage renderStage; - - int offset; - int n; - - DirectX::XMMATRIX projection; - DirectX::XMMATRIX view; - DirectX::XMMATRIX model; - - float4 invTexScale; - - float3 invViewport; - float3 invProjection; - - float blurRadiusWorld; - float blurScale; - float blurFalloff; - int debug; - - float3 lightPos; - float3 lightDir; - DirectX::XMMATRIX lightTransform; - - float4 color; - float4 clipPosToEye; - - float spotMin; - float spotMax; - float ior; - - ShadowMap* shadowMap; -}; - - -struct FluidRenderer -{ - ID3D11Device* m_device = nullptr; - ID3D11DeviceContext* m_deviceContext = nullptr; - - ID3D11InputLayout* m_ellipsoidDepthLayout = nullptr; - ID3D11VertexShader* m_ellipsoidDepthVS = nullptr; - ID3D11GeometryShader* m_ellipsoidDepthGS = nullptr; - ID3D11PixelShader* m_ellipsoidDepthPS = nullptr; - - ID3D11InputLayout* m_passThroughLayout = nullptr; - ID3D11VertexShader* m_passThroughVS = nullptr; - - ID3D11PixelShader* m_blurDepthPS = nullptr; - ID3D11PixelShader* m_compositePS = nullptr; - - ID3D11Buffer* m_constantBuffer = nullptr; - ID3D11RasterizerState* m_rasterizerStateRH[NUM_FLUID_RENDER_MODES][NUM_FLUID_CULL_MODES]; - - ID3D11Buffer* m_quadVertexBuffer; - ID3D11Buffer* m_quadIndexBuffer; - - RenderTarget mDepthTex; - RenderTarget mDepthSmoothTex; - RenderTarget mThicknessTex; - - int mSceneWidth; - int mSceneHeight; - - void Init(ID3D11Device* device, ID3D11DeviceContext* context, int width, int height); - void Destroy(); - - void DrawEllipsoids(const FluidDrawParams* params, const FluidRenderBuffers* buffers); - void DrawBlurDepth(const FluidDrawParams* params); - void DrawComposite(const FluidDrawParams* params, ID3D11ShaderResourceView* sceneMap); - - void CreateScreenQuad(); -}; - - diff --git a/demo/d3d11/fluidRenderD3D11.cpp b/demo/d3d11/fluidRenderD3D11.cpp new file mode 100644 index 0000000..fa36f9b --- /dev/null +++ b/demo/d3d11/fluidRenderD3D11.cpp @@ -0,0 +1,365 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +//direct3d headers + +#define NOMINMAX + +#include <d3d11.h> + +// include the Direct3D Library file +#pragma comment (lib, "d3d11.lib") + +#include <math.h> + +#include "appD3D11Ctx.h" + +#include "fluidRenderD3D11.h" + +#include "../d3d/shaders/ellipsoidDepthVS.hlsl.h" +#include "../d3d/shaders/ellipsoidDepthGS.hlsl.h" +#include "../d3d/shaders/ellipsoidDepthPS.hlsl.h" +#include "../d3d/shaders/passThroughVS.hlsl.h" +#include "../d3d/shaders/blurDepthPS.hlsl.h" +#include "../d3d/shaders/compositePS.hlsl.h" + +#include "../d3d/shaderCommonD3D.h" + +#include "renderTargetD3D11.h" +#include "shadowMapD3D11.h" + +#include "shaders.h" + +typedef DirectX::XMFLOAT2 float2; + +using namespace DirectX; + +struct PassthroughVertex +{ + float3 position; + float3 normal; + float2 texcoords; + float4 color; +}; + +void FluidRendererD3D11::init(ID3D11Device* device, ID3D11DeviceContext* context, int width, int height) +{ + m_sceneWidth = width; + m_sceneHeight = height; + + m_depthTexture.init(device, width, height); + m_depthSmoothTexture.init(device, width, height, false); + + m_device = device; + m_deviceContext = context; + + // create the input layout + { + D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "U", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "V", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 2, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "W", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 3, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + + m_device->CreateInputLayout(inputElementDescs, 4, g_ellipsoidDepthVS, sizeof(g_ellipsoidDepthVS), &m_ellipsoidDepthLayout); + } + + // create the shaders + m_device->CreateVertexShader(g_ellipsoidDepthVS, sizeof(g_ellipsoidDepthVS), nullptr, &m_ellipsoidDepthVs); + m_device->CreateGeometryShader(g_ellipsoidDepthGS, sizeof(g_ellipsoidDepthGS), nullptr, &m_ellipsoidDepthGs); + m_device->CreatePixelShader(g_ellipsoidDepthPS, sizeof(g_ellipsoidDepthPS), nullptr, &m_ellipsoidDepthPs); + + // create the input layout + { + D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 } + }; + + m_device->CreateInputLayout(inputElementDescs, 4, g_passThroughVS, sizeof(g_passThroughVS), &m_passThroughLayout); + } + + // pass through shader + m_device->CreateVertexShader(g_passThroughVS, sizeof(g_passThroughVS), nullptr, &m_passThroughVs); + + // full screen pixel shaders + m_device->CreatePixelShader(g_blurDepthPS, sizeof(g_blurDepthPS), nullptr, &m_blurDepthPs); + m_device->CreatePixelShader(g_compositePS, sizeof(g_compositePS), nullptr, &m_compositePs); + + // create a constant buffer + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = sizeof(Hlsl::FluidShaderConst); // 64 * sizeof(float); + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + + m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer); + } + + // create the rastersizer state + for (int i = 0; i < NUM_FLUID_RENDER_MODES; i++) + { + for (int j = 0; j < NUM_FLUID_CULL_MODES; j++) + { + D3D11_RASTERIZER_DESC desc = {}; + desc.FillMode = (D3D11_FILL_MODE)(D3D11_FILL_WIREFRAME + i); + desc.CullMode = (D3D11_CULL_MODE)(D3D11_CULL_NONE + j); + desc.FrontCounterClockwise = TRUE; // This is non-default + desc.DepthBias = 0; + desc.DepthBiasClamp = 0.f; + desc.SlopeScaledDepthBias = 0.f; + desc.DepthClipEnable = TRUE; + desc.ScissorEnable = FALSE; + desc.MultisampleEnable = FALSE; + desc.AntialiasedLineEnable = FALSE; + + m_device->CreateRasterizerState(&desc, &m_rasterizerState[i][j]); + } + } + + _createScreenQuad(); +} + +void FluidRendererD3D11::_createScreenQuad() +{ + // create an index buffer + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = 4*sizeof(UINT); + bufDesc.Usage = D3D11_USAGE_IMMUTABLE; + bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; + bufDesc.CPUAccessFlags = DXGI_CPU_ACCESS_NONE; + bufDesc.MiscFlags = 0; + + unsigned int quad_indices[4] = { 0, 1, 3, 2 }; + + D3D11_SUBRESOURCE_DATA data = { 0 }; + data.pSysMem = quad_indices; + + m_device->CreateBuffer(&bufDesc, &data, &m_quadIndexBuffer); + } + + // create a vertex buffer + { + + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = 4*sizeof(PassthroughVertex); + bufDesc.Usage = D3D11_USAGE_IMMUTABLE; + bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufDesc.CPUAccessFlags = DXGI_CPU_ACCESS_NONE; + bufDesc.MiscFlags = 0; + + D3D11_SUBRESOURCE_DATA data = { 0 }; + + + PassthroughVertex vertices[4] = + { + { {-1.0f, -1.0f, 0.0f}, {0, 1, 0}, {0.0f, 0.0f}, {1, 1, 1, 1}}, + { { 1.0f, -1.0f, 0.0f}, {0, 1, 0}, {1.0f, 0.0f}, {1, 1, 1, 1}}, + { { 1.0f, 1.0f, 0.0f}, {0, 1, 0}, {1.0f, 1.0f}, {1, 1, 1, 1}}, + { {-1.0f, 1.0f, 0.0f}, {0, 1, 0}, {0.0f, 1.0f}, {1, 1, 1, 1}}, + }; + + data.pSysMem = vertices; + + m_device->CreateBuffer(&bufDesc, &data, &m_quadVertexBuffer); + } +} + +void FluidRendererD3D11::drawEllipsoids(const FluidDrawParamsD3D* params, const FluidRenderBuffersD3D11* buffers) +{ + ID3D11DeviceContext* deviceContext = m_deviceContext; + + // update constant buffer + { + + D3D11_BUFFER_DESC desc; + m_constantBuffer->GetDesc(&desc); + + D3D11_MAPPED_SUBRESOURCE mappedResource = {}; + if (SUCCEEDED(deviceContext->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) + { + Hlsl::FluidShaderConst constBuf; + RenderParamsUtilD3D::calcFluidConstantBuffer(*params, constBuf); + memcpy(mappedResource.pData, &constBuf, sizeof(Hlsl::FluidShaderConst)); + deviceContext->Unmap(m_constantBuffer.Get(), 0u); + } + } + + deviceContext->VSSetShader(m_ellipsoidDepthVs.Get(), nullptr, 0u); + deviceContext->GSSetShader(m_ellipsoidDepthGs.Get(), nullptr, 0u); + deviceContext->PSSetShader(m_ellipsoidDepthPs.Get(), nullptr, 0u); + + deviceContext->IASetInputLayout(m_ellipsoidDepthLayout.Get()); + deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); + + deviceContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->GSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->PSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + + ID3D11Buffer* vertexBuffers[4] = + { + buffers->m_positions.Get(), + buffers->m_anisotropiesArr[0].Get(), + buffers->m_anisotropiesArr[1].Get(), + buffers->m_anisotropiesArr[2].Get() + }; + + unsigned int vertexBufferStrides[4] = + { + sizeof(float4), + sizeof(float4), + sizeof(float4), + sizeof(float4) + }; + + unsigned int vertexBufferOffsets[4] = { 0 }; + + deviceContext->IASetVertexBuffers(0, 4, vertexBuffers, vertexBufferStrides, vertexBufferOffsets); + deviceContext->IASetIndexBuffer(buffers->m_indices.Get(), DXGI_FORMAT_R32_UINT, 0u); + + float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); + if (depthSign < 0.f) + { + deviceContext->RSSetState(m_rasterizerState[params->renderMode][params->cullMode].Get()); + } + + deviceContext->DrawIndexed(params->n, params->offset, 0); + + if (depthSign < 0.f) + { + deviceContext->RSSetState(nullptr); + } +} + +void FluidRendererD3D11::drawBlurDepth(const FluidDrawParamsD3D* params) +{ + ID3D11DeviceContext* deviceContext = m_deviceContext; + + // update constant buffer + { + D3D11_MAPPED_SUBRESOURCE mappedResource = {}; + if (SUCCEEDED(deviceContext->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) + { + Hlsl::FluidShaderConst constBuf; + RenderParamsUtilD3D::calcFluidConstantBuffer(*params, constBuf); + memcpy(mappedResource.pData, &constBuf, sizeof(Hlsl::FluidShaderConst)); + deviceContext->Unmap(m_constantBuffer.Get(), 0u); + } + } + + deviceContext->VSSetShader(m_passThroughVs.Get(), nullptr, 0u); + deviceContext->GSSetShader(nullptr, nullptr, 0u); + deviceContext->PSSetShader(m_blurDepthPs.Get(), nullptr, 0u); + + ID3D11ShaderResourceView* srvs[1] = { m_depthTexture.m_backSrv.Get() }; + deviceContext->PSSetShaderResources(0, 1, srvs); + + deviceContext->IASetInputLayout(m_passThroughLayout.Get()); + deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + + deviceContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->PSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + + UINT vertexStride = sizeof(PassthroughVertex); + UINT offset = 0u; + deviceContext->IASetVertexBuffers(0, 1, m_quadVertexBuffer.GetAddressOf(), &vertexStride, &offset); + deviceContext->IASetIndexBuffer(m_quadIndexBuffer.Get(), DXGI_FORMAT_R32_UINT, 0u); + + float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); + if (depthSign < 0.f) + { + deviceContext->RSSetState(m_rasterizerState[params->renderMode][params->cullMode].Get()); + } + + deviceContext->DrawIndexed((UINT)4, 0, 0); + + if (depthSign < 0.f) + { + deviceContext->RSSetState(nullptr); + } +} + +void FluidRendererD3D11::drawComposite(const FluidDrawParamsD3D* params, ID3D11ShaderResourceView* sceneMap) +{ + ID3D11DeviceContext* deviceContext = m_deviceContext; + + // update constant buffer + { + D3D11_MAPPED_SUBRESOURCE mappedResource = {}; + if (SUCCEEDED(deviceContext->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) + { + Hlsl::FluidShaderConst constBuf; + RenderParamsUtilD3D::calcFluidCompositeConstantBuffer(*params, constBuf); + memcpy(mappedResource.pData, &constBuf, sizeof(Hlsl::FluidShaderConst)); + deviceContext->Unmap(m_constantBuffer.Get(), 0u); + } + } + + deviceContext->VSSetShader(m_passThroughVs.Get(), nullptr, 0u); + deviceContext->GSSetShader(nullptr, nullptr, 0u); + deviceContext->PSSetShader(m_compositePs.Get(), nullptr, 0u); + + RenderTargetD3D11* depthMap = &m_depthSmoothTexture; + ShadowMapD3D11* shadowMap = (ShadowMapD3D11*)params->shadowMap; + + ID3D11ShaderResourceView* srvs[3] = + { + depthMap->m_backSrv.Get(), + sceneMap, + shadowMap->m_depthSrv.Get() + + }; + deviceContext->PSSetShaderResources(0, 3, srvs); + + ID3D11SamplerState* samps[2] = + { + depthMap->m_linearSampler.Get() , + shadowMap->m_linearSampler.Get() + }; + deviceContext->PSSetSamplers(0, 2, samps); + + + deviceContext->IASetInputLayout(m_passThroughLayout.Get()); + deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + + deviceContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->PSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + + UINT vertexStride = sizeof(PassthroughVertex); + UINT offset = 0u; + deviceContext->IASetVertexBuffers(0, 1, m_quadVertexBuffer.GetAddressOf(), &vertexStride, &offset); + deviceContext->IASetIndexBuffer(m_quadIndexBuffer.Get(), DXGI_FORMAT_R32_UINT, 0u); + + float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); + if (depthSign < 0.f) + { + deviceContext->RSSetState(m_rasterizerState[params->renderMode][params->cullMode].Get()); + } + + deviceContext->DrawIndexed((UINT)4, 0, 0); + + if (depthSign < 0.f) + { + deviceContext->RSSetState(nullptr); + } + + // reset srvs + ID3D11ShaderResourceView* zero[3] = { NULL, NULL, NULL }; + deviceContext->PSSetShaderResources(0, 3, zero); +} + diff --git a/demo/d3d11/fluidRenderD3D11.h b/demo/d3d11/fluidRenderD3D11.h new file mode 100644 index 0000000..ad59534 --- /dev/null +++ b/demo/d3d11/fluidRenderD3D11.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#include <DirectXMath.h> + +#include <d3d11.h> + +#include "renderTargetD3D11.h" +#include "shadowMapD3D11.h" +#include "../include/NvFlex.h" +#include "../d3d/renderParamsD3D.h" +#include "shaders.h" + + +struct FluidRenderBuffersD3D11 +{ + FluidRenderBuffersD3D11(): + m_positionsBuf(nullptr), + m_densitiesBuf(nullptr), + m_indicesBuf(nullptr) + { + for (int i = 0; i < 3; i++) + { + m_anisotropiesBufArr[i] = nullptr; + } + m_numParticles = 0; + } + ~FluidRenderBuffersD3D11() + { + NvFlexUnregisterD3DBuffer(m_positionsBuf); + NvFlexUnregisterD3DBuffer(m_densitiesBuf); + NvFlexUnregisterD3DBuffer(m_indicesBuf); + + for (int i = 0; i < 3; i++) + { + NvFlexUnregisterD3DBuffer(m_anisotropiesBufArr[i]); + } + } + + int m_numParticles; + ComPtr<ID3D11Buffer> m_positions; + ComPtr<ID3D11Buffer> m_densities; + ComPtr<ID3D11Buffer> m_anisotropiesArr[3]; + ComPtr<ID3D11Buffer> m_indices; + + ComPtr<ID3D11Buffer> m_fluid; // to be removed + + // wrapper buffers that allow Flex to write directly to VBOs + NvFlexBuffer* m_positionsBuf; + NvFlexBuffer* m_densitiesBuf; + NvFlexBuffer* m_anisotropiesBufArr[3]; + NvFlexBuffer* m_indicesBuf; +}; + +struct FluidRendererD3D11 +{ + void init(ID3D11Device* device, ID3D11DeviceContext* context, int width, int height); + + void drawEllipsoids(const FluidDrawParamsD3D* params, const FluidRenderBuffersD3D11* buffers); + void drawBlurDepth(const FluidDrawParamsD3D* params); + void drawComposite(const FluidDrawParamsD3D* params, ID3D11ShaderResourceView* sceneMap); + + FluidRendererD3D11(): + m_device(nullptr), + m_deviceContext(nullptr) + {} + + void _createScreenQuad(); + + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceContext; + + ComPtr<ID3D11InputLayout> m_ellipsoidDepthLayout; + ComPtr<ID3D11VertexShader> m_ellipsoidDepthVs; + ComPtr<ID3D11GeometryShader> m_ellipsoidDepthGs; + ComPtr<ID3D11PixelShader> m_ellipsoidDepthPs; + + ComPtr<ID3D11InputLayout> m_passThroughLayout; + ComPtr<ID3D11VertexShader> m_passThroughVs; + + ComPtr<ID3D11PixelShader> m_blurDepthPs; + ComPtr<ID3D11PixelShader> m_compositePs; + + ComPtr<ID3D11Buffer> m_constantBuffer; + + // Right handed rasterizer state + ComPtr<ID3D11RasterizerState> m_rasterizerState[NUM_FLUID_RENDER_MODES][NUM_FLUID_CULL_MODES]; + + ComPtr<ID3D11Buffer> m_quadVertexBuffer; + ComPtr<ID3D11Buffer> m_quadIndexBuffer; + + RenderTargetD3D11 m_depthTexture; + RenderTargetD3D11 m_depthSmoothTexture; + RenderTargetD3D11 m_thicknessTexture; + + int m_sceneWidth; + int m_sceneHeight; +}; + + diff --git a/demo/d3d11/imguiGraph.h b/demo/d3d11/imguiGraph.h deleted file mode 100644 index e6e5eb4..0000000 --- a/demo/d3d11/imguiGraph.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -#pragma once - -#include <stdint.h> - -#define IMGUI_GRAPH_API extern "C" __declspec(dllexport) - -struct ImguiGraphDesc; - -typedef bool (*imguiGraphInit_t)(const char* fontpath, const ImguiGraphDesc* desc); - -typedef void (*imguiGraphUpdate_t)(const ImguiGraphDesc* desc); - -bool imguiGraphInit(const char* fontpath, const ImguiGraphDesc* desc); - -void imguiGraphUpdate(const ImguiGraphDesc* desc); - -void imguiGraphDestroy(); - -void imguiGraphDraw();
\ No newline at end of file diff --git a/demo/d3d11/imguiGraphD3D11.cpp b/demo/d3d11/imguiGraphD3D11.cpp index 89c8c91..2df555d 100644 --- a/demo/d3d11/imguiGraphD3D11.cpp +++ b/demo/d3d11/imguiGraphD3D11.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. * * NVIDIA CORPORATION and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation @@ -13,8 +13,8 @@ //direct3d headers #include <d3d11.h> -#include "shaders/imguiVS.hlsl.h" -#include "shaders/imguiPS.hlsl.h" +#include "../d3d/shaders/imguiVS.hlsl.h" +#include "../d3d/shaders/imguiPS.hlsl.h" namespace { @@ -77,7 +77,7 @@ namespace }; } -void imguiGraphContextDestroy() +void imguiGraphContextDestroyD3D11() { COMRelease(m_rasterizerState); COMRelease(m_samplerState); @@ -89,8 +89,10 @@ void imguiGraphContextDestroy() COMRelease(m_vertexBuffer); } -void imguiGraphContextInit(const ImguiGraphDesc* desc) +void imguiGraphContextInitD3D11(const ImguiGraphDesc* descIn) { + const auto desc = cast_to_imguiGraphDescD3D11(descIn); + m_device = desc->device; m_deviceContext = desc->deviceContext; m_winW = desc->winW; @@ -202,15 +204,17 @@ void imguiGraphContextInit(const ImguiGraphDesc* desc) } } -void imguiGraphContextUpdate(const ImguiGraphDesc* desc) +void imguiGraphContextUpdateD3D11(const ImguiGraphDesc* descIn) { + const auto desc = cast_to_imguiGraphDescD3D11(descIn); + m_device = desc->device; m_deviceContext = desc->deviceContext; m_winW = desc->winW; m_winH = desc->winH; } -void imguiGraphRecordBegin() +void imguiGraphRecordBeginD3D11() { Params params = { 2.f / float(m_winW), 0.f, 0.f, -1.f, @@ -319,7 +323,7 @@ static void imguiGraphFlush() } } -void imguiGraphRecordEnd() +void imguiGraphRecordEndD3D11() { ID3D11DeviceContext* context = m_deviceContext; @@ -341,7 +345,7 @@ void imguiGraphRecordEnd() context->RSSetState(nullptr); } -void imguiGraphEnableScissor(int x, int y, int width, int height) +void imguiGraphEnableScissorD3D11(int x, int y, int width, int height) { // mark end of last region m_stateScissor.stopIdx = m_stateVertIdx; @@ -356,7 +360,7 @@ void imguiGraphEnableScissor(int x, int y, int width, int height) m_stateScissor.height = height; } -void imguiGraphDisableScissor() +void imguiGraphDisableScissorD3D11() { if (m_stateVertIdx == 0) return; @@ -373,13 +377,13 @@ void imguiGraphDisableScissor() m_stateScissor.height = m_winH; } -void imguiGraphVertex2f(float x, float y) +void imguiGraphVertex2fD3D11(float x, float y) { float v[2] = { x,y }; - imguiGraphVertex2fv(v); + imguiGraphVertex2fvD3D11(v); } -void imguiGraphVertex2fv(const float* v) +void imguiGraphVertex2fvD3D11(const float* v) { // update state m_stateVert.x = v[0]; @@ -394,13 +398,13 @@ void imguiGraphVertex2fv(const float* v) } } -void imguiGraphTexCoord2f(float u, float v) +void imguiGraphTexCoord2fD3D11(float u, float v) { m_stateVert.u = u; m_stateVert.v = v; } -void imguiGraphColor4ub(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) +void imguiGraphColor4ubD3D11(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) { m_stateVert.rgba[0] = red; m_stateVert.rgba[1] = green; @@ -408,7 +412,7 @@ void imguiGraphColor4ub(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) m_stateVert.rgba[3] = alpha; } -void imguiGraphColor4ubv(const uint8_t* v) +void imguiGraphColor4ubvD3D11(const uint8_t* v) { m_stateVert.rgba[0] = v[0]; m_stateVert.rgba[1] = v[1]; @@ -416,18 +420,18 @@ void imguiGraphColor4ubv(const uint8_t* v) m_stateVert.rgba[3] = v[3]; } -void imguiGraphFontTextureEnable() +void imguiGraphFontTextureEnableD3D11() { } -void imguiGraphFontTextureDisable() +void imguiGraphFontTextureDisableD3D11() { m_stateVert.u = -1.f; m_stateVert.v = -1.f; } -void imguiGraphFontTextureInit(unsigned char* data) +void imguiGraphFontTextureInitD3D11(unsigned char* data) { ID3D11DeviceContext* context = m_deviceContext; @@ -466,7 +470,7 @@ void imguiGraphFontTextureInit(unsigned char* data) } -void imguiGraphFontTextureRelease() +void imguiGraphFontTextureReleaseD3D11() { COMRelease(m_texture); COMRelease(m_textureSRV); diff --git a/demo/d3d11/imguiGraphD3D11.h b/demo/d3d11/imguiGraphD3D11.h index be9c88b..8f521a9 100644 --- a/demo/d3d11/imguiGraphD3D11.h +++ b/demo/d3d11/imguiGraphD3D11.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. * * NVIDIA CORPORATION and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation @@ -13,12 +13,12 @@ #include <stdint.h> -#include "imguiGraph.h" +#include "../d3d/imguiGraph.h" struct ID3D11Device; struct ID3D11DeviceContext; -struct ImguiGraphDesc +struct ImguiGraphDescD3D11 { ID3D11Device* device = nullptr; ID3D11DeviceContext* deviceContext = nullptr; @@ -27,41 +27,49 @@ struct ImguiGraphDesc uint32_t maxVertices = 64 * 4096u; - ImguiGraphDesc() {} + ImguiGraphDescD3D11() {} }; -// Below are the functions that must be implemented per graphics API +inline const ImguiGraphDescD3D11* cast_to_imguiGraphDescD3D11(const ImguiGraphDesc* desc) +{ + return (const ImguiGraphDescD3D11*)(desc); +} + +inline ImguiGraphDesc* cast_from_imguiGraphDescD3D11(ImguiGraphDescD3D11* desc) +{ + return (ImguiGraphDesc*)(desc); +} -void imguiGraphContextInit(const ImguiGraphDesc* desc); +IMGUI_GRAPH_API void imguiGraphContextInitD3D11(const ImguiGraphDesc* desc); -void imguiGraphContextUpdate(const ImguiGraphDesc* desc); +IMGUI_GRAPH_API void imguiGraphContextUpdateD3D11(const ImguiGraphDesc* desc); -void imguiGraphContextDestroy(); +IMGUI_GRAPH_API void imguiGraphContextDestroyD3D11(); -void imguiGraphRecordBegin(); +IMGUI_GRAPH_API void imguiGraphRecordBeginD3D11(); -void imguiGraphRecordEnd(); +IMGUI_GRAPH_API void imguiGraphRecordEndD3D11(); -void imguiGraphVertex2f(float x, float y); +IMGUI_GRAPH_API void imguiGraphVertex2fD3D11(float x, float y); -void imguiGraphVertex2fv(const float* v); +IMGUI_GRAPH_API void imguiGraphVertex2fvD3D11(const float* v); -void imguiGraphTexCoord2f(float u, float v); +IMGUI_GRAPH_API void imguiGraphTexCoord2fD3D11(float u, float v); -void imguiGraphColor4ub(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha); +IMGUI_GRAPH_API void imguiGraphColor4ubD3D11(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha); -void imguiGraphColor4ubv(const uint8_t* v); +IMGUI_GRAPH_API void imguiGraphColor4ubvD3D11(const uint8_t* v); -void imguiGraphFontTextureEnable(); +IMGUI_GRAPH_API void imguiGraphFontTextureEnableD3D11(); -void imguiGraphFontTextureDisable(); +IMGUI_GRAPH_API void imguiGraphFontTextureDisableD3D11(); -void imguiGraphEnableScissor(int x, int y, int width, int height); +IMGUI_GRAPH_API void imguiGraphEnableScissorD3D11(int x, int y, int width, int height); -void imguiGraphDisableScissor(); +IMGUI_GRAPH_API void imguiGraphDisableScissorD3D11(); -void imguiGraphFontTextureInit(unsigned char* data); +IMGUI_GRAPH_API void imguiGraphFontTextureInitD3D11(unsigned char* data); -void imguiGraphFontTextureRelease(); +IMGUI_GRAPH_API void imguiGraphFontTextureReleaseD3D11(); #endif
\ No newline at end of file diff --git a/demo/d3d11/imguiInteropD3D11.cpp b/demo/d3d11/imguiInteropD3D11.cpp new file mode 100644 index 0000000..5d22d2e --- /dev/null +++ b/demo/d3d11/imguiInteropD3D11.cpp @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +//direct3d headers +#include <d3d11.h> + +#include "appD3D11Ctx.h" + +// include the Direct3D Library file +#pragma comment (lib, "d3d11.lib") + +#include "appD3D11Ctx.h" +#include "imguiGraphD3D11.h" + +IMGUI_GRAPH_API bool imguiInteropGraphInitD3D11(imguiGraphInit_t func, const char* fontpath, AppGraphCtx* appctx); + +IMGUI_GRAPH_API void imguiInteropGraphUpdateD3D11(imguiGraphUpdate_t func, AppGraphCtx* appctx); + +bool imguiInteropGraphInitD3D11(imguiGraphInit_t func, const char* fontpath, AppGraphCtx* appctxIn) +{ + ImguiGraphDescD3D11 desc; + + AppGraphCtxD3D11* appctx = cast_to_AppGraphCtxD3D11(appctxIn); + + desc.device = appctx->m_device; + desc.deviceContext = appctx->m_deviceContext; + desc.winW = appctx->m_winW; + desc.winH = appctx->m_winH; + + return func(fontpath, cast_from_imguiGraphDescD3D11(&desc)); +} + +void imguiInteropGraphUpdateD3D11(imguiGraphUpdate_t func, AppGraphCtx* appctxIn) +{ + ImguiGraphDescD3D11 desc; + AppGraphCtxD3D11* appctx = cast_to_AppGraphCtxD3D11(appctxIn); + + desc.device = appctx->m_device; + desc.deviceContext = appctx->m_deviceContext; + desc.winW = appctx->m_winW; + desc.winH = appctx->m_winH; + + return func(cast_from_imguiGraphDescD3D11(&desc)); +}
\ No newline at end of file diff --git a/demo/d3d11/meshRender.cpp b/demo/d3d11/meshRender.cpp deleted file mode 100644 index b07397b..0000000 --- a/demo/d3d11/meshRender.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -//direct3d headers - -#define NOMINMAX - -#include <d3d11.h> - -// include the Direct3D Library file -#pragma comment (lib, "d3d11.lib") - -#include <math.h> - -#include "meshRender.h" -#include "appD3d11Ctx.h" - - -#include "shaders/meshVS.hlsl.h" -#include "shaders/meshPS.hlsl.h" -#include "shaders/meshShadowPS.hlsl.h" - -#define EXCLUDE_SHADER_STRUCTS 1 -#include "shaders/shaderCommon.h" - -#include "shadowMap.h" - - -void MeshRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) -{ - for (int i = 0; i < NUM_MESH_RENDER_MODES; i++) - for (int j = 0; j < NUM_MESH_CULL_MODES; j++) - m_rasterizerStateRH[i][j] = nullptr; - - m_device = device; - m_deviceContext = context; - - // create the input layout - { - D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 2, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 3, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - - m_device->CreateInputLayout(inputElementDescs, 4, g_meshVS, sizeof(g_meshVS), &m_inputLayout); - } - - // create the shaders - m_device->CreateVertexShader(g_meshVS, sizeof(g_meshVS), nullptr, &m_meshVS); - m_device->CreatePixelShader(g_meshPS, sizeof(g_meshPS), nullptr, &m_meshPS); - m_device->CreatePixelShader(g_meshPS_Shadow, sizeof(g_meshPS_Shadow), nullptr, &m_meshPS_Shadow); - - // create a constant buffer - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(MeshShaderConst); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - - m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer); - } - - // create the rastersizer state - for (int i = 0; i < NUM_MESH_RENDER_MODES; i++) - { - for (int j = 0; j < NUM_MESH_CULL_MODES; j++) - - { - D3D11_RASTERIZER_DESC desc = {}; - desc.FillMode = (D3D11_FILL_MODE)(D3D11_FILL_WIREFRAME + i); - desc.CullMode = (D3D11_CULL_MODE)(D3D11_CULL_NONE + j); - desc.FrontCounterClockwise = TRUE; // This is non-default - desc.DepthBias = 0; - desc.DepthBiasClamp = 0.f; - desc.SlopeScaledDepthBias = 0.f; - desc.DepthClipEnable = TRUE; - desc.ScissorEnable = FALSE; - desc.MultisampleEnable = FALSE; - desc.AntialiasedLineEnable = FALSE; - - m_device->CreateRasterizerState(&desc, &m_rasterizerStateRH[i][j]); - } - } - -} - -void MeshRenderer::Destroy() -{ - COMRelease(m_inputLayout); - COMRelease(m_meshVS); - COMRelease(m_meshPS); - COMRelease(m_meshPS_Shadow); - COMRelease(m_constantBuffer); - - for (int i = 0; i < NUM_MESH_RENDER_MODES; i++) - for (int j = 0; j < NUM_MESH_CULL_MODES; j++) - COMRelease(m_rasterizerStateRH[i][j]); -} - - -void MeshRenderer::Draw(const GpuMesh* mesh, const MeshDrawParams* params) -{ - using namespace DirectX; - - // update constant buffer - { - D3D11_MAPPED_SUBRESOURCE mappedResource = {}; - if (S_OK == m_deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) - { - MeshShaderConst cParams; - - cParams.modelviewprojection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection)); - - cParams.modelview = (float4x4&)XMMatrixMultiply(params->model, params->view); - - cParams.objectTransform = (float4x4&)params->objectTransform; - cParams.lightTransform = (float4x4&)params->lightTransform; - - cParams.clipPlane = params->clipPlane; - cParams.fogColor = params->fogColor; - cParams.color = params->color; - cParams.secondaryColor = params->secondaryColor; - - cParams.lightPos = params->lightPos; - cParams.lightDir = params->lightDir; - - cParams.bias = params->bias; - cParams.expand = params->expand; - cParams.spotMin = params->spotMin; - cParams.spotMax = params->spotMax; - - cParams.grid = params->grid; - cParams.tex = params->tex; - cParams.colorArray = params->colorArray; - - memcpy(cParams.shadowTaps, params->shadowTaps, sizeof(cParams.shadowTaps)); - - memcpy(mappedResource.pData, &cParams, sizeof(MeshShaderConst)); - - m_deviceContext->Unmap(m_constantBuffer, 0u); - } - } - - m_deviceContext->VSSetShader(m_meshVS, nullptr, 0u); - m_deviceContext->GSSetShader(nullptr, nullptr, 0u); - - switch (params->renderStage) - { - case MESH_DRAW_SHADOW: - { - m_deviceContext->PSSetShader(m_meshPS_Shadow, nullptr, 0u); - break; - } - case MESH_DRAW_LIGHT: - { - m_deviceContext->PSSetShader(m_meshPS, nullptr, 0u); - - ShadowMap* shadowMap = (ShadowMap*)params->shadowMap; - ID3D11ShaderResourceView* ppSRV[1] = { shadowMap->m_depthSrv.Get() }; - m_deviceContext->PSSetShaderResources(0, 1, ppSRV); - ID3D11SamplerState* ppSS[1] = { shadowMap->m_linearSampler.Get() }; - m_deviceContext->PSSetSamplers(0, 1, ppSS); - break; - } - default: - assert(false); - break; - } - - m_deviceContext->IASetInputLayout(m_inputLayout); - m_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); - - m_deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer); - m_deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer); - - ID3D11Buffer* vertexBuffers[4] = - { - mesh->positionBuffer, - mesh->normalBuffer, - mesh->texcoordBuffer, - mesh->colorBuffer, - }; - - unsigned int vertexBufferStrides[4] = - { - sizeof(Vec3), - sizeof(Vec3), - sizeof(Vec2), - sizeof(Vec4) - }; - - unsigned int vertexBufferOffsets[4] = { 0, 0, 0, 0 }; - - m_deviceContext->IASetVertexBuffers(0, 4, vertexBuffers, vertexBufferStrides, vertexBufferOffsets); - m_deviceContext->IASetIndexBuffer(mesh->indexBuffer, DXGI_FORMAT_R32_UINT, 0u); - - float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); - if (depthSign < 0.f) - { - m_deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]); - } - - m_deviceContext->DrawIndexed((UINT)mesh->mNumFaces*3, 0, 0); - - if (depthSign < 0.f) - { - m_deviceContext->RSSetState(nullptr); - } -} diff --git a/demo/d3d11/meshRender.h b/demo/d3d11/meshRender.h deleted file mode 100644 index 01ad181..0000000 --- a/demo/d3d11/meshRender.h +++ /dev/null @@ -1,297 +0,0 @@ - -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -#pragma once - -#include <DirectXMath.h> - -#include "appD3D11Ctx.h" - -#include "core/maths.h" - -struct ShadowMap; - -struct GpuMesh -{ - ID3D11Buffer* positionBuffer; - ID3D11Buffer* normalBuffer; - ID3D11Buffer* texcoordBuffer; - ID3D11Buffer* colorBuffer; - - ID3D11Buffer* indexBuffer; - - GpuMesh(ID3D11Device* device, ID3D11DeviceContext* deviceContext) - : positionBuffer(NULL) - , normalBuffer(NULL) - , texcoordBuffer(NULL) - , colorBuffer(NULL) - , indexBuffer(NULL) - , mDevice(device) - , mDeviceContext(deviceContext) - , mNumFaces(0) - , mNumVertices(0) - {} - - ~GpuMesh() - { - Release(); - } - - void Release() - { - COMRelease(positionBuffer); - COMRelease(normalBuffer); - COMRelease(texcoordBuffer); - COMRelease(colorBuffer); - COMRelease(indexBuffer); - } - - void Resize(int numVertices, int numFaces) - { - Release(); - - { - // vertex buffers - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(Vec3)*numVertices; - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - - mDevice->CreateBuffer(&bufDesc, NULL, &positionBuffer); - mDevice->CreateBuffer(&bufDesc, NULL, &normalBuffer); - - bufDesc.ByteWidth = sizeof(Vec2)*numVertices; - mDevice->CreateBuffer(&bufDesc, NULL, &texcoordBuffer); - - bufDesc.ByteWidth = sizeof(Vec4)*numVertices; - mDevice->CreateBuffer(&bufDesc, NULL, &colorBuffer); - } - - { - // index buffer - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(int)*numFaces*3; - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - - mDevice->CreateBuffer(&bufDesc, NULL, &indexBuffer); - } - - mMaxVertices = numVertices; - mMaxFaces = numFaces; - } - - void UpdateData(const Vec3* positions, const Vec3* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces) - { - if (numVertices > mMaxVertices || numFaces > mMaxFaces) - { - Resize(numVertices, numFaces); - } - - D3D11_MAPPED_SUBRESOURCE res; - - // vertices - if (positions) - { - mDeviceContext->Map(positionBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, positions, sizeof(Vec3)*numVertices); - mDeviceContext->Unmap(positionBuffer, 0); - } - - if (normals) - { - mDeviceContext->Map(normalBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, normals, sizeof(Vec3)*numVertices); - mDeviceContext->Unmap(normalBuffer, 0); - } - - if (texcoords) - { - mDeviceContext->Map(texcoordBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, texcoords, sizeof(Vec2)*numVertices); - mDeviceContext->Unmap(texcoordBuffer, 0); - } - - if (colors) - { - mDeviceContext->Map(colorBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, colors, sizeof(Vec4)*numVertices); - mDeviceContext->Unmap(colorBuffer, 0); - } - - // indices - if (indices) - { - mDeviceContext->Map(indexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, indices, sizeof(int)*numFaces*3); - mDeviceContext->Unmap(indexBuffer, 0); - } - - mNumVertices = numVertices; - mNumFaces = numFaces; - } - - // duplicate method to handle conversion from vec4 to vec3 positions / normals - void UpdateData(const Vec4* positions, const Vec4* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces) - { - if (numVertices > mMaxVertices || numFaces > mMaxFaces) - { - Resize(numVertices, numFaces); - } - - D3D11_MAPPED_SUBRESOURCE res; - - // vertices - if (positions) - { - mDeviceContext->Map(positionBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - for (int i=0; i < numVertices; ++i) - ((Vec3*)res.pData)[i] = Vec3(positions[i]); - mDeviceContext->Unmap(positionBuffer, 0); - } - - if (normals) - { - mDeviceContext->Map(normalBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - for (int i=0; i < numVertices; ++i) - ((Vec3*)res.pData)[i] = Vec3(normals[i]); - mDeviceContext->Unmap(normalBuffer, 0); - } - - if (texcoords) - { - mDeviceContext->Map(texcoordBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, texcoords, sizeof(Vec2)*numVertices); - mDeviceContext->Unmap(texcoordBuffer, 0); - } - - if (colors) - { - mDeviceContext->Map(colorBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, colors, sizeof(Vec4)*numVertices); - mDeviceContext->Unmap(colorBuffer, 0); - } - - // indices - if (indices) - { - mDeviceContext->Map(indexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, indices, sizeof(int)*numFaces*3); - mDeviceContext->Unmap(indexBuffer, 0); - } - - mNumVertices = numVertices; - mNumFaces = numFaces; - } - - int mNumVertices = 0; - int mNumFaces = 0; - - int mMaxVertices = 0; - int mMaxFaces = 0; - - ID3D11Device* mDevice; - ID3D11DeviceContext* mDeviceContext; -}; - - - -enum MeshRenderMode -{ - MESH_RENDER_WIREFRAME, - MESH_RENDER_SOLID, - NUM_MESH_RENDER_MODES -}; - -enum MeshCullMode -{ - MESH_CULL_NONE, - MESH_CULL_FRONT, - MESH_CULL_BACK, - NUM_MESH_CULL_MODES -}; - -enum MeshDrawStage -{ - MESH_DRAW_NULL, - MESH_DRAW_SHADOW, - MESH_DRAW_REFLECTION, - MESH_DRAW_LIGHT -}; - -typedef DirectX::XMFLOAT3 float3; -typedef DirectX::XMFLOAT4 float4; -typedef DirectX::XMFLOAT4X4 float4x4; - -struct MeshDrawParams -{ - MeshRenderMode renderMode; - MeshCullMode cullMode; - MeshDrawStage renderStage; - - DirectX::XMMATRIX projection; - DirectX::XMMATRIX view; - DirectX::XMMATRIX model; - - float4x4 objectTransform; - - DirectX::XMMATRIX lightTransform; - float3 lightPos; - float3 lightDir; - - float4 clipPlane; - float4 fogColor; - float4 color; - float4 secondaryColor; - - float bias; - float expand; - float spotMin; - float spotMax; - - int grid; - int tex; - int colorArray; - - float4 shadowTaps[12]; - ShadowMap* shadowMap; -}; - -struct MeshRenderer -{ - ID3D11Device* m_device = nullptr; - ID3D11DeviceContext* m_deviceContext = nullptr; - - ID3D11InputLayout* m_inputLayout = nullptr; - ID3D11VertexShader* m_meshVS = nullptr; - ID3D11PixelShader* m_meshPS = nullptr; - ID3D11PixelShader* m_meshPS_Shadow = nullptr; - ID3D11Buffer* m_constantBuffer = nullptr; - ID3D11RasterizerState* m_rasterizerStateRH[NUM_MESH_RENDER_MODES][NUM_MESH_CULL_MODES]; - - ~MeshRenderer() - { - Destroy(); - } - - void Init(ID3D11Device* device, ID3D11DeviceContext* context); - void Destroy(); - - void Draw(const GpuMesh* mesh, const MeshDrawParams* params); - -}; - - - diff --git a/demo/d3d11/meshRenderD3D11.cpp b/demo/d3d11/meshRenderD3D11.cpp new file mode 100644 index 0000000..8936f04 --- /dev/null +++ b/demo/d3d11/meshRenderD3D11.cpp @@ -0,0 +1,341 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +//direct3d headers + +#define NOMINMAX + +#include <d3d11.h> + +// include the Direct3D Library file +#pragma comment (lib, "d3d11.lib") + +#include <math.h> + +#include "meshRenderD3D11.h" +#include "appD3d11Ctx.h" + + +#include "../d3d/shaders/meshVS.hlsl.h" +#include "../d3d/shaders/meshPS.hlsl.h" +#include "../d3d/shaders/meshShadowPS.hlsl.h" + +#include "../d3d/shaderCommonD3D.h" + +#include "shadowMapD3D11.h" + +// Make async compute benchmark shader have a unique name +namespace AsyncComputeBench +{ +#include "../d3d/shaders/meshAsyncComputeBenchPS.hlsl.h" +} + +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GpuMeshD3D11 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + +GpuMeshD3D11::GpuMeshD3D11(ID3D11Device* device, ID3D11DeviceContext* deviceContext) + : m_device(device) + , m_deviceContext(deviceContext) + , m_numFaces(0) + , m_numVertices(0) + , m_maxVertices(0) + , m_maxFaces(0) +{ +} + +void GpuMeshD3D11::resize(int numVertices, int numFaces) +{ + { + // vertex buffers + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = sizeof(Vec3)*numVertices; + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + + m_device->CreateBuffer(&bufDesc, NULL, m_positionBuffer.ReleaseAndGetAddressOf()); + m_device->CreateBuffer(&bufDesc, NULL, m_normalBuffer.ReleaseAndGetAddressOf()); + + bufDesc.ByteWidth = sizeof(Vec2)*numVertices; + m_device->CreateBuffer(&bufDesc, NULL, m_texcoordBuffer.ReleaseAndGetAddressOf()); + + bufDesc.ByteWidth = sizeof(Vec4)*numVertices; + m_device->CreateBuffer(&bufDesc, NULL, m_colorBuffer.ReleaseAndGetAddressOf()); + } + + { + // index buffer + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = sizeof(int)*numFaces * 3; + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + + m_device->CreateBuffer(&bufDesc, NULL, &m_indexBuffer); + } + + m_maxVertices = numVertices; + m_maxFaces = numFaces; +} + +void GpuMeshD3D11::updateData(const Vec3* positions, const Vec3* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces) +{ + if (numVertices > m_maxVertices || numFaces > m_maxFaces) + { + resize(numVertices, numFaces); + } + + D3D11_MAPPED_SUBRESOURCE res; + + // vertices + if (positions) + { + m_deviceContext->Map(m_positionBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, positions, sizeof(Vec3)*numVertices); + m_deviceContext->Unmap(m_positionBuffer.Get(), 0); + } + + if (normals) + { + m_deviceContext->Map(m_normalBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, normals, sizeof(Vec3)*numVertices); + m_deviceContext->Unmap(m_normalBuffer.Get(), 0); + } + + if (texcoords) + { + m_deviceContext->Map(m_texcoordBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, texcoords, sizeof(Vec2)*numVertices); + m_deviceContext->Unmap(m_texcoordBuffer.Get(), 0); + } + + if (colors) + { + m_deviceContext->Map(m_colorBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, colors, sizeof(Vec4)*numVertices); + m_deviceContext->Unmap(m_colorBuffer.Get(), 0); + } + + // indices + if (indices) + { + m_deviceContext->Map(m_indexBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, indices, sizeof(int)*numFaces * 3); + m_deviceContext->Unmap(m_indexBuffer.Get(), 0); + } + + m_numVertices = numVertices; + m_numFaces = numFaces; +} + +void GpuMeshD3D11::updateData(const Vec4* positions, const Vec4* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces) +{ + if (numVertices > m_maxVertices || numFaces > m_maxFaces) + { + resize(numVertices, numFaces); + } + + D3D11_MAPPED_SUBRESOURCE res; + + // vertices + if (positions) + { + m_deviceContext->Map(m_positionBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + for (int i = 0; i < numVertices; ++i) + ((Vec3*)res.pData)[i] = Vec3(positions[i]); + m_deviceContext->Unmap(m_positionBuffer.Get(), 0); + } + + if (normals) + { + m_deviceContext->Map(m_normalBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + for (int i = 0; i < numVertices; ++i) + ((Vec3*)res.pData)[i] = Vec3(normals[i]); + m_deviceContext->Unmap(m_normalBuffer.Get(), 0); + } + + if (texcoords) + { + m_deviceContext->Map(m_texcoordBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, texcoords, sizeof(Vec2)*numVertices); + m_deviceContext->Unmap(m_texcoordBuffer.Get(), 0); + } + + if (colors) + { + m_deviceContext->Map(m_colorBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, colors, sizeof(Vec4)*numVertices); + m_deviceContext->Unmap(m_colorBuffer.Get(), 0); + } + + // indices + if (indices) + { + m_deviceContext->Map(m_indexBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, indices, sizeof(int)*numFaces * 3); + m_deviceContext->Unmap(m_indexBuffer.Get(), 0); + } + + m_numVertices = numVertices; + m_numFaces = numFaces; +} + +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! MeshRendererD3D11 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + +void MeshRendererD3D11::init(ID3D11Device* device, ID3D11DeviceContext* context, bool asyncComputeBenchmark) +{ + m_device = device; + m_deviceContext = context; + + // create the input layout + { + D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 2, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 3, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + + m_device->CreateInputLayout(inputElementDescs, 4, g_meshVS, sizeof(g_meshVS), &m_inputLayout); + } + + // create the shaders + + if (asyncComputeBenchmark) + { + m_device->CreatePixelShader(AsyncComputeBench::g_meshPS, sizeof(AsyncComputeBench::g_meshPS), nullptr, &m_meshPs); + } + else + { + m_device->CreatePixelShader(g_meshPS, sizeof(g_meshPS), nullptr, &m_meshPs); + } + + m_device->CreateVertexShader(g_meshVS, sizeof(g_meshVS), nullptr, &m_meshVs); + m_device->CreatePixelShader(g_meshPS_Shadow, sizeof(g_meshPS_Shadow), nullptr, &m_meshShadowPs); + + // create a constant buffer + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = sizeof(Hlsl::MeshShaderConst); + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + + m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer); + } + + // create the rastersizer state + for (int i = 0; i < NUM_MESH_RENDER_MODES; i++) + { + for (int j = 0; j < NUM_MESH_CULL_MODES; j++) + + { + D3D11_RASTERIZER_DESC desc = {}; + desc.FillMode = (D3D11_FILL_MODE)(D3D11_FILL_WIREFRAME + i); + desc.CullMode = (D3D11_CULL_MODE)(D3D11_CULL_NONE + j); + desc.FrontCounterClockwise = TRUE; // This is non-default + desc.DepthBias = 0; + desc.DepthBiasClamp = 0.f; + desc.SlopeScaledDepthBias = 0.f; + desc.DepthClipEnable = TRUE; + desc.ScissorEnable = FALSE; + desc.MultisampleEnable = FALSE; + desc.AntialiasedLineEnable = FALSE; + + m_device->CreateRasterizerState(&desc, &m_rasterizerState[i][j]); + } + } +} + +void MeshRendererD3D11::draw(const GpuMeshD3D11* mesh, const MeshDrawParamsD3D* params) +{ + using namespace DirectX; + + // update constant buffer + { + D3D11_MAPPED_SUBRESOURCE mappedResource = {}; + if (SUCCEEDED(m_deviceContext->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) + { + Hlsl::MeshShaderConst constBuf; + RenderParamsUtilD3D::calcMeshConstantBuffer(*params, constBuf); + memcpy(mappedResource.pData, &constBuf, sizeof(Hlsl::MeshShaderConst)); + m_deviceContext->Unmap(m_constantBuffer.Get(), 0u); + } + } + + m_deviceContext->VSSetShader(m_meshVs.Get(), nullptr, 0u); + m_deviceContext->GSSetShader(nullptr, nullptr, 0u); + + switch (params->renderStage) + { + case MESH_DRAW_SHADOW: + { + m_deviceContext->PSSetShader(m_meshShadowPs.Get(), nullptr, 0u); + break; + } + case MESH_DRAW_LIGHT: + { + m_deviceContext->PSSetShader(m_meshPs.Get(), nullptr, 0u); + + ShadowMapD3D11* shadowMap = (ShadowMapD3D11*)params->shadowMap; + ID3D11ShaderResourceView* srvs[1] = { shadowMap->m_depthSrv.Get() }; + m_deviceContext->PSSetShaderResources(0, 1, srvs); + ID3D11SamplerState* sampStates[1] = { shadowMap->m_linearSampler.Get() }; + m_deviceContext->PSSetSamplers(0, 1, sampStates); + break; + } + default: + assert(false); + break; + } + + m_deviceContext->IASetInputLayout(m_inputLayout.Get()); + m_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + + m_deviceContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + m_deviceContext->PSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + + ID3D11Buffer* vertexBuffers[4] = + { + mesh->m_positionBuffer.Get(), + mesh->m_normalBuffer.Get(), + mesh->m_texcoordBuffer.Get(), + mesh->m_colorBuffer.Get(), + }; + + unsigned int vertexBufferStrides[4] = + { + sizeof(Vec3), + sizeof(Vec3), + sizeof(Vec2), + sizeof(Vec4) + }; + + unsigned int vertexBufferOffsets[4] = { 0, 0, 0, 0 }; + + m_deviceContext->IASetVertexBuffers(0, 4, vertexBuffers, vertexBufferStrides, vertexBufferOffsets); + m_deviceContext->IASetIndexBuffer(mesh->m_indexBuffer.Get(), DXGI_FORMAT_R32_UINT, 0u); + + float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); + if (depthSign < 0.f) + { + m_deviceContext->RSSetState(m_rasterizerState[params->renderMode][params->cullMode].Get()); + } + + m_deviceContext->DrawIndexed((UINT)mesh->m_numFaces*3, 0, 0); + + if (depthSign < 0.f) + { + m_deviceContext->RSSetState(nullptr); + } +} diff --git a/demo/d3d11/meshRenderD3D11.h b/demo/d3d11/meshRenderD3D11.h new file mode 100644 index 0000000..d7d6d1c --- /dev/null +++ b/demo/d3d11/meshRenderD3D11.h @@ -0,0 +1,74 @@ + +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#include <DirectXMath.h> + +#include "appD3D11Ctx.h" + +#include "core/maths.h" +#include "../d3d/renderParamsD3D.h" + +#include <wrl.h> +using namespace Microsoft::WRL; + +struct GpuMeshD3D11 +{ + GpuMeshD3D11(ID3D11Device* device, ID3D11DeviceContext* deviceContext) ; + + void resize(int numVertices, int numFaces); + + void updateData(const Vec3* positions, const Vec3* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces); + // duplicate method to handle conversion from vec4 to vec3 positions / normals + void updateData(const Vec4* positions, const Vec4* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces); + + ComPtr<ID3D11Buffer> m_positionBuffer; + ComPtr<ID3D11Buffer> m_normalBuffer; + ComPtr<ID3D11Buffer> m_texcoordBuffer; + ComPtr<ID3D11Buffer> m_colorBuffer; + + ComPtr<ID3D11Buffer> m_indexBuffer; + + int m_numVertices; + int m_numFaces; + + int m_maxVertices; + int m_maxFaces; + + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceContext; +}; + + +struct MeshRendererD3D11 +{ + void init(ID3D11Device* device, ID3D11DeviceContext* context, bool asyncComputeBenchmark); + void draw(const GpuMeshD3D11* mesh, const MeshDrawParamsD3D* params); + + MeshRendererD3D11(): + m_device(nullptr), + m_deviceContext(nullptr) + {} + + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceContext; + + ComPtr<ID3D11InputLayout> m_inputLayout; + ComPtr<ID3D11VertexShader> m_meshVs; + ComPtr<ID3D11PixelShader> m_meshPs; + ComPtr<ID3D11PixelShader> m_meshShadowPs; + ComPtr<ID3D11Buffer> m_constantBuffer; + ComPtr<ID3D11RasterizerState> m_rasterizerState[NUM_MESH_RENDER_MODES][NUM_MESH_CULL_MODES]; +}; + + + diff --git a/demo/d3d11/pointRender.h b/demo/d3d11/pointRender.h deleted file mode 100644 index 9631287..0000000 --- a/demo/d3d11/pointRender.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -#pragma once - -#include <DirectXMath.h> - -#include "shadowMap.h" - -enum PointRenderMode -{ - POINT_RENDER_WIREFRAME, - POINT_RENDER_SOLID, - NUM_POINT_RENDER_MODES -}; - -enum PointCullMode -{ - POINT_CULL_NONE, - POINT_CULL_FRONT, - POINT_CULL_BACK, - NUM_POINT_CULL_MODES -}; - -enum PointDrawStage -{ - POINT_DRAW_NULL, - POINT_DRAW_SHADOW, - POINT_DRAW_REFLECTION, - POINT_DRAW_LIGHT -}; - -typedef DirectX::XMFLOAT3 float3; -typedef DirectX::XMFLOAT4 float4; -typedef DirectX::XMFLOAT4X4 float4x4; - -struct PointDrawParams -{ - PointRenderMode renderMode; - PointCullMode cullMode; - PointDrawStage renderStage; - - DirectX::XMMATRIX projection; - DirectX::XMMATRIX view; - DirectX::XMMATRIX model; - - float pointRadius; // point size in world space - float pointScale; // scale to calculate size in pixels - float spotMin; - float spotMax; - - DirectX::XMMATRIX lightTransform; - float3 lightPos; - float3 lightDir; - - float4 colors[8]; - - float4 shadowTaps[12]; - ShadowMap* shadowMap; - - int mode; -}; - - -struct PointRenderer -{ - ID3D11Device* m_device = nullptr; - ID3D11DeviceContext* m_deviceContext = nullptr; - - ID3D11InputLayout* m_inputLayout = nullptr; - ID3D11VertexShader* m_pointVS = nullptr; - ID3D11GeometryShader* m_pointGS = nullptr; - ID3D11PixelShader* m_pointPS = nullptr; - ID3D11Buffer* m_constantBuffer = nullptr; - ID3D11RasterizerState* m_rasterizerStateRH[NUM_POINT_RENDER_MODES][NUM_POINT_CULL_MODES]; - - void Init(ID3D11Device* device, ID3D11DeviceContext* deviceContext); - void Destroy(); - - void Draw(const PointDrawParams* params, ID3D11Buffer* positions, ID3D11Buffer* colors, ID3D11Buffer* indices, int numParticles, int offset); -}; diff --git a/demo/d3d11/pointRender.cpp b/demo/d3d11/pointRenderD3D11.cpp index 1d3a8b0..20dde46 100644 --- a/demo/d3d11/pointRender.cpp +++ b/demo/d3d11/pointRenderD3D11.cpp @@ -21,17 +21,18 @@ #include "appD3D11Ctx.h" -#include "pointRender.h" +#include "shadowMapD3D11.h" -#include "shaders/pointVS.hlsl.h" -#include "shaders/pointGS.hlsl.h" -#include "shaders/pointPS.hlsl.h" +#include "pointRenderD3D11.h" -#define EXCLUDE_SHADER_STRUCTS 1 -#include "shaders/shaderCommon.h" +#include "../d3d/shaders/pointVS.hlsl.h" +#include "../d3d/shaders/pointGS.hlsl.h" +#include "../d3d/shaders/pointPS.hlsl.h" +#include "../d3d/shaders/pointShadowPS.hlsl.h" +#include "../d3d/shaderCommonD3D.h" -void PointRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) +void PointRendererD3D11::init(ID3D11Device* device, ID3D11DeviceContext* context) { m_device = device; m_deviceContext = context; @@ -49,14 +50,15 @@ void PointRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) } // create the shaders - m_device->CreateVertexShader(g_pointVS, sizeof(g_pointVS), nullptr, &m_pointVS); - m_device->CreateGeometryShader(g_pointGS, sizeof(g_pointGS), nullptr, &m_pointGS); - m_device->CreatePixelShader(g_pointPS, sizeof(g_pointPS), nullptr, &m_pointPS); + m_device->CreateVertexShader(g_pointVS, sizeof(g_pointVS), nullptr, &m_pointVs); + m_device->CreateGeometryShader(g_pointGS, sizeof(g_pointGS), nullptr, &m_pointGs); + m_device->CreatePixelShader(g_pointPS, sizeof(g_pointPS), nullptr, &m_pointPs); + m_device->CreatePixelShader(g_pointShadowPS, sizeof(g_pointShadowPS), nullptr, &m_pointShadowPs); // create a constant buffer { D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(PointShaderConst); // 64 * sizeof(float); + bufDesc.ByteWidth = sizeof(Hlsl::PointShaderConst); // 64 * sizeof(float); bufDesc.Usage = D3D11_USAGE_DYNAMIC; bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; @@ -65,7 +67,7 @@ void PointRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer); } - // create the rastersizer state + // create the rasterizer state for (int i = 0; i < NUM_POINT_RENDER_MODES; i++) { for (int j = 0; j < NUM_POINT_CULL_MODES; j++) @@ -83,27 +85,12 @@ void PointRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) desc.MultisampleEnable = FALSE; desc.AntialiasedLineEnable = FALSE; - m_device->CreateRasterizerState(&desc, &m_rasterizerStateRH[i][j]); + m_device->CreateRasterizerState(&desc, &m_rasterizerState[i][j]); } } } -void PointRenderer::Destroy() -{ - COMRelease(m_inputLayout); - COMRelease(m_pointVS); - COMRelease(m_pointGS); - COMRelease(m_pointPS); - COMRelease(m_constantBuffer); - - for (int i = 0; i < NUM_POINT_RENDER_MODES; i++) - for (int j = 0; j < NUM_POINT_CULL_MODES; j++) - COMRelease(m_rasterizerStateRH[i][j]); -} - - - -void PointRenderer::Draw(const PointDrawParams* params, ID3D11Buffer* positions, ID3D11Buffer* colors, ID3D11Buffer* indices, int numParticles, int offset) +void PointRendererD3D11::draw(const PointDrawParamsD3D* params, ID3D11Buffer* positions, ID3D11Buffer* colors, ID3D11Buffer* indices, int numParticles, int offset) { using namespace DirectX; @@ -112,64 +99,45 @@ void PointRenderer::Draw(const PointDrawParams* params, ID3D11Buffer* positions, // update constant buffer { D3D11_MAPPED_SUBRESOURCE mappedResource = {}; - if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) + if (SUCCEEDED(deviceContext->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) { - PointShaderConst cParams; - - cParams.modelview = (float4x4&)XMMatrixMultiply(params->model, params->view); - cParams.projection = (float4x4&)params->projection; - - cParams.pointRadius = params->pointRadius; - cParams.pointScale = params->pointScale; - cParams.spotMin = params->spotMin; - cParams.spotMax = params->spotMax; - - cParams.lightTransform = (float4x4&)params->lightTransform; - cParams.lightPos = params->lightPos; - cParams.lightDir = params->lightDir; - - for (int i = 0; i < 8; i++) - cParams.colors[i] = params->colors[i]; - - memcpy(cParams.shadowTaps, params->shadowTaps, sizeof(cParams.shadowTaps)); - - cParams.mode = params->mode; - - memcpy(mappedResource.pData, &cParams, sizeof(PointShaderConst)); - - deviceContext->Unmap(m_constantBuffer, 0u); + Hlsl::PointShaderConst constBuf; + RenderParamsUtilD3D::calcPointConstantBuffer(*params, constBuf); + memcpy(mappedResource.pData, &constBuf, sizeof(Hlsl::PointShaderConst)); + deviceContext->Unmap(m_constantBuffer.Get(), 0u); } } - deviceContext->VSSetShader(m_pointVS, nullptr, 0u); - deviceContext->GSSetShader(m_pointGS, nullptr, 0u); - deviceContext->PSSetShader(m_pointPS, nullptr, 0u); + deviceContext->VSSetShader(m_pointVs.Get(), nullptr, 0u); + deviceContext->GSSetShader(m_pointGs.Get(), nullptr, 0u); + deviceContext->PSSetShader(m_pointPs.Get(), nullptr, 0u); if (params->shadowMap) { - ShadowMap* shadowMap = (ShadowMap*)params->shadowMap; + ShadowMapD3D11* shadowMap = (ShadowMapD3D11*)params->shadowMap; if (params->renderStage == POINT_DRAW_SHADOW) { - ID3D11ShaderResourceView* ppSRV[1] = { nullptr }; - deviceContext->PSSetShaderResources(0, 1, ppSRV); - ID3D11SamplerState* ppSS[1] = { shadowMap->m_linearSampler.Get() }; - deviceContext->PSSetSamplers(0, 1, ppSS); + ID3D11ShaderResourceView* srvs[1] = { nullptr }; + deviceContext->PSSetShaderResources(0, 1, srvs); + ID3D11SamplerState* samps[1] = { shadowMap->m_linearSampler.Get() }; + deviceContext->PSSetSamplers(0, 1, samps); + deviceContext->PSSetShader(m_pointShadowPs.Get(), nullptr, 0u); } else { - ID3D11ShaderResourceView* ppSRV[1] = { shadowMap->m_depthSrv.Get() }; - deviceContext->PSSetShaderResources(0, 1, ppSRV); - ID3D11SamplerState* ppSS[1] = { shadowMap->m_linearSampler.Get() }; - deviceContext->PSSetSamplers(0, 1, ppSS); + ID3D11ShaderResourceView* srvs[1] = { shadowMap->m_depthSrv.Get() }; + deviceContext->PSSetShaderResources(0, 1, srvs); + ID3D11SamplerState* samps[1] = { shadowMap->m_linearSampler.Get() }; + deviceContext->PSSetSamplers(0, 1, samps); } } - deviceContext->IASetInputLayout(m_inputLayout); + deviceContext->IASetInputLayout(m_inputLayout.Get()); deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); - deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->GSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer); + deviceContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->GSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->PSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); ID3D11Buffer* vertexBuffers[3] = { @@ -190,11 +158,10 @@ void PointRenderer::Draw(const PointDrawParams* params, ID3D11Buffer* positions, deviceContext->IASetVertexBuffers(0, 3, vertexBuffers, vertexBufferStrides, vertexBufferOffsets); deviceContext->IASetIndexBuffer(indices, DXGI_FORMAT_R32_UINT, 0u); - float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); if (depthSign < 0.f) { - deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]); + deviceContext->RSSetState(m_rasterizerState[params->renderMode][params->cullMode].Get()); } deviceContext->DrawIndexed(numParticles, offset, 0); diff --git a/demo/d3d11/pointRenderD3D11.h b/demo/d3d11/pointRenderD3D11.h new file mode 100644 index 0000000..71a6247 --- /dev/null +++ b/demo/d3d11/pointRenderD3D11.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#include "../d3d/renderParamsD3D.h" + +#include <DirectXMath.h> +#include <wrl.h> +using namespace Microsoft::WRL; + + +struct PointRendererD3D11 +{ + void init(ID3D11Device* device, ID3D11DeviceContext* deviceContext); + + void draw(const PointDrawParamsD3D* params, ID3D11Buffer* positions, ID3D11Buffer* colors, ID3D11Buffer* indices, int numParticles, int offset); + + PointRendererD3D11(): + m_device(nullptr), + m_deviceContext(nullptr) + {} + + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceContext; + + ComPtr<ID3D11InputLayout> m_inputLayout; + ComPtr<ID3D11VertexShader> m_pointVs; + ComPtr<ID3D11GeometryShader> m_pointGs; + ComPtr<ID3D11PixelShader> m_pointPs; + ComPtr<ID3D11PixelShader> m_pointShadowPs; + ComPtr<ID3D11Buffer> m_constantBuffer; + + // Assumes right handed + ComPtr<ID3D11RasterizerState> m_rasterizerState[NUM_POINT_RENDER_MODES][NUM_POINT_CULL_MODES]; +}; diff --git a/demo/d3d11/renderTarget.cpp b/demo/d3d11/renderTargetD3D11.cpp index da71e4f..4035039 100644 --- a/demo/d3d11/renderTarget.cpp +++ b/demo/d3d11/renderTargetD3D11.cpp @@ -8,9 +8,9 @@ * license agreement from NVIDIA CORPORATION is strictly prohibited. */ -#include "renderTarget.h" +#include "renderTargetD3D11.h" -RenderTarget::RenderTarget() +RenderTargetD3D11::RenderTargetD3D11() { } @@ -56,7 +56,7 @@ static D3D11_SHADER_RESOURCE_VIEW_DESC _getSrvDesc(DXGI_FORMAT format) return desc; } -HRESULT RenderTarget::Init(ID3D11Device* device, int width, int height, bool depthTest) +HRESULT RenderTargetD3D11::init(ID3D11Device* device, int width, int height, bool depthTest) { // set viewport { @@ -130,7 +130,7 @@ HRESULT RenderTarget::Init(ID3D11Device* device, int width, int height, bool dep return S_OK; } -void RenderTarget::BindAndClear(ID3D11DeviceContext* context) +void RenderTargetD3D11::bindAndClear(ID3D11DeviceContext* context) { ID3D11RenderTargetView* ppRtv[1] = { m_backRtv.Get() }; context->OMSetRenderTargets(1, ppRtv, m_depthDsv.Get()); diff --git a/demo/d3d11/renderTarget.h b/demo/d3d11/renderTargetD3D11.h index ae5ff40..b299bec 100644 --- a/demo/d3d11/renderTarget.h +++ b/demo/d3d11/renderTargetD3D11.h @@ -20,15 +20,15 @@ using namespace Microsoft::WRL; #define NV_NULL nullptr #define NV_RETURN_ON_FAIL(x) { HRESULT _res = (x); if (FAILED(_res)) { return _res; } } -struct RenderTarget +struct RenderTargetD3D11 { public: - RenderTarget(); + RenderTargetD3D11(); - HRESULT Init(ID3D11Device* device, int width, int height, bool depthTest = true); + HRESULT init(ID3D11Device* device, int width, int height, bool depthTest = true); - void BindAndClear(ID3D11DeviceContext* context); + void bindAndClear(ID3D11DeviceContext* context); XMMATRIX m_lightView; XMMATRIX m_lightProjection; diff --git a/demo/d3d11/shaders/diffuseGS.hlsl b/demo/d3d11/shaders/diffuseGS.hlsl deleted file mode 100644 index e7a92db..0000000 --- a/demo/d3d11/shaders/diffuseGS.hlsl +++ /dev/null @@ -1,176 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - DiffuseShaderConst gParams; -}; - -static const float2 corners[4] = -{ - float2(0.0, 1.0), - float2(0.0, 0.0), - float2(1.0, 1.0), - float2(1.0, 0.0) -}; - -[maxvertexcount(4)] -void diffuseGS(point DiffuseVertexOut input[1], inout TriangleStream<DiffuseGeometryOut> triStream) -{ - float4 ndcPos = input[0].ndcPos; - - // frustrum culling - const float ndcBound = 1.0; - if (ndcPos.x < -ndcBound) return; - if (ndcPos.x > ndcBound) return; - if (ndcPos.y < -ndcBound) return; - if (ndcPos.y > ndcBound) return; - - float pointScale = gParams.diffuseScale; - float velocityScale = 1.0; - - float3 v = input[0].viewVel.xyz; - float3 p = input[0].viewPos.xyz; - - // billboard in eye space - float3 u = float3(0.0, pointScale, 0.0); - float3 l = float3(pointScale, 0.0, 0.0); - - // increase size based on life - float lifeTime = input[0].worldPos.w; - - float lifeFade = lerp(1.0f + gParams.diffusion, 1.0, min(1.0, lifeTime*0.25f)); - u *= lifeFade; - l *= lifeFade; - - float fade = 1.0/(lifeFade*lifeFade); - float vlen = length(v)*gParams.motionBlurScale; - - if (vlen > 0.5) - { - float len = max(pointScale, vlen*0.016); - fade = min(1.0, 2.0/(len/pointScale)); - - u = normalize(v)*max(pointScale, vlen*0.016); // assume 60hz - l = normalize(cross(u, float3(0.0, 0.0, -1.0)))*pointScale; - } - - - { - - DiffuseGeometryOut output; - - output.worldPos = input[0].worldPos; // vertex world pos (life in w) - output.viewPos = input[0].viewPos; // vertex eye pos - output.viewVel.xyz = input[0].viewVel.xyz; // vertex velocity in view space - output.viewVel.w = fade; - output.lightDir = mul(gParams.modelView, float4(gParams.lightDir, 0.0)); - output.color = input[0].color; - - output.uv = float4(0.0, 1.0, 0.0, 0.0); - output.clipPos = mul(gParams.projection, float4(p + u - l, 1.0)); - triStream.Append(output); - - output.uv = float4(0.0, 0.0, 0.0, 0.0); - output.clipPos = mul(gParams.projection, float4(p - u - l, 1.0)); - triStream.Append(output); - - output.uv = float4(1.0, 1.0, 0.0, 0.0); - output.clipPos = mul(gParams.projection, float4(p + u + l, 1.0)); - triStream.Append(output); - - output.uv = float4(1.0, 0.0, 0.0, 0.0); - output.clipPos = mul(gParams.projection, float4(p - u + l, 1.0)); - triStream.Append(output); - } - -} - -#if 0 - - -const char *geometryDiffuseShader = -"#version 120\n" -"#extension GL_EXT_geometry_shader4 : enable\n" -STRINGIFY( - -uniform float pointScale; // point size in world space -uniform float motionBlurScale; -uniform float diffusion; -uniform vec3 lightDir; - -void main() -{ - vec4 ndcPos = gl_TexCoordIn[0][5]; - - // frustrum culling - const float ndcBound = 1.0; - if (ndcPos.x < -ndcBound) return; - if (ndcPos.x > ndcBound) return; - if (ndcPos.y < -ndcBound) return; - if (ndcPos.y > ndcBound) return; - - float velocityScale = 1.0; - - vec3 v = gl_TexCoordIn[0][3].xyz*velocityScale; - vec3 p = gl_TexCoordIn[0][2].xyz; - - // billboard in eye space - vec3 u = vec3(0.0, pointScale, 0.0); - vec3 l = vec3(pointScale, 0.0, 0.0); - - // increase size based on life - float lifeFade = mix(1.0f+diffusion, 1.0, min(1.0, gl_TexCoordIn[0][1].w*0.25f)); - u *= lifeFade; - l *= lifeFade; - - //lifeFade = 1.0; - - float fade = 1.0/(lifeFade*lifeFade); - float vlen = length(v)*motionBlurScale; - - if (vlen > 0.5) - { - float len = max(pointScale, vlen*0.016); - fade = min(1.0, 2.0/(len/pointScale)); - - u = normalize(v)*max(pointScale, vlen*0.016); // assume 60hz - l = normalize(cross(u, vec3(0.0, 0.0, -1.0)))*pointScale; - } - - { - - gl_TexCoord[1] = gl_TexCoordIn[0][1]; // vertex world pos (life in w) - gl_TexCoord[2] = gl_TexCoordIn[0][2]; // vertex eye pos - gl_TexCoord[3] = gl_TexCoordIn[0][3]; // vertex velocity in view space - gl_TexCoord[3].w = fade; - gl_TexCoord[4] = gl_ModelViewMatrix*vec4(lightDir, 0.0); - gl_TexCoord[4].w = gl_TexCoordIn[0][3].w; // attenuation - gl_TexCoord[5].xyzw = gl_TexCoordIn[0][4].xyzw; // color - - float zbias = 0.0f;//0.00125*2.0; - - gl_TexCoord[0] = vec4(0.0, 1.0, 0.0, 0.0); - gl_Position = gl_ProjectionMatrix * vec4(p + u - l, 1.0); - gl_Position.z -= zbias; - EmitVertex(); - - gl_TexCoord[0] = vec4(0.0, 0.0, 0.0, 0.0); - gl_Position = gl_ProjectionMatrix * vec4(p - u - l, 1.0); - gl_Position.z -= zbias; - EmitVertex(); - - gl_TexCoord[0] = vec4(1.0, 1.0, 0.0, 0.0); - gl_Position = gl_ProjectionMatrix * vec4(p + u + l, 1.0); - gl_Position.z -= zbias; - EmitVertex(); - - gl_TexCoord[0] = vec4(1.0, 0.0, 0.0, 0.0); - gl_Position = gl_ProjectionMatrix * vec4(p - u + l, 1.0); - gl_Position.z -= zbias; - EmitVertex(); - } -} -); - - -#endif
\ No newline at end of file diff --git a/demo/d3d11/shaders/ellipsoidDepthGS.hlsl b/demo/d3d11/shaders/ellipsoidDepthGS.hlsl deleted file mode 100644 index 8c892e4..0000000 --- a/demo/d3d11/shaders/ellipsoidDepthGS.hlsl +++ /dev/null @@ -1,127 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - FluidShaderConst gParams; -}; - -static const float2 corners[4] = -{ - float2(0.0, 1.0), float2(0.0, 0.0), float2(1.0, 1.0), float2(1.0, 0.0) -}; - -[maxvertexcount(4)] -void ellipsoidDepthGS(point FluidVertexOut input[1], inout TriangleStream<FluidGeoOut> triStream) -{ - float4 gl_Position; - float4 gl_TexCoord[6]; - - float4 gl_PositionIn[1]; - float4 gl_TexCoordIn[1][6]; - - gl_PositionIn[0] = input[0].position; - { - [unroll] - for (int i = 0; i < 6; i++) - gl_TexCoordIn[0][i] = input[0].texCoord[i]; - } - - float3 pos = gl_PositionIn[0].xyz; - float4 bounds = gl_TexCoordIn[0][0]; - float4 ndcPos = gl_TexCoordIn[0][5]; - - if (ndcPos.w < 0.0) - return; - - // frustrum culling - const float ndcBound = 1.0; - if (ndcPos.x < -ndcBound) return; - if (ndcPos.x > ndcBound) return; - if (ndcPos.y < -ndcBound) return; - if (ndcPos.y > ndcBound) return; - - float xmin = bounds.x; - float xmax = bounds.y; - float ymin = bounds.z; - float ymax = bounds.w; - - - // inv quadric transform - gl_TexCoord[0] = gl_TexCoordIn[0][1]; - gl_TexCoord[1] = gl_TexCoordIn[0][2]; - gl_TexCoord[2] = gl_TexCoordIn[0][3]; - gl_TexCoord[3] = gl_TexCoordIn[0][4]; - - FluidGeoOut output; - - gl_Position = float4(xmin, ymax, 0.5, 1.0); - output.position = gl_Position; - output.texCoord[0] = gl_TexCoord[0]; - output.texCoord[1] = gl_TexCoord[1]; - output.texCoord[2] = gl_TexCoord[2]; - output.texCoord[3] = gl_TexCoord[3]; - triStream.Append(output); - - gl_Position = float4(xmin, ymin, 0.5, 1.0); - output.position = gl_Position; - output.texCoord[0] = gl_TexCoord[0]; - output.texCoord[1] = gl_TexCoord[1]; - output.texCoord[2] = gl_TexCoord[2]; - output.texCoord[3] = gl_TexCoord[3]; - triStream.Append(output); - - gl_Position = float4(xmax, ymax, 0.5, 1.0); - output.position = gl_Position; - output.texCoord[0] = gl_TexCoord[0]; - output.texCoord[1] = gl_TexCoord[1]; - output.texCoord[2] = gl_TexCoord[2]; - output.texCoord[3] = gl_TexCoord[3]; - triStream.Append(output); - - gl_Position = float4(xmax, ymin, 0.5, 1.0); - output.position = gl_Position; - output.texCoord[0] = gl_TexCoord[0]; - output.texCoord[1] = gl_TexCoord[1]; - output.texCoord[2] = gl_TexCoord[2]; - output.texCoord[3] = gl_TexCoord[3]; - triStream.Append(output); - - /* - void main() - { - vec3 pos = gl_PositionIn[0].xyz; - vec4 bounds = gl_TexCoordIn[0][0]; - vec4 ndcPos = gl_TexCoordIn[0][5]; - - // frustrum culling - const float ndcBound = 1.0; - if (ndcPos.x < -ndcBound) return; - if (ndcPos.x > ndcBound) return; - if (ndcPos.y < -ndcBound) return; - if (ndcPos.y > ndcBound) return; - - float xmin = bounds.x; - float xmax = bounds.y; - float ymin = bounds.z; - float ymax = bounds.w; - - // inv quadric transform - gl_TexCoord[0] = gl_TexCoordIn[0][1]; - gl_TexCoord[1] = gl_TexCoordIn[0][2]; - gl_TexCoord[2] = gl_TexCoordIn[0][3]; - gl_TexCoord[3] = gl_TexCoordIn[0][4]; - - gl_Position = vec4(xmin, ymax, 0.0, 1.0); - EmitVertex(); - - gl_Position = vec4(xmin, ymin, 0.0, 1.0); - EmitVertex(); - - gl_Position = vec4(xmax, ymax, 0.0, 1.0); - EmitVertex(); - - gl_Position = vec4(xmax, ymin, 0.0, 1.0); - EmitVertex(); - } - */ -} diff --git a/demo/d3d11/shaders/ellipsoidDepthPS.hlsl.h b/demo/d3d11/shaders/ellipsoidDepthPS.hlsl.h deleted file mode 100644 index d21d446..0000000 --- a/demo/d3d11/shaders/ellipsoidDepthPS.hlsl.h +++ /dev/null @@ -1,662 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer constBuf -// { -// -// struct FluidShaderConst -// { -// -// float4x4 modelviewprojection; // Offset: 0 -// float4x4 modelview; // Offset: 64 -// float4x4 projection; // Offset: 128 -// float4x4 modelview_inverse; // Offset: 192 -// float4x4 projection_inverse; // Offset: 256 -// float4 invTexScale; // Offset: 320 -// float3 invViewport; // Offset: 336 -// float _pad0; // Offset: 348 -// float blurRadiusWorld; // Offset: 352 -// float blurScale; // Offset: 356 -// float blurFalloff; // Offset: 360 -// int debug; // Offset: 364 -// float3 lightPos; // Offset: 368 -// float _pad1; // Offset: 380 -// float3 lightDir; // Offset: 384 -// float _pad2; // Offset: 396 -// float4x4 lightTransform; // Offset: 400 -// float4 color; // Offset: 464 -// float4 clipPosToEye; // Offset: 480 -// float spotMin; // Offset: 496 -// float spotMax; // Offset: 500 -// float ior; // Offset: 504 -// float _pad3; // Offset: 508 -// float4 shadowTaps[12]; // Offset: 512 -// -// } gParams; // Offset: 0 Size: 704 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// constBuf cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_POSITION 0 xyzw 0 POS float xy -// TEXCOORD 0 xyzw 1 NONE float xyzw -// TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float xyzw -// TEXCOORD 3 xyzw 4 NONE float xyzw -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// SV_DEPTH 0 N/A oDepth DEPTH float YES -// -ps_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[22], immediateIndexed -dcl_input_ps_siv linear noperspective v0.xy, position -dcl_input_ps linear v1.xyzw -dcl_input_ps linear v2.xyzw -dcl_input_ps linear v3.xyzw -dcl_input_ps linear v4.xyzw -dcl_output o0.xyzw -dcl_output oDepth -dcl_temps 4 -dp2 r0.x, v0.xxxx, cb0[21].xxxx -add r0.x, r0.x, l(-1.000000) -mad r0.y, -v0.y, cb0[21].y, l(1.000000) -mad r0.y, r0.y, l(2.000000), l(-1.000000) -mul r0.yzw, r0.yyyy, cb0[17].xxyz -mad r0.xyz, cb0[16].xyzx, r0.xxxx, r0.yzwy -add r0.xyz, r0.xyzx, cb0[19].xyzx -mul r1.xyzw, r0.yyyy, v2.xyzw -mad r1.xyzw, v1.xyzw, r0.xxxx, r1.xyzw -mad r1.xyzw, v3.xyzw, r0.zzzz, r1.xyzw -dp3 r0.w, r1.xyzx, r1.xyzx -dp3 r1.x, r1.xyzx, v4.xyzx -mad r1.x, -r1.w, v4.w, r1.x -dp3 r1.y, v4.xyzx, v4.xyzx -mad r1.y, -v4.w, v4.w, r1.y -add r1.z, r1.x, r1.x -eq r1.w, r0.w, l(0.000000) -eq r2.x, r1.x, l(0.000000) -and r1.w, r1.w, r2.x -mul r2.x, r0.w, r1.y -mul r2.x, r2.x, l(4.000000) -mad r2.x, r1.z, r1.z, -r2.x -lt r2.y, r2.x, l(0.000000) -not r3.y, r2.y -lt r1.x, r1.x, l(0.000000) -movc r1.x, r1.x, l(-1.000000), l(1.000000) -sqrt r2.x, r2.x -mad r1.x, r1.x, r2.x, r1.z -mul r1.x, r1.x, l(-0.500000) -div r0.w, r1.x, r0.w -div r1.x, r1.y, r1.x -lt r1.y, r1.x, r0.w -movc r3.z, r1.y, r1.x, r0.w -mov r3.xw, l(0,0,0,-1) -movc r1.xy, r2.yyyy, r3.xyxx, r3.zwzz -movc r1.xy, r1.wwww, l(0,-1,0,0), r1.xyxx -if_nz r1.y - mul r0.xyz, r0.xyzx, r1.xxxx - mul r0.yw, r0.yyyy, cb0[9].zzzw - mad r0.xy, cb0[8].zwzz, r0.xxxx, r0.ywyy - mad r0.xy, cb0[10].zwzz, r0.zzzz, r0.xyxx - add r0.xy, r0.xyxx, cb0[11].zwzz - div oDepth, r0.x, r0.y - mov o0.x, r0.z - mov o0.yzw, l(0,1.000000,1.000000,1.000000) - ret -endif -discard_nz l(-1) -mov o0.xyzw, l(0,0,0,0) -mov oDepth, l(1.000000) -ret -// Approximately 51 instruction slots used -#endif - -const BYTE g_ellipsoidDepthPS[] = -{ - 68, 88, 66, 67, 67, 187, - 249, 247, 27, 80, 204, 105, - 148, 238, 87, 239, 162, 120, - 35, 255, 1, 0, 0, 0, - 76, 12, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 116, 4, 0, 0, 20, 5, - 0, 0, 104, 5, 0, 0, - 176, 11, 0, 0, 82, 68, - 69, 70, 56, 4, 0, 0, - 1, 0, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 255, 255, 0, 1, 0, 0, - 4, 4, 0, 0, 82, 68, - 49, 49, 60, 0, 0, 0, - 24, 0, 0, 0, 32, 0, - 0, 0, 40, 0, 0, 0, - 36, 0, 0, 0, 12, 0, - 0, 0, 0, 0, 0, 0, - 92, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 1, 0, - 0, 0, 99, 111, 110, 115, - 116, 66, 117, 102, 0, 171, - 171, 171, 92, 0, 0, 0, - 1, 0, 0, 0, 128, 0, - 0, 0, 192, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 168, 0, 0, 0, - 0, 0, 0, 0, 192, 2, - 0, 0, 2, 0, 0, 0, - 224, 3, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 103, 80, 97, 114, 97, 109, - 115, 0, 70, 108, 117, 105, - 100, 83, 104, 97, 100, 101, - 114, 67, 111, 110, 115, 116, - 0, 109, 111, 100, 101, 108, - 118, 105, 101, 119, 112, 114, - 111, 106, 101, 99, 116, 105, - 111, 110, 0, 102, 108, 111, - 97, 116, 52, 120, 52, 0, - 171, 171, 3, 0, 3, 0, - 4, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 213, 0, - 0, 0, 109, 111, 100, 101, - 108, 118, 105, 101, 119, 0, - 112, 114, 111, 106, 101, 99, - 116, 105, 111, 110, 0, 109, - 111, 100, 101, 108, 118, 105, - 101, 119, 95, 105, 110, 118, - 101, 114, 115, 101, 0, 112, - 114, 111, 106, 101, 99, 116, - 105, 111, 110, 95, 105, 110, - 118, 101, 114, 115, 101, 0, - 105, 110, 118, 84, 101, 120, - 83, 99, 97, 108, 101, 0, - 102, 108, 111, 97, 116, 52, - 0, 171, 171, 171, 1, 0, - 3, 0, 1, 0, 4, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 74, 1, 0, 0, 105, 110, - 118, 86, 105, 101, 119, 112, - 111, 114, 116, 0, 102, 108, - 111, 97, 116, 51, 0, 171, - 1, 0, 3, 0, 1, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 132, 1, 0, 0, - 95, 112, 97, 100, 48, 0, - 102, 108, 111, 97, 116, 0, - 0, 0, 3, 0, 1, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 182, 1, 0, 0, - 98, 108, 117, 114, 82, 97, - 100, 105, 117, 115, 87, 111, - 114, 108, 100, 0, 98, 108, - 117, 114, 83, 99, 97, 108, - 101, 0, 98, 108, 117, 114, - 70, 97, 108, 108, 111, 102, - 102, 0, 100, 101, 98, 117, - 103, 0, 105, 110, 116, 0, - 0, 0, 2, 0, 1, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 12, 2, 0, 0, - 108, 105, 103, 104, 116, 80, - 111, 115, 0, 95, 112, 97, - 100, 49, 0, 108, 105, 103, - 104, 116, 68, 105, 114, 0, - 95, 112, 97, 100, 50, 0, - 108, 105, 103, 104, 116, 84, - 114, 97, 110, 115, 102, 111, - 114, 109, 0, 99, 111, 108, - 111, 114, 0, 99, 108, 105, - 112, 80, 111, 115, 84, 111, - 69, 121, 101, 0, 115, 112, - 111, 116, 77, 105, 110, 0, - 115, 112, 111, 116, 77, 97, - 120, 0, 105, 111, 114, 0, - 95, 112, 97, 100, 51, 0, - 115, 104, 97, 100, 111, 119, - 84, 97, 112, 115, 0, 171, - 171, 171, 1, 0, 3, 0, - 1, 0, 4, 0, 12, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 74, 1, - 0, 0, 193, 0, 0, 0, - 224, 0, 0, 0, 0, 0, - 0, 0, 4, 1, 0, 0, - 224, 0, 0, 0, 64, 0, - 0, 0, 14, 1, 0, 0, - 224, 0, 0, 0, 128, 0, - 0, 0, 25, 1, 0, 0, - 224, 0, 0, 0, 192, 0, - 0, 0, 43, 1, 0, 0, - 224, 0, 0, 0, 0, 1, - 0, 0, 62, 1, 0, 0, - 84, 1, 0, 0, 64, 1, - 0, 0, 120, 1, 0, 0, - 140, 1, 0, 0, 80, 1, - 0, 0, 176, 1, 0, 0, - 188, 1, 0, 0, 92, 1, - 0, 0, 224, 1, 0, 0, - 188, 1, 0, 0, 96, 1, - 0, 0, 240, 1, 0, 0, - 188, 1, 0, 0, 100, 1, - 0, 0, 250, 1, 0, 0, - 188, 1, 0, 0, 104, 1, - 0, 0, 6, 2, 0, 0, - 16, 2, 0, 0, 108, 1, - 0, 0, 52, 2, 0, 0, - 140, 1, 0, 0, 112, 1, - 0, 0, 61, 2, 0, 0, - 188, 1, 0, 0, 124, 1, - 0, 0, 67, 2, 0, 0, - 140, 1, 0, 0, 128, 1, - 0, 0, 76, 2, 0, 0, - 188, 1, 0, 0, 140, 1, - 0, 0, 82, 2, 0, 0, - 224, 0, 0, 0, 144, 1, - 0, 0, 97, 2, 0, 0, - 84, 1, 0, 0, 208, 1, - 0, 0, 103, 2, 0, 0, - 84, 1, 0, 0, 224, 1, - 0, 0, 116, 2, 0, 0, - 188, 1, 0, 0, 240, 1, - 0, 0, 124, 2, 0, 0, - 188, 1, 0, 0, 244, 1, - 0, 0, 132, 2, 0, 0, - 188, 1, 0, 0, 248, 1, - 0, 0, 136, 2, 0, 0, - 188, 1, 0, 0, 252, 1, - 0, 0, 142, 2, 0, 0, - 156, 2, 0, 0, 0, 2, - 0, 0, 5, 0, 0, 0, - 1, 0, 176, 0, 0, 0, - 24, 0, 192, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 176, 0, - 0, 0, 77, 105, 99, 114, - 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, - 100, 101, 114, 32, 67, 111, - 109, 112, 105, 108, 101, 114, - 32, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, - 51, 56, 52, 0, 171, 171, - 73, 83, 71, 78, 152, 0, - 0, 0, 5, 0, 0, 0, - 8, 0, 0, 0, 128, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 3, 0, 0, 140, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 15, 15, 0, 0, 140, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, - 15, 15, 0, 0, 140, 0, - 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, - 15, 15, 0, 0, 140, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 4, 0, 0, 0, - 15, 15, 0, 0, 83, 86, - 95, 80, 79, 83, 73, 84, - 73, 79, 78, 0, 84, 69, - 88, 67, 79, 79, 82, 68, - 0, 171, 171, 171, 79, 83, - 71, 78, 76, 0, 0, 0, - 2, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 66, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 255, 255, 255, 255, 1, 14, - 0, 0, 83, 86, 95, 84, - 65, 82, 71, 69, 84, 0, - 83, 86, 95, 68, 69, 80, - 84, 72, 0, 171, 83, 72, - 69, 88, 64, 6, 0, 0, - 80, 0, 0, 0, 144, 1, - 0, 0, 106, 8, 0, 1, - 89, 0, 0, 4, 70, 142, - 32, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 100, 32, - 0, 4, 50, 16, 16, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 98, 16, 0, 3, - 242, 16, 16, 0, 1, 0, - 0, 0, 98, 16, 0, 3, - 242, 16, 16, 0, 2, 0, - 0, 0, 98, 16, 0, 3, - 242, 16, 16, 0, 3, 0, - 0, 0, 98, 16, 0, 3, - 242, 16, 16, 0, 4, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 0, 0, - 0, 0, 101, 0, 0, 2, - 1, 192, 0, 0, 104, 0, - 0, 2, 4, 0, 0, 0, - 15, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, - 6, 16, 16, 0, 0, 0, - 0, 0, 6, 128, 32, 0, - 0, 0, 0, 0, 21, 0, - 0, 0, 0, 0, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 191, - 50, 0, 0, 11, 34, 0, - 16, 0, 0, 0, 0, 0, - 26, 16, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 26, 128, 32, 0, 0, 0, - 0, 0, 21, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 50, 0, 0, 9, - 34, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 64, - 1, 64, 0, 0, 0, 0, - 128, 191, 56, 0, 0, 8, - 226, 0, 16, 0, 0, 0, - 0, 0, 86, 5, 16, 0, - 0, 0, 0, 0, 6, 137, - 32, 0, 0, 0, 0, 0, - 17, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 0, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 16, 0, 0, 0, 6, 0, - 16, 0, 0, 0, 0, 0, - 150, 7, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 8, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 19, 0, 0, 0, 56, 0, - 0, 7, 242, 0, 16, 0, - 1, 0, 0, 0, 86, 5, - 16, 0, 0, 0, 0, 0, - 70, 30, 16, 0, 2, 0, - 0, 0, 50, 0, 0, 9, - 242, 0, 16, 0, 1, 0, - 0, 0, 70, 30, 16, 0, - 1, 0, 0, 0, 6, 0, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 1, 0, - 0, 0, 50, 0, 0, 9, - 242, 0, 16, 0, 1, 0, - 0, 0, 70, 30, 16, 0, - 3, 0, 0, 0, 166, 10, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 1, 0, - 0, 0, 16, 0, 0, 7, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 1, 0, 0, 0, - 16, 0, 0, 7, 18, 0, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 70, 18, 16, 0, - 4, 0, 0, 0, 50, 0, - 0, 10, 18, 0, 16, 0, - 1, 0, 0, 0, 58, 0, - 16, 128, 65, 0, 0, 0, - 1, 0, 0, 0, 58, 16, - 16, 0, 4, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 16, 0, 0, 7, - 34, 0, 16, 0, 1, 0, - 0, 0, 70, 18, 16, 0, - 4, 0, 0, 0, 70, 18, - 16, 0, 4, 0, 0, 0, - 50, 0, 0, 10, 34, 0, - 16, 0, 1, 0, 0, 0, - 58, 16, 16, 128, 65, 0, - 0, 0, 4, 0, 0, 0, - 58, 16, 16, 0, 4, 0, - 0, 0, 26, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 1, 0, 0, 0, 10, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 24, 0, 0, 7, - 130, 0, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 24, 0, 0, 7, 18, 0, - 16, 0, 2, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 7, 130, 0, 16, 0, - 1, 0, 0, 0, 58, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 2, 0, - 0, 0, 56, 0, 0, 7, - 18, 0, 16, 0, 2, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 1, 0, 0, 0, - 56, 0, 0, 7, 18, 0, - 16, 0, 2, 0, 0, 0, - 10, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 64, 50, 0, - 0, 10, 18, 0, 16, 0, - 2, 0, 0, 0, 42, 0, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 128, - 65, 0, 0, 0, 2, 0, - 0, 0, 49, 0, 0, 7, - 34, 0, 16, 0, 2, 0, - 0, 0, 10, 0, 16, 0, - 2, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 59, 0, 0, 5, 34, 0, - 16, 0, 3, 0, 0, 0, - 26, 0, 16, 0, 2, 0, - 0, 0, 49, 0, 0, 7, - 18, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 55, 0, 0, 9, 18, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 191, 1, 64, - 0, 0, 0, 0, 128, 63, - 75, 0, 0, 5, 18, 0, - 16, 0, 2, 0, 0, 0, - 10, 0, 16, 0, 2, 0, - 0, 0, 50, 0, 0, 9, - 18, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 10, 0, - 16, 0, 2, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 56, 0, 0, 7, - 18, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 191, - 14, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 14, 0, - 0, 7, 18, 0, 16, 0, - 1, 0, 0, 0, 26, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 49, 0, 0, 7, - 34, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 55, 0, 0, 9, 66, 0, - 16, 0, 3, 0, 0, 0, - 26, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 54, 0, 0, 8, 146, 0, - 16, 0, 3, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 55, 0, 0, 9, - 50, 0, 16, 0, 1, 0, - 0, 0, 86, 5, 16, 0, - 2, 0, 0, 0, 70, 0, - 16, 0, 3, 0, 0, 0, - 230, 10, 16, 0, 3, 0, - 0, 0, 55, 0, 0, 12, - 50, 0, 16, 0, 1, 0, - 0, 0, 246, 15, 16, 0, - 1, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 0, 0, 0, 0, - 70, 0, 16, 0, 1, 0, - 0, 0, 31, 0, 4, 3, - 26, 0, 16, 0, 1, 0, - 0, 0, 56, 0, 0, 7, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 6, 0, - 16, 0, 1, 0, 0, 0, - 56, 0, 0, 8, 162, 0, - 16, 0, 0, 0, 0, 0, - 86, 5, 16, 0, 0, 0, - 0, 0, 166, 142, 32, 0, - 0, 0, 0, 0, 9, 0, - 0, 0, 50, 0, 0, 10, - 50, 0, 16, 0, 0, 0, - 0, 0, 230, 138, 32, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 6, 0, 16, 0, - 0, 0, 0, 0, 214, 5, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 10, 50, 0, - 16, 0, 0, 0, 0, 0, - 230, 138, 32, 0, 0, 0, - 0, 0, 10, 0, 0, 0, - 166, 10, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 0, 0, 0, 0, 0, 0, - 0, 8, 50, 0, 16, 0, - 0, 0, 0, 0, 70, 0, - 16, 0, 0, 0, 0, 0, - 230, 138, 32, 0, 0, 0, - 0, 0, 11, 0, 0, 0, - 14, 0, 0, 6, 1, 192, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 18, 32, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 8, - 226, 32, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 128, 63, 0, 0, 128, 63, - 0, 0, 128, 63, 62, 0, - 0, 1, 21, 0, 0, 1, - 13, 0, 4, 3, 1, 64, - 0, 0, 255, 255, 255, 255, - 54, 0, 0, 8, 242, 32, - 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 54, 0, 0, 4, - 1, 192, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 62, 0, 0, 1, 83, 84, - 65, 84, 148, 0, 0, 0, - 51, 0, 0, 0, 4, 0, - 0, 0, 0, 0, 0, 0, - 7, 0, 0, 0, 35, 0, - 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 2, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 5, 0, - 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; diff --git a/demo/d3d11/shaders/ellipsoidDepthVS.hlsl b/demo/d3d11/shaders/ellipsoidDepthVS.hlsl deleted file mode 100644 index 03ef001..0000000 --- a/demo/d3d11/shaders/ellipsoidDepthVS.hlsl +++ /dev/null @@ -1,195 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - FluidShaderConst gParams; -}; - -// returns 1.0 for x==0.0 (unlike glsl) -float Sign(float x) { return x < 0.0 ? -1.0 : 1.0; } - -bool solveQuadratic(float a, float b, float c, out float minT, out float maxT) -{ -#if 0 - // for debugging - minT = -0.5; - maxT = 0.5; - return true; -#else - //minT = 0.0f; - //maxT = 0.0f; -#endif - - if (a == 0.0 && b == 0.0) - { - minT = maxT = 0.0; - return false; - } - - float discriminant = b*b - 4.0*a*c; - - if (discriminant < 0.0) - { - return false; - } - - float t = -0.5*(b + Sign(b)*sqrt(discriminant)); - minT = t / a; - maxT = c / t; - - if (minT > maxT) - { - float tmp = minT; - minT = maxT; - maxT = tmp; - } - - return true; -} - -float DotInvW(float4 a, float4 b) { return a.x*b.x + a.y*b.y + a.z*b.z - a.w*b.w; } - -FluidVertexOut ellipsoidDepthVS(FluidVertexIn input, uint instance : SV_VertexID) -{ - float4 gl_Position; - float4 gl_TexCoord[6]; - - const float4 gl_Vertex = input.position; - const float4 q1 = input.q1; - const float4 q2 = input.q2; - const float4 q3 = input.q3; - - const float4x4 gl_ModelViewProjectionMatrix = gParams.modelviewprojection; - const float4x4 gl_ModelViewMatrixInverse = gParams.modelview_inverse; - - float3 worldPos = gl_Vertex.xyz; - - // construct quadric matrix - float4x4 q; - q._m00_m10_m20_m30 = float4(q1.xyz*q1.w, 0.0); - q._m01_m11_m21_m31 = float4(q2.xyz*q2.w, 0.0); - q._m02_m12_m22_m32 = float4(q3.xyz*q3.w, 0.0); - q._m03_m13_m23_m33 = float4(worldPos, 1.0); - - // transforms a normal to parameter space (inverse transpose of (q*modelview)^-T) - float4x4 invClip = /*transpose*/(mul(gl_ModelViewProjectionMatrix, q)); - - // solve for the right hand bounds in homogenous clip space - float a1 = DotInvW(invClip[3], invClip[3]); - float b1 = -2.0f*DotInvW(invClip[0], invClip[3]); - float c1 = DotInvW(invClip[0], invClip[0]); - - float xmin; - float xmax; - solveQuadratic(a1, b1, c1, xmin, xmax); - - // solve for the right hand bounds in homogenous clip space - float a2 = DotInvW(invClip[3], invClip[3]); - float b2 = -2.0f*DotInvW(invClip[1], invClip[3]); - float c2 = DotInvW(invClip[1], invClip[1]); - - float ymin; - float ymax; - solveQuadratic(a2, b2, c2, ymin, ymax); - - gl_Position = float4(worldPos.xyz, 1.0); - gl_TexCoord[0] = float4(xmin, xmax, ymin, ymax); - - // construct inverse quadric matrix (used for ray-casting in parameter space) - float4x4 invq; - invq._m00_m10_m20_m30 = float4(q1.xyz / q1.w, 0.0); - invq._m01_m11_m21_m31 = float4(q2.xyz / q2.w, 0.0); - invq._m02_m12_m22_m32 = float4(q3.xyz / q3.w, 0.0); - invq._m03_m13_m23_m33 = float4(0.0, 0.0, 0.0, 1.0); - - invq = transpose(invq); - invq._m03_m13_m23_m33 = -(mul(invq, gl_Position)); - - // transform a point from view space to parameter space - invq = mul(invq, gl_ModelViewMatrixInverse); - - // pass down - gl_TexCoord[1] = invq._m00_m10_m20_m30; - gl_TexCoord[2] = invq._m01_m11_m21_m31; - gl_TexCoord[3] = invq._m02_m12_m22_m32; - gl_TexCoord[4] = invq._m03_m13_m23_m33; - - // compute ndc pos for frustrum culling in GS - float4 ndcPos = mul(gl_ModelViewProjectionMatrix, float4(worldPos.xyz, 1.0)); - gl_TexCoord[5].xyz = ndcPos.xyz / ndcPos.w; - gl_TexCoord[5].w = ndcPos.w; - - FluidVertexOut output; - output.position = gl_Position; - [unroll] - for (int j = 0; j < 6; j++) - output.texCoord[j] = gl_TexCoord[j]; - - return output; - - /* - // rotation matrix in xyz, scale in w - attribute vec4 q1; - attribute vec4 q2; - attribute vec4 q3; - - void main() - { - vec3 worldPos = gl_Vertex.xyz;// - vec3(0.0, 0.1*0.25, 0.0); // hack move towards ground to account for anisotropy - - // construct quadric matrix - mat4 q; - q[0] = vec4(q1.xyz*q1.w, 0.0); - q[1] = vec4(q2.xyz*q2.w, 0.0); - q[2] = vec4(q3.xyz*q3.w, 0.0); - q[3] = vec4(worldPos, 1.0); - - // transforms a normal to parameter space (inverse transpose of (q*modelview)^-T) - mat4 invClip = transpose(gl_ModelViewProjectionMatrix*q); - - // solve for the right hand bounds in homogenous clip space - float a1 = DotInvW(invClip[3], invClip[3]); - float b1 = -2.0f*DotInvW(invClip[0], invClip[3]); - float c1 = DotInvW(invClip[0], invClip[0]); - - float xmin; - float xmax; - solveQuadratic(a1, b1, c1, xmin, xmax); - - // solve for the right hand bounds in homogenous clip space - float a2 = DotInvW(invClip[3], invClip[3]); - float b2 = -2.0f*DotInvW(invClip[1], invClip[3]); - float c2 = DotInvW(invClip[1], invClip[1]); - - float ymin; - float ymax; - solveQuadratic(a2, b2, c2, ymin, ymax); - - gl_Position = vec4(worldPos.xyz, 1.0); - gl_TexCoord[0] = vec4(xmin, xmax, ymin, ymax); - - // construct inverse quadric matrix (used for ray-casting in parameter space) - mat4 invq; - invq[0] = vec4(q1.xyz / q1.w, 0.0); - invq[1] = vec4(q2.xyz / q2.w, 0.0); - invq[2] = vec4(q3.xyz / q3.w, 0.0); - invq[3] = vec4(0.0, 0.0, 0.0, 1.0); - - invq = transpose(invq); - invq[3] = -(invq*gl_Position); - - // transform a point from view space to parameter space - invq = invq*gl_ModelViewMatrixInverse; - - // pass down - gl_TexCoord[1] = invq[0]; - gl_TexCoord[2] = invq[1]; - gl_TexCoord[3] = invq[2]; - gl_TexCoord[4] = invq[3]; - - // compute ndc pos for frustrum culling in GS - vec4 ndcPos = gl_ModelViewProjectionMatrix * vec4(worldPos.xyz, 1.0); - gl_TexCoord[5] = ndcPos / ndcPos.w; - } - */ -} diff --git a/demo/d3d11/shaders/meshVS.hlsl b/demo/d3d11/shaders/meshVS.hlsl deleted file mode 100644 index 09f78ec..0000000 --- a/demo/d3d11/shaders/meshVS.hlsl +++ /dev/null @@ -1,91 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - MeshShaderConst gParams; -}; - -MeshVertexOut meshVS(MeshVertexIn input) -{ - float4 gl_Position; - float4 gl_TexCoord[8]; - - { - [unroll] - for (int i = 0; i < 8; i++) - gl_TexCoord[i] = float4(0.0f, 0.0f, 0.0f, 0.0f); - } - - const float4x4 gl_ModelViewProjectionMatrix = gParams.modelviewprojection; - const float4x4 gl_ModelViewMatrix = gParams.modelview; - const float4x4 objectTransform = gParams.objectTransform; - const float4x4 lightTransform = gParams.lightTransform; - const float3 lightDir = gParams.lightDir; - const float bias = gParams.bias; - const float4 clipPlane = gParams.clipPlane; - const float expand = gParams.expand; - const float4 gl_Color = gParams.color; - const float4 gl_SecondaryColor = gParams.secondaryColor; - - const float3 gl_Vertex = input.position; - const float3 gl_Normal = input.normal; - const float2 gl_MultiTexCoord0 = input.texCoord; - - float3 n = normalize(mul(objectTransform, float4(gl_Normal, 0.0)).xyz); - float3 p = mul(objectTransform, float4(gl_Vertex.xyz, 1.0)).xyz; - - // calculate window-space point size - gl_Position = mul(gl_ModelViewProjectionMatrix, float4(p + expand * n, 1.0)); - - gl_TexCoord[0].xyz = n; - gl_TexCoord[1] = mul(lightTransform, float4(p + n * bias, 1.0)); - gl_TexCoord[2] = mul(gl_ModelViewMatrix, float4(lightDir, 0.0)); - gl_TexCoord[3].xyz = p; - if (gParams.colorArray) - gl_TexCoord[4] = input.color; - else - gl_TexCoord[4] = gl_Color; - gl_TexCoord[5].xy = gl_MultiTexCoord0; - gl_TexCoord[5].y = 1.0f - gl_TexCoord[5].y; // flip the y component of uv (glsl to hlsl conversion) - gl_TexCoord[6] = gl_SecondaryColor; - gl_TexCoord[7] = mul(gl_ModelViewMatrix, float4(gl_Vertex.xyz, 1.0)); - - MeshVertexOut output; - output.position = gl_Position; - { - [unroll] - for (int i = 0; i < 8; i++) - output.texCoord[i] = gl_TexCoord[i]; - } - - return output; - - /* - uniform mat4 lightTransform; - uniform vec3 lightDir; - uniform float bias; - uniform vec4 clipPlane; - uniform float expand; - - uniform mat4 objectTransform; - - void main() - { - vec3 n = normalize((objectTransform*vec4(gl_Normal, 0.0)).xyz); - vec3 p = (objectTransform*vec4(gl_Vertex.xyz, 1.0)).xyz; - - // calculate window-space point size - gl_Position = gl_ModelViewProjectionMatrix * vec4(p + expand*n, 1.0); - - gl_TexCoord[0].xyz = n; - gl_TexCoord[1] = lightTransform*vec4(p + n*bias, 1.0); - gl_TexCoord[2] = gl_ModelViewMatrix*vec4(lightDir, 0.0); - gl_TexCoord[3].xyz = p; - gl_TexCoord[4] = gl_Color; - gl_TexCoord[5] = gl_MultiTexCoord0; - gl_TexCoord[6] = gl_SecondaryColor; - gl_TexCoord[7] = gl_ModelViewMatrix*vec4(gl_Vertex.xyz, 1.0); - - gl_ClipDistance[0] = dot(clipPlane, vec4(gl_Vertex.xyz, 1.0)); - */ -} diff --git a/demo/d3d11/shaders/passThroughVS.hlsl b/demo/d3d11/shaders/passThroughVS.hlsl deleted file mode 100644 index 9b16afa..0000000 --- a/demo/d3d11/shaders/passThroughVS.hlsl +++ /dev/null @@ -1,26 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - FluidShaderConst gParams; -}; - -PassthroughVertexOut passThroughVS(PassthroughVertexIn input) -{ - float4 gl_Vertex = float4(input.position, 0.0f, 1.0f); - float2 gl_MultiTexCoord0 = input.texCoord; - - PassthroughVertexOut output; - output.position = gl_Vertex; - output.texCoord[0] = gl_MultiTexCoord0; - - return output; - - /* - void main() - { - gl_Position = vec4(gl_Vertex.xyz, 1.0); - gl_TexCoord[0] = gl_MultiTexCoord0; - } - */ -} diff --git a/demo/d3d11/shaders/pointGS.hlsl b/demo/d3d11/shaders/pointGS.hlsl deleted file mode 100644 index 2d8126e..0000000 --- a/demo/d3d11/shaders/pointGS.hlsl +++ /dev/null @@ -1,84 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - PointShaderConst gParams; -}; - -static const float2 corners[4] = -{ - float2(0.0, 1.0), float2(0.0, 0.0), float2(1.0, 1.0), float2(1.0, 0.0) -}; - -[maxvertexcount(4)] -void pointGS(point PointVertexOut input[1], inout TriangleStream<PointGeoOut> triStream) -{ - float4 gl_Position; - float4 gl_TexCoord[6]; - - { - [unroll] - for (int i = 0; i < 6; i++) - gl_TexCoord[i] = float4(0.0f, 0.0f, 0.0f, 0.0f); - } - - const float4x4 gl_ModelViewMatrix = gParams.modelview; - const float pointRadius = gParams.pointRadius; - const float pointScale = gParams.pointScale; - const float4x4 lightTransform = gParams.lightTransform; - const float3 lightDir = gParams.lightDir.xyz; - const int mode = gParams.mode; - - float4 viewPos = input[0].position; - float density = input[0].density; - unsigned int phase = input[0].phase; - float4 gl_Vertex = input[0].vertex; - - //float gl_PointSize = -pointScale * (pointRadius / viewPos.z); - //float spriteSize = (pointRadius / viewPos.z); - float spriteSize = pointRadius * 2; - - PointGeoOut output; - - for (int i = 0; i < 4; ++i) - { - - float4 eyePos = viewPos; // start with point position - eyePos.xy += spriteSize * (corners[i] - float2(0.5, 0.5)); // add corner position - gl_Position = mul(gParams.projection, eyePos); // complete transformation - - gl_TexCoord[0].xy = corners[i].xy; // use corner as texCoord - gl_TexCoord[0].y = 1.0f - gl_TexCoord[0].y; // flip the y component of uv (glsl to hlsl conversion) - gl_TexCoord[1] = mul(lightTransform, float4(gl_Vertex.xyz - lightDir * pointRadius * 2.0, 1.0)); - gl_TexCoord[2] = mul(gl_ModelViewMatrix, float4(lightDir, 0.0)); - - if (mode == 1) - { - // density visualization - if (density < 0.0f) - gl_TexCoord[3].xyz = lerp(float3(0.1, 0.1, 1.0), float3(0.1, 1.0, 1.0), -density); - else - gl_TexCoord[3].xyz = lerp(float3(1.0, 1.0, 1.0), float3(0.1, 0.2, 1.0), density); - } - else if (mode == 2) - { - //gl_PointSize *= clamp(gl_Vertex.w * 0.25, 0.0f, 1.0); - float tmp = clamp(gl_Vertex.w * 0.05, 0.0f, 1.0); - gl_TexCoord[3].xyzw = float4(tmp, tmp, tmp, tmp); - } - else - { - gl_TexCoord[3].xyz = lerp(gParams.colors[phase % 8].xyz * 2.0, float3(1.0, 1.0, 1.0), 0.1); - } - - gl_TexCoord[4].xyz = gl_Vertex.xyz; - gl_TexCoord[5].xyz = viewPos.xyz; - - output.position = gl_Position; - [unroll] - for (int j = 0; j < 6; j++) - output.texCoord[j] = gl_TexCoord[j]; - - triStream.Append(output); - } -} diff --git a/demo/d3d11/shaders/pointPS.hlsl b/demo/d3d11/shaders/pointPS.hlsl deleted file mode 100644 index e8bcaf4..0000000 --- a/demo/d3d11/shaders/pointPS.hlsl +++ /dev/null @@ -1,103 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - PointShaderConst gParams; -}; - -Texture2D<float> shadowTexture : register(t0); // shadow map - -SamplerComparisonState shadowSampler : register(s0); // texture sample used to sample depth from shadow texture in this sample - -float sqr(float x) { return x * x; } - -float shadowSample(float4 gl_TexCoord[6]) -{ - float3 pos = float3(gl_TexCoord[1].xyz / gl_TexCoord[1].w); - //float3 uvw = (pos.xyz * 0.5) + vec3(0.5); - float3 uvw = (pos.xyz * float3(0.5, 0.5, 1.0)) + float3(0.5, 0.5, 0.0); - - // user clip - if (uvw.x < 0.0 || uvw.x > 1.0) - return 1.0; - if (uvw.y < 0.0 || uvw.y > 1.0) - return 1.0; - - float s = 0.0; - float radius = 0.002; - - // flip uv y-coordinate - uvw.y = 1.0f - uvw.y; - - [unroll] - for (int i = 0; i < 8; i++) - { - float2 shadowTaps = gParams.shadowTaps[i].xy; - shadowTaps.y = 1.0f - shadowTaps.y; - - //s += shadow2D(shadowTex, vec3(uvw.xy + shadowTaps[i] * radius, uvw.z)).r; - s += shadowTexture.SampleCmpLevelZero(shadowSampler, uvw.xy + shadowTaps * radius, uvw.z); - } - s /= 8.0; - - return s; -} - -float4 pointPS(PointGeoOut input - //, out float gl_FragDepth : SV_DEPTH -) : SV_TARGET -{ - //gl_FragDepth = 0.0f; - - const float spotMin = gParams.spotMin; - const float spotMax = gParams.spotMax; - - float4 gl_FragColor; - float4 gl_TexCoord[6]; - - [unroll] - for (int i = 0; i < 6; i++) - gl_TexCoord[i] = input.texCoord[i]; - - // calculate normal from texture coordinates - float3 normal; - normal.xy = gl_TexCoord[0].xy * float2(2.0, -2.0) + float2(-1.0, 1.0); - float mag = dot(normal.xy, normal.xy); - if (mag > 1.0) discard; // kill pixels outside circle - normal.z = sqrt(1.0 - mag); - - if (gParams.mode == 2) - { - float alpha = normal.z * gl_TexCoord[3].w; - gl_FragColor.xyz = gl_TexCoord[3].xyz * alpha; - gl_FragColor.w = alpha; - - return gl_FragColor; - } - - // calculate lighting - float shadow = shadowSample(gl_TexCoord); - - float3 lPos = float3(gl_TexCoord[1].xyz / gl_TexCoord[1].w); - float attenuation = max(smoothstep(spotMax, spotMin, dot(lPos.xy, lPos.xy)), 0.05); - - float3 diffuse = float3(0.9, 0.9, 0.9); - float3 reflectance = gl_TexCoord[3].xyz; - - float3 Lo = diffuse * reflectance * max(0.0, sqr(-dot(gl_TexCoord[2].xyz, normal) * 0.5 + 0.5)) * max(0.2, shadow) * attenuation; - - const float tmp = 1.0 / 2.2; - gl_FragColor = float4(pow(abs(Lo), float3(tmp, tmp, tmp)), 1.0); - - /* - const float pointRadius = gParams.pointRadius; - const float4x4 gl_ProjectionMatrix = gParams.projection; - - float3 eyePos = gl_TexCoord[5].xyz + normal * pointRadius; - float4 ndcPos = mul(gl_ProjectionMatrix, float4(eyePos, 1.0)); - ndcPos.z /= ndcPos.w; - gl_FragDepth = ndcPos.z; - */ - - return gl_FragColor; -} diff --git a/demo/d3d11/shadersD3D11.cpp b/demo/d3d11/shadersD3D11.cpp deleted file mode 100644 index 9e1d278..0000000 --- a/demo/d3d11/shadersD3D11.cpp +++ /dev/null @@ -1,1041 +0,0 @@ -#include "core/maths.h" -#include "core/extrude.h" - -#include "shaders.h" - -#include "meshRender.h" -#include "pointRender.h" -#include "fluidRender.h" -#include "diffuseRender.h" -#include "debugLineRender.h" - -#include "shadowMap.h" -#include "renderTarget.h" - -#include "imguiGraph.h" -#include "imguiGraphD3D11.h" - -#include "appD3D11Ctx.h" - -#include <d3d11.h> -#include <d3dcompiler.h> - -#include <cstdlib> - -DebugLineRender gDebugLineRender; -MeshRenderer gMeshRenderer; -PointRenderer gPointRenderer; -DiffuseRenderer gDiffuseRenderer; - -AppGraphCtx* gAppGraphCtx; - -static float gSpotMin = 0.5f; -static float gSpotMax = 1.0f; -float gShadowBias = 0.075f; - -struct RenderContext -{ - RenderContext() - { - memset(&mMeshDrawParams, 0, sizeof(MeshDrawParams)); - } - - MeshDrawParams mMeshDrawParams; - - Matrix44 view; - Matrix44 proj; - - ShadowMap* shadowMap; - GpuMesh* immediateMesh; - - SDL_Window* window; - - int msaaSamples; -}; - -RenderContext gContext; - - -// convert an OpenGL style projection matrix to D3D (clip z range [0, 1]) -Matrix44 ConvertToD3DProjection(const Matrix44& proj) -{ - Matrix44 scale = Matrix44::kIdentity; - scale.columns[2][2] = 0.5f; - - Matrix44 bias = Matrix44::kIdentity; - bias.columns[3][2] = 1.0f; - - return scale*bias*proj; -} - -#define checkDxErrors(err) __checkDxErrors (err, __FILE__, __LINE__) - -inline void __checkDxErrors(HRESULT err, const char *file, const int line) -{ - if (FAILED(err)) - { - char* lpMsgBuf; - - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - err, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)&lpMsgBuf, - 0, NULL); - - fprintf(stdout, "DX Error = %04d \"%s\" from file <%s>, line %i.\n", - err, lpMsgBuf, file, line); - - exit(EXIT_FAILURE); - } -} - -void InitRender(SDL_Window* window, bool fullscreen, int msaaSamples) -{ - // must always have at least one sample - msaaSamples = Max(1, msaaSamples); - - // create app graph context - gAppGraphCtx = AppGraphCtxCreate(0); - - AppGraphCtxInitRenderTarget(gAppGraphCtx, window, fullscreen, msaaSamples); - //gScene = getScene(0); - - float clearVal[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; - AppGraphCtxFrameStart(gAppGraphCtx, clearVal); - - // create imgui, connect to app graph context - - ImguiGraphDesc desc; - desc.device = gAppGraphCtx->m_device; - desc.deviceContext = gAppGraphCtx->m_deviceContext; - desc.winW = gAppGraphCtx->m_winW; - desc.winH = gAppGraphCtx->m_winH; - - imguiGraphInit("../../data/DroidSans.ttf", &desc); - - AppGraphCtxFramePresent(gAppGraphCtx, true); - - gPointRenderer.Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext); - gMeshRenderer.Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext); - gDebugLineRender.Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext); - gDiffuseRenderer.Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext); - - // create a mesh for immediate mode rendering - gContext.immediateMesh = new GpuMesh(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext); - - gContext.window = window; - gContext.msaaSamples = msaaSamples; -} - -void GetRenderDevice(ID3D11Device** device, ID3D11DeviceContext** context) -{ - *device = gAppGraphCtx->m_device; - *context = gAppGraphCtx->m_deviceContext; -} - -void ReshapeRender(SDL_Window* window) -{ - AppGraphCtxReleaseRenderTarget(gAppGraphCtx); - AppGraphCtxInitRenderTarget(gAppGraphCtx, window, false, gContext.msaaSamples); -} - -void DestroyRender() -{ - gDebugLineRender.Destroy(); - gMeshRenderer.Destroy(); - gPointRenderer.Destroy(); - gDiffuseRenderer.Destroy(); - - imguiGraphDestroy(); - - delete gContext.immediateMesh; - - // do this first, since it flushes all GPU work - AppGraphCtxReleaseRenderTarget(gAppGraphCtx); - AppGraphCtxRelease(gAppGraphCtx); - - gAppGraphCtx = nullptr; -} - -void StartFrame(Vec4 clear) -{ - AppGraphCtxFrameStart(gAppGraphCtx, clear); - - MeshDrawParams meshDrawParams; - memset(&meshDrawParams, 0, sizeof(MeshDrawParams)); - meshDrawParams.renderStage = MESH_DRAW_LIGHT; - meshDrawParams.renderMode = MESH_RENDER_SOLID; - meshDrawParams.cullMode = MESH_CULL_BACK; - meshDrawParams.projection = (XMMATRIX)Matrix44::kIdentity; - meshDrawParams.view = (XMMATRIX)Matrix44::kIdentity; - meshDrawParams.model = DirectX::XMMatrixMultiply( - DirectX::XMMatrixScaling(1.0f, 1.0f, 1.0f), - DirectX::XMMatrixTranslation(0.0f, 0.0f, 0.0f) - ); - - gContext.mMeshDrawParams = meshDrawParams; -} - -void FlushFrame() -{ - gAppGraphCtx->m_deviceContext->Flush(); - -} - -void EndFrame() -{ - FlushFrame(); - - ImguiGraphDesc desc; - desc.device = gAppGraphCtx->m_device; - desc.deviceContext = gAppGraphCtx->m_deviceContext; - desc.winW = gAppGraphCtx->m_winW; - desc.winH = gAppGraphCtx->m_winH; - - imguiGraphUpdate(&desc); -} - -void PresentFrame(bool fullsync) -{ - AppGraphCtxFramePresent(gAppGraphCtx, fullsync); - -} - -void ReadFrame(int* backbuffer, int width, int height) -{ - assert(0); -} - -void GetViewRay(int x, int y, Vec3& origin, Vec3& dir) -{ - using namespace DirectX; - - XMVECTOR nearVector = XMVector3Unproject(XMVectorSet(float(x), float(gAppGraphCtx->m_winH-y), 0.0f, 0.0f), 0.0f, 0.0f, (float)gAppGraphCtx->m_winW, (float)gAppGraphCtx->m_winH, 0.0f, 1.0f, (XMMATRIX)gContext.proj, XMMatrixIdentity(), (XMMATRIX)gContext.view); - XMVECTOR farVector = XMVector3Unproject(XMVectorSet(float(x), float(gAppGraphCtx->m_winH-y), 1.0f, 0.0f), 0.0f, 0.0f, (float)gAppGraphCtx->m_winW, (float)gAppGraphCtx->m_winH, 0.0f, 1.0f, (XMMATRIX)gContext.proj, XMMatrixIdentity(), (XMMATRIX)gContext.view); - - origin = Vec3(XMVectorGetX(nearVector), XMVectorGetY(nearVector), XMVectorGetZ(nearVector)); - XMVECTOR tmp = farVector - nearVector; - dir = Normalize(Vec3(XMVectorGetX(tmp), XMVectorGetY(tmp), XMVectorGetZ(tmp))); - -} - -Colour gColors[] = -{ - Colour(0.0f, 0.5f, 1.0f), - Colour(0.797f, 0.354f, 0.000f), - Colour(0.092f, 0.465f, 0.820f), - Colour(0.000f, 0.349f, 0.173f), - Colour(0.875f, 0.782f, 0.051f), - Colour(0.000f, 0.170f, 0.453f), - Colour(0.673f, 0.111f, 0.000f), - Colour(0.612f, 0.194f, 0.394f) -}; - - -void SetFillMode(bool wire) -{ - gContext.mMeshDrawParams.renderMode = wire?MESH_RENDER_WIREFRAME:MESH_RENDER_SOLID; -} - -void SetCullMode(bool enabled) -{ - gContext.mMeshDrawParams.cullMode = enabled?MESH_CULL_BACK:MESH_CULL_NONE; -} - -void SetView(Matrix44 view, Matrix44 projection) -{ - Matrix44 vp = projection*view; - - gContext.mMeshDrawParams.model = (XMMATRIX)Matrix44::kIdentity; - gContext.mMeshDrawParams.view = (XMMATRIX)view; - gContext.mMeshDrawParams.projection = (XMMATRIX)(ConvertToD3DProjection(projection)); - - gContext.view = view; - gContext.proj = ConvertToD3DProjection(projection); -} - - - -FluidRenderer* CreateFluidRenderer(uint32_t width, uint32_t height) -{ - FluidRenderer* renderer = new(_aligned_malloc(sizeof(FluidRenderer), 16)) FluidRenderer(); - renderer->Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext, width, height); - - return renderer; -} - -void DestroyFluidRenderer(FluidRenderer* renderer) -{ - renderer->Destroy(); - renderer->~FluidRenderer(); - - _aligned_free(renderer); -} - -FluidRenderBuffers CreateFluidRenderBuffers(int numParticles, bool enableInterop) -{ - FluidRenderBuffers buffers = {}; - buffers.mNumFluidParticles = numParticles; - - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = numParticles*sizeof(Vec4); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - bufDesc.StructureByteStride = 0; - - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mPositionVBO); - - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mAnisotropyVBO[0]); - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mAnisotropyVBO[1]); - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mAnisotropyVBO[2]); - - bufDesc.ByteWidth = numParticles*sizeof(float); - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mDensityVBO); - } - - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = numParticles * sizeof(int); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - bufDesc.StructureByteStride = 0; - - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mIndices); - } - - if (enableInterop) - { - extern NvFlexLibrary* g_flexLib; - - buffers.mPositionBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mPositionVBO, numParticles, sizeof(Vec4)); - buffers.mDensitiesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mDensityVBO, numParticles, sizeof(float)); - buffers.mIndicesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mIndices, numParticles, sizeof(int)); - - buffers.mAnisotropyBuf[0] = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mAnisotropyVBO[0], numParticles, sizeof(Vec4)); - buffers.mAnisotropyBuf[1] = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mAnisotropyVBO[1], numParticles, sizeof(Vec4)); - buffers.mAnisotropyBuf[2] = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mAnisotropyVBO[2], numParticles, sizeof(Vec4)); - } - - return buffers; -} - -void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, NvFlexSolver* solver, bool anisotropy, bool density) -{ - if (!anisotropy) - { - // regular particles - NvFlexGetParticles(solver, buffers.mPositionBuf, buffers.mNumFluidParticles); - } - else - { - // fluid buffers - NvFlexGetSmoothParticles(solver, buffers.mPositionBuf, buffers.mNumFluidParticles); - NvFlexGetAnisotropy(solver, buffers.mAnisotropyBuf[0], buffers.mAnisotropyBuf[1], buffers.mAnisotropyBuf[2]); - } - - if (density) - { - NvFlexGetDensities(solver, buffers.mDensitiesBuf, buffers.mNumFluidParticles); - } - else - { - NvFlexGetPhases(solver, buffers.mDensitiesBuf, buffers.mNumFluidParticles); - } - - NvFlexGetActive(solver, buffers.mIndicesBuf); -} - -void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices) -{ - D3D11_MAPPED_SUBRESOURCE res; - - // vertices - if (particles) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mPositionVBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, particles, sizeof(Vec4)*numParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mPositionVBO, 0); - } - - if (anisotropy1) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mAnisotropyVBO[0], 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, anisotropy1, sizeof(Vec4)*numParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mAnisotropyVBO[0], 0); - } - - if (anisotropy2) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mAnisotropyVBO[1], 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, anisotropy2, sizeof(Vec4)*numParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mAnisotropyVBO[1], 0); - } - - if (anisotropy3) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mAnisotropyVBO[2], 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, anisotropy3, sizeof(Vec4)*numParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mAnisotropyVBO[2], 0); - } - - if (densities) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mDensityVBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, densities, sizeof(float)*numParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mDensityVBO, 0); - } - - // indices - if (indices) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mIndices, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, indices, sizeof(int)*numIndices); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mIndices, 0); - } - -} - -void DestroyFluidRenderBuffers(FluidRenderBuffers buffers) -{ - COMRelease(buffers.mPositionVBO); - COMRelease(buffers.mAnisotropyVBO[0]); - COMRelease(buffers.mAnisotropyVBO[1]); - COMRelease(buffers.mAnisotropyVBO[2]); - COMRelease(buffers.mDensityVBO); - COMRelease(buffers.mIndices); - - NvFlexUnregisterD3DBuffer(buffers.mPositionBuf); - NvFlexUnregisterD3DBuffer(buffers.mDensitiesBuf); - NvFlexUnregisterD3DBuffer(buffers.mIndicesBuf); - - NvFlexUnregisterD3DBuffer(buffers.mAnisotropyBuf[0]); - NvFlexUnregisterD3DBuffer(buffers.mAnisotropyBuf[1]); - NvFlexUnregisterD3DBuffer(buffers.mAnisotropyBuf[2]); -} - - -static const int kShadowResolution = 2048; - - -ShadowMap* ShadowCreate() -{ - ShadowMap* shadowMap = new(_aligned_malloc(sizeof(ShadowMap), 16)) ShadowMap(); - shadowMap->init(gAppGraphCtx->m_device, kShadowResolution); - - return shadowMap; -} - -void ShadowDestroy(ShadowMap* map) -{ - map->~ShadowMap(); - _aligned_free(map); -} - -void ShadowBegin(ShadowMap* map) -{ - ShadowMap* shadowMap = map; - shadowMap->bindAndClear(gAppGraphCtx->m_deviceContext); - - gContext.mMeshDrawParams.renderStage = MESH_DRAW_SHADOW; -} - -void ShadowEnd() -{ - AppGraphCtx* context = gAppGraphCtx; - - // reset to main frame buffer - context->m_deviceContext->RSSetViewports(1, &context->m_viewport); - context->m_deviceContext->OMSetRenderTargets(1, &context->m_rtv, context->m_dsv); - context->m_deviceContext->OMSetDepthStencilState(context->m_depthState, 0u); - context->m_deviceContext->ClearDepthStencilView(context->m_dsv, D3D11_CLEAR_DEPTH, 1.0, 0); - - gContext.mMeshDrawParams.renderStage = MESH_DRAW_NULL; - -} - - -struct ShadowParams -{ - DirectX::XMMATRIX lightTransform; - float3 lightPos; - float3 lightDir; - float bias; - float4 shadowTaps[12]; -}; - -void ShadowApply(ShadowParams* params, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, void* shadowTex) -{ - params->lightTransform = (DirectX::XMMATRIX&)(ConvertToD3DProjection(lightTransform)); - params->lightPos = (float3&)lightPos; - params->lightDir = (float3&)Normalize(lightTarget - lightPos); - params->bias = gShadowBias; - - const Vec4 taps[] = - { - Vec2(-0.326212f,-0.40581f), Vec2(-0.840144f,-0.07358f), - Vec2(-0.695914f,0.457137f), Vec2(-0.203345f,0.620716f), - Vec2(0.96234f,-0.194983f), Vec2(0.473434f,-0.480026f), - Vec2(0.519456f,0.767022f), Vec2(0.185461f,-0.893124f), - Vec2(0.507431f,0.064425f), Vec2(0.89642f,0.412458f), - Vec2(-0.32194f,-0.932615f), Vec2(-0.791559f,-0.59771f) - }; - memcpy(params->shadowTaps, taps, sizeof(taps)); - -} - -void BindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float bias, Vec4 fogColor) -{ - gContext.mMeshDrawParams.renderStage = MESH_DRAW_LIGHT; - - gContext.mMeshDrawParams.grid = 0; - gContext.mMeshDrawParams.spotMin = gSpotMin; - gContext.mMeshDrawParams.spotMax = gSpotMax; - gContext.mMeshDrawParams.fogColor = (float4&)fogColor; - - gContext.mMeshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; - - ShadowParams shadow; - ShadowApply(&shadow, lightPos, lightTarget, lightTransform, shadowMap); - gContext.mMeshDrawParams.lightTransform = shadow.lightTransform; - gContext.mMeshDrawParams.lightDir = shadow.lightDir; - gContext.mMeshDrawParams.lightPos = shadow.lightPos; - gContext.mMeshDrawParams.bias = shadow.bias; - memcpy(gContext.mMeshDrawParams.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); - - gContext.shadowMap = shadowMap; - -} - -void UnbindSolidShader() -{ - gContext.mMeshDrawParams.renderStage = MESH_DRAW_NULL; -} - -void DrawMesh(const Mesh* m, Vec3 color) -{ - if (m) - { - if (m->m_colours.size()) - { - gContext.mMeshDrawParams.colorArray = 1; - gContext.immediateMesh->UpdateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, (Vec4*)&m->m_colours[0], (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces())); - } - else - { - gContext.mMeshDrawParams.colorArray = 0; - gContext.immediateMesh->UpdateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, NULL, (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces())); - } - - gContext.mMeshDrawParams.color = (float4&)color; - gContext.mMeshDrawParams.secondaryColor = (float4&)color; - gContext.mMeshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; - gContext.mMeshDrawParams.shadowMap = gContext.shadowMap; - - gMeshRenderer.Draw(gContext.immediateMesh, &gContext.mMeshDrawParams); - - if (m->m_colours.size()) - gContext.mMeshDrawParams.colorArray = 0; - - } -} - -void DrawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex, float expand, bool twosided, bool smooth) -{ - if (!numTris) - return; - - gContext.immediateMesh->UpdateData(positions, normals, NULL, NULL, indices, numPositions, numTris); - - if (twosided) - SetCullMode(false); - - gContext.mMeshDrawParams.bias = 0.0f; - gContext.mMeshDrawParams.expand = expand; - - gContext.mMeshDrawParams.color = (float4&)(gColors[colorIndex + 1] * 1.5f); - gContext.mMeshDrawParams.secondaryColor = (float4&)(gColors[colorIndex] * 1.5f); - gContext.mMeshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; - gContext.mMeshDrawParams.shadowMap = gContext.shadowMap; - - gMeshRenderer.Draw(gContext.immediateMesh, &gContext.mMeshDrawParams); - - if (twosided) - SetCullMode(true); - - gContext.mMeshDrawParams.bias = gShadowBias; - gContext.mMeshDrawParams.expand = 0.0f; - -} - -void DrawRope(Vec4* positions, int* indices, int numIndices, float radius, int color) -{ - if (numIndices < 2) - return; - - std::vector<Vec3> vertices; - std::vector<Vec3> normals; - std::vector<int> triangles; - - // flatten curve - std::vector<Vec3> curve(numIndices); - for (int i = 0; i < numIndices; ++i) - curve[i] = Vec3(positions[indices[i]]); - - const int resolution = 8; - const int smoothing = 3; - - vertices.reserve(resolution*numIndices*smoothing); - normals.reserve(resolution*numIndices*smoothing); - triangles.reserve(numIndices*resolution * 6 * smoothing); - - Extrude(&curve[0], int(curve.size()), vertices, normals, triangles, radius, resolution, smoothing); - - gContext.immediateMesh->UpdateData(&vertices[0], &normals[0], NULL, NULL, &triangles[0], int(vertices.size()), int(triangles.size())/3); - - SetCullMode(false); - - gContext.mMeshDrawParams.color = (float4&)(gColors[color % 8] * 1.5f); - gContext.mMeshDrawParams.secondaryColor = (float4&)(gColors[color % 8] * 1.5f); - gContext.mMeshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; - gContext.mMeshDrawParams.shadowMap = gContext.shadowMap; - - gMeshRenderer.Draw(gContext.immediateMesh, &gContext.mMeshDrawParams); - - SetCullMode(true); -} - -void DrawPlane(const Vec4& p, bool color) -{ - std::vector<Vec3> vertices; - std::vector<Vec3> normals; - std::vector<int> indices; - - Vec3 u, v; - BasisFromVector(Vec3(p.x, p.y, p.z), &u, &v); - - Vec3 c = Vec3(p.x, p.y, p.z)*-p.w; - - gContext.mMeshDrawParams.shadowMap = gContext.shadowMap; - - if (color) - gContext.mMeshDrawParams.color = (float4&)(p * 0.5f + Vec4(0.5f, 0.5f, 0.5f, 0.5f)); - - const float kSize = 200.0f; - const int kGrid = 3; - - // draw a grid of quads, otherwise z precision suffers - for (int x = -kGrid; x <= kGrid; ++x) - { - for (int y = -kGrid; y <= kGrid; ++y) - { - Vec3 coff = c + u*float(x)*kSize*2.0f + v*float(y)*kSize*2.0f; - - int indexStart = int(vertices.size()); - - vertices.push_back(Vec3(coff + u*kSize + v*kSize)); - vertices.push_back(Vec3(coff - u*kSize + v*kSize)); - vertices.push_back(Vec3(coff - u*kSize - v*kSize)); - vertices.push_back(Vec3(coff + u*kSize - v*kSize)); - - normals.push_back(Vec3(p.x, p.y, p.z)); - normals.push_back(Vec3(p.x, p.y, p.z)); - normals.push_back(Vec3(p.x, p.y, p.z)); - normals.push_back(Vec3(p.x, p.y, p.z)); - - - indices.push_back(indexStart+0); - indices.push_back(indexStart+1); - indices.push_back(indexStart+2); - - indices.push_back(indexStart+2); - indices.push_back(indexStart+3); - indices.push_back(indexStart+0); - } - } - - gContext.immediateMesh->UpdateData(&vertices[0], &normals[0], NULL, NULL, &indices[0], int(vertices.size()), int(indices.size())/3); - gMeshRenderer.Draw(gContext.immediateMesh, &gContext.mMeshDrawParams); -} - -void DrawPlanes(Vec4* planes, int n, float bias) -{ - gContext.mMeshDrawParams.color = (float4&)Vec4(0.9f, 0.9f, 0.9f, 1.0f); - - gContext.mMeshDrawParams.bias = 0.0f; - gContext.mMeshDrawParams.grid = 1; - gContext.mMeshDrawParams.expand = 0; - - for (int i = 0; i < n; ++i) - { - Vec4 p = planes[i]; - p.w -= bias; - - DrawPlane(p, false); - } - - gContext.mMeshDrawParams.grid = 0; - gContext.mMeshDrawParams.bias = gShadowBias; - -} - -GpuMesh* CreateGpuMesh(const Mesh* m) -{ - GpuMesh* mesh = new GpuMesh(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext); - - mesh->UpdateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, NULL, (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces())); - - return mesh; -} - -void DestroyGpuMesh(GpuMesh* m) -{ - delete m; -} - -void DrawGpuMesh(GpuMesh* m, const Matrix44& xform, const Vec3& color) -{ - if (m) - { - MeshDrawParams params = gContext.mMeshDrawParams; - - params.color = (float4&)color; - params.secondaryColor = (float4&)color; - params.objectTransform = (float4x4&)xform; - params.shadowMap = gContext.shadowMap; - - gMeshRenderer.Draw(m, ¶ms); - } -} - -void DrawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const Vec3& color) -{ - if (m) - { - gContext.mMeshDrawParams.color = (float4&)color; - gContext.mMeshDrawParams.secondaryColor = (float4&)color; - gContext.mMeshDrawParams.shadowMap = gContext.shadowMap; - - // copy params - MeshDrawParams params = gContext.mMeshDrawParams; - - for (int i = 0; i < n; ++i) - { - params.objectTransform = (float4x4&)xforms[i]; - - gMeshRenderer.Draw(m, ¶ms); - } - } -} - -void DrawPoints(VertexBuffer positions, VertexBuffer colors, IndexBuffer indices, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, bool showDensity) -{ - if (n == 0) - return; - - PointDrawParams params; - - params.renderMode = POINT_RENDER_SOLID; - params.cullMode = POINT_CULL_BACK; - params.model = (XMMATRIX&)Matrix44::kIdentity; - params.view = (XMMATRIX&)gContext.view; - params.projection = (XMMATRIX&)gContext.proj; - - params.pointRadius = radius; - params.pointScale = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); - params.spotMin = gSpotMin; - params.spotMax = gSpotMax; - - int mode = 0; - if (showDensity) - mode = 1; - if (shadowTex == 0) - mode = 2; - params.mode = mode; - - for (int i = 0; i < 8; i++) - params.colors[i] = *((float4*)&gColors[i].r); - - // set shadow parameters - ShadowParams shadow; - ShadowApply(&shadow, lightPos, lightTarget, lightTransform, shadowTex); - params.lightTransform = shadow.lightTransform; - params.lightDir = shadow.lightDir; - params.lightPos = shadow.lightPos; - memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); - - if (gContext.mMeshDrawParams.renderStage == MESH_DRAW_SHADOW) - { - params.renderStage = POINT_DRAW_SHADOW; - params.mode = 2; - } - else - params.renderStage = POINT_DRAW_LIGHT; - - params.shadowMap = gContext.shadowMap; - - gPointRenderer.Draw(¶ms, positions, colors, indices, n, offset); - -} - -void RenderEllipsoids(FluidRenderer* renderer, FluidRenderBuffers buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, Vec4 color, float blur, float ior, bool debug) -{ - if (n == 0) - return; - - FluidDrawParams params; - - params.renderMode = FLUID_RENDER_SOLID; - params.cullMode = FLUID_CULL_BACK; - params.model = (XMMATRIX&)Matrix44::kIdentity; - params.view = (XMMATRIX&)gContext.view; - params.projection = (XMMATRIX&)gContext.proj; - - params.offset = offset; - params.n = n; - params.renderStage = FLUID_DRAW_LIGHT; - - const float viewHeight = tanf(fov / 2.0f); - params.invViewport = float3(1.0f / screenWidth, screenAspect / screenWidth, 1.0f); - params.invProjection = float3(screenAspect * viewHeight, viewHeight, 1.0f); - - params.shadowMap = gContext.shadowMap; - - renderer->mDepthTex.BindAndClear(gAppGraphCtx->m_deviceContext); - - // draw static shapes into depth buffer - //DrawShapes(); - - renderer->DrawEllipsoids(¶ms, &buffers); - - - //--------------------------------------------------------------- - // build smooth depth - - renderer->mDepthSmoothTex.BindAndClear(gAppGraphCtx->m_deviceContext); - - params.blurRadiusWorld = radius * 0.5f; - params.blurScale = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); - params.invTexScale = float4(1.0f / screenAspect, 1.0f, 0.0f, 0.0f); - params.blurFalloff = blur; - params.debug = debug; - - renderer->DrawBlurDepth(¶ms); - - //--------------------------------------------------------------- - // composite - - AppGraphCtx* context = gAppGraphCtx; - - { - context->m_deviceContext->RSSetViewports(1, &context->m_viewport); - context->m_deviceContext->RSSetScissorRects(0, nullptr); - - context->m_deviceContext->OMSetRenderTargets(1, &context->m_rtv, context->m_dsv); - context->m_deviceContext->OMSetDepthStencilState(context->m_depthState, 0u); - - float blendFactor[4] = { 1.0, 1.0, 1.0, 1.0 }; - context->m_deviceContext->OMSetBlendState(context->m_blendState, blendFactor, 0xffff); - } - - params.invTexScale = (float4&)Vec2(1.0f / screenWidth, screenAspect / screenWidth); - params.clipPosToEye = (float4&)Vec2(tanf(fov*0.5f)*screenAspect, tanf(fov*0.5f)); - params.color = (float4&)color; - params.ior = ior; - params.spotMin = gSpotMin; - params.spotMax = gSpotMax; - params.debug = debug; - - params.lightPos = (float3&)lightPos; - params.lightDir = (float3&)-Normalize(lightTarget - lightPos); - params.lightTransform = (XMMATRIX&)(ConvertToD3DProjection(lightTransform)); - - - AppGraphCtxResolveFrame(context); - - - renderer->DrawComposite(¶ms, context->m_resolvedTargetSRV); - - { - AppGraphCtx* context = gAppGraphCtx; - context->m_deviceContext->OMSetBlendState(nullptr, 0, 0xffff); - } -} - -DiffuseRenderBuffers CreateDiffuseRenderBuffers(int numParticles, bool& enableInterop) -{ - DiffuseRenderBuffers buffers = {}; - buffers.mNumDiffuseParticles = numParticles; - if (numParticles > 0) - { - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = numParticles * sizeof(Vec4); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - if (enableInterop) - { - bufDesc.CPUAccessFlags = 0; - bufDesc.Usage = D3D11_USAGE_DEFAULT; - bufDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; - } - - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mDiffusePositionVBO); - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mDiffuseVelocityVBO); - } - - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = numParticles * sizeof(int); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - if (enableInterop) - { - bufDesc.CPUAccessFlags = 0; - bufDesc.Usage = D3D11_USAGE_DEFAULT; - bufDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; - } - - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mDiffuseIndicesIBO); - } - - if (enableInterop) - { - extern NvFlexLibrary* g_flexLib; - - buffers.mDiffuseIndicesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mDiffuseIndicesIBO, numParticles, sizeof(int)); - buffers.mDiffusePositionsBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mDiffusePositionVBO, numParticles, sizeof(Vec4)); - buffers.mDiffuseVelocitiesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mDiffuseVelocityVBO, numParticles, sizeof(Vec4)); - - if (buffers.mDiffuseIndicesBuf == nullptr || - buffers.mDiffusePositionsBuf == nullptr || - buffers.mDiffuseVelocitiesBuf == nullptr) - enableInterop = false; - } - } - - return buffers; -} - -void DestroyDiffuseRenderBuffers(DiffuseRenderBuffers buffers) -{ - if (buffers.mNumDiffuseParticles > 0) - { - COMRelease(buffers.mDiffusePositionVBO); - COMRelease(buffers.mDiffuseVelocityVBO); - COMRelease(buffers.mDiffuseIndicesIBO); - - NvFlexUnregisterD3DBuffer(buffers.mDiffuseIndicesBuf); - NvFlexUnregisterD3DBuffer(buffers.mDiffusePositionsBuf); - NvFlexUnregisterD3DBuffer(buffers.mDiffuseVelocitiesBuf); - } -} - -void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, NvFlexSolver* solver) -{ - // diffuse particles - if (buffers.mNumDiffuseParticles) - { - NvFlexGetDiffuseParticles(solver, buffers.mDiffusePositionsBuf, buffers.mDiffuseVelocitiesBuf, buffers.mDiffuseIndicesBuf); - } -} - -void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, Vec4* diffusePositions, Vec4* diffuseVelocities, int* diffuseIndices, int numDiffuseParticles) -{ - D3D11_MAPPED_SUBRESOURCE res; - - // vertices - if (diffusePositions) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mDiffusePositionVBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, diffusePositions, sizeof(Vec4)*numDiffuseParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mDiffusePositionVBO, 0); - } - - if (diffuseVelocities) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mDiffuseVelocityVBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, diffuseVelocities, sizeof(Vec4)*numDiffuseParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mDiffuseVelocityVBO, 0); - } - - if (diffuseIndices) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mDiffuseIndicesIBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, diffuseIndices, sizeof(int)*numDiffuseParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mDiffuseIndicesIBO, 0); - } - -} - -void RenderDiffuse(FluidRenderer* render, DiffuseRenderBuffers buffers, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadowEnabled, bool front) -{ - if (n == 0) - return; - - DiffuseDrawParams params; - - params.model = (const XMMATRIX&)Matrix44::kIdentity; - params.view = (const XMMATRIX&)gContext.view; - params.projection = (const XMMATRIX&)gContext.proj; - params.diffuseRadius = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); - params.diffuseScale = radius; - params.spotMin = gSpotMin; - params.spotMax = gSpotMax; - params.color = float4(1.0f, 1.0f, 1.0f, 1.0f); - params.motionScale = motionBlur; - - // set shadow parameters - ShadowParams shadow; - ShadowApply(&shadow, lightPos, lightTarget, lightTransform, shadowMap); - params.lightTransform = shadow.lightTransform; - params.lightDir = shadow.lightDir; - params.lightPos = shadow.lightPos; - params.shadowMap = gContext.shadowMap; - - memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); - - - gDiffuseRenderer.Draw(¶ms, buffers.mDiffusePositionVBO, buffers.mDiffuseVelocityVBO, buffers.mDiffuseIndicesIBO, n); - - // reset depth stencil state - gAppGraphCtx->m_deviceContext->OMSetDepthStencilState(gAppGraphCtx->m_depthState, 0u); - - -} - - -void BeginLines() -{ - -} - -void DrawLine(const Vec3& p, const Vec3& q, const Vec4& color) -{ - gDebugLineRender.AddLine(p, q, color); -} - -void EndLines() -{ - // draw - Matrix44 projectionViewWorld = ((Matrix44&)(gContext.mMeshDrawParams.projection))*((Matrix44&)(gContext.mMeshDrawParams.view)); - - gDebugLineRender.FlushLines(projectionViewWorld); -} - -void BeginPoints(float size) {} -void DrawPoint(const Vec3& p, const Vec4& color) {} -void EndPoints() {} - diff --git a/demo/d3d11/shadowMap.cpp b/demo/d3d11/shadowMapD3D11.cpp index 403ec59..a824929 100644 --- a/demo/d3d11/shadowMap.cpp +++ b/demo/d3d11/shadowMapD3D11.cpp @@ -8,9 +8,9 @@ * license agreement from NVIDIA CORPORATION is strictly prohibited. */ -#include "shadowMap.h" +#include "shadowMapD3D11.h" -ShadowMap::ShadowMap() +ShadowMapD3D11::ShadowMapD3D11() { } @@ -56,7 +56,7 @@ static D3D11_SHADER_RESOURCE_VIEW_DESC _getSrvDesc(DXGI_FORMAT format) return desc; } -HRESULT ShadowMap::init(ID3D11Device* device, int resolution) +HRESULT ShadowMapD3D11::init(ID3D11Device* device, int resolution) { // set viewport { @@ -122,7 +122,7 @@ HRESULT ShadowMap::init(ID3D11Device* device, int resolution) return S_OK; } -void ShadowMap::bindAndClear(ID3D11DeviceContext* context) +void ShadowMapD3D11::bindAndClear(ID3D11DeviceContext* context) { ID3D11RenderTargetView* ppRtv[1] = { m_backRtv.Get() }; context->OMSetRenderTargets(1, ppRtv, m_depthDsv.Get()); @@ -136,7 +136,7 @@ void ShadowMap::bindAndClear(ID3D11DeviceContext* context) context->ClearDepthStencilView(m_depthDsv.Get(), D3D11_CLEAR_DEPTH, 1.0, 0); } -void ShadowMap::setDefaultLight(FXMVECTOR eye, FXMVECTOR at, FXMVECTOR up) +void ShadowMapD3D11::setDefaultLight(FXMVECTOR eye, FXMVECTOR at, FXMVECTOR up) { float sizeX = 50.0f; float sizeY = 50.0f; @@ -146,7 +146,7 @@ void ShadowMap::setDefaultLight(FXMVECTOR eye, FXMVECTOR at, FXMVECTOR up) setLightMatrices(eye, at, up, sizeX, sizeY, znear, zfar); } -void ShadowMap::setLightMatrices(FXMVECTOR eye, FXMVECTOR lookAt, FXMVECTOR up, float sizeX, float sizeY, float zNear, float zFar) +void ShadowMapD3D11::setLightMatrices(FXMVECTOR eye, FXMVECTOR lookAt, FXMVECTOR up, float sizeX, float sizeY, float zNear, float zFar) { m_lightView = XMMatrixLookAtLH(eye, lookAt, up); diff --git a/demo/d3d11/shadowMap.h b/demo/d3d11/shadowMapD3D11.h index 2ed15ca..1fa79ec 100644 --- a/demo/d3d11/shadowMap.h +++ b/demo/d3d11/shadowMapD3D11.h @@ -20,10 +20,9 @@ using namespace Microsoft::WRL; #define NV_NULL nullptr #define NV_RETURN_ON_FAIL(x) { HRESULT _res = (x); if (FAILED(_res)) { return _res; } } -struct ShadowMap +struct ShadowMapD3D11 { - - ShadowMap(); + ShadowMapD3D11(); HRESULT init(ID3D11Device* device, int resolution); diff --git a/demo/d3d12/NvCoDx12CircularResourceHeap.cpp b/demo/d3d12/NvCoDx12CircularResourceHeap.cpp new file mode 100644 index 0000000..040b159 --- /dev/null +++ b/demo/d3d12/NvCoDx12CircularResourceHeap.cpp @@ -0,0 +1,204 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#include "NvCoDx12CircularResourceHeap.h" + +namespace nvidia { +namespace Common { + +Dx12CircularResourceHeap::Dx12CircularResourceHeap(): + m_fence(nullptr), + m_device(nullptr), + m_blockFreeList(sizeof(Block), __alignof(Block), 16), + m_blocks(nullptr) +{ + m_back.m_block = nullptr; + m_back.m_position = nullptr; + m_front.m_block = nullptr; + m_front.m_position = nullptr; +} + +Dx12CircularResourceHeap::~Dx12CircularResourceHeap() +{ + _freeBlockListResources(m_blocks); +} + +void Dx12CircularResourceHeap::_freeBlockListResources(const Block* start) +{ + if (start) + { + { + ID3D12Resource* resource = start->m_resource; + resource->Unmap(0, nullptr); + resource->Release(); + } + for (Block* block = start->m_next; block != start; block = block->m_next) + { + ID3D12Resource* resource = block->m_resource; + resource->Unmap(0, nullptr); + resource->Release(); + } + } +} + +int Dx12CircularResourceHeap::init(ID3D12Device* device, const Desc& desc, Dx12CounterFence* fence) +{ + assert(m_blocks == nullptr); + assert(desc.m_blockSize > 0); + + m_fence = fence; + m_desc = desc; + m_device = device; + + return NV_OK; +} + +void Dx12CircularResourceHeap::addSync(uint64_t signalValue) +{ + assert(signalValue == m_fence->getCurrentValue()); + PendingEntry entry; + entry.m_completedValue = signalValue; + entry.m_cursor = m_front; + m_pendingQueue.push_back(entry); +} + +void Dx12CircularResourceHeap::updateCompleted() +{ + const uint64_t completedValue = m_fence->getCompletedValue(); + while (!m_pendingQueue.empty()) + { + const PendingEntry& entry = m_pendingQueue.front(); + if (entry.m_completedValue <= completedValue) + { + m_back = entry.m_cursor; + m_pendingQueue.pop_front(); + } + else + { + break; + } + } +} + +Dx12CircularResourceHeap::Block* Dx12CircularResourceHeap::_newBlock() +{ + D3D12_RESOURCE_DESC desc; + + desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; + desc.Alignment = 0; + desc.Width = m_desc.m_blockSize; + desc.Height = 1; + desc.DepthOrArraySize = 1; + desc.MipLevels = 1; + desc.Format = DXGI_FORMAT_UNKNOWN; + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = 0; + desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; + desc.Flags = D3D12_RESOURCE_FLAG_NONE; + + ComPtr<ID3D12Resource> resource; + int res = m_device->CreateCommittedResource(&m_desc.m_heapProperties, m_desc.m_heapFlags, &desc, m_desc.m_initialState, nullptr, IID_PPV_ARGS(&resource)); + if (NV_FAILED(res)) + { + printf("Resource allocation failed"); + return nullptr; + } + + uint8_t* data = nullptr; + if (m_desc.m_heapProperties.Type == D3D12_HEAP_TYPE_READBACK) + { + } + else + { + // Map it, and keep it mapped + resource->Map(0, nullptr, (void**)&data); + } + + // We have no blocks -> so lets allocate the first + Block* block = (Block*)m_blockFreeList.allocate(); + block->m_next = nullptr; + + block->m_resource = resource.Detach(); + block->m_start = data; + return block; +} + +Dx12CircularResourceHeap::Cursor Dx12CircularResourceHeap::allocate(size_t size, size_t alignment) +{ + const size_t blockSize = getBlockSize(); + + assert(size <= blockSize); + + // If nothing is allocated add the first block + if (m_blocks == nullptr) + { + Block* block = _newBlock(); + if (!block) + { + Cursor cursor = {}; + return cursor; + } + m_blocks = block; + // Make circular + block->m_next = block; + + // Point front and back to same position, as currently it is all free + m_back = { block, block->m_start }; + m_front = m_back; + } + + // If front and back are in the same block then front MUST be ahead of back (as that defined as + // an invariant and is required for block insertion to be possible + Block* block = m_front.m_block; + + // Check the invariant + assert(block != m_back.m_block || m_front.m_position >= m_back.m_position); + + { + uint8_t* cur = (uint8_t*)((size_t(m_front.m_position) + alignment - 1) & ~(alignment - 1)); + // Does the the allocation fit? + if (cur + size <= block->m_start + blockSize) + { + // It fits + // Move the front forward + m_front.m_position = cur + size; + Cursor cursor = { block, cur }; + return cursor; + } + } + + // Okay I can't fit into current block... + + // If the next block contains front, we need to add a block, else we can use that block + if (block->m_next == m_back.m_block) + { + Block* newBlock = _newBlock(); + // Insert into the list + newBlock->m_next = block->m_next; + block->m_next = newBlock; + } + + // Use the block we are going to add to + block = block->m_next; + uint8_t* cur = (uint8_t*)((size_t(block->m_start) + alignment - 1) & ~(alignment - 1)); + // Does the the allocation fit? + if (cur + size > block->m_start + blockSize) + { + printf("Couldn't fit into a free block(!) Alignment breaks it?"); + Cursor cursor = {}; + return cursor; + } + // It fits + // Move the front forward + m_front.m_block = block; + m_front.m_position = cur + size; + Cursor cursor = { block, cur }; + return cursor; +} + +} // namespace Common +} // namespace nvidia diff --git a/demo/d3d12/NvCoDx12CircularResourceHeap.h b/demo/d3d12/NvCoDx12CircularResourceHeap.h new file mode 100644 index 0000000..c88db06 --- /dev/null +++ b/demo/d3d12/NvCoDx12CircularResourceHeap.h @@ -0,0 +1,234 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#ifndef NV_CO_DX12_CIRCULAR_RESOURCE_HEAP_H +#define NV_CO_DX12_CIRCULAR_RESOURCE_HEAP_H + +#include <NvResult.h> +#include <NvCoFreeList.h> +#include "NvCoDx12CounterFence.h" + +#define NOMINMAX +#include <d3d12.h> +#include <wrl.h> +#include <deque> + +using namespace Microsoft::WRL; + +/** \addtogroup common +@{ +*/ + +namespace nvidia { +namespace Common { + +/*! \brief The Dx12CircularResourceHeap is a heap that is suited for size constrained real-time resources allocation that +is transitory in nature. It is designed to allocate resources which are used and discarded, often used where in +previous versions of DirectX the 'DISCARD' flag was used. + +The idea is to have a heap which chunks of resource can be allocated, and used for GPU execution, +and that the heap is able through the addSync/updateCompleted idiom is able to track when the usage of the resources is +completed allowing them to be reused. The heap is arranged as circularly, with new allocations made from the front, and the back +being updated as the GPU updating the back when it is informed anything using prior parts of the heap have completed. In this +arrangement all the heap between the back and the front can be thought of as in use or potentially in use by the GPU. All the heap +from the front back around to the back, is free and can be allocated from. It is the responsibility of the user of the Heap to make +sure the invariant holds, but in most normal usage it does so simply. + +Another feature of the heap is that it does not require upfront knowledge of how big a heap is needed. The backing resources will be expanded +dynamically with requests as needed. The only requirement is that know single request can be larger than m_blockSize specified in the Desc +used to initialize the heap. This is because all the backing resources are allocated to a single size. This limitation means the Dx12CircularResourceHeap +may not be the best use for example for uploading a texture - because it's design is really around transitory uploads or write backs, and so more suited +to constant buffers, vertex buffer, index buffers and the like. + +To upload a texture at program startup it is most likely better to use a Dx12ResourceScopeManager. + +### The addSync/updateCompleted Idiom + +Lots of classes in Nv/Common/Platform/Dx12 use the addSync/update idiom. The idiom enables a class to track GPU progress fairly simply. The +two methods are generally called at a fairly low frequency - say once a frame. The addSync method is given a signalValue that should be the +value generated from nextSignal on the Dx12Fence that is passed on construction of the type. Calling addSync means when this value is hit +ALL previous heap allocations will no longer be used. Thus in practice usage looks something like + +\code{.cpp} + +typedef Dx12CircularResourceHeap Heap; + +Heap::Cursor cursor = heap.allocateVertexBuffer(sizeof(Vertex) * numVerts); +Memory:copy(cursor.m_position, verts, sizeof(Vertex) * numVerts); + +// Do a command using the GPU handle +m_commandList->... +// Do another command using the GPU handle + +m_commandList->... + +// Execute the command list on the command queue +{ + ID3D12CommandList* lists[] = { m_commandList }; + m_commandQueue->ExecuteCommandLists(_countof(lists), lists); +} + +// Add a sync point +const uint64_t signalValue = m_fence.nextSignal(m_commandQueue); +heap.addSync(signalValue) + +// The cursors cannot be used anymore + +// At some later point call updateCompleted. This will see where the GPU is at, and make resources available that the GPU no longer accesses. +heap.updateCompleted(); + +\endcode + +### Implementation + +Front and back can be in the same block, but ONLY if back is behind front, because we have to always be able to insert +new blocks in front of front. So it must be possible to do an block insertion between the two of them. + +|--B---F-----| |----------| + +When B and F are on top of one another it means there is nothing in the list. NOTE this also means that a move of front can never place it +top of the back. + +https://msdn.microsoft.com/en-us/library/windows/desktop/dn899125%28v=vs.85%29.aspx +https://msdn.microsoft.com/en-us/library/windows/desktop/mt426646%28v=vs.85%29.aspx +*/ +class Dx12CircularResourceHeap +{ + protected: + struct Block; + + //NV_CO_DECLARE_CLASS_BASE(Dx12CircularResourceHeap); +public: + /// The alignment used for VERTEX_BUFFER allocations + /// Strictly speaking it seems the hardware can handle 4 byte alignment, but since often in use + /// data will be copied from CPU memory to the allocation, using 16 byte alignment is superior as allows + /// significantly faster memcpy. + /// The sample that shows sizeof(float) - 4 bytes is appropriate is at the link below. + /// https://msdn.microsoft.com/en-us/library/windows/desktop/mt426646%28v=vs.85%29.aspx + enum + { + VERTEX_BUFFER_ALIGNMENT = 16, + }; + + struct Desc + { + void init() + { + { + D3D12_HEAP_PROPERTIES& props = m_heapProperties; + + props.Type = D3D12_HEAP_TYPE_UPLOAD; + props.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; + props.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; + props.CreationNodeMask = 1; + props.VisibleNodeMask = 1; + } + m_heapFlags = D3D12_HEAP_FLAG_NONE; + m_initialState = D3D12_RESOURCE_STATE_GENERIC_READ; + m_blockSize = 0; + } + + D3D12_HEAP_PROPERTIES m_heapProperties; + D3D12_HEAP_FLAGS m_heapFlags; + D3D12_RESOURCE_STATES m_initialState; + size_t m_blockSize; + }; + + /// Cursor position + struct Cursor + { + /// Get GpuHandle + inline D3D12_GPU_VIRTUAL_ADDRESS getGpuHandle() const { return m_block->m_resource->GetGPUVirtualAddress() + size_t(m_position - m_block->m_start); } + /// Must have a block and position + inline bool isValid() const { return m_block != nullptr; } + /// Calculate the offset into the underlying resource + inline size_t getOffset() const { return size_t(m_position - m_block->m_start); } + /// Get the underlying resource + inline ID3D12Resource* getResource() const { return m_block->m_resource; } + + Block* m_block; ///< The block index + uint8_t* m_position; ///< The current position + }; + + /// Get the desc used to initialize the heap + inline const Desc& getDesc() const { return m_desc; } + + /// Must be called before used + /// Block size must be at least as large as the _largest_ thing allocated + /// Also note depending on alignment of a resource allocation, the block size might also need to take into account the + /// maximum alignment use. It is a REQUIREMENT that a newly allocated resource block is large enough to hold any + /// allocation taking into account the alignment used. + int init(ID3D12Device* device, const Desc& desc, Dx12CounterFence* fence); + + /// Get the block size + inline size_t getBlockSize() const { return m_desc.m_blockSize; } + + /// Allocate constant buffer of specified size + Cursor allocate(size_t size, size_t alignment); + + /// Allocate a constant buffer + inline Cursor allocateConstantBuffer(size_t size) { return allocate(size, D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT); } + /// Allocate a vertex buffer + inline Cursor allocateVertexBuffer(size_t size) { return allocate(size, VERTEX_BUFFER_ALIGNMENT); } + + /// Create filled in constant buffer + inline Cursor newConstantBuffer(const void* data, size_t size) { Cursor cursor = allocateConstantBuffer(size); memcpy(cursor.m_position, data, size); return cursor; } + /// Create in filled in constant buffer + template <typename T> + inline Cursor newConstantBuffer(const T& in) { return newConstantBuffer(&in, sizeof(T)); } + + /// Look where the GPU has got to and release anything not currently used + void updateCompleted(); + /// Add a sync point - meaning that when this point is hit in the queue + /// all of the resources up to this point will no longer be used. + void addSync(uint64_t signalValue); + + /// Get the gpu address of this cursor + D3D12_GPU_VIRTUAL_ADDRESS getGpuHandle(const Cursor& cursor) const { return cursor.m_block->m_resource->GetGPUVirtualAddress() + size_t(cursor.m_position - cursor.m_block->m_start); } + + /// Ctor + Dx12CircularResourceHeap(); + /// Dtor + ~Dx12CircularResourceHeap(); + + protected: + + struct Block + { + ID3D12Resource* m_resource; ///< The mapped resource + uint8_t* m_start; ///< Once created the resource is mapped to here + Block* m_next; ///< Points to next block in the list + }; + struct PendingEntry + { + uint64_t m_completedValue; ///< The value when this is completed + Cursor m_cursor; ///< the cursor at that point + }; + void _freeBlockListResources(const Block* block); + /// Create a new block (with associated resource), do not add the block list + Block* _newBlock(); + + Block* m_blocks; ///< Circular singly linked list of block. nullptr initially + FreeList m_blockFreeList; ///< Free list of actual allocations of blocks + std::deque<PendingEntry> m_pendingQueue; ///< Holds the list of pending positions. When the fence value is greater than the value on the queue entry, the entry is done. + + // Allocation is made from the front, and freed from the back. + Cursor m_back; ///< Current back position. + Cursor m_front; ///< Current front position. + + Desc m_desc; ///< Describes the heap + + Dx12CounterFence* m_fence; ///< The fence to use + ID3D12Device* m_device; ///< The device that resources will be constructed on +}; + +} // namespace Common +} // namespace nvidia + +/** @} */ + +#endif // NV_CO_DX12_CIRCULAR_RESOURCE_HEAP_H diff --git a/demo/d3d12/NvCoDx12CounterFence.cpp b/demo/d3d12/NvCoDx12CounterFence.cpp new file mode 100644 index 0000000..bca181a --- /dev/null +++ b/demo/d3d12/NvCoDx12CounterFence.cpp @@ -0,0 +1,71 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#include "NvCoDx12CounterFence.h" + +namespace nvidia { +namespace Common { + +Dx12CounterFence::~Dx12CounterFence() +{ + if (m_event) + { + CloseHandle(m_event); + } +} + +int Dx12CounterFence::init(ID3D12Device* device, uint64_t initialValue) +{ + m_currentValue = initialValue; + + NV_RETURN_ON_FAIL(device->CreateFence(m_currentValue, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&m_fence))); + // Create an event handle to use for frame synchronization. + m_event = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (m_event == nullptr) + { + int res = HRESULT_FROM_WIN32(GetLastError()); + return NV_FAILED(res) ? res : NV_FAIL; + } + return NV_OK; +} + +uint64_t Dx12CounterFence::nextSignal(ID3D12CommandQueue* commandQueue) +{ + // Increment the fence value. Save on the frame - we'll know that frame is done when the fence value >= + m_currentValue++; + // Schedule a Signal command in the queue. + int res = commandQueue->Signal(m_fence.Get(), m_currentValue); + if (NV_FAILED(res)) + { + printf("Signal failed"); + } + return m_currentValue; +} + +void Dx12CounterFence::waitUntilCompleted(uint64_t completedValue) +{ + // You can only wait for a value that is less than or equal to the current value + assert(completedValue <= m_currentValue); + + // Wait until the previous frame is finished. + while (m_fence->GetCompletedValue() < completedValue) + { + // Make it signal with the current value + HRESULT res = m_fence->SetEventOnCompletion(completedValue, m_event); + if (FAILED(res)) { assert(0); return; } + + WaitForSingleObject(m_event, INFINITE); + } +} + +void Dx12CounterFence::nextSignalAndWait(ID3D12CommandQueue* commandQueue) +{ + waitUntilCompleted(nextSignal(commandQueue)); +} + +} // namespace Common +} // namespace nvidia diff --git a/demo/d3d12/NvCoDx12CounterFence.h b/demo/d3d12/NvCoDx12CounterFence.h new file mode 100644 index 0000000..9add39b --- /dev/null +++ b/demo/d3d12/NvCoDx12CounterFence.h @@ -0,0 +1,82 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#ifndef NV_CO_DX12_COUNTER_FENCE_H +#define NV_CO_DX12_COUNTER_FENCE_H + +#include <NvResult.h> + +#define NOMINMAX +#include <d3d12.h> +#include <stdint.h> +#include <stdio.h> +#include <assert.h> +#include <wrl.h> + +using namespace Microsoft::WRL; + +/** \addtogroup common +@{ +*/ + +namespace nvidia { +namespace Common { + +/*! \brief A class to simplify using Dx12 fences. + +A fence is a mechanism to track GPU work. This is achieved by having a counter that the CPU holds +called the current value. Calling nextSignal will increase the CPU counter, and add a fence +with that value to the commandQueue. When the GPU has completed all the work before the fence it will +update the completed value. This is typically used when +the CPU needs to know the GPU has finished some piece of work has completed. To do this the CPU +can check the completed value, and when it is greater or equal to the value returned by nextSignal the +CPU will know that all the work prior to when the nextSignal was added to the queue will have completed. + +NOTE! This cannot be used across threads, as for amongst other reasons SetEventOnCompletion +only works with a single value. + +Signal on the CommandQueue updates the fence on the GPU side. Signal on the fence object changes +the value on the CPU side (not used here). + +Useful article describing how Dx12 synchronization works: +https://msdn.microsoft.com/en-us/library/windows/desktop/dn899217%28v=vs.85%29.aspx +*/ +class Dx12CounterFence +{ + //NV_CO_DECLARE_CLASS_BASE(Dx12CounterFence); +public: + /// Must be called before used + int init(ID3D12Device* device, uint64_t initialValue = 0); + /// Increases the counter, signals the queue and waits for the signal to be hit + void nextSignalAndWait(ID3D12CommandQueue* queue); + /// Signals with next counter value. Returns the value the signal was called on + uint64_t nextSignal(ID3D12CommandQueue* commandQueue); + /// Get the current value + inline uint64_t getCurrentValue() const { return m_currentValue; } + /// Get the completed value + inline uint64_t getCompletedValue() const { return m_fence->GetCompletedValue(); } + + /// Waits for the the specified value + void waitUntilCompleted(uint64_t completedValue); + + /// Ctor + Dx12CounterFence():m_event(nullptr), m_currentValue(0) {} + /// Dtor + ~Dx12CounterFence(); + + protected: + HANDLE m_event; + ComPtr<ID3D12Fence> m_fence; + uint64_t m_currentValue; +}; + +} // namespace Common +} // namespace nvidia + +/** @} */ + +#endif // NV_CO_DX12_COUNTER_FENCE_H diff --git a/demo/d3d12/NvCoDx12DescriptorHeap.cpp b/demo/d3d12/NvCoDx12DescriptorHeap.cpp new file mode 100644 index 0000000..acda590 --- /dev/null +++ b/demo/d3d12/NvCoDx12DescriptorHeap.cpp @@ -0,0 +1,54 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#include "NvCoDx12DescriptorHeap.h" + +namespace nvidia { +namespace Common { + +Dx12DescriptorHeap::Dx12DescriptorHeap(): + m_size(0), + m_currentIndex(0), + m_descriptorSize(0) +{ +} + +int Dx12DescriptorHeap::init(ID3D12Device* device, int size, D3D12_DESCRIPTOR_HEAP_TYPE type, D3D12_DESCRIPTOR_HEAP_FLAGS flags) +{ + D3D12_DESCRIPTOR_HEAP_DESC srvHeapDesc = {}; + srvHeapDesc.NumDescriptors = size; + srvHeapDesc.Flags = flags; + srvHeapDesc.Type = type; + NV_RETURN_ON_FAIL(device->CreateDescriptorHeap(&srvHeapDesc, IID_PPV_ARGS(&m_heap))); + + m_descriptorSize = device->GetDescriptorHandleIncrementSize(type); + m_size = size; + + return NV_OK; +} + +int Dx12DescriptorHeap::init(ID3D12Device* device, const D3D12_CPU_DESCRIPTOR_HANDLE* handles, int numHandles, D3D12_DESCRIPTOR_HEAP_TYPE type, D3D12_DESCRIPTOR_HEAP_FLAGS flags) +{ + NV_RETURN_ON_FAIL(init(device, numHandles, type, flags)); + D3D12_CPU_DESCRIPTOR_HANDLE dst = m_heap->GetCPUDescriptorHandleForHeapStart(); + + // Copy them all + for (int i = 0; i < numHandles; i++, dst.ptr += m_descriptorSize) + { + D3D12_CPU_DESCRIPTOR_HANDLE src = handles[i]; + if (src.ptr != 0) + { + device->CopyDescriptorsSimple(1, dst, src, type); + } + } + + return NV_OK; +} + +} // namespace Common +} // namespace nvidia + diff --git a/demo/d3d12/NvCoDx12DescriptorHeap.h b/demo/d3d12/NvCoDx12DescriptorHeap.h new file mode 100644 index 0000000..d323ce6 --- /dev/null +++ b/demo/d3d12/NvCoDx12DescriptorHeap.h @@ -0,0 +1,116 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#ifndef NV_CO_DX12_DESCRIPTOR_HEAP_H +#define NV_CO_DX12_DESCRIPTOR_HEAP_H + +#include <NvResult.h> + +#define NOMINMAX +#include <dxgi.h> +#include <d3d12.h> +#include <assert.h> +#include <wrl.h> + +using namespace Microsoft::WRL; + +namespace nvidia { +namespace Common { + +/*! \brief A simple class to manage an underlying Dx12 Descriptor Heap. Allocations are made linearly in order. It is not possible to free +individual allocations, but all allocations can be deallocated with 'deallocateAll'. */ +class Dx12DescriptorHeap +{ + //NV_CO_DECLARE_CLASS_BASE(Dx12DescriptorHeap); +public: + /// Initialize + int init(ID3D12Device* device, int size, D3D12_DESCRIPTOR_HEAP_TYPE type, D3D12_DESCRIPTOR_HEAP_FLAGS flags); + /// Initialize with an array of handles copying over the representation + int init(ID3D12Device* device, const D3D12_CPU_DESCRIPTOR_HANDLE* handles, int numHandles, D3D12_DESCRIPTOR_HEAP_TYPE type, D3D12_DESCRIPTOR_HEAP_FLAGS flags); + + /// Get the total amount of descriptors possible on the heap + inline int getSize() const { return m_size; } + /// Allocate a descriptor. Returns the index, or -1 if none left. + inline int allocate(); + /// Allocate a number of descriptors. Returns the start index (or -1 if not possible) + inline int allocate(int numDescriptors); + + /// Deallocates all allocations, and starts allocation from the start of the underlying heap again + inline void deallocateAll() { m_currentIndex = 0; } + + /// Get the size of each + inline int getDescriptorSize() const { return m_descriptorSize; } + + /// Get the GPU heap start + inline D3D12_GPU_DESCRIPTOR_HANDLE getGpuStart() const { return m_heap->GetGPUDescriptorHandleForHeapStart(); } + /// Get the CPU heap start + inline D3D12_CPU_DESCRIPTOR_HANDLE getCpuStart() const { return m_heap->GetCPUDescriptorHandleForHeapStart(); } + + /// Get the GPU handle at the specified index + inline D3D12_GPU_DESCRIPTOR_HANDLE getGpuHandle(int index) const; + /// Get the CPU handle at the specified index + inline D3D12_CPU_DESCRIPTOR_HANDLE getCpuHandle(int index) const; + + /// Get the underlying heap + inline ID3D12DescriptorHeap* getHeap() const { return m_heap.Get(); } + + /// Ctor + Dx12DescriptorHeap(); + +protected: + ComPtr<ID3D12DescriptorHeap> m_heap; ///< The underlying heap being allocated from + int m_size; ///< Total amount of allocations available on the heap + int m_currentIndex; ///< The current descriptor + int m_descriptorSize; ///< The size of each descriptor +}; + +// --------------------------------------------------------------------------- +int Dx12DescriptorHeap::allocate() +{ + assert(m_currentIndex < m_size); + if (m_currentIndex < m_size) + { + return m_currentIndex++; + } + return -1; +} +// --------------------------------------------------------------------------- +int Dx12DescriptorHeap::allocate(int numDescriptors) +{ + assert(m_currentIndex + numDescriptors <= m_size); + if (m_currentIndex + numDescriptors <= m_size) + { + const int index = m_currentIndex; + m_currentIndex += numDescriptors; + return index; + } + return -1; +} +// --------------------------------------------------------------------------- +inline D3D12_CPU_DESCRIPTOR_HANDLE Dx12DescriptorHeap::getCpuHandle(int index) const +{ + assert(index >= 0 && index < m_size); + D3D12_CPU_DESCRIPTOR_HANDLE start = m_heap->GetCPUDescriptorHandleForHeapStart(); + D3D12_CPU_DESCRIPTOR_HANDLE dst; + dst.ptr = start.ptr + m_descriptorSize * index; + return dst; +} +// --------------------------------------------------------------------------- +inline D3D12_GPU_DESCRIPTOR_HANDLE Dx12DescriptorHeap::getGpuHandle(int index) const +{ + assert(index >= 0 && index < m_size); + D3D12_GPU_DESCRIPTOR_HANDLE start = m_heap->GetGPUDescriptorHandleForHeapStart(); + D3D12_GPU_DESCRIPTOR_HANDLE dst; + dst.ptr = start.ptr + m_descriptorSize * index; + return dst; +} + +} // namespace Common +} // namespace nvidia + + +#endif // NV_CO_DX12_DESCRIPTOR_HEAP_H diff --git a/demo/d3d12/NvCoDx12Handle.h b/demo/d3d12/NvCoDx12Handle.h new file mode 100644 index 0000000..bbe8372 --- /dev/null +++ b/demo/d3d12/NvCoDx12Handle.h @@ -0,0 +1,162 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#ifndef NV_CO_DX12_HANDLE_H +#define NV_CO_DX12_HANDLE_H + +// Dx12 types +#define NOMINMAX +#include <d3d12.h> +#include <stdint.h> + +/** \addtogroup common +@{ +*/ + +namespace nvidia { +namespace Common { + +/*! +\brief Description of how the intended rendering target is arranged. +*/ +struct Dx12TargetInfo +{ + void init() + { + m_numRenderTargets = 1; + m_renderTargetFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM; + m_depthStencilFormat = DXGI_FORMAT_D24_UNORM_S8_UINT; + m_numSamples = 1; + m_sampleQuality = 0; + m_sampleMask = ~uint32_t(0); + } + + int m_numRenderTargets; + DXGI_FORMAT m_renderTargetFormats[8]; ///< Format used for render target view access (the actual resource could be different!) + DXGI_FORMAT m_depthStencilFormat; ///< Format to use for depth stencil view access (the actual resource could be different!) + int m_numSamples; ///< The number of multi sample samples + int m_sampleQuality; ///< The multi sample quality + uint32_t m_sampleMask; ///< The sample mask +}; + +#if 0 +/*! +\brief Specifies the kinds of types that can be wrapped in ApiHandle/ApiPtr/ConstPtr types */ +class Dx12SubType { Dx12SubType(); public: +/*! SubTypes for Dx12 */ +enum Enum +{ + UNKNOWN, ///< Unknown + CONTEXT, + DEVICE, + BUFFER, + FLOAT32, + CPU_DESCRIPTOR_HANDLE, + COMMAND_QUEUE, + TARGET_INFO, + COUNT_OF, +}; +}; + +// Handle types +#define NV_DX12_HANDLE_TYPES(x) \ + x(ID3D12Device, DEVICE, DEVICE) \ + x(ID3D12GraphicsCommandList, CONTEXT, CONTEXT) \ + x(ID3D12Resource, BUFFER, BUFFER) \ + x(ID3D12CommandQueue, COMMAND_QUEUE, UNKNOWN ) + +// The 'value' types - ie ones that can be passed as pointers, in addition to the handle types +#define NV_DX12_VALUE_TYPES(x) \ + x(Float32, FLOAT32, UNKNOWN) \ + x(D3D12_CPU_DESCRIPTOR_HANDLE, CPU_DESCRIPTOR_HANDLE, CPU_DESCRIPTOR_HANDLE) \ + x(Dx12TargetInfo, TARGET_INFO, UNKNOWN) + +/*! +\brief A helper class to wrap Dx12 related types to ApiHandle, ApiPtr types, or extract via a cast the Dx12 types back out again. + +Some examples of how to wrap and cast handles and pointers + +\code{.cpp} +ID3D12Device* device = ...; + +\\ To wrap as a handle +ApiHandle handle = Dx12Type::wrap(device); + +\\ To wrap an array or pointer you can use + +Dx12TargetInfo target; +ApiPtr ptr = Dx12Type::wrapPtr(&target); + +\\ If you want to convert a wrapped handle back you can use +ID3D12Device* device = Dx12Type::cast<ID3D12Device>(handle); + +\\ Similarly to get a pointer +Dx12TargetInfo* target = Dx12Type::castPtr<Dx12TargetInfo>(ptr); +\endcode + +*/ +struct Dx12Type +{ + // Used by the macros. NOTE! Should be wrapping type (ie not the actual type - typically with E prefix) + typedef Dx12SubType ScopeSubType; + + /// Get the full type for the subtype + inline static int getType(Dx12SubType::Enum subType) { return (int(ApiType::DX12) << 8) | int(subType); } + /// Get the type via template, needed for arrays + template <typename T> + inline static int getType() { return getType((T*)NV_NULL); } + + /// Implement getType + NV_DX12_HANDLE_TYPES(NV_CO_API_GET_TYPE) + /// Implement getHandle, which will return a TypedApiHandle + NV_DX12_HANDLE_TYPES(NV_CO_API_WRAP) + /// Implement getType for 'value types' (ie structs and others that shouldn't be in a handle) + NV_DX12_VALUE_TYPES(NV_CO_API_GET_VALUE_TYPE) + + /// A template to work around warnings from dereferencing NV_NULL + template <typename T> + inline static int getPtrType() { void* data = NV_NULL; return getType(*(const T*)&data); } + + /// Get a pointer + template <typename T> + inline static ConstApiPtr wrapPtr(const T* in) { return ConstApiPtr(getPtrType<T>(), in); } + template <typename T> + inline static ApiPtr wrapPtr(T* in) { return ApiPtr(getPtrType<T>(), in); } + + /// Get from a handle + template <typename T> + inline static T* cast(const ApiHandle& in) { const int type = getType((T*)NV_NULL); return reinterpret_cast<T*>((type == in.m_type) ? in.m_handle : NV_NULL); } + /// Get from + template <typename T> + inline static const T* cast(const ConstApiPtr& ptr) { const int type = getPtrType<T>(); return reinterpret_cast<const T*>((ptr.m_type == type) ? ptr.getData() : NV_NULL); } + // Get from + template <typename T> + inline static T* cast(const ApiPtr& ptr) { const int type = getPtrType<T>(); return reinterpret_cast<T*>((ptr.m_type == type) ? ptr.getData() : NV_NULL); } + + /// Get the sub type as text + static const Char* getSubTypeText(Dx12SubType::Enum subType); + + /// If the match fails - implement casting. Writes impossible casts to Logger and returns NV_NULL. + static void* handlePtrCast(int fromType, int toType); + static void* handleCast(int fromType, int toType); + /// Called when a cast isn't possible. Will output warnings to log and return NV_NULL + static void castFailure(int fromType, int toType); + /// Log failure + static void logCastFailure(int fromType, int toType); +}; + +/* For generic handles you can use Dx11Handle. If you want the typed handle type use Dx11Type::wrap(texture) */ +typedef WrapApiHandle<Dx12Type> Dx12Handle; + +#endif + +} // namespace Common +} // namespace nvidia + +/** @} */ + +#endif // NV_CO_DX12_HANDLE_H diff --git a/demo/d3d12/NvCoDx12HelperUtil.cpp b/demo/d3d12/NvCoDx12HelperUtil.cpp new file mode 100644 index 0000000..46e2265 --- /dev/null +++ b/demo/d3d12/NvCoDx12HelperUtil.cpp @@ -0,0 +1,89 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +// Make the DXGI_DEBUG_D3D12 symbol defined in this compilation unit, to avoid link problems +#define INITGUID + +#include "NvCoDx12HelperUtil.h" + +namespace nvidia { +namespace Common { + +void Dx12HelperUtil::calcSrvDesc(ID3D12Resource* resource, DXGI_FORMAT pixelFormat, D3D12_SHADER_RESOURCE_VIEW_DESC& descOut) +{ + // Get the desc + return calcSrvDesc(resource->GetDesc(), pixelFormat, descOut); +} + +void Dx12HelperUtil::calcSrvDesc(const D3D12_RESOURCE_DESC& desc, DXGI_FORMAT pixelFormat, D3D12_SHADER_RESOURCE_VIEW_DESC& descOut) +{ + + // create SRV + descOut = D3D12_SHADER_RESOURCE_VIEW_DESC(); + + descOut.Format = (pixelFormat == DXGI_FORMAT_UNKNOWN) ? DxFormatUtil::calcFormat(DxFormatUtil::USAGE_SRV, desc.Format) : pixelFormat; + descOut.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + if (desc.DepthOrArraySize == 1) + { + descOut.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; + + descOut.Texture2D.MipLevels = desc.MipLevels; + descOut.Texture2D.MostDetailedMip = 0; + descOut.Texture2D.PlaneSlice = 0; + descOut.Texture2D.ResourceMinLODClamp = 0.0f; + } + else if (desc.DepthOrArraySize == 6) + { + descOut.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBE; + + descOut.TextureCube.MipLevels = desc.MipLevels; + descOut.TextureCube.MostDetailedMip = 0; + descOut.TextureCube.ResourceMinLODClamp = 0; + } + else + { + descOut.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DARRAY; + + descOut.Texture2DArray.ArraySize = desc.DepthOrArraySize; + descOut.Texture2DArray.MostDetailedMip = 0; + descOut.Texture2DArray.MipLevels = desc.MipLevels; + descOut.Texture2DArray.FirstArraySlice = 0; + descOut.Texture2DArray.PlaneSlice = 0; + descOut.Texture2DArray.ResourceMinLODClamp = 0; + } +} + +/* static */void Dx12HelperUtil::reportLiveObjects() +{ + IDXGIDebug* dxgiDebug; + int res = DxDebugUtil::getDebugInterface(&dxgiDebug); + + if (NV_FAILED(res) || !dxgiDebug) + { + printf("Unable to access debug interface -> can't report live objects"); + return; + } + dxgiDebug->ReportLiveObjects(DXGI_DEBUG_D3D12, DXGI_DEBUG_RLO_DETAIL); +} + +/* static */int Dx12HelperUtil::serializeRootSigniture(const D3D12_ROOT_SIGNATURE_DESC& desc, D3D_ROOT_SIGNATURE_VERSION signitureVersion, ComPtr<ID3DBlob>& sigBlobOut) +{ + ComPtr<ID3DBlob> error; + int res = D3D12SerializeRootSignature(&desc, signitureVersion, &sigBlobOut, &error); + if (NV_SUCCEEDED(res)) + { + return res; + } + + char* errorText = (char*)error->GetBufferPointer(); + + printf("Unable to serialize Dx12 signature: %s\n", errorText); + return res; +} + +} // namespace Common +} // namespace nvidia diff --git a/demo/d3d12/NvCoDx12HelperUtil.h b/demo/d3d12/NvCoDx12HelperUtil.h new file mode 100644 index 0000000..1c05253 --- /dev/null +++ b/demo/d3d12/NvCoDx12HelperUtil.h @@ -0,0 +1,52 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#ifndef NV_CO_DX12_HELPER_UTIL_H +#define NV_CO_DX12_HELPER_UTIL_H + +#include <NvResult.h> +#include <NvCoDxFormatUtil.h> +#include <NvCoDxDebugUtil.h> + +#define NOMINMAX +#include <d3d12.h> +#include <stdio.h> +#include <wrl.h> + +using namespace Microsoft::WRL; + +/** \addtogroup common +@{ +*/ + +namespace nvidia { +namespace Common { + +struct Dx12HelperUtil +{ + /// Get a Shader resource view from a resourceDesc + /// If pixelFormat is UNKNOWN, will use the pixelFormat in the resourceDesc + static void calcSrvDesc(const D3D12_RESOURCE_DESC& resourceDesc, DXGI_FORMAT pixelFormat, D3D12_SHADER_RESOURCE_VIEW_DESC& descOut); + + /// Get a Shader resource view from a resource + /// If pixelFormat is UNKNOWN, will use the pixelFormat in the resourceDesc + static void calcSrvDesc(ID3D12Resource* resource, DXGI_FORMAT pixelFormat, D3D12_SHADER_RESOURCE_VIEW_DESC& descOut); + + /// Serializes the root signiture. If any errors occur will write to the log + static int serializeRootSigniture(const D3D12_ROOT_SIGNATURE_DESC& desc, D3D_ROOT_SIGNATURE_VERSION signitureVersion, ComPtr<ID3DBlob>& sigBlobOut); + + /// Reports to the output debug window any live objects, using debug interface. + /// Only works on systems that have "Dxgidebug.dll" + static void reportLiveObjects(); +}; + +} // namespace Common +} // namespace nvidia + +/** @} */ + +#endif // NV_CO_DX12_DEBUG_UTIL_H diff --git a/demo/d3d12/NvCoDx12RenderTarget.cpp b/demo/d3d12/NvCoDx12RenderTarget.cpp new file mode 100644 index 0000000..2ce4d86 --- /dev/null +++ b/demo/d3d12/NvCoDx12RenderTarget.cpp @@ -0,0 +1,324 @@ + +#include "NvCoDx12RenderTarget.h" +#include "appD3D12Ctx.h" + +#include <external/D3D12/include/d3dx12.h> + +namespace nvidia { +namespace Common { + +Dx12RenderTarget::Dx12RenderTarget() +{ + memset(m_srvIndices, -1, sizeof(m_srvIndices)); +} + +int Dx12RenderTarget::init(AppGraphCtxD3D12* renderContext, const Desc& desc) +{ + ID3D12Device* device = renderContext->m_device; + + m_desc = desc; + + // set viewport + { + m_viewport.Width = float(desc.m_width); + m_viewport.Height = float(desc.m_height); + m_viewport.MinDepth = 0; + m_viewport.MaxDepth = 1; + m_viewport.TopLeftX = 0; + m_viewport.TopLeftY = 0; + } + + { + m_scissorRect.left = 0; + m_scissorRect.top = 0; + m_scissorRect.right = desc.m_width; + m_scissorRect.bottom = desc.m_height; + } + + if (desc.m_targetFormat != DXGI_FORMAT_UNKNOWN) + { + D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {}; + heapDesc.NumDescriptors = 1; + heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; + heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; + NV_RETURN_ON_FAIL(device->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&m_descriptorHeapRtv))); + + DXGI_FORMAT resourceFormat = DxFormatUtil::calcResourceFormat(DxFormatUtil::USAGE_TARGET, m_desc.m_usageFlags, desc.m_targetFormat); + DXGI_FORMAT targetFormat = DxFormatUtil::calcFormat(DxFormatUtil::USAGE_TARGET, resourceFormat); + + D3D12_RESOURCE_DESC resourceDesc = CD3DX12_RESOURCE_DESC::Tex2D(resourceFormat, UINT(desc.m_width), UINT(desc.m_height), 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, D3D12_TEXTURE_LAYOUT_UNKNOWN, 0); + D3D12_HEAP_PROPERTIES heapProps = CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT); + + // Depending on usage this format may not be right... + D3D12_CLEAR_VALUE clearValue; + clearValue.Format = targetFormat; + clearValue.Color[0] = FLT_MAX; + clearValue.Color[1] = FLT_MAX; + clearValue.Color[2] = FLT_MAX; + clearValue.Color[3] = FLT_MAX; + + NV_RETURN_ON_FAIL(m_renderTarget.initCommitted(device, heapProps, D3D12_HEAP_FLAG_NONE, resourceDesc, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, &clearValue)); + + D3D12_RENDER_TARGET_VIEW_DESC rtvDesc = {}; + rtvDesc.Format = targetFormat; + rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; + rtvDesc.Texture2D.MipSlice = 0; + rtvDesc.Texture2D.PlaneSlice = 0; + device->CreateRenderTargetView(m_renderTarget, &rtvDesc, m_descriptorHeapRtv->GetCPUDescriptorHandleForHeapStart()); + } + + // Create the depth stencil descriptor heap + if (desc.m_depthStencilFormat != DXGI_FORMAT_UNKNOWN) + { + D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {}; + heapDesc.NumDescriptors = 1; + heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV; + heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; + NV_RETURN_ON_FAIL(device->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&m_descriptorHeapDsv))); + + DXGI_FORMAT resourceFormat = DxFormatUtil::calcResourceFormat(DxFormatUtil::USAGE_DEPTH_STENCIL, m_desc.m_usageFlags, desc.m_depthStencilFormat); + DXGI_FORMAT depthStencilFormat = DxFormatUtil::calcFormat(DxFormatUtil::USAGE_DEPTH_STENCIL, resourceFormat); + + D3D12_RESOURCE_DESC resourceDesc = CD3DX12_RESOURCE_DESC::Tex2D(resourceFormat, UINT(desc.m_width), UINT(desc.m_height), 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL, D3D12_TEXTURE_LAYOUT_UNKNOWN, 0); + D3D12_HEAP_PROPERTIES heapProps = CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT); + + D3D12_CLEAR_VALUE clearValue; + clearValue.Format = depthStencilFormat; + clearValue.DepthStencil.Depth = 1.0f; + clearValue.DepthStencil.Stencil = 0; + NV_RETURN_ON_FAIL(m_depthStencilBuffer.initCommitted(device, heapProps, D3D12_HEAP_FLAG_NONE, resourceDesc, D3D12_RESOURCE_STATE_DEPTH_WRITE, &clearValue)); + + // Create the depth stencil view + D3D12_DEPTH_STENCIL_VIEW_DESC dsvDesc = {}; + dsvDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D; + dsvDesc.Format = depthStencilFormat; + dsvDesc.Texture2D.MipSlice = 0; + dsvDesc.Flags = D3D12_DSV_FLAG_NONE; + device->CreateDepthStencilView(m_depthStencilBuffer, &dsvDesc, m_descriptorHeapDsv->GetCPUDescriptorHandleForHeapStart()); + } + + return NV_OK; +} + +/* static */DxFormatUtil::UsageType Dx12RenderTarget::getUsageType(BufferType type) +{ + switch (type) + { + case BUFFER_DEPTH_STENCIL: return DxFormatUtil::USAGE_DEPTH_STENCIL; + case BUFFER_TARGET: return DxFormatUtil::USAGE_TARGET; + default: return DxFormatUtil::USAGE_UNKNOWN; + } +} + +void Dx12RenderTarget::bind(AppGraphCtxD3D12* renderContext) +{ + ID3D12GraphicsCommandList* commandList = renderContext->m_commandList; + + // Work out what is bound + int numTargets = 0; + D3D12_CPU_DESCRIPTOR_HANDLE dsvHandle = {}; + D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle = {}; + + if (m_renderTarget) + { + rtvHandle = m_descriptorHeapRtv->GetCPUDescriptorHandleForHeapStart(); + numTargets = 1; + } + if (m_depthStencilBuffer) + { + dsvHandle = m_descriptorHeapDsv->GetCPUDescriptorHandleForHeapStart(); + commandList->OMSetRenderTargets(numTargets, &rtvHandle, FALSE, &dsvHandle); + } + else + { + commandList->OMSetRenderTargets(numTargets, &rtvHandle, FALSE, nullptr); + } + + commandList->RSSetViewports(1, &m_viewport); + commandList->RSSetScissorRects(1, &m_scissorRect); +} + + +void Dx12RenderTarget::clear(AppGraphCtxD3D12* renderContext) +{ + ID3D12GraphicsCommandList* commandList = renderContext->m_commandList; + D3D12_RECT rect = { 0, 0, m_desc.m_width, m_desc.m_height }; + + // Clear + if (m_renderTarget) + { + D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle = m_descriptorHeapRtv->GetCPUDescriptorHandleForHeapStart(); + commandList->ClearRenderTargetView(rtvHandle, m_desc.m_targetClearColor, 1, &rect); + } + if (m_depthStencilBuffer) + { + D3D12_CPU_DESCRIPTOR_HANDLE dsvHandle = m_descriptorHeapDsv->GetCPUDescriptorHandleForHeapStart(); + commandList->ClearDepthStencilView(dsvHandle, D3D12_CLEAR_FLAG_DEPTH, m_desc.m_depthStencilClearDepth, 0, 1, &rect); + } +} + +void Dx12RenderTarget::bindAndClear(AppGraphCtxD3D12* renderContext) +{ + ID3D12GraphicsCommandList* commandList = renderContext->m_commandList; + + // Work out what is bound + int numTargets = 0; + D3D12_CPU_DESCRIPTOR_HANDLE dsvHandle = {}; + D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle = {}; + + if (m_renderTarget) + { + rtvHandle = m_descriptorHeapRtv->GetCPUDescriptorHandleForHeapStart(); + numTargets = 1; + } + if (m_depthStencilBuffer) + { + dsvHandle = m_descriptorHeapDsv->GetCPUDescriptorHandleForHeapStart(); + commandList->OMSetRenderTargets(numTargets, &rtvHandle, FALSE, &dsvHandle); + } + else + { + commandList->OMSetRenderTargets(numTargets, &rtvHandle, FALSE, nullptr); + } + + commandList->RSSetViewports(1, &m_viewport); + commandList->RSSetScissorRects(1, &m_scissorRect); + + D3D12_RECT rect = { 0, 0, m_desc.m_width, m_desc.m_height }; + + // Clear + if (m_renderTarget) + { + commandList->ClearRenderTargetView(rtvHandle, m_desc.m_targetClearColor, 1, &rect); + } + if (m_depthStencilBuffer) + { + commandList->ClearDepthStencilView(dsvHandle, D3D12_CLEAR_FLAG_DEPTH, m_desc.m_depthStencilClearDepth, 0, 1, &rect); + } +} + +void Dx12RenderTarget::setShadowDefaultLight(FXMVECTOR eye, FXMVECTOR at, FXMVECTOR up) +{ + float sizeX = 50.0f; + float sizeY = 50.0f; + float znear = -200.0f; + float zfar = 200.0f; + + setShadowLightMatrices(eye, at, up, sizeX, sizeY, znear, zfar); +} + +void Dx12RenderTarget::setShadowLightMatrices(FXMVECTOR eye, FXMVECTOR lookAt, FXMVECTOR up, float sizeX, float sizeY, float zNear, float zFar) +{ + m_shadowLightView = XMMatrixLookAtLH(eye, lookAt, up); + m_shadowLightProjection = XMMatrixOrthographicLH(sizeX, sizeY, zNear, zFar); + DirectX::XMMATRIX clip2Tex(0.5, 0, 0, 0, + 0, -0.5, 0, 0, + 0, 0, 1, 0, + 0.5, 0.5, 0, 1); + DirectX::XMMATRIX viewProjection = m_shadowLightView * m_shadowLightProjection; + m_shadowLightWorldToTex = viewProjection * clip2Tex; +} + +void Dx12RenderTarget::toWritable(AppGraphCtxD3D12* renderContext) +{ + Dx12BarrierSubmitter submitter(renderContext->m_commandList); + + m_renderTarget.transition(D3D12_RESOURCE_STATE_RENDER_TARGET, submitter); + m_depthStencilBuffer.transition(D3D12_RESOURCE_STATE_DEPTH_WRITE, submitter); +} + +void Dx12RenderTarget::toReadable(AppGraphCtxD3D12* renderContext) +{ + Dx12BarrierSubmitter submitter(renderContext->m_commandList); + + m_renderTarget.transition(D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, submitter); + m_depthStencilBuffer.transition(D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, submitter); +} + +DXGI_FORMAT Dx12RenderTarget::getSrvFormat(BufferType type) const +{ + return Dx12Resource::calcFormat(DxFormatUtil::USAGE_SRV, getResource(type)); +} + +DXGI_FORMAT Dx12RenderTarget::getTargetFormat(BufferType type) const +{ + return Dx12Resource::calcFormat(getUsageType(type), getResource(type)); +} + +D3D12_SHADER_RESOURCE_VIEW_DESC Dx12RenderTarget::calcDefaultSrvDesc(BufferType type) const +{ + ID3D12Resource* resource = getResource(type); + + D3D12_RESOURCE_DESC resourceDesc = resource->GetDesc(); + + D3D12_SHADER_RESOURCE_VIEW_DESC desc; + + desc.Format = getSrvFormat(type); + desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + + desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; + + desc.Texture2D.MipLevels = resourceDesc.MipLevels; + desc.Texture2D.MostDetailedMip = 0; + desc.Texture2D.PlaneSlice = 0; + desc.Texture2D.ResourceMinLODClamp = 0.0f; + return desc; +} + +int Dx12RenderTarget::allocateSrvView(BufferType type, ID3D12Device* device, Dx12DescriptorHeap& heap, const D3D12_SHADER_RESOURCE_VIEW_DESC* desc) +{ + if (m_srvIndices[type] >= 0) + { + printf("A srv index has already been associated!"); + return m_srvIndices[type]; + } + + if (!desc) + { + // If not set construct a default desc + D3D12_SHADER_RESOURCE_VIEW_DESC defaultDesc = calcDefaultSrvDesc(type); + return allocateSrvView(type, device, heap, &defaultDesc); + } + + // Create the srv for the shadow buffer + ID3D12Resource* resource = getResource(type); + int srvIndex = heap.allocate(); + + if (srvIndex < 0) + { + return srvIndex; + } + + // Create on the the heap + device->CreateShaderResourceView(resource, desc, heap.getCpuHandle(srvIndex)); + + m_srvIndices[type] = srvIndex; + // Return the allocated index + return srvIndex; +} + +void Dx12RenderTarget::setDebugName(BufferType type, const std::wstring& name) +{ + getResource(type).setDebugName(name); +} + +void Dx12RenderTarget::setDebugName(const std::wstring& name) +{ + std::wstring buf(name); + buf += L" [Target]"; + setDebugName(BUFFER_TARGET, buf); + buf = name; + buf += L" [DepthStencil]"; + setDebugName(BUFFER_DEPTH_STENCIL, buf); +} + + +void Dx12RenderTarget::createSrv(ID3D12Device* device, Dx12DescriptorHeap& heap, BufferType type, int descriptorIndex) +{ + D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = calcDefaultSrvDesc(type); + ID3D12Resource* resource = getResource(type); + device->CreateShaderResourceView(resource, &srvDesc, heap.getCpuHandle(descriptorIndex)); +} + +} // namespace Common +} // namespace nvidia diff --git a/demo/d3d12/NvCoDx12RenderTarget.h b/demo/d3d12/NvCoDx12RenderTarget.h new file mode 100644 index 0000000..48e7fd0 --- /dev/null +++ b/demo/d3d12/NvCoDx12RenderTarget.h @@ -0,0 +1,122 @@ +#ifndef NV_CO_DX12_RENDER_TARGET_H +#define NV_CO_DX12_RENDER_TARGET_H + +#include <DirectXMath.h> +#include <NvCoDx12DescriptorHeap.h> +#include <NvCoDx12Resource.h> +#include "appD3D12Ctx.h" +#include "core/maths.h" + +namespace nvidia { +namespace Common { + +using namespace DirectX; + +class Dx12RenderTarget +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS_BASE(Dx12RenderTarget); +public: + enum BufferType + { + BUFFER_TARGET, + BUFFER_DEPTH_STENCIL, + BUFFER_COUNT_OF, + }; + + struct Desc + { + void init(int width, int height, DXGI_FORMAT targetFormat = DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT depthStencilFormat = DXGI_FORMAT_D32_FLOAT, int usageFlags = 0) + { + m_width = width; + m_height = height; + m_targetFormat = targetFormat; + m_depthStencilFormat = depthStencilFormat; + m_usageFlags = usageFlags; + + const Vec4 clearColor = { FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX }; + m_targetClearColor = clearColor; + m_depthStencilClearDepth = 1.0; + } + + int m_usageFlags; ///< Usage flags from DxFormatUtil + int m_width; + int m_height; + DXGI_FORMAT m_depthStencilFormat; ///< DXGI_FORMAT_UNKNOWN means don't allocate resource + DXGI_FORMAT m_targetFormat; ///< DXGI_FORMAT_UNKNOWN means don't allocate resource + Vec4 m_targetClearColor; + float m_depthStencilClearDepth; + }; + + int init(AppGraphCtxD3D12* renderContext, const Desc& desc); + + void setShadowDefaultLight(FXMVECTOR eye, FXMVECTOR at, FXMVECTOR up); + void setShadowLightMatrices(FXMVECTOR eye, FXMVECTOR lookAt, FXMVECTOR up, float sizeX, float sizeY, float zNear, float zFar); + + void bind(AppGraphCtxD3D12* renderContext); + + void clear(AppGraphCtxD3D12* renderContext); + void bindAndClear(AppGraphCtxD3D12* renderContext); + + void toWritable(AppGraphCtxD3D12* renderContext); + void toReadable(AppGraphCtxD3D12* renderContext); + + /// Set the debug name + void setDebugName(BufferType type, const std::wstring& name); + /// Set name (plus if depth/target) for all buffers + void setDebugName(const std::wstring& name); + + /// Get the 'primary' buffer type. + BufferType getPrimaryBufferType() const { return m_renderTarget ? BUFFER_TARGET : BUFFER_DEPTH_STENCIL; } + + /// Get the resource by the buffer type + const Dx12ResourceBase& getResource(BufferType type) const { return type == BUFFER_TARGET ? m_renderTarget : m_depthStencilBuffer; } + Dx12Resource& getResource(BufferType type) { return type == BUFFER_TARGET ? m_renderTarget : m_depthStencilBuffer; } + + /// Calculates a default shader resource view + D3D12_SHADER_RESOURCE_VIEW_DESC calcDefaultSrvDesc(BufferType type) const; + + /// Allocates a srv view. Stores the index in m_srvView. If < 0 there isn't an associated srv + /// If the desc isn't set one will be created via calcDefaultSrvDesc + int allocateSrvView(BufferType type, ID3D12Device* device, Dx12DescriptorHeap& heap, const D3D12_SHADER_RESOURCE_VIEW_DESC* desc = nullptr); + + /// Gets the appropriate format for reading as srv + DXGI_FORMAT getSrvFormat(BufferType type) const; + /// Gets the suitable target for rendering to + DXGI_FORMAT getTargetFormat(BufferType type) const; + /// Get the amount of render targets + inline int getNumRenderTargets() const { return m_renderTarget ? 1 : 0; } + + /// Create a srv at the index on the heap for the buffer type + void createSrv(ID3D12Device* device, Dx12DescriptorHeap& heap, BufferType type, int descriptorIndex); + + /// Get an associated srv heap index (as produced by allocateSrvView) + inline int getSrvHeapIndex(BufferType type) const { return m_srvIndices[type]; } + + /// Get the desc + inline const Desc& getDesc() const { return m_desc; } + + Dx12RenderTarget(); + + static DxFormatUtil::UsageType getUsageType(BufferType type); + + int m_srvIndices[BUFFER_COUNT_OF]; + + XMMATRIX m_shadowLightView; + XMMATRIX m_shadowLightProjection; + XMMATRIX m_shadowLightWorldToTex; + + Desc m_desc; + + D3D12_VIEWPORT m_viewport; + D3D12_RECT m_scissorRect; + + Dx12Resource m_renderTarget; + ComPtr<ID3D12DescriptorHeap> m_descriptorHeapRtv; + Dx12Resource m_depthStencilBuffer; + ComPtr<ID3D12DescriptorHeap> m_descriptorHeapDsv; +}; + +} // namespace Common +} // namespace nvidia + +#endif // NV_CO_DX12_RENDER_TARGET_H
\ No newline at end of file diff --git a/demo/d3d12/NvCoDx12Resource.cpp b/demo/d3d12/NvCoDx12Resource.cpp new file mode 100644 index 0000000..e771a15 --- /dev/null +++ b/demo/d3d12/NvCoDx12Resource.cpp @@ -0,0 +1,167 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#include "NvCoDx12Resource.h" + +#include <assert.h> + +#define NOMINMAX +#include <wrl.h> +using namespace Microsoft::WRL; + +namespace nvidia { +namespace Common { + +/* !!!!!!!!!!!!!!!!!!!!!!!!! Dx12BarrierSubmitter !!!!!!!!!!!!!!!!!!!!!!!! */ + +void Dx12BarrierSubmitter::_flush() +{ + assert(m_numBarriers > 0); + + if (m_commandList) + { + m_commandList->ResourceBarrier(UINT(m_numBarriers), m_barriers); + } + m_numBarriers = 0; +} + +D3D12_RESOURCE_BARRIER& Dx12BarrierSubmitter::_expandOne() +{ + _flush(); + return m_barriers[m_numBarriers++]; +} + +/* !!!!!!!!!!!!!!!!!!!!!!!!! Dx12ResourceBase !!!!!!!!!!!!!!!!!!!!!!!! */ + +void Dx12ResourceBase::transition(D3D12_RESOURCE_STATES nextState, Dx12BarrierSubmitter& submitter) +{ + // If there is no resource, then there is nothing to transition + if (!m_resource) + { + return; + } + + if (nextState != m_state) + { + D3D12_RESOURCE_BARRIER& barrier = submitter.expandOne(); + + const UINT subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES; + const D3D12_RESOURCE_BARRIER_FLAGS flags = D3D12_RESOURCE_BARRIER_FLAG_NONE; + + memset(&barrier, 0, sizeof(barrier)); + barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + barrier.Flags = flags; + barrier.Transition.pResource = m_resource; + barrier.Transition.StateBefore = m_state; + barrier.Transition.StateAfter = nextState; + barrier.Transition.Subresource = subresource; + + m_prevState = m_state; + m_state = nextState; + } + else + { + if (nextState == D3D12_RESOURCE_STATE_UNORDERED_ACCESS) + { + D3D12_RESOURCE_BARRIER& barrier = submitter.expandOne(); + + memset(&barrier, 0, sizeof(barrier)); + barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV; + barrier.UAV.pResource = m_resource; + + m_state = nextState; + } + } +} + +/* static */DXGI_FORMAT Dx12ResourceBase::calcFormat(DxFormatUtil::UsageType usage, ID3D12Resource* resource) +{ + return resource ? DxFormatUtil::calcFormat(usage, resource->GetDesc().Format) : DXGI_FORMAT_UNKNOWN; +} + +/* !!!!!!!!!!!!!!!!!!!!!!!!! Dx12Resource !!!!!!!!!!!!!!!!!!!!!!!! */ + +/* static */void Dx12Resource::setDebugName(ID3D12Resource* resource, const std::wstring& name) +{ + if (resource) + { + resource->SetName(name.c_str()); + } +} + +void Dx12Resource::setDebugName(const std::wstring& name) +{ + setDebugName(m_resource, name); +} + +void Dx12Resource::setDebugName(const wchar_t* name) +{ + if (m_resource) + { + m_resource->SetName(name); + } +} + +void Dx12Resource::setResource(ID3D12Resource* resource, D3D12_RESOURCE_STATES initialState) +{ + if (resource != m_resource) + { + if (resource) + { + resource->AddRef(); + } + if (m_resource) + { + m_resource->Release(); + } + m_resource = resource; + } + m_prevState = initialState; + m_state = initialState; +} + +void Dx12Resource::setResourceNull() +{ + if (m_resource) + { + m_resource->Release(); + m_resource = nullptr; + } +} + +int Dx12Resource::initCommitted(ID3D12Device* device, const D3D12_HEAP_PROPERTIES& heapProps, D3D12_HEAP_FLAGS heapFlags, const D3D12_RESOURCE_DESC& resourceDesc, D3D12_RESOURCE_STATES initState, const D3D12_CLEAR_VALUE * clearValue) +{ + setResourceNull(); + ComPtr<ID3D12Resource> resource; + NV_RETURN_ON_FAIL(device->CreateCommittedResource(&heapProps, heapFlags, &resourceDesc, initState, clearValue, IID_PPV_ARGS(&resource))); + setResource(resource.Get(), initState); + return NV_OK; +} + +ID3D12Resource* Dx12Resource::detach() +{ + ID3D12Resource* resource = m_resource; + m_resource = nullptr; + return resource; +} + +void Dx12Resource::swap(ComPtr<ID3D12Resource>& resourceInOut) +{ + ID3D12Resource* tmp = m_resource; + m_resource = resourceInOut.Detach(); + resourceInOut.Attach(tmp); +} + +void Dx12Resource::setState(D3D12_RESOURCE_STATES state) +{ + m_prevState = state; + m_state = state; +} + + +} // namespace Common +} // namespace nvidia diff --git a/demo/d3d12/NvCoDx12Resource.h b/demo/d3d12/NvCoDx12Resource.h new file mode 100644 index 0000000..9bb8dab --- /dev/null +++ b/demo/d3d12/NvCoDx12Resource.h @@ -0,0 +1,140 @@ +#ifndef NV_CO_DX12_RESOURCE_H +#define NV_CO_DX12_RESOURCE_H + +#include <NvResult.h> +#include <NvCoDxFormatUtil.h> + +#define NOMINMAX +#include <d3d12.h> +#include <string> +#include <wrl.h> + +using namespace Microsoft::WRL; + +namespace nvidia { +namespace Common { + +// Enables more conservative barriers - restoring the state of resources after they are used. +// Should not need to be enabled in normal builds, as the barriers should correctly sync resources +// If enabling fixes an issue it implies regular barriers are not correctly used. +#define NV_CO_ENABLE_CONSERVATIVE_RESOURCE_BARRIERS 0 + +struct Dx12BarrierSubmitter +{ + enum { MAX_BARRIERS = 8 }; + + /// Expand one space to hold a barrier + inline D3D12_RESOURCE_BARRIER& expandOne() { return (m_numBarriers < MAX_BARRIERS) ? m_barriers[m_numBarriers++] : _expandOne(); } + /// Flush barriers to command list + inline void flush() { if (m_numBarriers > 0) _flush(); } + + /// Ctor + inline Dx12BarrierSubmitter(ID3D12GraphicsCommandList* commandList):m_numBarriers(0), m_commandList(commandList) { } + /// Dtor + inline ~Dx12BarrierSubmitter() { flush(); } + + protected: + D3D12_RESOURCE_BARRIER& _expandOne(); + void _flush(); + + ID3D12GraphicsCommandList* m_commandList; + ptrdiff_t m_numBarriers; + D3D12_RESOURCE_BARRIER m_barriers[MAX_BARRIERS]; +}; + +/** The base class for resource types allows for tracking of state. It does not allow for setting of the resource though, such that +an interface can return a Dx12ResourceBase, and a client cant manipulate it's state, but it cannot replace/change the actual resource */ +struct Dx12ResourceBase +{ + /// Add a transition if necessary to the list + void transition(D3D12_RESOURCE_STATES nextState, Dx12BarrierSubmitter& submitter); + /// Get the current state + inline D3D12_RESOURCE_STATES getState() const { return m_state; } + + /// Get the associated resource + inline ID3D12Resource* getResource() const { return m_resource; } + + /// True if a resource is set + inline bool isSet() const { return m_resource != nullptr; } + + /// Coercable into ID3D12Resource + inline operator ID3D12Resource*() const { return m_resource; } + + /// restore previous state +#if NV_CO_ENABLE_CONSERVATIVE_RESOURCE_BARRIERS + inline void restore(Dx12BarrierSubmitter& submitter) { transition(m_prevState, submitter); } +#else + inline void restore(Dx12BarrierSubmitter& submitter) { (void)submitter; } +#endif + + /// Given the usage, flags, and format will return the most suitable format. Will return DXGI_UNKNOWN if combination is not possible + static DXGI_FORMAT calcFormat(DxFormatUtil::UsageType usage, ID3D12Resource* resource); + + /// Ctor + inline Dx12ResourceBase() : + m_state(D3D12_RESOURCE_STATE_COMMON), + m_prevState(D3D12_RESOURCE_STATE_COMMON), + m_resource(nullptr) + {} + + protected: + /// This is protected so as clients cannot slice the class, and so state tracking is lost + ~Dx12ResourceBase() {} + + ID3D12Resource* m_resource; + D3D12_RESOURCE_STATES m_state; + D3D12_RESOURCE_STATES m_prevState; +}; + +struct Dx12Resource: public Dx12ResourceBase +{ + + /// Dtor + ~Dx12Resource() + { + if (m_resource) + { + m_resource->Release(); + } + } + + /// Initialize as committed resource + int initCommitted(ID3D12Device* device, const D3D12_HEAP_PROPERTIES& heapProps, D3D12_HEAP_FLAGS heapFlags, const D3D12_RESOURCE_DESC& resourceDesc, D3D12_RESOURCE_STATES initState, const D3D12_CLEAR_VALUE * clearValue); + + /// Set a resource with an initial state + void setResource(ID3D12Resource* resource, D3D12_RESOURCE_STATES initialState); + /// Make the resource null + void setResourceNull(); + /// Returns the attached resource (with any ref counts) and sets to nullptr on this. + ID3D12Resource* detach(); + + /// Swaps the resource contents with the contents of the smart pointer + void swap(ComPtr<ID3D12Resource>& resourceInOut); + + /// Sets the current state of the resource (the current state is taken to be the future state once the command list has executed) + /// NOTE! This must be used with care, otherwise state tracking can be made incorrect. + void setState(D3D12_RESOURCE_STATES state); + + /// Set the debug name on a resource + static void setDebugName(ID3D12Resource* resource, const std::wstring& name); + + /// Set the the debug name on the resource + void setDebugName(const wchar_t* name); + /// Set the debug name + void setDebugName(const std::wstring& name); +}; + +/// Convenient way to set blobs +struct Dx12Blob : public D3D12_SHADER_BYTECODE +{ + template <size_t SIZE> + inline Dx12Blob(const BYTE(&in)[SIZE]) { pShaderBytecode = in; BytecodeLength = SIZE; } + inline Dx12Blob(const BYTE* in, size_t size) { pShaderBytecode = in; BytecodeLength = size; } + inline Dx12Blob() { pShaderBytecode = nullptr; BytecodeLength = 0; } + inline Dx12Blob(ID3DBlob* blob) { pShaderBytecode = blob->GetBufferPointer(); BytecodeLength = blob->GetBufferSize(); } +}; + +} // namespace Common +} // namespace nvidia + +#endif // NV_CO_DX12_RESOURCE_H diff --git a/demo/d3d12/NvCoDx12ResourceScopeManager.cpp b/demo/d3d12/NvCoDx12ResourceScopeManager.cpp new file mode 100644 index 0000000..268ecab --- /dev/null +++ b/demo/d3d12/NvCoDx12ResourceScopeManager.cpp @@ -0,0 +1,179 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#include "NvCoDx12ResourceScopeManager.h" + +#include <assert.h> + +namespace nvidia { +namespace Common { + +Dx12ResourceScopeManager::Dx12ResourceScopeManager(): + m_fence(nullptr), + m_device(nullptr) +{ +} + +Dx12ResourceScopeManager::~Dx12ResourceScopeManager() +{ + while (!m_entryQueue.empty()) + { + Entry& entry = m_entryQueue.front(); + entry.m_resource->Release(); + m_entryQueue.pop_front(); + } +} + +int Dx12ResourceScopeManager::init(ID3D12Device* device, Dx12CounterFence* fence) +{ + m_fence = fence; + m_device = device; + return NV_OK; +} + +void Dx12ResourceScopeManager::addSync(uint64_t signalValue) +{ + (void)signalValue; + + assert(m_fence->getCurrentValue() == signalValue); +} + +void Dx12ResourceScopeManager::updateCompleted() +{ + const uint64_t completedValue = m_fence->getCompletedValue(); + if (!m_entryQueue.empty()) + { + const Entry& entry = m_entryQueue.front(); + if (entry.m_completedValue >= completedValue) + { + return; + } + entry.m_resource->Release(); + m_entryQueue.pop_front(); + } +} + +ID3D12Resource* Dx12ResourceScopeManager::newUploadResource(const D3D12_RESOURCE_DESC& resourceDesc, const D3D12_CLEAR_VALUE* clearValue) +{ + D3D12_HEAP_PROPERTIES heapProps; + { + heapProps.Type = D3D12_HEAP_TYPE_UPLOAD; + heapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; + heapProps.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; + heapProps.CreationNodeMask = 1; + heapProps.VisibleNodeMask = 1; + } + const D3D12_HEAP_FLAGS heapFlags = D3D12_HEAP_FLAG_NONE; + + const D3D12_RESOURCE_STATES initialState = D3D12_RESOURCE_STATE_GENERIC_READ; + + ComPtr<ID3D12Resource> resource; + int res = m_device->CreateCommittedResource(&heapProps, heapFlags, &resourceDesc, initialState, clearValue, IID_PPV_ARGS(&resource)); + if (NV_FAILED(res)) return nullptr; + + // Get the current fence count + const uint64_t completedValue = m_fence->getCurrentValue(); + + Entry entry; + entry.m_completedValue = completedValue; + entry.m_resource = resource.Detach(); + m_entryQueue.push_back(entry); + + return entry.m_resource; +} + +/* static */void Dx12ResourceScopeManager::copy(const D3D12_SUBRESOURCE_DATA& src, size_t rowSizeInBytes, int numRows, int numSlices, const D3D12_MEMCPY_DEST& dst) +{ + for (int i = 0; i < numSlices; ++i) + { + uint8_t* dstSlice = reinterpret_cast<uint8_t*>(dst.pData) + dst.SlicePitch * i; + const uint8_t* srcSlice = reinterpret_cast<const uint8_t*>(src.pData) + src.SlicePitch * i; + for (int j = 0; j < numRows; ++j) + { + memcpy(dstSlice + dst.RowPitch * j, srcSlice + src.RowPitch * j, rowSizeInBytes); + } + } +} + +int Dx12ResourceScopeManager::upload(ID3D12GraphicsCommandList* commandList, const void* srcDataIn, ID3D12Resource* targetResource, D3D12_RESOURCE_STATES targetState) +{ + // Get the targetDesc + const D3D12_RESOURCE_DESC targetDesc = targetResource->GetDesc(); + // Ensure it is just a regular buffer + assert(targetDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER); + assert(targetDesc.Layout == D3D12_TEXTURE_LAYOUT_ROW_MAJOR); + + // The buffer size is the width + const size_t bufferSize = size_t(targetDesc.Width); + + D3D12_RESOURCE_DESC uploadDesc = targetDesc; + uploadDesc.Flags = D3D12_RESOURCE_FLAG_NONE; + + // Create the upload resource + ID3D12Resource* uploadResource = newUploadResource(uploadDesc); + + // Map it and copy + { + uint8_t* uploadMapped; + NV_RETURN_ON_FAIL(uploadResource->Map(0, nullptr, (void**)&uploadMapped)); + memcpy(uploadMapped, srcDataIn, bufferSize); + uploadResource->Unmap(0, nullptr); + } + + // Add the copy + commandList->CopyBufferRegion(targetResource, 0, uploadResource, 0, bufferSize); + + // Add the barrier + { + D3D12_RESOURCE_BARRIER barrier = {}; + + barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE; + D3D12_RESOURCE_TRANSITION_BARRIER& transition = barrier.Transition; + transition.pResource = targetResource; + transition.StateBefore = D3D12_RESOURCE_STATE_COPY_DEST; + transition.StateAfter = targetState; + transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES; + + commandList->ResourceBarrier(1, &barrier); + } + + return NV_OK; +} + +void Dx12ResourceScopeManager::add(ID3D12Resource* resource) +{ + assert(resource); + + // Get the current fence count + const uint64_t completedValue = m_fence->getCurrentValue(); + + Entry entry; + entry.m_completedValue = completedValue; + resource->AddRef(); + entry.m_resource = resource; + + m_entryQueue.push_back(entry); +} + +int Dx12ResourceScopeManager::uploadWithState(ID3D12GraphicsCommandList* commandList, const void* srcDataIn, Dx12Resource& target, D3D12_RESOURCE_STATES targetState) +{ + // make sure we are in the correct initial state + if (target.getState() != D3D12_RESOURCE_STATE_COPY_DEST) + { + Dx12BarrierSubmitter submitter(commandList); + target.transition(D3D12_RESOURCE_STATE_COPY_DEST, submitter); + } + // Do the upload + NV_RETURN_ON_FAIL(upload(commandList, srcDataIn, target.getResource(), targetState)); + target.setState(targetState); + return NV_OK; +} + + +} // namespace Common +} // namespace nvidia diff --git a/demo/d3d12/NvCoDx12ResourceScopeManager.h b/demo/d3d12/NvCoDx12ResourceScopeManager.h new file mode 100644 index 0000000..7bd71ff --- /dev/null +++ b/demo/d3d12/NvCoDx12ResourceScopeManager.h @@ -0,0 +1,100 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#ifndef NV_CO_DX12_RESOURCE_SCOPE_MANAGER_H +#define NV_CO_DX12_RESOURCE_SCOPE_MANAGER_H + +#include "NvCoDx12Resource.h" +#include "NvCoDx12CounterFence.h" + +// Dx12 types +#define NOMINMAX +#include <d3d12.h> + +#include <deque> + +/** \addtogroup common +@{ +*/ + +namespace nvidia { +namespace Common { + +/*! \brief A class to manage the lifetime of resources that are transitory (as used only for a single specific piece of GPU work), +but arbitrarily sized - such as textures. + +With Dx12 there is no management for the lifetime of resources within the Api directly. It is the duty of +the application to make sure resources are released when they are no longer being referenced. The Dx12ResourceScopeManager +tries to simplify this management for some common use cases. Firstly when creating a GPU based resource and filling it +with data, the data must first be copied to an upload buffer, and then to the target gpu based buffer. The upload buffer +is only needed whilst copying takes place. The method 'upload' will create a temporary upload buffer, and initiate the +copy into target. + +The upload resource will ONLY BE RELEASED when the fences value is greater than the current value. Assuming the command list +is added to the queue, and the fence is added afterwards (which is the appropriate way), the resources will only be released +after the fence has been hit AND when updateCompleted is called. + +The Dx12ResourceScopeManager is most useful for resource uploads that happen at startup, and might be very large. If you want to +upload constrained sized (like constant buffer) resources quickly and efficiently at runtime you might be better using Dx12CircularResourceHeap. + +The Dx12ResourceScopeManager uses the addSync/updateCompleted idiom, see details in Dx12CircularResourceHeap. + +*/ +class Dx12ResourceScopeManager +{ + //NV_CO_DECLARE_CLASS_BASE(Dx12ResourceScopeManager); +public: + /// Initialize + int init(ID3D12Device* device, Dx12CounterFence* fence); + + /// Allocate constant buffer of specified size + ID3D12Resource* newUploadResource(const D3D12_RESOURCE_DESC& resourceDesc, const D3D12_CLEAR_VALUE* clearValue = nullptr); + /// Do an upload on the specified command list + int upload(ID3D12GraphicsCommandList* commandList, const void* srcDataIn, ID3D12Resource* target, D3D12_RESOURCE_STATES targetState); + /// Upload data to the target, and set state. Will add barriers if target is in the wrong state + int uploadWithState(ID3D12GraphicsCommandList* commandList, const void* srcDataIn, Dx12Resource& target, D3D12_RESOURCE_STATES targetState); + + /// Add a resource, which will be released when updateCompleted has a greater value + void add(ID3D12Resource* resource); + + /// Look where the GPU has got to and release anything not currently used + void updateCompleted(); + /// Add a sync point - meaning that when this point is hit in the queue + /// all of the resources up to this point will no longer be used. + void addSync(uint64_t signalValue); + + /// Get the device associated with this manager + inline ID3D12Device* getDevice() const { return m_device; } + + /// Ctor + Dx12ResourceScopeManager(); + /// Dtor + ~Dx12ResourceScopeManager(); + + /// Copy from src to dst + static void copy(const D3D12_SUBRESOURCE_DATA& src, size_t rowSizeInBytes, int numRows, int numSlices, const D3D12_MEMCPY_DEST& dst); + + protected: + + struct Entry + { + uint64_t m_completedValue; ///< If less than fence value this is completed + ID3D12Resource* m_resource; ///< The mapped resource + }; + + std::deque<Entry> m_entryQueue; + + Dx12CounterFence* m_fence; ///< The fence to use + ID3D12Device* m_device; ///< The device that resources will be constructed on +}; + +} // namespace Common +} // namespace nvidia + +/** @} */ + +#endif // NV_CO_DX12_RESOURCE_SCOPE_MANAGER_H diff --git a/demo/d3d12/NvCoDxDebugUtil.cpp b/demo/d3d12/NvCoDxDebugUtil.cpp new file mode 100644 index 0000000..b5ef17c --- /dev/null +++ b/demo/d3d12/NvCoDxDebugUtil.cpp @@ -0,0 +1,32 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#include "NvCoDxDebugUtil.h" + +namespace nvidia { +namespace Common { + +/* static */int DxDebugUtil::getDebugInterface(IDXGIDebug** debugOut) +{ + HMODULE module = GetModuleHandleA("Dxgidebug.dll"); + if (module) + { + //WINAPI + typedef HRESULT(WINAPI *FuncType)(REFIID riid, void **ppDebug); + FARPROC funcAddr = GetProcAddress(module, "DXGIGetDebugInterface"); + + FuncType debugFunc = (FuncType)funcAddr; + if (debugFunc) + { + return debugFunc(__uuidof(IDXGIDebug), (void**)debugOut); + } + } + return NV_FAIL; +} + +} // namespace Common +} // namespace nvidia diff --git a/demo/d3d12/NvCoDxDebugUtil.h b/demo/d3d12/NvCoDxDebugUtil.h new file mode 100644 index 0000000..8916ecf --- /dev/null +++ b/demo/d3d12/NvCoDxDebugUtil.h @@ -0,0 +1,37 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#ifndef NV_CO_DX_DEBUG_UTIL_H +#define NV_CO_DX_DEBUG_UTIL_H + +#include <NvResult.h> + +#define NOMINMAX +#include <DXGIDebug.h> +#include <wrl.h> + +using namespace Microsoft::WRL; + +/** \addtogroup common +@{ +*/ + +namespace nvidia { +namespace Common { + +struct DxDebugUtil +{ + /// Get the debug interface + static int getDebugInterface(IDXGIDebug** debugOut); +}; + +} // namespace Common +} // namespace nvidia + +/** @} */ + +#endif // NV_CO_DX12_DEBUG_UTIL_H diff --git a/demo/d3d12/NvCoDxFormatUtil.cpp b/demo/d3d12/NvCoDxFormatUtil.cpp new file mode 100644 index 0000000..7facf2e --- /dev/null +++ b/demo/d3d12/NvCoDxFormatUtil.cpp @@ -0,0 +1,173 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#include "NvCoDxFormatUtil.h" + +#include <stdio.h> + +namespace nvidia { +namespace Common { + +/* static */DXGI_FORMAT DxFormatUtil::calcResourceFormat(UsageType usage, int usageFlags, DXGI_FORMAT format) +{ + (void)usage; + if (usageFlags) + { + switch (format) + { + case DXGI_FORMAT_R32_FLOAT: + case DXGI_FORMAT_D32_FLOAT: return DXGI_FORMAT_R32_TYPELESS; + case DXGI_FORMAT_D24_UNORM_S8_UINT: return DXGI_FORMAT_R24G8_TYPELESS; + default: break; + } + return format; + } + return format; +} + +/* static */DXGI_FORMAT DxFormatUtil::calcFormat(UsageType usage, DXGI_FORMAT format) +{ + switch (usage) + { + case USAGE_COUNT_OF: + case USAGE_UNKNOWN: + { + return DXGI_FORMAT_UNKNOWN; + } + case USAGE_DEPTH_STENCIL: + { + switch (format) + { + case DXGI_FORMAT_D32_FLOAT: + case DXGI_FORMAT_R32_TYPELESS: return DXGI_FORMAT_D32_FLOAT; + case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: return DXGI_FORMAT_D24_UNORM_S8_UINT; + case DXGI_FORMAT_R24G8_TYPELESS: return DXGI_FORMAT_D24_UNORM_S8_UINT; + default: break; + } + return format; + } + case USAGE_TARGET: + { + switch (format) + { + case DXGI_FORMAT_D32_FLOAT: + case DXGI_FORMAT_D24_UNORM_S8_UINT: return DXGI_FORMAT_UNKNOWN; + case DXGI_FORMAT_R32_TYPELESS: return DXGI_FORMAT_R32_FLOAT; + default: break; + } + return format; + } + case USAGE_SRV: + { + switch (format) + { + case DXGI_FORMAT_D32_FLOAT: + case DXGI_FORMAT_R32_TYPELESS: return DXGI_FORMAT_R32_FLOAT; + case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS; + default: break; + } + + return format; + } + } + + printf("Not reachable"); + return DXGI_FORMAT_UNKNOWN; +} + +bool DxFormatUtil::isTypeless(DXGI_FORMAT format) +{ + switch (format) + { + case DXGI_FORMAT_R32G32B32A32_TYPELESS: + case DXGI_FORMAT_R32G32B32_TYPELESS: + case DXGI_FORMAT_R16G16B16A16_TYPELESS: + case DXGI_FORMAT_R32G32_TYPELESS: + case DXGI_FORMAT_R32G8X24_TYPELESS: + case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: + case DXGI_FORMAT_R10G10B10A2_TYPELESS: + case DXGI_FORMAT_R8G8B8A8_TYPELESS: + case DXGI_FORMAT_R16G16_TYPELESS: + case DXGI_FORMAT_R32_TYPELESS: + case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: + case DXGI_FORMAT_R24G8_TYPELESS: + case DXGI_FORMAT_R8G8_TYPELESS: + case DXGI_FORMAT_R16_TYPELESS: + case DXGI_FORMAT_R8_TYPELESS: + case DXGI_FORMAT_BC1_TYPELESS: + case DXGI_FORMAT_BC2_TYPELESS: + case DXGI_FORMAT_BC3_TYPELESS: + case DXGI_FORMAT_BC4_TYPELESS: + case DXGI_FORMAT_BC5_TYPELESS: + case DXGI_FORMAT_B8G8R8A8_TYPELESS: + case DXGI_FORMAT_BC6H_TYPELESS: + case DXGI_FORMAT_BC7_TYPELESS: + { + return true; + } + default: break; + } + return false; +} + +/* static */int DxFormatUtil::getNumColorChannelBits(DXGI_FORMAT fmt) +{ + switch (fmt) + { + case DXGI_FORMAT_R32G32B32A32_TYPELESS: + case DXGI_FORMAT_R32G32B32A32_FLOAT: + case DXGI_FORMAT_R32G32B32A32_UINT: + case DXGI_FORMAT_R32G32B32A32_SINT: + case DXGI_FORMAT_R32G32B32_TYPELESS: + case DXGI_FORMAT_R32G32B32_FLOAT: + case DXGI_FORMAT_R32G32B32_UINT: + case DXGI_FORMAT_R32G32B32_SINT: + return 32; + + case DXGI_FORMAT_R16G16B16A16_TYPELESS: + case DXGI_FORMAT_R16G16B16A16_FLOAT: + case DXGI_FORMAT_R16G16B16A16_UNORM: + case DXGI_FORMAT_R16G16B16A16_UINT: + case DXGI_FORMAT_R16G16B16A16_SNORM: + case DXGI_FORMAT_R16G16B16A16_SINT: + return 16; + + case DXGI_FORMAT_R10G10B10A2_TYPELESS: + case DXGI_FORMAT_R10G10B10A2_UNORM: + case DXGI_FORMAT_R10G10B10A2_UINT: + case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: + return 10; + + case DXGI_FORMAT_R8G8B8A8_TYPELESS: + case DXGI_FORMAT_R8G8B8A8_UNORM: + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: + case DXGI_FORMAT_R8G8B8A8_UINT: + case DXGI_FORMAT_R8G8B8A8_SNORM: + case DXGI_FORMAT_R8G8B8A8_SINT: + case DXGI_FORMAT_B8G8R8A8_UNORM: + case DXGI_FORMAT_B8G8R8X8_UNORM: + case DXGI_FORMAT_B8G8R8A8_TYPELESS: + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: + case DXGI_FORMAT_B8G8R8X8_TYPELESS: + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: + return 8; + + case DXGI_FORMAT_B5G6R5_UNORM: + case DXGI_FORMAT_B5G5R5A1_UNORM: + return 5; + + case DXGI_FORMAT_B4G4R4A4_UNORM: + return 4; + + default: + return 0; + } +} + + +} // namespace Common +} // namespace nvidia diff --git a/demo/d3d12/NvCoDxFormatUtil.h b/demo/d3d12/NvCoDxFormatUtil.h new file mode 100644 index 0000000..e749ea8 --- /dev/null +++ b/demo/d3d12/NvCoDxFormatUtil.h @@ -0,0 +1,41 @@ +#ifndef NV_CO_DX_FORMAT_UTIL_H +#define NV_CO_DX_FORMAT_UTIL_H + +#define NOMINMAX +#include <dxgi.h> + +namespace nvidia { +namespace Common { + +struct DxFormatUtil +{ + enum UsageType + { + USAGE_UNKNOWN, ///< Generally used to mark an error + USAGE_TARGET, ///< Format should be used when written as target + USAGE_DEPTH_STENCIL, ///< Format should be used when written as depth stencil + USAGE_SRV, ///< Format if being read as srv + USAGE_COUNT_OF, + }; + enum UsageFlag + { + USAGE_FLAG_MULTI_SAMPLE = 0x1, + USAGE_FLAG_SRV = 0x2, + }; + + /// Given the usage, flags, and format will return the most suitable format. Will return DXGI_UNKNOWN if combination is not possible + static DXGI_FORMAT calcFormat(UsageType usage, DXGI_FORMAT format); + /// Calculate appropriate format for creating a buffer for usage and flags + static DXGI_FORMAT calcResourceFormat(UsageType usage, int usageFlags, DXGI_FORMAT format); + /// True if the type is 'typeless' + static bool isTypeless(DXGI_FORMAT format); + + /// Returns number of bits used for color channel for format (for channels with multiple sizes, returns smallest ie RGB565 -> 5) + static int getNumColorChannelBits(DXGI_FORMAT fmt); + +}; + +} // namespace Common +} // namespace nvidia + +#endif // NV_CO_DX12_RESOURCE_H diff --git a/demo/d3d12/NvCoFreeList.cpp b/demo/d3d12/NvCoFreeList.cpp new file mode 100644 index 0000000..72b23b2 --- /dev/null +++ b/demo/d3d12/NvCoFreeList.cpp @@ -0,0 +1,232 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#include "NvCoFreeList.h" + +#include <stdlib.h> +#include <string.h> + +#define DEFAULT_ALIGNMENT 16 + +namespace nvidia { +namespace Common { + +FreeList::~FreeList() +{ + _deallocateBlocks(m_activeBlocks); + _deallocateBlocks(m_freeBlocks); +} + +void FreeList::_init() +{ + m_top = nullptr; + m_end = nullptr; + + m_activeBlocks = nullptr; + m_freeBlocks = nullptr; + + m_freeElements = nullptr; + + m_elementSize = 0; + m_alignment = 1; + m_blockSize = 0; + m_blockAllocationSize = 0; + //m_allocator = nullptr; +} + +void FreeList::_init(size_t elementSize, size_t alignment, size_t elemsPerBlock) +{ + //allocator = allocator ? allocator : MemoryAllocator::getInstance(); + //assert(allocator); + //m_allocator = allocator; + + alignment = (alignment < sizeof(void*)) ? sizeof(void*) : alignment; + + // Alignment must be a power of 2 + assert(((alignment - 1) & alignment) == 0); + + // The elementSize must at least be + elementSize = (elementSize >= alignment) ? elementSize : alignment; + m_blockSize = elementSize * elemsPerBlock; + m_elementSize = elementSize; + m_alignment = alignment; + + // Calculate the block size neeed, correcting for alignment + const size_t alignedBlockSize = (alignment <= DEFAULT_ALIGNMENT) ? + _calcAlignedBlockSize(DEFAULT_ALIGNMENT) : + _calcAlignedBlockSize(alignment); + + // Make the block struct size aligned + m_blockAllocationSize = m_blockSize + alignedBlockSize; + + m_top = nullptr; + m_end = nullptr; + + m_activeBlocks = nullptr; + m_freeBlocks = nullptr; ///< Blocks that there are no allocations in + + m_freeElements = nullptr; +} + +void FreeList::init(size_t elementSize, size_t alignment, size_t elemsPerBlock) +{ + _deallocateBlocks(m_activeBlocks); + _deallocateBlocks(m_freeBlocks); + _init(elementSize, alignment, elemsPerBlock); +} + +void FreeList::_deallocateBlocks(Block* block) +{ + while (block) + { + Block* next = block->m_next; + +#ifdef NV_CO_FREE_LIST_INIT_MEM + Memory::set(block, 0xfd, m_blockAllocationSize); +#endif + + free(block); + block = next; + } +} + +bool FreeList::isValidAllocation(const void* dataIn) const +{ + uint8_t* data = (uint8_t*)dataIn; + + Block* block = m_activeBlocks; + while (block) + { + uint8_t* start = block->m_data; + uint8_t* end = start + m_blockSize; + + if (data >= start && data < end) + { + // Check it's aligned correctly + if ((data - start) % m_elementSize) + { + return false; + } + + // Non allocated data is between top and end + if (data >= m_top && data < m_end) + { + return false; + } + + // It can't be in the free list + Element* ele = m_freeElements; + while (ele) + { + if (ele == (Element*)data) + { + return false; + } + + ele = ele->m_next; + } + return true; + } + + block = block->m_next; + } + // It's not in an active block -> it cannot be a valid allocation + return false; +} + +void* FreeList::_allocate() +{ + Block* block = m_freeBlocks; + if (block) + { + /// Remove from the free blocks + m_freeBlocks = block->m_next; + } + else + { + block = (Block*)malloc(m_blockAllocationSize); + if (!block) + { + // Allocation failed... doh + return nullptr; + } + // Do the alignment + { + size_t fix = (size_t(block) + sizeof(Block) + m_alignment - 1) & ~(m_alignment - 1); + block->m_data = (uint8_t*)fix; + } + } + + // Attach to the active blocks + block->m_next = m_activeBlocks; + m_activeBlocks = block; + + // Set up top and end + m_end = block->m_data + m_blockSize; + + // Return the first element + uint8_t* element = block->m_data; + m_top = element + m_elementSize; + + NV_CO_FREE_LIST_INIT_ALLOCATE(element) + + return element; +} + +void FreeList::deallocateAll() +{ + Block* block = m_activeBlocks; + if (block) + { + // Find the end block + while (block->m_next) + { +#ifdef NV_CO_FREE_LIST_INIT_MEM + Memory::set(block->m_data, 0xfd, m_blockSize); +#endif + block = block->m_next; + } + // Attach to the freeblocks + block->m_next = m_freeBlocks; + // The list is now all freelists + m_freeBlocks = m_activeBlocks; + // There are no active blocks + m_activeBlocks = nullptr; + } + + m_top = nullptr; + m_end = nullptr; +} + +void FreeList::reset() +{ + _deallocateBlocks(m_activeBlocks); + _deallocateBlocks(m_freeBlocks); + + m_top = nullptr; + m_end = nullptr; + + m_activeBlocks = nullptr; + m_freeBlocks = nullptr; + + m_freeElements = nullptr; +} + + +void FreeList::_initAllocate(void* mem) +{ + memset(mem, 0xcd, m_elementSize); +} + +void FreeList::_initDeallocate(void* mem) +{ + memset(mem, 0xfd, m_elementSize); +} + +} // namespace Common +} // namespace nvidia + diff --git a/demo/d3d12/NvCoFreeList.h b/demo/d3d12/NvCoFreeList.h new file mode 100644 index 0000000..2b71c62 --- /dev/null +++ b/demo/d3d12/NvCoFreeList.h @@ -0,0 +1,154 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#ifndef NV_CO_FREELIST_H +#define NV_CO_FREELIST_H + +#include <assert.h> +#include <stdint.h> + +/** \addtogroup common +@{ +*/ + +namespace nvidia { +namespace Common { + +#if NV_DEBUG +# define NV_CO_FREE_LIST_INIT_MEM +#endif + +#ifdef NV_CO_FREE_LIST_INIT_MEM +# define NV_CO_FREE_LIST_INIT_ALLOCATE(ptr) _initAllocate(ptr); +# define NV_CO_FREE_LIST_INIT_DEALLOCATE(ptr) _initDeallocate(ptr); +#else +# define NV_CO_FREE_LIST_INIT_ALLOCATE(ptr) +# define NV_CO_FREE_LIST_INIT_DEALLOCATE(ptr) +#endif + + +/*! \brief A freelist is a simple and fast memory allocator that can allocate and free in any order identically sized blocks. + +\details A free list is a memory allocation system that performs allocations/deallocations very quickly for elements which are +all the same size. +In a freelist all elements are the same size, and elements can be allocated and freed in any order, as long as every deallocation +matches every allocation. Both allocation and deallocation are O(1), and generally just a few instructions. The underlying +memory allocator will allocate in large blocks, with multiple elements amortizing a more costly large allocation against lots +of fast small element allocations. */ +class FreeList +{ + //NV_CO_DECLARE_CLASS_BASE(FreeList); +public: + /// Free elements are held in a singly linked list. The minimum size of an element is therefore a pointer + struct Element + { + Element* m_next; + }; + struct Block + { + Block* m_next; ///< The next block + uint8_t* m_data; ///< The list of the elements each m_elementSize in size + }; + + /// Allocate a single element + inline void* allocate(); + /// Deallocate a block that was previously allocated with allocate + inline void deallocate(void* data); + + /// Returns true if this is from a valid allocation + bool isValidAllocation(const void* dataIn) const; + + /// Get the element size + inline size_t getElementSize() const { return m_elementSize; } + /// Get the total size of each individual block allocation in bytes + inline size_t getBlockSize() const { return m_blockSize; } + + /// Deallocates all elements + void deallocateAll(); + /// Deallocates all, and frees any backing memory (put in initial state) + void reset(); + + /// Initialize. If called on an already initialized heap, the heap will be deallocated. + void init(size_t elementSize, size_t alignment, size_t elemsPerBlock); + + /// Default Ctor + FreeList() { _init(); } + /// Ctor + FreeList(size_t elementSize, size_t alignment, size_t elemsPerBlock) { _init(elementSize, alignment, elemsPerBlock); } + /// Dtor + ~FreeList(); + + protected: + /// Initializes assuming freelist is not constructed + void _init(size_t elementSize, size_t alignment, size_t elemsPerBlock); + void* _allocate(); + void _deallocateBlocks(Block* block); + /// Initializes setting everything to empty (doesn't free anything if already allocated) + void _init(); + + inline static size_t _calcAlignedBlockSize(size_t align) { return (sizeof(Block) + align - 1) & ~(align - 1); } + + void _initAllocate(void* mem); + void _initDeallocate(void* mem); + + uint8_t* m_top; ///< The top position of the current block + uint8_t* m_end; ///< The end of the current block + + Block* m_activeBlocks; ///< The blocks there are potentially allocations from + Block* m_freeBlocks; ///< Blocks that there are no allocations in + + Element* m_freeElements; ///< A singly linked list of elements available + + size_t m_elementSize; + size_t m_alignment; + size_t m_blockSize; + size_t m_blockAllocationSize; ///< The actual allocation size. Maybe bigger than m_blockSize if alignment requires it. + //MemoryAllocator* m_allocator; +}; + +// -------------------------------------------------------------------------- +inline void* FreeList::allocate() +{ + // First see if there are any freeElements ready to go + { + Element* element = m_freeElements; + if (element) + { + m_freeElements = element->m_next; + NV_CO_FREE_LIST_INIT_ALLOCATE(element) + return element; + } + } + if (m_top >= m_end) + { + return _allocate(); + } + void* data = (void*)m_top; + NV_CO_FREE_LIST_INIT_ALLOCATE(data) + + m_top += m_elementSize; + return data; +} +// -------------------------------------------------------------------------- +inline void FreeList::deallocate(void* data) +{ + assert(isValidAllocation(data)); + + NV_CO_FREE_LIST_INIT_DEALLOCATE(data) + + // Put onto the singly linked free element list + Element* ele = (Element*)data; + ele->m_next = m_freeElements; + m_freeElements = ele; +} + +} // namespace Common +} // namespace nvidia + +/** @} */ + +#endif // NV_CO_FREELIST_H
\ No newline at end of file diff --git a/demo/d3d12/NvResult.h b/demo/d3d12/NvResult.h new file mode 100644 index 0000000..27cf936 --- /dev/null +++ b/demo/d3d12/NvResult.h @@ -0,0 +1,137 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + +#ifndef NV_RESULT_H +#define NV_RESULT_H + +#include <assert.h> + +/** \addtogroup core +@{ +*/ + +/*! Result is designed to be compatible with COM HRESULT. + +It's layout in bits is as follows + +Severity | Facility | Code +---------|----------|----- +31 | 30-16 | 15-0 + +Severity - 1 fail, 0 is success. +Facility is where the error originated from +Code is the code specific to the facility. + +The layout is designed such that failure is a negative number, and success is positive due to Result +being represented by an Int32. + +Result codes have the following style + +1. NV_name +2. NV_s_f_name +3. NV_s_name + +where s is severity as a single letter S - success, and E for error +Style 1 is reserved for NV_OK and NV_FAIL as they are so common and not tied to a facility + +s is S for success, E for error +f is the short version of the facility name + +For the common used NV_OK and NV_FAIL, the name prefix is dropped +It is acceptable to expand 'f' to a longer name to differentiate a name +ie for a facility 'DRIVER' it might make sense to have an error of the form NV_E_DRIVER_OUT_OF_MEMORY */ +typedef int NvResult; + +//! Make a result +#define NV_MAKE_RESULT(sev, fac, code) ((((int)(sev))<<31) | (((int)(fac))<<16) | ((int)(code))) + +//! Will be 0 - for ok, 1 for failure +#define NV_GET_RESULT_SEVERITY(r) ((int)(((NvUInt32)(r)) >> 31)) +//! Will be 0 - for ok, 1 for failure +#define NV_GET_RESULT_FACILITY(r) ((int)(((r) >> 16) & 0x7fff)) +//! Get the result code +#define NV_GET_RESULT_CODE(r) ((int)((r) & 0xffff)) + +#define NV_SEVERITY_ERROR 1 +#define NV_SEVERITY_SUCCESS 0 + +#define NV_MAKE_ERROR(fac, code) NV_MAKE_RESULT(NV_SEVERITY_ERROR, NV_FACILITY_##fac, code) +#define NV_MAKE_SUCCESS(fac, code) NV_MAKE_RESULT(NV_SEVERITY_SUCCESS, NV_FACILITY_##fac, code) + +/*************************** Facilities ************************************/ + +//! General - careful to make compatible with HRESULT +#define NV_FACILITY_GENERAL 0 + +//! Base facility -> so as to not clash with HRESULT values +#define NV_FACILITY_BASE 0x100 + +/*! Facilities numbers must be unique across a project to make the resulting result a unique number! +It can be useful to have a consistent short name for a facility, as used in the name prefix */ +#define NV_FACILITY_DISK (NV_FACILITY_BASE + 1) +#define NV_FACILITY_INTERFACE (NV_FACILITY_BASE + 2) +#define NV_FACILITY_UNKNOWN (NV_FACILITY_BASE + 3) +#define NV_FACILITY_MEMORY (NV_FACILITY_BASE + 4) +#define NV_FACILITY_MISC (NV_FACILITY_BASE + 5) + +/// Base for external facilities. Facilities should be unique across modules. +#define NV_FACILITY_EXTERNAL_BASE 0x200 +#define NV_FACILITY_HAIR (NV_FACILITY_EXTERNAL_BASE + 1) + +/* *************************** Codes **************************************/ + +// Memory +#define NV_E_MEM_OUT_OF_MEMORY NV_MAKE_ERROR(MEMORY, 1) +#define NV_E_MEM_BUFFER_TOO_SMALL NV_MAKE_ERROR(MEMORY, 2) + +//! NV_OK indicates success, and is equivalent to NV_MAKE_RESULT(0, NV_FACILITY_GENERAL, 0) +#define NV_OK 0 +//! NV_FAIL is the generic failure code - meaning a serious error occurred and the call couldn't complete +#define NV_FAIL NV_MAKE_ERROR(GENERAL, 1) + +//! Used to identify a Result that has yet to be initialized. +//! It defaults to failure such that if used incorrectly will fail, as similar in concept to using an uninitialized variable. +#define NV_E_MISC_UNINITIALIZED NV_MAKE_ERROR(MISC, 2) +//! Returned from an async method meaning the output is invalid (thus an error), but a result for the request is pending, and will be returned on a subsequent call with the async handle. +#define NV_E_MISC_PENDING NV_MAKE_ERROR(MISC, 3) +//! Indicates that a handle passed in as parameter to a method is invalid. +#define NV_E_MISC_INVALID_HANDLE NV_MAKE_ERROR(MISC, 4) + +/*! Set NV_HANDLE_RESULT_FAIL(x) to code to be executed whenever an error occurs, and is detected by one of the macros */ +#ifndef NV_HANDLE_RESULT_FAIL +# define NV_HANDLE_RESULT_FAIL(x) +#endif + +/* !!!!!!!!!!!!!!!!!!!!!!!!! Checking codes !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + +//! Use to test if a result was failure. Never use result != NV_OK to test for failure, as there may be successful codes != NV_OK. +#define NV_FAILED(status) ((status) < 0) +//! Use to test if a result succeeded. Never use result == NV_OK to test for success, as will detect other successful codes as a failure. +#define NV_SUCCEEDED(status) ((status) >= 0) + +//! Helper macro, that makes it easy to add result checking to calls in functions/methods that themselves return Result. +#define NV_RETURN_ON_FAIL(x) { NvResult _res = (x); if (NV_FAILED(_res)) { NV_HANDLE_RESULT_FAIL(_res); return _res; } } +//! Helper macro that can be used to test the return value from a call, and will return in a void method/function +#define NV_RETURN_VOID_ON_FAIL(x) { NvResult _res = (x); if (NV_FAILED(_res)) { NV_HANDLE_RESULT_FAIL(_res); return; } } +//! Helper macro that will return false on failure. +#define NV_RETURN_FALSE_ON_FAIL(x) { NvResult _res = (x); if (NV_FAILED(_res)) { NV_HANDLE_RESULT_FAIL(_res); return false; } } + +//! Helper macro that will assert if the return code from a call is failure, also returns the failure. +#define NV_CORE_ASSERT_ON_FAIL(x) { NvResult _res = (x); if (NV_FAILED(_res)) { assert(false); return _res; } } +//! Helper macro that will assert if the result from a call is a failure, also returns. +#define NV_CORE_ASSERT_VOID_ON_FAIL(x) { NvResult _res = (x); if (NV_FAILED(_res)) { assert(false); return; } } + + +#if __cplusplus +namespace nvidia { +typedef NvResult Result; +} // namespace nvidia +#endif + +/** @} */ + +#endif diff --git a/demo/d3d12/appD3D12Ctx.cpp b/demo/d3d12/appD3D12Ctx.cpp new file mode 100644 index 0000000..944453a --- /dev/null +++ b/demo/d3d12/appD3D12Ctx.cpp @@ -0,0 +1,1210 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +//direct3d headers +#define NOMINMAX +#include <d3d12.h> +#include <dxgi1_4.h> + +// include the Direct3D Library file +#pragma comment (lib, "d3d12.lib") +#pragma comment (lib, "DXGI.lib") + +#include "appD3D12Ctx.h" + +#include <stdio.h> + +#include <SDL.h> +#include <SDL_video.h> +#include <SDL_syswm.h> + +namespace +{ + // COM object release utilities + template <class T> + void inline COMRelease(T& t) + { + if (t) t->Release(); + t = nullptr; + } + + template <class T> + void inline COMRelease(T& t, UINT arraySize) + { + for (UINT i = 0; i < arraySize; i++) + { + if (t[i]) t[i]->Release(); + t[i] = nullptr; + } + } +} + +AppGraphProfilerD3D12* appGraphCreateProfilerD3D12(AppGraphCtx* ctx); +void appGraphProfilerD3D12FrameBegin(AppGraphProfilerD3D12* profiler); +void appGraphProfilerD3D12FrameEnd(AppGraphProfilerD3D12* profiler); +void appGraphProfilerD3D12Enable(AppGraphProfilerD3D12* profiler, bool enabled); +void appGraphProfilerD3D12Begin(AppGraphProfilerD3D12* profiler, const char* label); +void appGraphProfilerD3D12End(AppGraphProfilerD3D12* profiler, const char* label); +bool appGraphProfilerD3D12Get(AppGraphProfilerD3D12* profiler, const char** plabel, float* cpuTime, float* gpuTime, int index); +void appGraphReleaseProfiler(AppGraphProfilerD3D12* profiler); + +AppGraphCtxD3D12::AppGraphCtxD3D12() +{ + m_profiler = appGraphCreateProfilerD3D12(cast_from_AppGraphCtxD3D12(this)); + + m_targetInfo.init(); + + memset(m_commandAllocators, 0, sizeof(m_commandAllocators)); + memset(m_fenceValues, 0, sizeof(m_fenceValues)); +} + +AppGraphCtxD3D12::~AppGraphCtxD3D12() +{ + AppGraphCtxReleaseRenderTargetD3D12(cast_from_AppGraphCtxD3D12(this)); + + COMRelease(m_device); + COMRelease(m_commandQueue); + COMRelease(m_rtvHeap); + COMRelease(m_dsvHeap); + COMRelease(m_depthSrvHeap); + COMRelease(m_commandAllocators, m_frameCount); + + COMRelease(m_fence); + CloseHandle(m_fenceEvent); + + COMRelease(m_commandList); + + m_dynamicHeapCbvSrvUav.release(); + + appGraphReleaseProfiler(m_profiler); + m_profiler = nullptr; +} + +AppGraphCtx* AppGraphCtxCreateD3D12(int deviceID) +{ + AppGraphCtxD3D12* context = new AppGraphCtxD3D12; + + HRESULT hr = S_OK; + +#if defined(_DEBUG) + // Enable the D3D12 debug layer. + { + ID3D12Debug* debugController; + if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&debugController)))) + { + debugController->EnableDebugLayer(); + } + COMRelease(debugController); + } +#endif + + UINT debugFlags = 0; +#ifdef _DEBUG + debugFlags |= DXGI_CREATE_FACTORY_DEBUG; +#endif + + // enumerate devices + IDXGIFactory4* pFactory = NULL; + CreateDXGIFactory2(debugFlags, IID_PPV_ARGS(&pFactory)); + IDXGIAdapter1* pAdapterTemp = NULL; + IDXGIAdapter1* pAdapter = NULL; + DXGI_ADAPTER_DESC1 adapterDesc; + int adapterIdx = 0; + while (S_OK == pFactory->EnumAdapters1(adapterIdx, &pAdapterTemp)) + { + pAdapterTemp->GetDesc1(&adapterDesc); + + context->m_dedicatedVideoMemory = (size_t)adapterDesc.DedicatedVideoMemory; + + if (deviceID == adapterIdx) + { + pAdapter = pAdapterTemp; + break; + } + else + { + pAdapterTemp->Release(); + } + adapterIdx++; + } + + // create device + if (hr = D3D12CreateDevice(pAdapter, D3D_FEATURE_LEVEL_11_0, __uuidof(ID3D12Device), (void**)&context->m_device)) + { + delete context; + return nullptr; + } + + // to disable annoying warning +#if 0 + context->m_device->SetStablePowerState(TRUE); +#endif + + // create command queue + { + D3D12_COMMAND_QUEUE_DESC desc; + desc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT; + desc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL; + desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE; + desc.NodeMask = 0; + + if (hr = context->m_device->CreateCommandQueue(&desc, IID_PPV_ARGS(&context->m_commandQueue))) + { + delete context; + return nullptr; + } + } + + // cleanup adapter and factory + COMRelease(pAdapter); + COMRelease(pFactory); + + // create RTV descriptor heap + { + D3D12_DESCRIPTOR_HEAP_DESC desc = {}; + desc.NumDescriptors = context->m_renderTargetCount; + desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; + desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; + if (hr = context->m_device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&context->m_rtvHeap))) + { + delete context; + return nullptr; + } + context->m_rtvDescriptorSize = context->m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); + } + + // create DSV descriptor heap + { + D3D12_DESCRIPTOR_HEAP_DESC desc = {}; + desc.NumDescriptors = 1; + desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV; + desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; + if (hr = context->m_device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&context->m_dsvHeap))) + { + delete context; + return nullptr; + } + } + + // create depth SRV descriptor heap + { + D3D12_DESCRIPTOR_HEAP_DESC desc = {}; + desc.NumDescriptors = 1; + desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; + desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; + if (hr = context->m_device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&context->m_depthSrvHeap))) + { + delete context; + return nullptr; + } + } + + // Create per frame resources + { + for (UINT idx = 0; idx < context->m_frameCount; idx++) + { + if (hr = context->m_device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&context->m_commandAllocators[idx]))) + { + delete context; + return nullptr; + } + } + } + + // create dynamic heap + { + context->m_dynamicHeapCbvSrvUav.init(context->m_device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 256u * 1024u); + } + + // Create command list and close it + { + if (hr = context->m_device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, + context->m_commandAllocators[context->m_frameIndex], nullptr, IID_PPV_ARGS(&context->m_commandList)) + ) + { + delete context; + return nullptr; + } + context->m_commandList->Close(); + } + + // create synchronization objects + { + if (hr = context->m_device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&context->m_fence))) + { + delete context; + return nullptr; + } + + context->m_fenceEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (context->m_fenceEvent == nullptr) + { + delete context; + return nullptr; + } + } + + return cast_from_AppGraphCtxD3D12(context); +} + + +void AppGraphCtxInitRenderTargetD3D12(AppGraphCtx* contextIn, SDL_Window* window, bool fullscreen, int numMSAASamples) +{ + auto context = cast_to_AppGraphCtxD3D12(contextIn); + + HWND hWnd = nullptr; + // get Windows handle to this SDL window + SDL_SysWMinfo winInfo; + SDL_VERSION(&winInfo.version); + if (SDL_GetWindowWMInfo(window, &winInfo)) + { + if (winInfo.subsystem == SDL_SYSWM_WINDOWS) + { + hWnd = winInfo.info.win.window; + } + } + context->m_hWnd = hWnd; + context->m_fullscreen = fullscreen; + + HRESULT hr = S_OK; + + UINT debugFlags = 0; +#ifdef _DEBUG + debugFlags |= DXGI_CREATE_FACTORY_DEBUG; +#endif + + // enumerate devices + IDXGIFactory4* pFactory = NULL; + CreateDXGIFactory2(debugFlags, IID_PPV_ARGS(&pFactory)); + + // create the swap chain + for (int i = 0; i < 2; i++) + { + DXGI_SWAP_CHAIN_DESC desc; + ZeroMemory(&desc, sizeof(desc)); + desc.BufferCount = context->m_renderTargetCount; + desc.BufferDesc.Width = context->m_winW; + desc.BufferDesc.Height = context->m_winH; + desc.BufferDesc.Format = context->m_rtv_format; // DXGI_FORMAT_R8G8B8A8_UNORM; + desc.BufferDesc.RefreshRate.Numerator = 0; + desc.BufferDesc.RefreshRate.Denominator = 0; + desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; + desc.OutputWindow = context->m_hWnd; + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = 0; + desc.Windowed = context->m_fullscreen ? FALSE : TRUE; + desc.Flags = context->m_fullscreen ? 0u : DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT; + + context->m_current_rtvDesc.Format = context->m_rtv_format; + context->m_current_rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; + context->m_current_rtvDesc.Texture2D.MipSlice = 0u; + context->m_current_rtvDesc.Texture2D.PlaneSlice = 0u; + + hr = pFactory->CreateSwapChain(context->m_commandQueue, &desc, (IDXGISwapChain**)&context->m_swapChain); + + if(hr != S_OK) + { + COMRelease(context->m_swapChain); + context->m_fullscreen = false; + continue; + } + + if (!context->m_fullscreen) + { + context->m_swapChainWaitableObject = context->m_swapChain->GetFrameLatencyWaitableObject(); + context->m_swapChain->SetMaximumFrameLatency(context->m_renderTargetCount - 2); + } + else + { + hr = context->m_swapChain->SetFullscreenState(true, nullptr); + if (hr != S_OK) + { + COMRelease(context->m_swapChain); + context->m_fullscreen = false; + continue; + } + DXGI_SWAP_CHAIN_DESC desc = {}; + context->m_swapChain->GetDesc(&desc); + + context->m_winW = desc.BufferDesc.Width; + context->m_winH = desc.BufferDesc.Height; + } + + context->m_frameIndex = context->m_swapChain->GetCurrentBackBufferIndex(); + break; + } + + // configure scissor and viewport + { + context->m_viewport.Width = float(context->m_winW); + context->m_viewport.Height = float(context->m_winH); + context->m_viewport.MaxDepth = 1.f; + + context->m_scissorRect.right = context->m_winW; + context->m_scissorRect.bottom = context->m_winH; + } + + COMRelease(pFactory); + + // create per render target resources + { + D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle = context->m_rtvHeap->GetCPUDescriptorHandleForHeapStart(); + + for (UINT idx = 0; idx < context->m_renderTargetCount; idx++) + { + ComPtr<ID3D12Resource> backBuffer; + if (hr = context->m_swapChain->GetBuffer(idx, IID_PPV_ARGS(&backBuffer))) + { + return; + } + context->m_backBuffers[idx].setDebugName(L"Backbuffer"); + context->m_backBuffers[idx].setResource(backBuffer.Get(), D3D12_RESOURCE_STATE_COMMON); + // Assume they are the same thing for now... + context->m_renderTargets[idx] = &context->m_backBuffers[idx]; + + // If we are multi-sampling - create a render target separate from the back buffer + if (context->m_numMsaaSamples > 1) + { + D3D12_HEAP_PROPERTIES heapProps = {}; + heapProps.Type = D3D12_HEAP_TYPE_DEFAULT; + D3D12_RESOURCE_DESC desc = backBuffer->GetDesc(); + + DXGI_FORMAT resourceFormat; + + if (desc.Format == DXGI_FORMAT_R32_FLOAT || desc.Format == DXGI_FORMAT_D32_FLOAT) + { + resourceFormat = DXGI_FORMAT_R32_TYPELESS; + } + else if (desc.Format == DXGI_FORMAT_D24_UNORM_S8_UINT) + { + resourceFormat = DXGI_FORMAT_R24G8_TYPELESS; + } + else + { + resourceFormat = desc.Format; + } + + DXGI_FORMAT targetFormat = nvidia::Common::DxFormatUtil::calcFormat(nvidia::Common::DxFormatUtil::USAGE_TARGET, resourceFormat); + + // Set the target format + context->m_targetInfo.m_renderTargetFormats[0] = targetFormat; + + D3D12_CLEAR_VALUE clearValue = {}; + clearValue.Format = targetFormat; + + desc.Format = resourceFormat; + desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + desc.SampleDesc.Count = context->m_targetInfo.m_numSamples; + desc.SampleDesc.Quality = context->m_targetInfo.m_sampleQuality; + desc.Alignment = 0; + + context->m_renderTargetResources[idx].initCommitted(context->m_device, heapProps, D3D12_HEAP_FLAG_NONE, desc, D3D12_RESOURCE_STATE_RENDER_TARGET, &clearValue); + context->m_renderTargets[idx] = &context->m_renderTargetResources[idx]; + + context->m_renderTargetResources[idx].setDebugName(L"Render Target"); + } + + context->m_device->CreateRenderTargetView(*context->m_renderTargets[idx], nullptr, rtvHandle); + rtvHandle.ptr += context->m_rtvDescriptorSize; + } + } + + // create the depth stencil + { + D3D12_HEAP_PROPERTIES heapProps = {}; + heapProps.Type = D3D12_HEAP_TYPE_DEFAULT; + heapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; + heapProps.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; + heapProps.CreationNodeMask = 0u; + heapProps.VisibleNodeMask = 0u; + + D3D12_RESOURCE_DESC texDesc = {}; + texDesc.MipLevels = 1u; + texDesc.Format = context->m_depth_format; // DXGI_FORMAT_R32_TYPELESS; // DXGI_FORMAT_R24G8_TYPELESS + texDesc.Width = context->m_winW; + texDesc.Height = context->m_winH; + texDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL /*| D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE*/; + texDesc.DepthOrArraySize = 1u; + texDesc.SampleDesc.Count = context->m_targetInfo.m_numSamples; + texDesc.SampleDesc.Quality = context->m_targetInfo.m_sampleQuality; + texDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + + D3D12_CLEAR_VALUE clearValue; + clearValue.Format = context->m_dsv_format; // DXGI_FORMAT_D32_FLOAT; + clearValue.DepthStencil.Depth = 1.f; + clearValue.DepthStencil.Stencil = 0; + + if (hr = context->m_device->CreateCommittedResource( + &heapProps, + D3D12_HEAP_FLAG_NONE, + &texDesc, + D3D12_RESOURCE_STATE_DEPTH_WRITE, + &clearValue, + IID_PPV_ARGS(&context->m_depthStencil) + )) + { + return; + } + + // create the depth stencil view + D3D12_DEPTH_STENCIL_VIEW_DESC viewDesc = {}; + viewDesc.Format = context->m_dsv_format; // DXGI_FORMAT_D32_FLOAT; + viewDesc.ViewDimension = (context->m_numMsaaSamples>1) ? D3D12_DSV_DIMENSION_TEXTURE2DMS : D3D12_DSV_DIMENSION_TEXTURE2D; + viewDesc.Flags = D3D12_DSV_FLAG_NONE; + viewDesc.Texture2D.MipSlice = 0; + + context->m_current_dsvDesc = viewDesc; + + context->m_device->CreateDepthStencilView(context->m_depthStencil, &viewDesc, context->m_dsvHeap->GetCPUDescriptorHandleForHeapStart()); + + context->m_targetInfo.m_depthStencilFormat = context->m_dsv_format; + } +} + +bool AppGraphCtxUpdateSizeD3D12(AppGraphCtx* contextIn, SDL_Window* window, bool fullscreen, int numMSAASamples) +{ + auto context = cast_to_AppGraphCtxD3D12(contextIn); + + bool sizeChanged = false; + + // sync with window + { + HWND hWnd = nullptr; + // get Windows handle to this SDL window + SDL_SysWMinfo winInfo; + SDL_VERSION(&winInfo.version); + if (SDL_GetWindowWMInfo(window, &winInfo)) + { + if (winInfo.subsystem == SDL_SYSWM_WINDOWS) + { + hWnd = winInfo.info.win.window; + } + } + context->m_hWnd = hWnd; + context->m_fullscreen = fullscreen; + + HRESULT hr = S_OK; + + RECT rc; + GetClientRect(context->m_hWnd, &rc); + UINT width = rc.right - rc.left; + UINT height = rc.bottom - rc.top; + + if (context->m_winW != width || context->m_winH != height) + { + context->m_winW = width; + context->m_winH = height; + sizeChanged = true; + context->m_valid = (context->m_winW != 0 && context->m_winH != 0); + } + } + + context->m_numMsaaSamples = numMSAASamples; + context->m_targetInfo.m_numSamples = numMSAASamples; + + if (sizeChanged) + { + AppGraphCtxReleaseRenderTargetD3D12(cast_from_AppGraphCtxD3D12(context)); + } + if (sizeChanged && context->m_valid) + { + AppGraphCtxInitRenderTargetD3D12(cast_from_AppGraphCtxD3D12(context), window, fullscreen, numMSAASamples); + } + + return context->m_valid; +} + +void AppGraphCtxReleaseRenderTargetD3D12(AppGraphCtx* contextIn) +{ + auto context = cast_to_AppGraphCtxD3D12(contextIn); + + if (context->m_swapChain == nullptr) + { + return; + } + + // need to make sure the pipeline is flushed + for (UINT i = 0; i < context->m_frameCount; i++) + { + // check dependencies + UINT64 fenceCompleted = context->m_fence->GetCompletedValue(); + if (fenceCompleted < context->m_fenceValues[i]) + { + context->m_fence->SetEventOnCompletion(context->m_fenceValues[i], context->m_fenceEvent); + WaitForSingleObjectEx(context->m_fenceEvent, INFINITE, FALSE); + } + } + + BOOL bFullscreen = FALSE; + context->m_swapChain->GetFullscreenState(&bFullscreen, nullptr); + if (bFullscreen == TRUE) context->m_swapChain->SetFullscreenState(FALSE, nullptr); + + COMRelease(context->m_swapChain); + COMRelease(context->m_depthStencil); + + for(int i=0;i!= context->m_renderTargetCount; i++) + context->m_renderTargets[i]->setResourceNull(); + + context->m_valid = false; + context->m_winW = 0u; + context->m_winH = 0u; +} + +void AppGraphCtxReleaseD3D12(AppGraphCtx* context) +{ + if (context == nullptr) return; + + delete cast_to_AppGraphCtxD3D12(context); +} + +void AppGraphCtxFrameStartD3D12(AppGraphCtx* contextIn, AppGraphColor clearColor) +{ + auto context = cast_to_AppGraphCtxD3D12(contextIn); + + // Get back render target index + context->m_renderTargetIndex = context->m_swapChain->GetCurrentBackBufferIndex(); + + // check dependencies + UINT64 fenceCompleted = context->m_fence->GetCompletedValue(); + if (fenceCompleted < context->m_fenceValues[context->m_frameIndex]) + { + context->m_fence->SetEventOnCompletion(context->m_fenceValues[context->m_frameIndex], context->m_fenceEvent); + WaitForSingleObjectEx(context->m_fenceEvent, INFINITE, FALSE); + } + + // The fence ID associated with completion of this frame + context->m_thisFrameFenceID = context->m_frameID + 1; + context->m_lastFenceComplete = context->m_fence->GetCompletedValue(); + + // reset this frame's command allocator + context->m_commandAllocators[context->m_frameIndex]->Reset(); + + // reset command list with this frame's allocator + context->m_commandList->Reset(context->m_commandAllocators[context->m_frameIndex], nullptr); + + appGraphProfilerD3D12FrameBegin(context->m_profiler); + + context->m_commandList->RSSetViewports(1, &context->m_viewport); + context->m_commandList->RSSetScissorRects(1, &context->m_scissorRect); + + { + nvidia::Common::Dx12BarrierSubmitter submitter(context->m_commandList); + context->m_renderTargets[context->m_renderTargetIndex]->transition(D3D12_RESOURCE_STATE_RENDER_TARGET, submitter); + } + + D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle = context->m_rtvHeap->GetCPUDescriptorHandleForHeapStart(); + rtvHandle.ptr += context->m_renderTargetIndex * context->m_rtvDescriptorSize; + + D3D12_CPU_DESCRIPTOR_HANDLE dsvHandle = context->m_dsvHeap->GetCPUDescriptorHandleForHeapStart(); + context->m_commandList->OMSetRenderTargets(1, &rtvHandle, FALSE, &dsvHandle); + + context->m_commandList->ClearRenderTargetView(rtvHandle, &clearColor.r, 0, nullptr); + context->m_commandList->ClearDepthStencilView(dsvHandle, D3D12_CLEAR_FLAG_DEPTH, 1.f, 0, 0, nullptr); + + /// to simplify interop implementation + context->m_current_renderTarget = context->m_renderTargets[context->m_renderTargetIndex]->getResource(); + context->m_current_rtvHandle = rtvHandle; + context->m_current_dsvHandle = dsvHandle; + context->m_current_depth_srvHandle = context->m_depthSrvHeap->GetCPUDescriptorHandleForHeapStart(); +} + +void AppGraphCtxFramePresentD3D12(AppGraphCtx* contextIn, bool fullsync) +{ + auto context = cast_to_AppGraphCtxD3D12(contextIn); + + // check if now is good time to present + bool shouldPresent = context->m_fullscreen ? true : WaitForSingleObjectEx(context->m_swapChainWaitableObject, 0, TRUE) != WAIT_TIMEOUT; + if (shouldPresent) + { + context->m_swapChain->Present(fullsync, 0); + context->m_renderTargetID++; + } + + appGraphProfilerD3D12FrameEnd(context->m_profiler); + + // signal for this frame id + context->m_frameID++; + context->m_fenceValues[context->m_frameIndex] = context->m_frameID; + context->m_commandQueue->Signal(context->m_fence, context->m_frameID); + + // increment frame index after signal + context->m_frameIndex = (context->m_frameIndex + 1) % context->m_frameCount; + + if (fullsync) + { + // check dependencies + for (int frameIndex = 0; frameIndex < context->m_frameCount; frameIndex++) + { + UINT64 fenceCompleted = context->m_fence->GetCompletedValue(); + if (fenceCompleted < context->m_fenceValues[frameIndex]) + { + context->m_fence->SetEventOnCompletion(context->m_fenceValues[frameIndex], context->m_fenceEvent); + WaitForSingleObjectEx(context->m_fenceEvent, INFINITE, FALSE); + } + } + } +} + +void AppGraphCtxWaitForFramesD3D12(AppGraphCtx* contextIn, unsigned int maxFramesInFlight) +{ + auto context = cast_to_AppGraphCtxD3D12(contextIn); + + unsigned int framesActive = maxFramesInFlight; + while (framesActive >= maxFramesInFlight) + { + // reset count each cycle, and get latest fence value + framesActive = 0u; + UINT64 fenceCompleted = context->m_fence->GetCompletedValue(); + + // determine how many frames are in flight + for (int frameIndex = 0; frameIndex < context->m_frameCount; frameIndex++) + { + if (fenceCompleted < context->m_fenceValues[frameIndex]) + { + framesActive++; + } + } + + if (framesActive >= maxFramesInFlight) + { + // find the active frame with the lowest fence ID + UINT64 minFenceID = 0; + unsigned int minFrameIdx = 0; + for (int frameIndex = 0; frameIndex < context->m_frameCount; frameIndex++) + { + if (fenceCompleted < context->m_fenceValues[frameIndex]) + { + if (minFenceID == 0) + { + minFenceID = context->m_fenceValues[frameIndex]; + minFrameIdx = frameIndex; + } + else if (context->m_fenceValues[frameIndex] < minFenceID) + { + minFenceID = context->m_fenceValues[frameIndex]; + minFrameIdx = frameIndex; + } + } + } + // Wait for min frame + { + unsigned int frameIndex = minFrameIdx; + fenceCompleted = context->m_fence->GetCompletedValue(); + if (fenceCompleted < context->m_fenceValues[frameIndex]) + { + context->m_fence->SetEventOnCompletion(context->m_fenceValues[frameIndex], context->m_fenceEvent); + WaitForSingleObjectEx(context->m_fenceEvent, INFINITE, FALSE); + } + } + } + } +} + +void AppGraphCtxProfileEnableD3D12(AppGraphCtx* contextIn, bool enabled) +{ + auto context = cast_to_AppGraphCtxD3D12(contextIn); + appGraphProfilerD3D12Enable(context->m_profiler, enabled); +} + +void AppGraphCtxProfileBeginD3D12(AppGraphCtx* contextIn, const char* label) +{ + auto context = cast_to_AppGraphCtxD3D12(contextIn); + appGraphProfilerD3D12Begin(context->m_profiler, label); +} + +void AppGraphCtxProfileEndD3D12(AppGraphCtx* contextIn, const char* label) +{ + auto context = cast_to_AppGraphCtxD3D12(contextIn); + appGraphProfilerD3D12End(context->m_profiler, label); +} + +bool AppGraphCtxProfileGetD3D12(AppGraphCtx* contextIn, const char** plabel, float* cpuTime, float* gpuTime, int index) +{ + auto context = cast_to_AppGraphCtxD3D12(contextIn); + return appGraphProfilerD3D12Get(context->m_profiler, plabel, cpuTime, gpuTime, index); +} + +// ******************************* Dynamic descriptor heap ****************************** + +void AppDynamicDescriptorHeapD3D12::init(ID3D12Device* device, D3D12_DESCRIPTOR_HEAP_TYPE heapType, UINT minHeapSize) +{ + m_device = device; + m_heapSize = minHeapSize; + m_startSlot = 0u; + m_descriptorSize = m_device->GetDescriptorHandleIncrementSize(heapType); + + D3D12_DESCRIPTOR_HEAP_DESC desc = {}; + desc.NumDescriptors = m_heapSize; + desc.Type = heapType; + desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; + m_device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&m_heap)); +} + +void AppDynamicDescriptorHeapD3D12::release() +{ + m_device = nullptr; + COMRelease(m_heap); + m_descriptorSize = 0u; + m_startSlot = 0u; + m_heapSize = 0u; +} + +AppDescriptorReserveHandleD3D12 AppDynamicDescriptorHeapD3D12::reserveDescriptors(UINT numDescriptors, UINT64 lastFenceCompleted, UINT64 nextFenceValue) +{ + UINT endSlot = m_startSlot + numDescriptors; + if (endSlot >= m_heapSize) + { + m_startSlot = 0u; + endSlot = numDescriptors; + } + D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle; + D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle; + cpuHandle = m_heap->GetCPUDescriptorHandleForHeapStart(); + cpuHandle.ptr += m_startSlot * m_descriptorSize; + gpuHandle = m_heap->GetGPUDescriptorHandleForHeapStart(); + gpuHandle.ptr += m_startSlot * m_descriptorSize; + + // advance start slot + m_startSlot = endSlot; + + AppDescriptorReserveHandleD3D12 handle = {}; + handle.heap = m_heap; + handle.descriptorSize = m_descriptorSize; + handle.cpuHandle = cpuHandle; + handle.gpuHandle = gpuHandle; + return handle; +} + +// ******************************* Profiler ********************************* + +namespace +{ + struct TimerCPU + { + LARGE_INTEGER oldCount; + LARGE_INTEGER count; + LARGE_INTEGER freq; + TimerCPU() + { + QueryPerformanceCounter(&count); + QueryPerformanceFrequency(&freq); + oldCount = count; + } + double getDeltaTime() + { + QueryPerformanceCounter(&count); + double dt = double(count.QuadPart - oldCount.QuadPart) / double(freq.QuadPart); + oldCount = count; + return dt; + } + }; + + struct TimerGPU + { + ID3D12QueryHeap* m_queryHeap = nullptr; + ID3D12Resource* m_queryReadback = nullptr; + UINT64 m_queryFrequency = 0; + UINT64 m_queryReadbackFenceVal = ~0llu; + + TimerGPU() {} + ~TimerGPU() + { + COMRelease(m_queryHeap); + COMRelease(m_queryReadback); + } + }; + + struct Timer + { + TimerCPU m_cpu; + TimerGPU m_gpu; + + const char* m_label = nullptr; + float m_cpuTime = 0.f; + float m_gpuTime = 0.f; + + Timer() {} + ~Timer() {} + }; + + struct TimerValue + { + const char* m_label = nullptr; + float m_cpuTime = 0.f; + float m_gpuTime = 0.f; + + struct Stat + { + float m_time = 0.f; + float m_maxTime = 0.f; + float m_maxTimeAge = 0.f; + + float m_smoothTime = 0.f; + float m_smoothTimeSum = 0.f; + float m_smoothTimeCount = 0.f; + + Stat() {} + void push(float time) + { + m_time = time; + + if (m_time > m_maxTime) + { + m_maxTime = m_time; + m_maxTimeAge = 0.f; + } + + if (fabsf(m_time - m_maxTime) < 0.25f * m_maxTime) + { + m_smoothTimeSum += m_time; + m_smoothTimeCount += 1.f; + m_smoothTimeSum *= 0.98f; + m_smoothTimeCount *= 0.98f; + m_smoothTime = m_smoothTimeSum / m_smoothTimeCount; + } + } + + float pull(float frameTime) + { + m_maxTimeAge += frameTime; + + if (m_maxTimeAge > 1.f) + { + m_maxTimeAge = 0.f; + m_maxTime = m_time; + m_smoothTimeSum = 0.f; + m_smoothTimeCount = 0.f; + } + return m_smoothTime; + } + }; + + Stat m_cpu; + Stat m_gpu; + + void push(float cpuTime, float gpuTime) + { + m_cpu.push(cpuTime); + m_gpu.push(gpuTime); + } + + void pull(float frameTime) + { + m_cpuTime = m_cpu.pull(frameTime); + m_gpuTime = m_gpu.pull(frameTime); + } + }; + + struct HeapPropsReadback : public D3D12_HEAP_PROPERTIES + { + HeapPropsReadback() + { + Type = D3D12_HEAP_TYPE_READBACK; + CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; + MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; + CreationNodeMask = 0u; + VisibleNodeMask = 0u; + } + }; + struct ResourceDescBuffer : public D3D12_RESOURCE_DESC + { + ResourceDescBuffer(UINT64 size) + { + Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; + Alignment = 0u; + Width = size; + Height = 1u; + DepthOrArraySize = 1u; + MipLevels = 1; + Format = DXGI_FORMAT_UNKNOWN; + SampleDesc.Count = 1u; + SampleDesc.Quality = 0u; + Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; + Flags = D3D12_RESOURCE_FLAG_NONE; + } + }; +} + +struct AppGraphProfilerD3D12 +{ + AppGraphCtxD3D12* m_context; + + int m_state = 0; + bool m_enabled = false; + + TimerCPU m_frameTimer; + float m_frameTime = 0.f; + + static const int m_timersCap = 64; + Timer m_timers[m_timersCap]; + int m_timersSize = 0; + + TimerValue m_timerValues[m_timersCap]; + int m_timerValuesSize = 0; + + AppGraphProfilerD3D12(AppGraphCtx* context); + ~AppGraphProfilerD3D12(); +}; + +AppGraphProfilerD3D12::AppGraphProfilerD3D12(AppGraphCtx* context) : m_context(cast_to_AppGraphCtxD3D12(context)) +{ +} + +AppGraphProfilerD3D12::~AppGraphProfilerD3D12() +{ +} + +AppGraphProfilerD3D12* appGraphCreateProfilerD3D12(AppGraphCtx* ctx) +{ + return new AppGraphProfilerD3D12(ctx); +} + +void appGraphReleaseProfiler(AppGraphProfilerD3D12* profiler) +{ + delete profiler; +} + +void appGraphProfilerD3D12FrameBegin(AppGraphProfilerD3D12* p) +{ + p->m_frameTime = (float)p->m_frameTimer.getDeltaTime(); + + if (p->m_state == 0 && p->m_enabled) + { + p->m_timersSize = 0; + + p->m_state = 1; + } +} + +void appGraphProfilerD3D12FrameEnd(AppGraphProfilerD3D12* p) +{ + if (p->m_state == 1) + { + p->m_state = 2; + } +} + +void appGraphProfilerD3D12Enable(AppGraphProfilerD3D12* p, bool enabled) +{ + p->m_enabled = enabled; +} + +void appGraphProfilerD3D12Begin(AppGraphProfilerD3D12* p, const char* label) +{ + if (p->m_state == 1 && p->m_timersSize < p->m_timersCap) + { + auto& timer = p->m_timers[p->m_timersSize++]; + timer.m_label = label; + timer.m_cpu.getDeltaTime(); + + auto device = p->m_context->m_device; + + if (timer.m_gpu.m_queryHeap == nullptr) + { + D3D12_QUERY_HEAP_DESC queryDesc = {}; + queryDesc.Type = D3D12_QUERY_HEAP_TYPE_TIMESTAMP; + queryDesc.Count = 2; + queryDesc.NodeMask = 0; + + device->CreateQueryHeap(&queryDesc, IID_PPV_ARGS(&timer.m_gpu.m_queryHeap)); + + HeapPropsReadback readbackProps; + ResourceDescBuffer resDesc(2 * sizeof(UINT64)); + resDesc.Flags = D3D12_RESOURCE_FLAG_NONE; + + device->CreateCommittedResource(&readbackProps, D3D12_HEAP_FLAG_NONE, + &resDesc, D3D12_RESOURCE_STATE_COPY_DEST, + nullptr, IID_PPV_ARGS(&timer.m_gpu.m_queryReadback)); + } + + p->m_context->m_commandQueue->GetTimestampFrequency(&timer.m_gpu.m_queryFrequency); + + p->m_context->m_commandList->EndQuery(timer.m_gpu.m_queryHeap, D3D12_QUERY_TYPE_TIMESTAMP, 0); + } +} + +void appGraphProfilerD3D12End(AppGraphProfilerD3D12* p, const char* label) +{ + if (p->m_state == 1) + { + Timer* timer = nullptr; + for (int i = 0; i < p->m_timersSize; i++) + { + if (strcmp(p->m_timers[i].m_label, label) == 0) + { + timer = &p->m_timers[i]; + break; + } + } + if (timer) + { + p->m_context->m_commandList->EndQuery(timer->m_gpu.m_queryHeap, D3D12_QUERY_TYPE_TIMESTAMP, 1); + + p->m_context->m_commandList->ResolveQueryData(timer->m_gpu.m_queryHeap, D3D12_QUERY_TYPE_TIMESTAMP, 0, 2, timer->m_gpu.m_queryReadback, 0u); + + timer->m_gpu.m_queryReadbackFenceVal = p->m_context->m_thisFrameFenceID; + + timer->m_cpuTime = (float)timer->m_cpu.getDeltaTime(); + } + } +} + +bool appGraphProfilerD3D12Flush(AppGraphProfilerD3D12* p) +{ + if (p->m_state == 2) + { + for (int i = 0; i < p->m_timersSize; i++) + { + Timer& timer = p->m_timers[i]; + + if (timer.m_gpu.m_queryReadbackFenceVal > p->m_context->m_lastFenceComplete) + { + return false; + } + + UINT64 tsBegin, tsEnd; + { + void* data; + // Read range is nullptr, meaning full read access + D3D12_RANGE readRange; + readRange.Begin = 0u; + readRange.End = 2 * sizeof(UINT64); + timer.m_gpu.m_queryReadback->Map(0u, &readRange, &data); + if (data) + { + auto mapped = (UINT64*)data; + tsBegin = mapped[0]; + tsEnd = mapped[1]; + + D3D12_RANGE writeRange{}; + timer.m_gpu.m_queryReadback->Unmap(0u, &writeRange); + } + } + + timer.m_gpuTime = float(tsEnd - tsBegin) / float(timer.m_gpu.m_queryFrequency); + + // update TimerValue + int j = 0; + for (; j < p->m_timerValuesSize; j++) + { + TimerValue& value = p->m_timerValues[j]; + if (strcmp(value.m_label, timer.m_label) == 0) + { + value.push(timer.m_cpuTime, timer.m_gpuTime); + break; + } + } + if (j >= p->m_timerValuesSize && p->m_timerValuesSize < p->m_timersCap) + { + TimerValue& value = p->m_timerValues[p->m_timerValuesSize++]; + value.m_label = timer.m_label; + value.push(timer.m_cpuTime, timer.m_gpuTime); + } + } + + p->m_state = 0; + } + return false; +} + +bool appGraphProfilerD3D12Get(AppGraphProfilerD3D12* p, const char** plabel, float* cpuTime, float* gpuTime, int index) +{ + appGraphProfilerD3D12Flush(p); + { + if (index < p->m_timerValuesSize) + { + TimerValue& timer = p->m_timerValues[index]; + + timer.pull(p->m_frameTime); + + if (plabel) *plabel = timer.m_label; + if (cpuTime) *cpuTime = timer.m_cpuTime; + if (gpuTime) *gpuTime = timer.m_gpuTime; + + return true; + } + } + return false; +} + +size_t AppGraphCtxDedicatedVideoMemoryD3D12(AppGraphCtx* contextIn) +{ + auto context = cast_to_AppGraphCtxD3D12(contextIn); + return context->m_dedicatedVideoMemory; +} + +void AppGraphCtxBeginGpuWork(AppGraphCtxD3D12* context) +{ + if (context->m_commandListOpenCount == 0) + { + // It's not open so open it + ID3D12GraphicsCommandList* commandList = context->m_commandList; + + commandList->Reset(context->m_commandAllocators[context->m_frameIndex], nullptr); + } + context->m_commandListOpenCount++; +} + +void AppGraphCtxEndGpuWork(AppGraphCtxD3D12* context) +{ + assert(context->m_commandListOpenCount); + ID3D12GraphicsCommandList* commandList = context->m_commandList; + + NV_CORE_ASSERT_VOID_ON_FAIL(commandList->Close()); + { + // Execute the command list. + ID3D12CommandList* commandLists[] = { commandList }; + context->m_commandQueue->ExecuteCommandLists(_countof(commandLists), commandLists); + } + + AppGraphCtxWaitForGPU(context); + + // Dec the count. If >0 it needs to still be open + --context->m_commandListOpenCount; + + // Reopen if needs to be open + if (context->m_commandListOpenCount) + { + // Reopen + context->m_commandList->Reset(context->m_commandAllocators[context->m_frameIndex], nullptr); + } +} + +void AppGraphCtxPrepareRenderTarget(AppGraphCtxD3D12* context) +{ + D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle = context->m_rtvHeap->GetCPUDescriptorHandleForHeapStart(); + rtvHandle.ptr += context->m_renderTargetIndex * context->m_rtvDescriptorSize; + + D3D12_CPU_DESCRIPTOR_HANDLE dsvHandle = context->m_dsvHeap->GetCPUDescriptorHandleForHeapStart(); + context->m_commandList->OMSetRenderTargets(1, &rtvHandle, FALSE, &dsvHandle); + + // Set necessary state. + context->m_commandList->RSSetViewports(1, &context->m_viewport); + context->m_commandList->RSSetScissorRects(1, &context->m_scissorRect); +} + +void AppGraphCtxWaitForGPU(AppGraphCtxD3D12* context) +{ + context->m_frameID++; + context->m_fenceValues[context->m_frameIndex] = context->m_frameID; + + context->m_commandQueue->Signal(context->m_fence, context->m_frameID); + + for (int frameIndex = 0; frameIndex < context->m_frameCount; frameIndex++) + { + UINT64 fenceCompleted = context->m_fence->GetCompletedValue(); + if (fenceCompleted < context->m_fenceValues[frameIndex]) + { + context->m_fence->SetEventOnCompletion(context->m_fenceValues[frameIndex], context->m_fenceEvent); + WaitForSingleObjectEx(context->m_fenceEvent, INFINITE, FALSE); + } + } +}
\ No newline at end of file diff --git a/demo/d3d12/appD3D12Ctx.h b/demo/d3d12/appD3D12Ctx.h new file mode 100644 index 0000000..4f6ba77 --- /dev/null +++ b/demo/d3d12/appD3D12Ctx.h @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#ifndef APP_D3D12_CTX_H +#define APP_D3D12_CTX_H + +#include "../d3d/appGraphCtx.h" +#include "NvCoDx12Resource.h" +#include "NvCoDx12Handle.h" + +struct IDXGISwapChain3; + +struct AppGraphProfilerD3D12; + +struct AppDescriptorReserveHandleD3D12 +{ + ID3D12DescriptorHeap* heap; + UINT descriptorSize; + D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle; + D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle; +}; + +struct AppDynamicDescriptorHeapD3D12 +{ + ID3D12Device* m_device = nullptr; + ID3D12DescriptorHeap* m_heap = nullptr; + UINT m_descriptorSize = 0u; + UINT m_startSlot = 0u; + UINT m_heapSize = 0u; + + void init(ID3D12Device* device, D3D12_DESCRIPTOR_HEAP_TYPE heapType, UINT minHeapSize); + void release(); + AppDescriptorReserveHandleD3D12 reserveDescriptors(UINT numDescriptors, UINT64 lastFenceCompleted, UINT64 nextFenceValue); + + AppDynamicDescriptorHeapD3D12() {} + ~AppDynamicDescriptorHeapD3D12() { release(); } +}; + +struct AppGraphCtxD3D12 +{ + HWND m_hWnd = nullptr; + + int m_winW = 0; + int m_winH = 0; + bool m_fullscreen = false; + bool m_valid = false; + + size_t m_dedicatedVideoMemory = 0u; + + // D3D12 non-replicated objects + D3D12_VIEWPORT m_viewport = {}; + D3D12_RECT m_scissorRect = {}; + ID3D12Device* m_device = nullptr; + ID3D12CommandQueue* m_commandQueue = nullptr; + + // D3D12 render target pipeline + static const UINT m_renderTargetCount = 6u; + UINT m_renderTargetIndex = 0u; + UINT64 m_renderTargetID = 0u; + IDXGISwapChain3* m_swapChain = nullptr; + HANDLE m_swapChainWaitableObject = nullptr; + ID3D12DescriptorHeap* m_rtvHeap = nullptr; + UINT m_rtvDescriptorSize = 0u; + nvidia::Common::Dx12Resource m_backBuffers[m_renderTargetCount]; + nvidia::Common::Dx12Resource m_renderTargetResources[m_renderTargetCount]; + nvidia::Common::Dx12Resource* m_renderTargets[m_renderTargetCount]; + + ID3D12Resource* m_depthStencil = nullptr; + ID3D12DescriptorHeap* m_dsvHeap = nullptr; + ID3D12DescriptorHeap* m_depthSrvHeap = nullptr; + + // D3D12 frame pipeline objects + static const UINT m_frameCount = 8u; + UINT m_frameIndex = 0u; + UINT64 m_frameID = 0u; + ID3D12CommandAllocator* m_commandAllocators[m_frameCount]; + + // D3D12 synchronization objects + ID3D12Fence* m_fence = nullptr; + HANDLE m_fenceEvent = 0u; + UINT64 m_fenceValues[m_frameCount]; + + // fence values for library synchronization + UINT64 m_lastFenceComplete = 1u; + UINT64 m_thisFrameFenceID = 2u; + + // D3D12 per asset objects + ID3D12GraphicsCommandList* m_commandList = nullptr; + UINT m_commandListOpenCount = 0; + ID3D12Resource* m_current_renderTarget = nullptr; + D3D12_CPU_DESCRIPTOR_HANDLE m_current_rtvHandle; + D3D12_RENDER_TARGET_VIEW_DESC m_current_rtvDesc; + D3D12_CPU_DESCRIPTOR_HANDLE m_current_dsvHandle; + D3D12_DEPTH_STENCIL_VIEW_DESC m_current_dsvDesc; + D3D12_CPU_DESCRIPTOR_HANDLE m_current_depth_srvHandle; + D3D12_SHADER_RESOURCE_VIEW_DESC m_current_depth_srvDesc; + + DXGI_FORMAT m_rtv_format = DXGI_FORMAT_R8G8B8A8_UNORM; + DXGI_FORMAT m_dsv_format = DXGI_FORMAT_D32_FLOAT; + DXGI_FORMAT m_depth_srv_format = DXGI_FORMAT_R32_FLOAT; + DXGI_FORMAT m_depth_format = DXGI_FORMAT_R32_TYPELESS; + + UINT m_numMsaaSamples = 1; + + nvidia::Common::Dx12TargetInfo m_targetInfo; + + AppDynamicDescriptorHeapD3D12 m_dynamicHeapCbvSrvUav; + + AppGraphProfilerD3D12* m_profiler = nullptr; + + AppGraphCtxD3D12(); + ~AppGraphCtxD3D12(); +}; + +inline AppGraphCtxD3D12* cast_to_AppGraphCtxD3D12(AppGraphCtx* appctx) +{ + return (AppGraphCtxD3D12*)(appctx); +} + +inline AppGraphCtx* cast_from_AppGraphCtxD3D12(AppGraphCtxD3D12* appctx) +{ + return (AppGraphCtx*)(appctx); +} + +APP_GRAPH_CTX_API AppGraphCtx* AppGraphCtxCreateD3D12(int deviceID); + +APP_GRAPH_CTX_API bool AppGraphCtxUpdateSizeD3D12(AppGraphCtx* context, SDL_Window* window, bool fullscreen, int numMSAASamples); + +APP_GRAPH_CTX_API void AppGraphCtxReleaseRenderTargetD3D12(AppGraphCtx* context); + +APP_GRAPH_CTX_API void AppGraphCtxReleaseD3D12(AppGraphCtx* context); + +APP_GRAPH_CTX_API void AppGraphCtxFrameStartD3D12(AppGraphCtx* context, AppGraphColor clearColor); + +APP_GRAPH_CTX_API void AppGraphCtxFramePresentD3D12(AppGraphCtx* context, bool fullsync); + +APP_GRAPH_CTX_API void AppGraphCtxWaitForFramesD3D12(AppGraphCtx* context, unsigned int maxFramesInFlight); + +APP_GRAPH_CTX_API void AppGraphCtxProfileEnableD3D12(AppGraphCtx* context, bool enabled); + +APP_GRAPH_CTX_API void AppGraphCtxProfileBeginD3D12(AppGraphCtx* context, const char* label); + +APP_GRAPH_CTX_API void AppGraphCtxProfileEndD3D12(AppGraphCtx* context, const char* label); + +APP_GRAPH_CTX_API bool AppGraphCtxProfileGetD3D12(AppGraphCtx* context, const char** plabel, float* cpuTime, float* gpuTime, int index); + +APP_GRAPH_CTX_API size_t AppGraphCtxDedicatedVideoMemoryD3D12(AppGraphCtx* context); + +APP_GRAPH_CTX_API void AppGraphCtxBeginGpuWork(AppGraphCtxD3D12* context); + +APP_GRAPH_CTX_API void AppGraphCtxEndGpuWork(AppGraphCtxD3D12* context); + +APP_GRAPH_CTX_API void AppGraphCtxPrepareRenderTarget(AppGraphCtxD3D12* context); + +APP_GRAPH_CTX_API void AppGraphCtxWaitForGPU(AppGraphCtxD3D12* context); + +/// ScopeGpuWork is used to handle gpu work that must be synchronized with the CPU. +/// It is guaranteed when scope is released the CPU and GPU will sync. NOTE! This means +/// you don't want to do this as part of render/update unless you have to because it will be slow. +struct ScopeGpuWork +{ + inline ScopeGpuWork(AppGraphCtxD3D12* context) : + m_context(context) + { + AppGraphCtxBeginGpuWork(context); + } + inline ~ScopeGpuWork() + { + AppGraphCtxEndGpuWork(m_context); + } +private: + AppGraphCtxD3D12* m_context; +}; +#endif
\ No newline at end of file diff --git a/demo/d3d12/bufferD3D12.cpp b/demo/d3d12/bufferD3D12.cpp new file mode 100644 index 0000000..b7954ea --- /dev/null +++ b/demo/d3d12/bufferD3D12.cpp @@ -0,0 +1,118 @@ +/* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. */ + + +#include <NvCoDx12HelperUtil.h> +#include <external/D3D12/include/d3dx12.h> + +#include "bufferD3D12.h" + +#include <vector> + +namespace FlexSample { + +int IndexBufferD3D12::init(const RenderStateD3D12& state, int stride, ptrdiff_t numIndices, const void* sysMem) +{ + assert(sysMem); + assert(stride == 4); + const size_t bufferSize = stride * numIndices; + + { + ComPtr<ID3D12Resource> resource; + CD3DX12_HEAP_PROPERTIES defaultHeapProps(D3D12_HEAP_TYPE_DEFAULT); + D3D12_RESOURCE_DESC resourceDesc(CD3DX12_RESOURCE_DESC::Buffer(bufferSize)); + if (sysMem) + { + NV_RETURN_ON_FAIL(state.m_device->CreateCommittedResource(&defaultHeapProps, D3D12_HEAP_FLAG_NONE, &resourceDesc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr, + IID_PPV_ARGS(&resource))); + NV_RETURN_ON_FAIL(state.m_scopeManager->upload(state.m_commandList, sysMem, resource.Get(), D3D12_RESOURCE_STATE_COMMON)); + } + else + { + NV_RETURN_ON_FAIL(state.m_device->CreateCommittedResource(&defaultHeapProps, D3D12_HEAP_FLAG_NONE, &resourceDesc, D3D12_RESOURCE_STATE_COMMON, nullptr, + IID_PPV_ARGS(&resource))); + } + setResource(resource.Get(), D3D12_RESOURCE_STATE_COMMON); + } + + memset(&m_indexBufferView, 0, sizeof(m_indexBufferView)); + m_indexBufferView.BufferLocation = m_resource->GetGPUVirtualAddress(); + m_indexBufferView.SizeInBytes = UINT(bufferSize); + m_indexBufferView.Format = DXGI_FORMAT_R32_UINT; + return NV_OK; +} + +int VertexBufferD3D12::init(const RenderStateD3D12& state, int stride, ptrdiff_t numElements, const void* sysMem, D3D12_RESOURCE_FLAGS resourceFlags) +{ + if (!sysMem) + { + memset(&m_vertexBufferView, 0, sizeof(m_vertexBufferView)); + return NV_OK; + } + + size_t bufferSize = size_t(numElements * stride); + + { + CD3DX12_HEAP_PROPERTIES defaultHeapProps(D3D12_HEAP_TYPE_DEFAULT); + D3D12_RESOURCE_DESC resourceDesc(CD3DX12_RESOURCE_DESC::Buffer(bufferSize, resourceFlags)); + ComPtr<ID3D12Resource> resource; + + if (sysMem) + { + NV_RETURN_ON_FAIL(state.m_device->CreateCommittedResource(&defaultHeapProps, D3D12_HEAP_FLAG_NONE, &resourceDesc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr, + IID_PPV_ARGS(&resource))); + NV_RETURN_ON_FAIL(state.m_scopeManager->upload(state.m_commandList, sysMem, resource.Get(), D3D12_RESOURCE_STATE_COMMON)); + } + else + { + NV_RETURN_ON_FAIL(state.m_device->CreateCommittedResource(&defaultHeapProps, D3D12_HEAP_FLAG_NONE, &resourceDesc, D3D12_RESOURCE_STATE_COMMON, nullptr, + IID_PPV_ARGS(&resource))); + } + setResource(resource.Get(), D3D12_RESOURCE_STATE_COMMON); + } + + { + memset(&m_vertexBufferView, 0, sizeof(m_vertexBufferView)); + m_vertexBufferView.BufferLocation = m_resource->GetGPUVirtualAddress(); + m_vertexBufferView.SizeInBytes = UINT(bufferSize); + m_vertexBufferView.StrideInBytes = stride; + } + + return NV_OK; +} + +int VertexBufferD3D12::init(const RenderStateD3D12& state, int srcStride, int dstStride, ptrdiff_t numElements, const void* sysMem, D3D12_RESOURCE_FLAGS resourceFlags) +{ + if (srcStride == dstStride || sysMem == nullptr) + { + return init(state, dstStride, numElements, sysMem, resourceFlags); + } + else + { + if (srcStride == 4 * 4 && dstStride == 4 * 3) + { + std::vector<uint32_t> buf(numElements * 3); + uint32_t* dst = &buf.front(); + const uint32_t* src = (const uint32_t*)sysMem; + + for (ptrdiff_t i = 0; i < numElements; i++, dst += 3, src += 4) + { + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + } + + return init(state, dstStride, numElements, &buf.front(), resourceFlags); + } + } + + assert(!"Unhandled conversion"); + return NV_FAIL; +} + + +} // namespace FlexSample diff --git a/demo/d3d12/bufferD3D12.h b/demo/d3d12/bufferD3D12.h new file mode 100644 index 0000000..b2bd98a --- /dev/null +++ b/demo/d3d12/bufferD3D12.h @@ -0,0 +1,38 @@ +#ifndef BUFFER_D3D12_H +#define BUFFER_D3D12_H + +#include <NvCoDx12Resource.h> + +#include "renderStateD3D12.h" + +#define NOMINMAX +#include <dxgi.h> +#include <d3d12.h> + +namespace FlexSample { +using namespace nvidia; + +struct IndexBufferD3D12: public NvCo::Dx12Resource +{ + int init(const RenderStateD3D12& state, int stride, ptrdiff_t numIndices, const void* sysMem); + /// Reset + void reset() { setResourceNull(); } + + D3D12_INDEX_BUFFER_VIEW m_indexBufferView; +}; + +struct VertexBufferD3D12: public NvCo::Dx12Resource +{ + /// + int init(const RenderStateD3D12& state, int stride, ptrdiff_t numElements, const void* sysMem, D3D12_RESOURCE_FLAGS resourceFlags = D3D12_RESOURCE_FLAG_NONE); + int init(const RenderStateD3D12& state, int srcStride, int stride, ptrdiff_t numElements, const void* sysMem, D3D12_RESOURCE_FLAGS resourceFlags = D3D12_RESOURCE_FLAG_NONE); + + /// Ctor + VertexBufferD3D12() {} + + D3D12_VERTEX_BUFFER_VIEW m_vertexBufferView; +}; + +} // namespace FlexSample + +#endif // BUFFER_D3D12_H diff --git a/demo/d3d12/demoContextD3D12.cpp b/demo/d3d12/demoContextD3D12.cpp new file mode 100644 index 0000000..8a698f7 --- /dev/null +++ b/demo/d3d12/demoContextD3D12.cpp @@ -0,0 +1,1410 @@ +// to fix min max windows macros +#define NOMINMAX + +#include "meshRendererD3D12.h" + +// Pipelines + +#include "meshRenderPipelineD3D12.h" +#include "pointRenderPipelineD3D12.h" +#include "fluidEllipsoidRenderPipelineD3D12.h" +#include "fluidSmoothRenderPipelineD3D12.h" +#include "fluidCompositeRenderPipelineD3D12.h" +#include "diffusePointRenderPipelineD3D12.h" +#include "lineRenderPipelineD3D12.h" + +#include "meshUtil.h" + +#include <NvCoDx12RenderTarget.h> + +// SDL +#include <SDL_syswm.h> + +#include "d3d/shadersDemoContext.h" + +// Flex +#include "core/maths.h" +#include "core/extrude.h" + +#define NOMINMAX +#include <d3d12.h> +#include <d3dcompiler.h> + +#include "imguiGraphD3D12.h" + +#include "../d3d/loader.h" + +#include "demoContextD3D12.h" + +// include the Direct3D Library file +#pragma comment (lib, "d3d12.lib") +#pragma comment (lib, "DXGI.lib") + +using namespace DirectX; + +static float gSpotMin = 0.5f; +static float gSpotMax = 1.0f; +static float gShadowBias = 0.075f; +static const int kShadowResolution = 2048; + +// Global externally +extern Colour g_colors[]; + +#define NV_PRINT_F_U64 "%I64u" + +DemoContext* CreateDemoContextD3D12() +{ + return new FlexSample::DemoContextD3D12; +} + +namespace FlexSample { + +DemoContextD3D12::DemoContextD3D12() +{ + m_shadowMapLinearSamplerIndex = -1; + m_fluidPointDepthSrvIndex = -1; + m_currentShadowMap = nullptr; + m_targetShadowMap = nullptr; + + m_inLineDraw = false; + memset(&m_meshDrawParams, 0, sizeof(m_meshDrawParams)); + + m_hwnd = nullptr; + m_window = nullptr; + + // Allocate space for all debug vertices + m_debugLineVertices.resize(MAX_DEBUG_LINE_SIZE); +} + +DemoContextD3D12::~DemoContextD3D12() +{ + imguiGraphDestroy(); +} + +bool DemoContextD3D12::initialize(const RenderInitOptions& options) +{ + // must always have at least one sample + m_msaaSamples = Max(1, options.numMsaaSamples); + + { + // Load external modules + loadModules(APP_CONTEXT_D3D12); + } + + m_appGraphCtx = AppGraphCtxCreate(0); + m_renderContext = cast_to_AppGraphCtxD3D12(m_appGraphCtx); + + AppGraphCtxUpdateSize(m_appGraphCtx, options.window, options.fullscreen, m_msaaSamples); + + using namespace NvCo; + // Get the hwnd + m_hwnd = nullptr; + m_window = options.window; + { + // get Windows handle to this SDL window + SDL_SysWMinfo winInfo; + SDL_VERSION(&winInfo.version); + if (SDL_GetWindowWMInfo(options.window, &winInfo)) + { + if (winInfo.subsystem == SDL_SYSWM_WINDOWS) + { + m_hwnd = winInfo.info.win.window; + } + } + } + + { + WCHAR buffer[_MAX_PATH]; + DWORD size = GetModuleFileNameW(nullptr, buffer, _MAX_PATH); + if (size == 0 || size == _MAX_PATH) + { + // Method failed or path was truncated. + return false; + } + std::wstring path; + path += buffer; + const size_t lastSlash = path.find_last_of(L"\\"); + if (lastSlash >= 0) + { + path.resize(lastSlash + 1); + } + + m_executablePath.swap(path); + } + + { + m_shadersPath = m_executablePath; + m_shadersPath += L"../../demo/d3d/shaders/"; + } + + int width, height; + SDL_GetWindowSize(m_window, &width, &height); + + { + ScopeGpuWork scope(getRenderContext()); + NV_RETURN_FALSE_ON_FAIL(_initRenderResources(options)); + + { + // create imgui, connect to app graph context + ImguiGraphDescD3D12 desc; + desc.device = m_renderContext->m_device; + desc.commandList = m_renderContext->m_commandList; + desc.lastFenceCompleted = 0; + desc.nextFenceValue = 1; + desc.winW = m_renderContext->m_winW; + desc.winW = m_renderContext->m_winH; + desc.numMSAASamples = options.numMsaaSamples; + desc.dynamicHeapCbvSrvUav.userdata = this; + desc.dynamicHeapCbvSrvUav.reserveDescriptors = NULL; + + int defaultFontHeight = (options.defaultFontHeight <= 0) ? 13 : options.defaultFontHeight; + + if (!imguiGraphInit("../../data/DroidSans.ttf", float(defaultFontHeight), (ImguiGraphDesc*)&desc)) + { + return false; + } + } + } + + return true; +} + +int DemoContextD3D12::_initRenderResources(const RenderInitOptions& options) +{ + AppGraphCtxD3D12* renderContext = getRenderContext(); + ID3D12Device* device = renderContext->m_device; + + { + // https://msdn.microsoft.com/en-us/library/windows/desktop/dn859253(v=vs.85).aspx + // https://msdn.microsoft.com/en-us/library/windows/desktop/ff476876(v=vs.85).aspx#Overview + D3D12_FEATURE_DATA_D3D12_OPTIONS options; + device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &options, sizeof(options)); + } + + { + // Make enough space for largest _single_ dynamic buffer allocation + NV_RETURN_ON_FAIL(m_renderStateManager.initialize(renderContext, 16 * 1024 * 1024)); + m_renderState = m_renderStateManager.getState(); + } + + // Create the renderer + { + std::unique_ptr<MeshRendererD3D12> renderer(new MeshRendererD3D12); + NV_RETURN_ON_FAIL(renderer->initialize(m_renderState)); + m_meshRenderer = std::move(renderer); + } + + { + // NOTE! Must be in this order, as compositePS expects s0, s1 = linear, shadow samplers, in that order + m_linearSamplerIndex = m_renderState.m_samplerDescriptorHeap->allocate(); + m_shadowMapLinearSamplerIndex = m_renderState.m_samplerDescriptorHeap->allocate(); + + { + // linear sampler with comparator - used for shadow map sampling + D3D12_SAMPLER_DESC desc = + { + D3D12_FILTER_COMPARISON_MIN_MAG_MIP_POINT, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, + 0.0f, 0, D3D12_COMPARISON_FUNC_LESS_EQUAL, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, + }; + device->CreateSampler(&desc, m_renderState.m_samplerDescriptorHeap->getCpuHandle(m_shadowMapLinearSamplerIndex)); + } + { + // A regular linear sampler + D3D12_SAMPLER_DESC desc = + { + D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, + 0.0, 0, D3D12_COMPARISON_FUNC_NEVER, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, + }; + device->CreateSampler(&desc, m_renderState.m_samplerDescriptorHeap->getCpuHandle(m_linearSamplerIndex)); + } + } + + // Allocate the srvs used for fluid render targets + { + m_fluidPointDepthSrvIndex = m_renderState.m_srvCbvUavDescriptorHeap->allocate(); + m_fluidCompositeSrvBaseIndex = m_renderState.m_srvCbvUavDescriptorHeap->allocate(NUM_COMPOSITE_SRVS); + } + + // Create the shadow map + { + m_shadowMap = std::unique_ptr<NvCo::Dx12RenderTarget>(new NvCo::Dx12RenderTarget); + + NvCo::Dx12RenderTarget::Desc desc; + desc.init(kShadowResolution, kShadowResolution); + desc.m_targetFormat = DXGI_FORMAT_UNKNOWN; + desc.m_depthStencilFormat = DXGI_FORMAT_R32_TYPELESS; + + // Make a small shadow map so we can configure pipeline correctly + NV_RETURN_ON_FAIL(m_shadowMap->init(renderContext, desc)); + + m_shadowMap->setDebugName(L"ShadowMap"); + + if (m_shadowMap->allocateSrvView(NvCo::Dx12RenderTarget::BUFFER_DEPTH_STENCIL, device, *m_renderState.m_srvCbvUavDescriptorHeap) < 0) + { + printf("Unable to allocate shadow buffer srv index"); + + return NV_FAIL; + } + } + + // Init fluid resources + NV_RETURN_ON_FAIL(_initFluidRenderTargets()); + + // Create pipelines + { + + // Mesh + { + std::unique_ptr<MeshRenderPipelineD3D12> pipeline(new MeshRenderPipelineD3D12); + NV_RETURN_ON_FAIL(pipeline->initialize(m_renderState, m_shadersPath, FRONT_WINDING_COUNTER_CLOCKWISE, m_shadowMapLinearSamplerIndex, m_shadowMap.get(), options.asyncComputeBenchmark)); + m_meshPipeline = std::move(pipeline); + } + // Point + { + std::unique_ptr<PointRenderPipelineD3D12> pipeline(new PointRenderPipelineD3D12); + NV_RETURN_ON_FAIL(pipeline->initialize(m_renderState, m_shadersPath, m_shadowMapLinearSamplerIndex, m_shadowMap.get())); + m_pointPipeline = std::move(pipeline); + } + // FluidPoint + { + std::unique_ptr<FluidEllipsoidRenderPipelineD3D12> pipeline(new FluidEllipsoidRenderPipelineD3D12); + NV_RETURN_ON_FAIL(pipeline->initialize(m_renderState, m_shadersPath, m_fluidPointRenderTarget.get())); + m_fluidPointPipeline = std::move(pipeline); + } + // FluidSmooth + { + std::unique_ptr<FluidSmoothRenderPipelineD3D12> pipeline(new FluidSmoothRenderPipelineD3D12(m_fluidPointDepthSrvIndex)); + NV_RETURN_ON_FAIL(pipeline->initialize(m_renderState, m_shadersPath, m_fluidSmoothRenderTarget.get())); + m_fluidSmoothPipeline = std::move(pipeline); + } + // FluidComposite + { + std::unique_ptr<FluidCompositeRenderPipelineD3D12> pipeline(new FluidCompositeRenderPipelineD3D12); + NV_RETURN_ON_FAIL(pipeline->initialize(m_renderState, m_shadersPath)); + m_fluidCompositePipeline = std::move(pipeline); + } + // DiffusePoint + { + std::unique_ptr<DiffusePointRenderPipelineD3D12> pipeline(new DiffusePointRenderPipelineD3D12); + NV_RETURN_ON_FAIL(pipeline->initialize(m_renderState, m_shadersPath, m_linearSamplerIndex, m_shadowMap.get())); + m_diffusePointPipeline = std::move(pipeline); + } + // Line + { + std::unique_ptr<LineRenderPipelineD3D12> pipeline(new LineRenderPipelineD3D12); + NV_RETURN_ON_FAIL(pipeline->initialize(m_renderState, m_shadersPath, m_shadowMap.get())); + m_linePipeline = std::move(pipeline); + } + } + + { + // Create a passthru screen quad + uint32_t indices[] = { 0, 1, 2, 0, 2, 3 }; + Vec3 pos[] = { { -1, -1, 0} , {1, -1, 0}, {1, 1, 0}, {-1, 1, 0} }; + Vec2 uvs[] = { { 0, 0}, {1, 0}, {1, 1}, {0, 1} }; + + MeshData mesh; + mesh.init(); + + mesh.indices = indices; + mesh.positions = pos; + mesh.texcoords = uvs; + mesh.numFaces = _countof(indices) / 3; + mesh.numVertices = _countof(pos); + + m_screenQuadMesh = std::unique_ptr<FlexSample::RenderMesh>(m_meshRenderer->createMesh(mesh)); + } + + // create synchronization objects + { + m_graphicsCompleteEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (!m_graphicsCompleteEvent) + { + return E_FAIL; + } + NV_RETURN_ON_FAIL(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&m_graphicsCompleteFence))); + m_graphicsCompleteFenceValue = 1; + } + + { + // Query heap and results buffer + + // Create timestamp query heap and results buffer + const int queryCount = 2; + D3D12_QUERY_HEAP_DESC queryHeapDesc = { D3D12_QUERY_HEAP_TYPE_TIMESTAMP, queryCount, 0 /* NodeMask */ }; + NV_RETURN_ON_FAIL(device->CreateQueryHeap(&queryHeapDesc, IID_PPV_ARGS(&m_queryHeap))); + + D3D12_HEAP_PROPERTIES heapProps = + { + D3D12_HEAP_TYPE_READBACK, + D3D12_CPU_PAGE_PROPERTY_UNKNOWN, + D3D12_MEMORY_POOL_UNKNOWN, + 0, + 0 + }; + + D3D12_RESOURCE_DESC queryBufDesc = + { + D3D12_RESOURCE_DIMENSION_BUFFER, + 0u, + queryCount * sizeof(uint64_t), + 1u, + 1u, + 1, + DXGI_FORMAT_UNKNOWN, + { 1u, 0u }, + D3D12_TEXTURE_LAYOUT_ROW_MAJOR, + D3D12_RESOURCE_FLAG_NONE + }; + + NV_RETURN_ON_FAIL(device->CreateCommittedResource( + &heapProps, + D3D12_HEAP_FLAG_NONE, + &queryBufDesc, + D3D12_RESOURCE_STATE_COPY_DEST, + nullptr, + IID_PPV_ARGS(&m_queryResults))); + } + return NV_OK; +} + +int DemoContextD3D12::_initFluidRenderTargets() +{ + AppGraphCtxD3D12* renderContext = getRenderContext(); + ID3D12Device* device = renderContext->m_device; + + // Fluid point render target + { + { + std::unique_ptr<NvCo::Dx12RenderTarget> target(new NvCo::Dx12RenderTarget); + NvCo::Dx12RenderTarget::Desc desc; + desc.init(renderContext->m_winW, renderContext->m_winH, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_TYPELESS); + for(int i=0;i!=4;i++) desc.m_targetClearColor[i] = 0; + + NV_RETURN_ON_FAIL(target->init(renderContext, desc)); + + target->setDebugName(L"Fluid Point"); + m_fluidPointRenderTarget = std::move(target); + } + + } + + // Fluid smooth + { + std::unique_ptr<NvCo::Dx12RenderTarget> target(new NvCo::Dx12RenderTarget); + NvCo::Dx12RenderTarget::Desc desc; + desc.init(renderContext->m_winW, renderContext->m_winH, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN); + for (int i = 0; i != 4; i++) desc.m_targetClearColor[i] = 0; + + NV_RETURN_ON_FAIL(target->init(renderContext, desc)); + + target->setDebugName(L"Fluid Smooth"); + m_fluidSmoothRenderTarget = std::move(target); + } + + // The resolved target for final compose + { + std::unique_ptr<NvCo::Dx12RenderTarget> target(new NvCo::Dx12RenderTarget); + NvCo::Dx12RenderTarget::Desc desc; + Vec4 clearColor = { 1, 0, 1, 1 }; + desc.m_targetClearColor = clearColor; + desc.init(renderContext->m_winW, renderContext->m_winH, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN); + + NV_RETURN_ON_FAIL(target->init(renderContext, desc)); + + target->setDebugName(L"Fluid Resolved Target"); + m_fluidResolvedTarget = std::move(target); + } + + // Init all of the srvs!!!! + + { + NvCo::Dx12DescriptorHeap& heap = *m_renderState.m_srvCbvUavDescriptorHeap; + // Set up the srv for accessing this buffer + { + m_fluidPointRenderTarget->createSrv(device, heap, NvCo::Dx12RenderTarget::BUFFER_TARGET, m_fluidPointDepthSrvIndex); + } + + { + // 0 - is the depth texture m_fluidSmoothRenderTarget (target) + // 1 - is the 'composite' scene texture m_fluidResolvedTarget (target) + // 2 - shadow texture m_shadowMap (depth stencil) + + m_fluidSmoothRenderTarget->createSrv(device, heap, NvCo::Dx12RenderTarget::BUFFER_TARGET, m_fluidCompositeSrvBaseIndex + 0); + m_fluidResolvedTarget->createSrv(device, heap, NvCo::Dx12RenderTarget::BUFFER_TARGET, m_fluidCompositeSrvBaseIndex + 1); + m_shadowMap->createSrv(device, heap, NvCo::Dx12RenderTarget::BUFFER_DEPTH_STENCIL, m_fluidCompositeSrvBaseIndex + 2); + } + } + + return NV_OK; +} + +void DemoContextD3D12::onSizeChanged(int width, int height, bool minimized) +{ + // Free any set render targets + m_fluidPointRenderTarget.reset(); + m_fluidSmoothRenderTarget.reset(); + m_fluidResolvedTarget.reset(); + + // Will need to create the render targets.. + _initFluidRenderTargets(); +} + +void DemoContextD3D12::startFrame(FlexVec4 colorIn) +{ + AppGraphCtxD3D12* renderContext = getRenderContext(); + + // Work out what what can be recovered, as GPU no longer accessing + m_renderStateManager.updateCompleted(); + + AppGraphColor clearColor = { colorIn.x, colorIn.y, colorIn.z, colorIn.w }; + AppGraphCtxFrameStart(cast_from_AppGraphCtxD3D12(renderContext), clearColor); + + { + MeshDrawParamsD3D& params = m_meshDrawParams; + memset(¶ms, 0, sizeof(MeshDrawParamsD3D)); + params.renderStage = MESH_DRAW_LIGHT; + params.renderMode = MESH_RENDER_SOLID; + params.cullMode = MESH_CULL_BACK; + params.projection = XMMatrixIdentity(); + params.view = XMMatrixIdentity(); + params.model = DirectX::XMMatrixMultiply( + DirectX::XMMatrixScaling(1.0f, 1.0f, 1.0f), + DirectX::XMMatrixTranslation(0.0f, 0.0f, 0.0f) + ); + } +} + +void DemoContextD3D12::endFrame() +{ + { + ImguiGraphDescD3D12 desc; + desc.device = m_renderContext->m_device; + desc.commandList = m_renderContext->m_commandList; + desc.winW = m_renderContext->m_winW; + desc.winH = m_renderContext->m_winH; + + imguiGraphUpdate((ImguiGraphDesc*)&desc); + } + + AppGraphCtxD3D12* renderContext = getRenderContext(); + + nvidia::Common::Dx12Resource& backBuffer = renderContext->m_backBuffers[renderContext->m_renderTargetIndex]; + if (renderContext->m_numMsaaSamples > 1) + { + // MSAA resolve + nvidia::Common::Dx12Resource& renderTarget = *renderContext->m_renderTargets[renderContext->m_renderTargetIndex]; + assert(&renderTarget != &backBuffer); + // Barriers to wait for the render target, and the backbuffer to be in correct state + { + nvidia::Common::Dx12BarrierSubmitter submitter(renderContext->m_commandList); + renderTarget.transition(D3D12_RESOURCE_STATE_RESOLVE_SOURCE, submitter); + backBuffer.transition(D3D12_RESOURCE_STATE_RESOLVE_DEST, submitter); + } + // Do the resolve... + renderContext->m_commandList->ResolveSubresource(backBuffer, 0, renderTarget, 0, renderContext->m_targetInfo.m_renderTargetFormats[0]); + } + + { + nvidia::Common::Dx12BarrierSubmitter submitter(renderContext->m_commandList); + backBuffer.transition(D3D12_RESOURCE_STATE_PRESENT, submitter); + } + + renderContext->m_commandList->Close(); + + // submit command list + ID3D12CommandList* cmdLists[] = { renderContext->m_commandList }; + renderContext->m_commandQueue->ExecuteCommandLists(1, cmdLists); + + renderContext->m_commandListOpenCount = 0; + + // Inform the manager that the work has been submitted + m_renderStateManager.onGpuWorkSubmitted(renderContext->m_commandQueue); + + HANDLE completeEvent = m_graphicsCompleteEvent; + + renderContext->m_commandQueue->Signal(m_graphicsCompleteFence.Get(), m_graphicsCompleteFenceValue); +} + +void DemoContextD3D12::getRenderDevice(void** device, void** context) +{ + *device = m_renderContext->m_device; + *context = m_renderContext->m_commandQueue; +} + +void DemoContextD3D12::startGpuWork() +{ + AppGraphCtxBeginGpuWork(m_renderContext); +} + +void DemoContextD3D12::endGpuWork() +{ + AppGraphCtxEndGpuWork(m_renderContext); +} + +void DemoContextD3D12::presentFrame(bool fullsync) +{ + AppGraphCtxFramePresent(cast_from_AppGraphCtxD3D12(m_renderContext), fullsync); +} + +void DemoContextD3D12::getViewRay(int x, int y, FlexVec3& origin, FlexVec3& dir) +{ + //using namespace DirectX; + AppGraphCtxD3D12* renderContext = getRenderContext(); + + int width = renderContext->m_winW; + int height = renderContext->m_winH; + + XMVECTOR nearVector = XMVector3Unproject(XMVectorSet(float(x), float(height - y), 0.0f, 0.0f), 0.0f, 0.0f, (float)width, (float)height, 0.0f, 1.0f, (XMMATRIX)m_proj, XMMatrixIdentity(), (XMMATRIX)m_view); + XMVECTOR farVector = XMVector3Unproject(XMVectorSet(float(x), float(height - y), 1.0f, 0.0f), 0.0f, 0.0f, (float)width, (float)height, 0.0f, 1.0f, (XMMATRIX)m_proj, XMMatrixIdentity(), (XMMATRIX)m_view); + + origin = FlexVec3(XMVectorGetX(nearVector), XMVectorGetY(nearVector), XMVectorGetZ(nearVector)); + XMVECTOR tmp = farVector - nearVector; + dir = Normalize(FlexVec3(XMVectorGetX(tmp), XMVectorGetY(tmp), XMVectorGetZ(tmp))); +} + +void DemoContextD3D12::setView(Matrix44 view, Matrix44 projection) +{ + Matrix44 vp = projection*view; + MeshDrawParamsD3D& params = m_meshDrawParams; + + params.model = XMMatrixIdentity(); + params.view = (XMMATRIX)view; + params.projection = (XMMATRIX)(RenderParamsUtilD3D::convertGLToD3DProjection(projection)); + + m_view = view; + m_proj = RenderParamsUtilD3D::convertGLToD3DProjection(projection); +} + +void DemoContextD3D12::renderEllipsoids(FluidRenderer* renderer, FluidRenderBuffers* buffersIn, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, FlexVec3 lightPos, FlexVec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, FlexVec4 color, float blur, float ior, bool debug) +{ + FluidRenderBuffersD3D12& buffers = *reinterpret_cast<FluidRenderBuffersD3D12*>(buffersIn); + if (n == 0) + return; + + typedef PointRenderAllocationD3D12 Alloc; + + Alloc alloc; + alloc.init(PRIMITIVE_POINT); + + alloc.m_numPrimitives = buffers.m_numParticles; + alloc.m_numPositions = 0; ///? We don't know here yet... + + alloc.m_indexBufferView = buffers.m_indicesView; + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_DENSITY] = buffers.m_densitiesView; + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_POSITION] = buffers.m_positionsView; + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY1] = buffers.m_anisotropiesViewArr[0]; + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY2] = buffers.m_anisotropiesViewArr[1]; + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY3] = buffers.m_anisotropiesViewArr[2]; + + AppGraphCtxD3D12* renderContext = getRenderContext(); + + FluidDrawParamsD3D params; + + params.renderMode = FLUID_RENDER_SOLID; + params.cullMode = FLUID_CULL_BACK; + params.model = XMMatrixIdentity(); + params.view = (XMMATRIX&)m_view; + params.projection = (XMMATRIX&)m_proj; + + params.offset = offset; + params.n = n; + params.renderStage = FLUID_DRAW_LIGHT; + + const float viewHeight = tanf(fov / 2.0f); + params.invViewport = Hlsl::float3(1.0f / screenWidth, screenAspect / screenWidth, 1.0f); + params.invProjection = Hlsl::float3(screenAspect * viewHeight, viewHeight, 1.0f); + params.debug = 0; + + params.shadowMap = nullptr; + + { + m_fluidPointRenderTarget->toWritable(renderContext); + m_fluidPointRenderTarget->bindAndClear(renderContext); + + // Draw the ellipsoids + m_meshRenderer->drawTransitory(alloc, sizeof(Alloc), m_fluidPointPipeline.get(), ¶ms); + + m_fluidPointRenderTarget->toReadable(renderContext); + } + + //--------------------------------------------------------------- + // build smooth depth + + { + m_fluidSmoothRenderTarget->toWritable(renderContext); + m_fluidSmoothRenderTarget->bind(renderContext); + + params.blurRadiusWorld = radius * 0.5f; + params.blurScale = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); + params.invTexScale = Hlsl::float4(1.0f / screenAspect, 1.0f, 0.0f, 0.0f); + params.blurFalloff = blur; + params.debug = debug; + + m_meshRenderer->draw(m_screenQuadMesh.get(), m_fluidSmoothPipeline.get(), ¶ms); + + m_fluidSmoothRenderTarget->toReadable(renderContext); + } + + // First lets resolve the render target + ID3D12GraphicsCommandList* commandList = m_renderContext->m_commandList; + { + // Lets take what's rendered so far and + NvCo::Dx12ResourceBase* targetResource = m_renderContext->m_renderTargets[m_renderContext->m_renderTargetIndex]; + NvCo::Dx12ResourceBase& fluidResolvedTarget = m_fluidResolvedTarget->getResource(NvCo::Dx12RenderTarget::BUFFER_TARGET); + + if (m_renderContext->m_numMsaaSamples > 1) + { + // If enabled can stop/reduce flickering issues on some GPUs related to a problem around ResolveSubresource/ + //m_renderContext->submitGpuWork(); + + { + NvCo::Dx12BarrierSubmitter submitter(commandList); + targetResource->transition(D3D12_RESOURCE_STATE_RESOLVE_SOURCE, submitter); + fluidResolvedTarget.transition(D3D12_RESOURCE_STATE_RESOLVE_DEST, submitter); + } + // Do the resolve + const DXGI_FORMAT format = fluidResolvedTarget.getResource()->GetDesc().Format; + commandList->ResolveSubresource(fluidResolvedTarget, 0, *targetResource, 0, format); + { + NvCo::Dx12BarrierSubmitter submitter(commandList); + targetResource->transition(D3D12_RESOURCE_STATE_RENDER_TARGET, submitter); + fluidResolvedTarget.transition(D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, submitter); + } + } + else + { + { + NvCo::Dx12BarrierSubmitter submitter(commandList); + targetResource->transition(D3D12_RESOURCE_STATE_COPY_SOURCE, submitter); + fluidResolvedTarget.transition(D3D12_RESOURCE_STATE_COPY_DEST, submitter); + } + commandList->CopyResource(fluidResolvedTarget, *targetResource); + } + } + + //--------------------------------------------------------------- + // composite + + { + m_shadowMap->toReadable(renderContext); + + AppGraphCtxPrepareRenderTarget(renderContext); + + FlexVec4 aspectWork(1.0f / screenWidth, screenAspect / screenWidth, 0, 0); + params.invTexScale = (Hlsl::float4&)aspectWork; + FlexVec4 clipPosToEyeWork(tanf(fov*0.5f)*screenAspect, tanf(fov*0.5f), 0, 0); + params.clipPosToEye = (Hlsl::float4&)clipPosToEyeWork; + params.color = (Hlsl::float4&)color; + params.ior = ior; + params.spotMin = gSpotMin; + params.spotMax = gSpotMax; + params.debug = debug; + + params.lightPos = (Hlsl::float3&)lightPos; + FlexVec3 lightDirWork = -Normalize(lightTarget - lightPos); + params.lightDir = (Hlsl::float3&)lightDirWork; + Matrix44 lightTransformWork = RenderParamsUtilD3D::convertGLToD3DProjection(lightTransform); + params.lightTransform = (XMMATRIX&)lightTransformWork; + + params.m_srvDescriptorBase = m_fluidCompositeSrvBaseIndex; + params.m_sampleDescriptorBase = m_linearSamplerIndex; + params.shadowMap = (ShadowMapD3D*)m_currentShadowMap; + + m_meshRenderer->draw(m_screenQuadMesh.get(), m_fluidCompositePipeline.get(), ¶ms); + } +} + +void DemoContextD3D12::updateFluidRenderBuffers(FluidRenderBuffers* buffersIn, FlexVec4* particles, float* densities, FlexVec4* anisotropy1, FlexVec4* anisotropy2, FlexVec4* anisotropy3, int numParticles, int* indices, int numIndices) +{ + FluidRenderBuffersD3D12& buffers = *reinterpret_cast<FluidRenderBuffersD3D12*>(buffersIn); + + typedef PointRenderAllocationD3D12 Alloc; + Alloc alloc; + + PointData pointData; + + pointData.positions = (const Vec4*)particles; + pointData.density = densities; + pointData.phase = nullptr; + pointData.indices = (uint32_t*)indices; + pointData.numIndices = numIndices; + pointData.numPoints = numParticles; + pointData.anisotropy[0] = (const Vec4*)anisotropy1; + pointData.anisotropy[1] = (const Vec4*)anisotropy2; + pointData.anisotropy[2] = (const Vec4*)anisotropy3; + + m_meshRenderer->allocateTransitory(pointData, alloc, sizeof(alloc)); + + buffers.m_positionsView = alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_POSITION]; + buffers.m_densitiesView = alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_DENSITY]; + + buffers.m_anisotropiesViewArr[0] = alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY1]; + buffers.m_anisotropiesViewArr[1] = alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY2]; + buffers.m_anisotropiesViewArr[2] = alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY3]; + + buffers.m_indicesView = alloc.m_indexBufferView; + + buffers.m_numParticles = numIndices; +} + +void DemoContextD3D12::shadowBegin(::ShadowMap* map) +{ + assert(map); + assert(m_targetShadowMap == nullptr); + + AppGraphCtxD3D12* renderContext = getRenderContext(); + NvCo::Dx12RenderTarget* shadowMap = reinterpret_cast<NvCo::Dx12RenderTarget*>(map); + + shadowMap->toWritable(renderContext); + shadowMap->bindAndClear(renderContext); + + m_targetShadowMap = shadowMap; + + m_meshDrawParams.renderStage = MESH_DRAW_SHADOW; +} + +void DemoContextD3D12::shadowEnd() +{ + AppGraphCtxD3D12* renderContext = getRenderContext(); + NvCo::Dx12RenderTarget* shadowMap = m_targetShadowMap; + shadowMap->toReadable(renderContext); + m_targetShadowMap = nullptr; + + // Restore to regular render target + AppGraphCtxPrepareRenderTarget(renderContext); + + m_meshDrawParams.renderStage = MESH_DRAW_NULL; +} + +void DemoContextD3D12::drawMesh(const Mesh* m, FlexVec3 color) +{ + MeshDrawParamsD3D& params = m_meshDrawParams; + + if (m) + { + MeshData meshData; + + meshData.positions = (Vec3*)&m->m_positions[0]; + meshData.normals = (Vec3*)&m->m_normals[0]; + meshData.colors = nullptr; + meshData.texcoords = nullptr; + meshData.indices = (uint32_t*)&m->m_indices[0]; + meshData.numFaces = m->GetNumFaces(); + meshData.numVertices = m->GetNumVertices(); + + params.colorArray = 0; + if (m->m_colours.size()) + { + params.colorArray = 1; + meshData.colors = (Vec4*)&m->m_colours[0]; + } + + params.color = Hlsl::float4(color.x, color.y, color.z, 1); + params.secondaryColor = params.color; + params.objectTransform = (Hlsl::float4x4&)Matrix44::kIdentity; + params.shadowMap = (ShadowMapD3D*)m_currentShadowMap; + + m_meshRenderer->drawImmediate(meshData, m_meshPipeline.get(), ¶ms); + + if (m->m_colours.size()) + { + params.colorArray = 0; + } + } +} + +void DemoContextD3D12::drawCloth(const FlexVec4* positions, const FlexVec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex, float expand, bool twosided, bool smooth) +{ + if (!numTris) + return; + + MeshData2 meshData; + + meshData.positions = (const Vec4*)positions; + meshData.normals = (const Vec4*)normals; + meshData.texcoords = nullptr; /* (const Vec2*)uvs; */ + meshData.colors = nullptr; + meshData.numFaces = numTris; + meshData.indices = (const uint32_t*)indices; + meshData.numVertices = numPositions; + + if (twosided) + SetCullMode(false); + + MeshDrawParamsD3D& params = m_meshDrawParams; + + params.bias = 0.0f; + params.expand = expand; + + params.color = (Hlsl::float4&)(g_colors[colorIndex + 1] * 1.5f); + params.secondaryColor = (Hlsl::float4&)(g_colors[colorIndex] * 1.5f); + params.objectTransform = (Hlsl::float4x4&)Matrix44::kIdentity; + params.shadowMap = (ShadowMapD3D*)m_currentShadowMap; + + m_meshRenderer->drawImmediate(meshData, m_meshPipeline.get(), ¶ms); + + if (twosided) + SetCullMode(true); + + params.bias = gShadowBias; + params.expand = 0.0f; +} + +void DemoContextD3D12::drawRope(FlexVec4* positions, int* indices, int numIndices, float radius, int color) +{ + if (numIndices < 2) + return; + + std::vector<FlexVec3> vertices; + std::vector<FlexVec3> normals; + std::vector<int> triangles; + + // flatten curve + std::vector<FlexVec3> curve(numIndices); + for (int i = 0; i < numIndices; ++i) + { + curve[i] = FlexVec3(positions[indices[i]]); + } + + const int resolution = 8; + const int smoothing = 3; + + vertices.reserve(resolution*numIndices*smoothing); + normals.reserve(resolution*numIndices*smoothing); + triangles.reserve(numIndices*resolution * 6 * smoothing); + + Extrude(&curve[0], int(curve.size()), vertices, normals, triangles, radius, resolution, smoothing); + + SetCullMode(false); + + MeshDrawParamsD3D& params = m_meshDrawParams; + + params.color = (Hlsl::float4&)(g_colors[color % 8] * 1.5f); + params.secondaryColor = (Hlsl::float4&)(g_colors[color % 8] * 1.5f); + params.shadowMap = (ShadowMapD3D*)m_currentShadowMap; + + MeshData meshData; + + meshData.positions = (const Vec3*)&vertices[0]; + meshData.normals = (const Vec3*)&normals[0]; + meshData.texcoords = nullptr; + meshData.colors = nullptr; + meshData.indices = (const uint32_t*)&triangles[0]; + meshData.numFaces = int(triangles.size()) / 3; + meshData.numVertices = int(vertices.size()); + + m_meshRenderer->drawImmediate(meshData, m_meshPipeline.get(), ¶ms); + + SetCullMode(true); +} + +void DemoContextD3D12::drawPlane(const FlexVec4& p, bool color) +{ + std::vector<FlexVec3> vertices; + std::vector<FlexVec3> normals; + std::vector<int> indices; + + FlexVec3 u, v; + BasisFromVector(FlexVec3(p.x, p.y, p.z), &u, &v); + + FlexVec3 c = FlexVec3(p.x, p.y, p.z)*-p.w; + + MeshDrawParamsD3D& params = m_meshDrawParams; + + params.shadowMap = (ShadowMapD3D*)m_currentShadowMap; + + if (color) + params.color = (Hlsl::float4&)(p * 0.5f + FlexVec4(0.5f, 0.5f, 0.5f, 0.5f)); + + const float kSize = 200.0f; + const int kGrid = 3; + + // draw a grid of quads, otherwise z precision suffers + for (int x = -kGrid; x <= kGrid; ++x) + { + for (int y = -kGrid; y <= kGrid; ++y) + { + FlexVec3 coff = c + u*float(x)*kSize*2.0f + v*float(y)*kSize*2.0f; + + int indexStart = int(vertices.size()); + + vertices.push_back(FlexVec3(coff + u*kSize + v*kSize)); + vertices.push_back(FlexVec3(coff - u*kSize + v*kSize)); + vertices.push_back(FlexVec3(coff - u*kSize - v*kSize)); + vertices.push_back(FlexVec3(coff + u*kSize - v*kSize)); + + normals.push_back(FlexVec3(p.x, p.y, p.z)); + normals.push_back(FlexVec3(p.x, p.y, p.z)); + normals.push_back(FlexVec3(p.x, p.y, p.z)); + normals.push_back(FlexVec3(p.x, p.y, p.z)); + + + indices.push_back(indexStart + 0); + indices.push_back(indexStart + 1); + indices.push_back(indexStart + 2); + + indices.push_back(indexStart + 2); + indices.push_back(indexStart + 3); + indices.push_back(indexStart + 0); + } + } + + MeshData meshData; + meshData.texcoords = nullptr; + meshData.colors = nullptr; + meshData.positions = (Vec3*)&vertices[0]; + meshData.normals = (Vec3*)&normals[0]; + meshData.indices = (uint32_t*)&indices[0]; + meshData.numFaces = int(indices.size() / 3); + meshData.numVertices = int(vertices.size()); + + m_meshRenderer->drawImmediate(meshData, m_meshPipeline.get(), ¶ms); +} + +void DemoContextD3D12::drawPlanes(FlexVec4* planes, int n, float bias) +{ + MeshDrawParamsD3D& params = m_meshDrawParams; + + params.color = (Hlsl::float4&)FlexVec4(0.9f, 0.9f, 0.9f, 1.0f); + + params.bias = 0.0f; + params.grid = 1; + params.expand = 0; + + for (int i = 0; i < n; ++i) + { + FlexVec4 p = planes[i]; + p.w -= bias; + + drawPlane(p, false); + } + + params.grid = 0; + params.bias = gShadowBias; +} + +void DemoContextD3D12::drawPoints(FluidRenderBuffers* buffersIn, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, FlexVec3 lightPos, FlexVec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowTex, bool showDensity) +{ + FluidRenderBuffersD3D12* buffers = reinterpret_cast<FluidRenderBuffersD3D12*>(buffersIn); + // Okay we can draw the particles here. The update can copy the point positions into the heap, so here we just draw them + + if (n == 0) + return; + + PointRenderAllocationD3D12 pointAlloc; + pointAlloc.init(PRIMITIVE_POINT); + pointAlloc.m_vertexBufferViews[PointRenderAllocationD3D12::VERTEX_VIEW_POSITION] = buffers->m_positionsView; + // It says 'color' as the parameter but actually its the 'density' parameter that is passed in here + pointAlloc.m_vertexBufferViews[PointRenderAllocationD3D12::VERTEX_VIEW_DENSITY] = buffers->m_densitiesView; + pointAlloc.m_indexBufferView = buffers->m_indicesView; + // TODO: JS - I don't know the amount of positions/colors... but the render call doesn't need to know. So just set to 0 for now + pointAlloc.m_numPositions = 0; + pointAlloc.m_numPrimitives = n; + + PointDrawParamsD3D params; + + params.renderMode = POINT_RENDER_SOLID; + params.cullMode = POINT_CULL_BACK; + params.model = XMMatrixIdentity(); + params.view = (XMMATRIX&)m_view; + params.projection = (XMMATRIX&)m_proj; + + params.pointRadius = radius; + params.pointScale = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); + params.spotMin = gSpotMin; + params.spotMax = gSpotMax; + + int mode = 0; + if (showDensity) + mode = 1; + if (shadowTex == 0) + mode = 2; + params.mode = mode; + + for (int i = 0; i < 8; i++) + params.colors[i] = *((Hlsl::float4*)&g_colors[i].r); + + // set shadow parameters + ShadowParamsD3D shadow; + RenderParamsUtilD3D::calcShadowParams(lightPos, lightTarget, lightTransform, gShadowBias, &shadow); + params.lightTransform = shadow.lightTransform; + params.lightDir = shadow.lightDir; + params.lightPos = shadow.lightPos; + memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); + + if (m_meshDrawParams.renderStage == MESH_DRAW_SHADOW) + { + params.renderStage = POINT_DRAW_SHADOW; + params.mode = 2; + } + else + params.renderStage = POINT_DRAW_LIGHT; + + params.shadowMap = (ShadowMapD3D*)m_currentShadowMap; + + m_meshRenderer->drawTransitory(pointAlloc, sizeof(pointAlloc), m_pointPipeline.get(), ¶ms); +} + +void DemoContextD3D12::graphicsTimerBegin() +{ + ID3D12GraphicsCommandList* commandList = m_renderContext->m_commandList; + + commandList->EndQuery(m_queryHeap.Get(), D3D12_QUERY_TYPE_TIMESTAMP, 0); +} + +void DemoContextD3D12::graphicsTimerEnd() +{ + ID3D12GraphicsCommandList* commandList = m_renderContext->m_commandList; + + commandList->EndQuery(m_queryHeap.Get(), D3D12_QUERY_TYPE_TIMESTAMP, 1); + commandList->ResolveQueryData(m_queryHeap.Get(), D3D12_QUERY_TYPE_TIMESTAMP, 0, 2, m_queryResults.Get(), 0); +} + +float DemoContextD3D12::rendererGetDeviceTimestamps(unsigned long long* begin, unsigned long long* end, unsigned long long* freq) +{ + AppGraphCtxD3D12* renderContext = getRenderContext(); + ID3D12CommandQueue* commandQueue = m_renderContext->m_commandQueue; + + AppGraphCtxWaitForGPU(renderContext); + + // Get timer frequency + static uint64_t frequency = 0; + + if (frequency == 0) + { + commandQueue->GetTimestampFrequency(&frequency); + } + + //Get render timestamps + uint64_t* times; + //m_queryResults->Map(0, nullptr, (void**)×); + D3D12_RANGE readRange = { 0, 1 }; + m_queryResults->Map(0, &readRange, (void**)×); + uint64_t renderBegin = times[0]; + uint64_t renderEnd = times[1]; + D3D12_RANGE writtenRange = { 0, 0 }; // nothing was written + m_queryResults->Unmap(0, &writtenRange); + + double renderTime = double(renderEnd - renderBegin) / double(frequency); + + if (begin) *begin = renderBegin; + if (end) *end = renderEnd; + if (freq) *freq = frequency; + + return float(renderTime); +} + +void DemoContextD3D12::bindSolidShader(FlexVec3 lightPos, FlexVec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, float bias, FlexVec4 fogColor) +{ + MeshDrawParamsD3D& params = m_meshDrawParams; + + params.renderStage = MESH_DRAW_LIGHT; + + params.grid = 0; + params.spotMin = gSpotMin; + params.spotMax = gSpotMax; + params.fogColor = (Hlsl::float4&)fogColor; + + params.objectTransform = (Hlsl::float4x4&)Matrix44::kIdentity; + + ShadowParamsD3D shadow; + RenderParamsUtilD3D::calcShadowParams(lightPos, lightTarget, lightTransform, gShadowBias, &shadow); + params.lightTransform = shadow.lightTransform; + params.lightDir = shadow.lightDir; + params.lightPos = shadow.lightPos; + params.bias = shadow.bias; + memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); + + m_currentShadowMap = (NvCo::Dx12RenderTarget*)shadowMap; +} + +void DemoContextD3D12::drawGpuMesh(GpuMesh* m, const Matrix44& xform, const FlexVec3& color) +{ + if (m) + { + MeshDrawParamsD3D params(m_meshDrawParams); + + params.color = (Hlsl::float4&)color; + params.secondaryColor = (Hlsl::float4&)color; + params.objectTransform = (Hlsl::float4x4&)xform; + params.shadowMap = (ShadowMapD3D*)m_currentShadowMap; + + RenderMesh* renderMesh = (RenderMesh*)m; + + m_meshRenderer->draw(renderMesh, m_meshPipeline.get(), ¶ms); + } +} + +void DemoContextD3D12::drawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const FlexVec3& color) +{ + if (m) + { + MeshDrawParamsD3D& contextParams = m_meshDrawParams; + + contextParams.color = (Hlsl::float4&)color; + contextParams.secondaryColor = (Hlsl::float4&)color; + contextParams.shadowMap = (ShadowMapD3D*)m_currentShadowMap; + + // copy params + MeshDrawParamsD3D params(contextParams); + + for (int i = 0; i < n; ++i) + { + params.objectTransform = (Hlsl::float4x4&)xforms[i]; + RenderMesh* renderMesh = (RenderMesh*)m; + m_meshRenderer->draw(renderMesh, m_meshPipeline.get(), ¶ms); + } + } +} + +void DemoContextD3D12::drawDiffuse(FluidRenderer* render, const DiffuseRenderBuffers* buffersIn, int n, float radius, float screenWidth, float screenAspect, float fov, FlexVec4 color, FlexVec3 lightPos, FlexVec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadowEnabled, bool front) +{ + const DiffuseRenderBuffersD3D12& buffers = *reinterpret_cast<const DiffuseRenderBuffersD3D12*>(buffersIn); + if (n == 0) + return; + + typedef PointRenderAllocationD3D12 Alloc; + Alloc alloc; + alloc.init(PRIMITIVE_POINT); + + alloc.m_numPrimitives = buffers.m_numParticles; + alloc.m_numPositions = 0; // ! We don't know + alloc.m_indexBufferView = buffers.m_indicesView; + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_POSITION] = buffers.m_positionsView; + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY1] = buffers.m_velocitiesView; // Velocity stored in ANISO1 + + DiffuseDrawParamsD3D params; + + params.model = XMMatrixIdentity(); + params.view = (const XMMATRIX&)m_view; + params.projection = (const XMMATRIX&)m_proj; + params.diffuseRadius = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); + params.diffuseScale = radius; + params.spotMin = gSpotMin; + params.spotMax = gSpotMax; + params.color = Hlsl::float4(1.0f, 1.0f, 1.0f, 1.0f); + params.motionScale = motionBlur; + + // set shadow parameters + ShadowParamsD3D shadow; + RenderParamsUtilD3D::calcShadowParams(lightPos, lightTarget, lightTransform, gShadowBias, &shadow); + params.lightTransform = shadow.lightTransform; + params.lightDir = shadow.lightDir; + params.lightPos = shadow.lightPos; + params.shadowMap = (ShadowMapD3D*)m_currentShadowMap; + + memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); + + m_meshRenderer->drawTransitory(alloc, sizeof(alloc), m_diffusePointPipeline.get(), ¶ms); +} + +void DemoContextD3D12::beginLines() +{ + assert(!m_inLineDraw); + m_inLineDraw = true; + m_debugLineVertices.clear(); +} + +void DemoContextD3D12::drawLine(const Vec3& p, const Vec3& q, const Vec4& color) +{ + assert(m_inLineDraw); + + if (m_debugLineVertices.size() + 2 > MAX_DEBUG_LINE_SIZE) + { + _flushDebugLines(); + } + + LineData::Vertex dst[2]; + dst[0].position = (const Vec3&)p; + dst[0].color = (const Vec4&)color; + dst[1].position = (const Vec3&)q; + dst[1].color = (const Vec4&)color; + + m_debugLineVertices.push_back(dst[0]); + m_debugLineVertices.push_back(dst[1]); +} + +void DemoContextD3D12::_flushDebugLines() +{ + assert(m_inLineDraw); + + if (m_debugLineVertices.size() > 0) + { + LineDrawParams params; + + const Matrix44 modelWorldProjection = ((Matrix44&)(m_meshDrawParams.projection)) * ((Matrix44&)(m_meshDrawParams.view)); + // draw + params.m_modelWorldProjection = (const Hlsl::float4x4&)modelWorldProjection; + params.m_drawStage = (m_targetShadowMap) ? LINE_DRAW_SHADOW : LINE_DRAW_NORMAL; + + LineData lineData; + lineData.init(); + lineData.vertices = &m_debugLineVertices.front(); + lineData.numVertices = m_debugLineVertices.size(); + lineData.numLines = lineData.numVertices / 2; + + m_meshRenderer->drawImmediate(lineData, m_linePipeline.get(), ¶ms); + + m_debugLineVertices.clear(); + } +} + +void DemoContextD3D12::endLines() +{ + _flushDebugLines(); + // No longer in line drawing + m_inLineDraw = false; +} + +void DemoContextD3D12::flushGraphicsAndWait() +{ + AppGraphCtxWaitForGPU(getRenderContext()); +} + +FluidRenderer* DemoContextD3D12::createFluidRenderer(uint32_t width, uint32_t height) +{ + // It's always created.. so just return the context + return (FluidRenderer*)this; +} + +void DemoContextD3D12::destroyFluidRenderer(FluidRenderer* renderer) +{ + /// Don't need to do anything, as will be destroyed with context +} + +FluidRenderBuffers* DemoContextD3D12::createFluidRenderBuffers(int numParticles, bool enableInterop) +{ + return reinterpret_cast<FluidRenderBuffers*>(new FluidRenderBuffersD3D12(numParticles)); +} + +void DemoContextD3D12::updateFluidRenderBuffers(FluidRenderBuffers* buffers, NvFlexSolver* flex, bool anisotropy, bool density) +{ + printf("Not implemented"); + assert(0); +} + +void DemoContextD3D12::destroyFluidRenderBuffers(FluidRenderBuffers* buffers) +{ + delete reinterpret_cast<FluidRenderBuffersD3D12*>(buffers); +} + +ShadowMap* DemoContextD3D12::shadowCreate() +{ + // Currently only allows single shadow map, which is pre created + return (::ShadowMap*)m_shadowMap.get(); +} + +void DemoContextD3D12::shadowDestroy(ShadowMap* map) +{ + assert(map); + assert(m_shadowMap.get() == (NvCo::Dx12RenderTarget*)map); +} + +void DemoContextD3D12::unbindSolidShader() +{ + m_meshDrawParams.renderStage = MESH_DRAW_NULL; + + // !!! Other code appears to assume that this will be set + //context->m_currentShadowMap = nullptr; +} + +GpuMesh* DemoContextD3D12::createGpuMesh(const Mesh* m) +{ + if (m) + { + return (GpuMesh*)MeshUtil::createRenderMesh(m_meshRenderer.get(), *m); + } + return nullptr; +} + +void DemoContextD3D12::destroyGpuMesh(GpuMesh* m) +{ + delete reinterpret_cast<RenderMesh*>(m); +} + + +DiffuseRenderBuffers* DemoContextD3D12::createDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop) +{ + return reinterpret_cast<DiffuseRenderBuffers*>(new DiffuseRenderBuffersD3D12(numDiffuseParticles)); +} + +void DemoContextD3D12::destroyDiffuseRenderBuffers(DiffuseRenderBuffers* buffers) +{ + delete reinterpret_cast<DiffuseRenderBuffersD3D12*>(buffers); +} + +int DemoContextD3D12::getNumDiffuseRenderParticles(DiffuseRenderBuffers* buffers) +{ + return reinterpret_cast<DiffuseRenderBuffersD3D12*>(buffers)->m_numParticles; +} + +void DemoContextD3D12::updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffersIn, Vec4* diffusePositions, Vec4* diffuseVelocities, int numDiffuseParticles) +{ + DiffuseRenderBuffersD3D12& buffers = *reinterpret_cast<DiffuseRenderBuffersD3D12*>(buffersIn); + + typedef PointRenderAllocationD3D12 Alloc; + + Alloc alloc; + + PointData pointData; + pointData.init(); + pointData.numIndices = numDiffuseParticles; + pointData.positions = (Vec4*)diffusePositions; + pointData.anisotropy[0] = (Vec4*)diffuseVelocities; // We'll store the velocities in the anisotropy buffer, cos it's the right size + pointData.numPoints = buffers.m_numParticles; + + m_meshRenderer->allocateTransitory(pointData, alloc, sizeof(alloc)); + + buffers.m_indicesView = alloc.m_indexBufferView; + buffers.m_positionsView = alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_POSITION]; + buffers.m_velocitiesView = alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY1]; // The velocity + + buffers.m_numParticles = numDiffuseParticles; +} + +void DemoContextD3D12::updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, NvFlexSolver* solver) +{ + printf("Not implemented"); + assert(0); +} + +void* DemoContextD3D12::getGraphicsCommandQueue() +{ + return m_renderContext->m_commandQueue; +} + +void DemoContextD3D12::setFillMode(bool wire) +{ + m_meshDrawParams.renderMode = wire ? MESH_RENDER_WIREFRAME : MESH_RENDER_SOLID; +} + +void DemoContextD3D12::setCullMode(bool enabled) +{ + m_meshDrawParams.cullMode = enabled ? MESH_CULL_BACK : MESH_CULL_NONE; +} + +void DemoContextD3D12::drawImguiGraph() +{ + imguiGraphDraw(); + /* + const imguiGfxCmd* cmds = imguiGetRenderQueue(); + int numCmds = imguiGetRenderQueueSize(); + m_imguiGraphContext->draw(cmds, numCmds); */ +} + + +} // namespace FlexSample + + + diff --git a/demo/d3d12/demoContextD3D12.h b/demo/d3d12/demoContextD3D12.h new file mode 100644 index 0000000..5f43c31 --- /dev/null +++ b/demo/d3d12/demoContextD3D12.h @@ -0,0 +1,256 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#ifndef DEMO_CONTEXT_D3D12_H +#define DEMO_CONTEXT_D3D12_H + +#include <memory> +#include <NvCoDx12RenderTarget.h> + +#include "meshRenderer.h" +#include "renderStateD3D12.h" +#include "appD3D12Ctx.h" + +// SDL +#include <SDL.h> +#include <SDL_video.h> + +#include "shaders.h" +#include "d3d/demoContext.h" + +#define NOMINMAX +#include <d3d12.h> + +namespace FlexSample { + +struct FlexBuffer +{ + inline FlexBuffer():m_buffer(nullptr) {} + inline operator NvFlexBuffer* () const { return m_buffer; } + ~FlexBuffer() { if (m_buffer) { NvFlexUnregisterD3DBuffer(m_buffer); } } + + NvFlexBuffer* m_buffer; +}; + +struct FluidRenderBuffersD3D12 +{ + FluidRenderBuffersD3D12(int numParticles = 0) + { + m_numParticles = numParticles; + { + const D3D12_VERTEX_BUFFER_VIEW nullView = {}; + m_positionsView = nullView; + m_densitiesView = nullView; + m_fluidView = nullView; + for (int i = 0; i < _countof(m_anisotropiesViewArr); i++) + { + m_anisotropiesViewArr[i] = nullView; + } + } + { + D3D12_INDEX_BUFFER_VIEW nullView = {}; + m_indicesView = nullView; + } + } + + int m_numParticles; + + D3D12_VERTEX_BUFFER_VIEW m_positionsView; + D3D12_VERTEX_BUFFER_VIEW m_densitiesView; + D3D12_VERTEX_BUFFER_VIEW m_anisotropiesViewArr[3]; + D3D12_INDEX_BUFFER_VIEW m_indicesView; + + D3D12_VERTEX_BUFFER_VIEW m_fluidView; // to be removed + + // wrapper buffers that allow Flex to write directly to VBOs + FlexBuffer m_positionsBuf; + FlexBuffer m_densitiesBuf; + FlexBuffer m_anisotropiesBufArr[3]; + FlexBuffer m_indicesBuf; +}; + +// vertex buffers for diffuse particles +struct DiffuseRenderBuffersD3D12 +{ + DiffuseRenderBuffersD3D12(int numParticles = 0) + { + m_numParticles = numParticles; + { + const D3D12_VERTEX_BUFFER_VIEW nullView = {}; + m_positionsView = nullView; + m_velocitiesView = nullView; + } + { + D3D12_INDEX_BUFFER_VIEW nullView = {}; + m_indicesView = nullView; + } + } + + int m_numParticles; + + D3D12_VERTEX_BUFFER_VIEW m_positionsView; + D3D12_VERTEX_BUFFER_VIEW m_velocitiesView; + D3D12_INDEX_BUFFER_VIEW m_indicesView; + + FlexBuffer m_indicesBuf; + FlexBuffer m_positionsBuf; + FlexBuffer m_velocitiesBuf; +}; + +struct DemoContextD3D12: public DemoContext +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS_BASE(DemoContextD3D12) +public: + enum + { + NUM_COMPOSITE_SRVS = 3, + MAX_DEBUG_LINE_SIZE = 1024 * 4, // Will flush if exceeds this + }; + + // DemoContext Impl + virtual bool initialize(const RenderInitOptions& options) override; + virtual void startFrame(Vec4 colorIn) override; + virtual void endFrame() override; + virtual void presentFrame(bool fullsync) override; + + virtual void getViewRay(int x, int y, Vec3& origin, Vec3& dir) override; + virtual void setView(Matrix44 view, Matrix44 projection) override; + virtual void renderEllipsoids(FluidRenderer* renderer, FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, Vec4 color, float blur, float ior, bool debug) override; + + virtual void drawMesh(const Mesh* m, Vec3 color) override; + virtual void drawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex, float expand, bool twosided, bool smooth) override; + virtual void drawRope(Vec4* positions, int* indices, int numIndices, float radius, int color) override; + virtual void drawPlane(const Vec4& p, bool color) override; + virtual void drawPlanes(Vec4* planes, int n, float bias) override; + virtual void drawPoints(FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowTex, bool showDensity) override; + + virtual void graphicsTimerBegin() override; + virtual void graphicsTimerEnd() override; + + virtual float rendererGetDeviceTimestamps(unsigned long long* begin, unsigned long long* end, unsigned long long* freq) override; + + virtual void bindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, float bias, Vec4 fogColor) override; + virtual void unbindSolidShader() override; + + virtual ShadowMap* shadowCreate() override; + virtual void shadowDestroy(ShadowMap* map) override; + virtual void shadowBegin(ShadowMap* map) override; + virtual void shadowEnd() override; + + virtual FluidRenderer* createFluidRenderer(uint32_t width, uint32_t height) override; + virtual void destroyFluidRenderer(FluidRenderer* renderer) override; + + virtual FluidRenderBuffers* createFluidRenderBuffers(int numParticles, bool enableInterop) override; + virtual void updateFluidRenderBuffers(FluidRenderBuffers* buffers, NvFlexSolver* flex, bool anisotropy, bool density) override; + virtual void updateFluidRenderBuffers(FluidRenderBuffers* buffers, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices) override; + virtual void destroyFluidRenderBuffers(FluidRenderBuffers* buffers) override; + + virtual GpuMesh* createGpuMesh(const Mesh* m) override; + virtual void destroyGpuMesh(GpuMesh* mesh) override; + virtual void drawGpuMesh(GpuMesh* m, const Matrix44& xform, const Vec3& color) override; + virtual void drawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const Vec3& color) override; + + virtual DiffuseRenderBuffers* createDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop) override; + virtual void drawDiffuse(FluidRenderer* render, const DiffuseRenderBuffers* buffers, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadowEnabled, bool front) override; + virtual void destroyDiffuseRenderBuffers(DiffuseRenderBuffers* buffers) override; + virtual void updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, Vec4* diffusePositions, Vec4* diffuseVelocities, int numDiffuseParticles) override; + virtual void updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, NvFlexSolver* solver) override; + virtual int getNumDiffuseRenderParticles(DiffuseRenderBuffers* buffers) override; + + virtual void beginLines() override; + virtual void drawLine(const Vec3& p, const Vec3& q, const Vec4& color) override; + virtual void endLines() override; + + virtual void onSizeChanged(int width, int height, bool minimized) override; + + virtual void startGpuWork() override; + virtual void endGpuWork() override; + virtual void flushGraphicsAndWait() override; + + virtual void setFillMode(bool wire) override; + virtual void setCullMode(bool enabled) override; + + virtual void getRenderDevice(void** device, void** context) override; + virtual void drawImguiGraph() override; + virtual void* getGraphicsCommandQueue() override; + + /// Get the render context + inline AppGraphCtxD3D12* getRenderContext() const { return m_renderContext; } + + DemoContextD3D12(); + ~DemoContextD3D12(); + + int _initRenderResources(const RenderInitOptions& options); + int _initFluidRenderTargets(); + + void _flushDebugLines(); + + MeshDrawParamsD3D m_meshDrawParams; + + Matrix44 m_view; + Matrix44 m_proj; + + // NOTE! These are allocated such that they are in order. This is required because on compositePS.hlsl, I need s0, and s1 to be linear, and then shadowMap samplers. + int m_linearSamplerIndex; ///< Index to a linear sample on the m_samplerDescriptorHeap + int m_shadowMapLinearSamplerIndex; ///< Index to shadow map depth comparator sampler descriptor in m_samplerDescriptorHeap + + int m_fluidPointDepthSrvIndex; ///< Index into srv heap that holds srv for the m_flexMeshPipeline + int m_fluidCompositeSrvBaseIndex; ///< We have a set of NUM_COMPOSITE_SRVS for every back buffer there is + + AppGraphCtx* m_appGraphCtx; + AppGraphCtxD3D12* m_renderContext; + + std::unique_ptr<MeshRenderer> m_meshRenderer; + + // Render pipelines + std::unique_ptr<RenderPipeline> m_meshPipeline; + std::unique_ptr<RenderPipeline> m_pointPipeline; + std::unique_ptr<RenderPipeline> m_fluidPointPipeline; + std::unique_ptr<RenderPipeline> m_fluidSmoothPipeline; + std::unique_ptr<RenderPipeline> m_fluidCompositePipeline; + std::unique_ptr<RenderPipeline> m_diffusePointPipeline; + std::unique_ptr<RenderPipeline> m_linePipeline; + + std::unique_ptr<NvCo::Dx12RenderTarget> m_fluidPointRenderTarget; + std::unique_ptr<NvCo::Dx12RenderTarget> m_fluidSmoothRenderTarget; + std::unique_ptr<NvCo::Dx12RenderTarget> m_fluidResolvedTarget; ///< The main render target resolved, such that it can be sampled from + + std::unique_ptr<RenderMesh> m_screenQuadMesh; + + std::unique_ptr<NvCo::Dx12RenderTarget> m_shadowMap; + + NvCo::Dx12RenderTarget* m_currentShadowMap; ///< The current read from shadow buffer + NvCo::Dx12RenderTarget* m_targetShadowMap; ///< The shadow map bound to render to (ie for write with Begin/EndShadow + + std::wstring m_executablePath; + std::wstring m_shadersPath; + + RenderStateManagerD3D12 m_renderStateManager; + RenderStateD3D12 m_renderState; + + SDL_Window* m_window; + HWND m_hwnd; + + int m_msaaSamples; + + // Synchronization and timing for async compute benchmarking + ComPtr<ID3D12Fence> m_graphicsCompleteFence; + HANDLE m_graphicsCompleteEvent; + UINT64 m_graphicsCompleteFenceValue; + ComPtr<ID3D12QueryHeap> m_queryHeap; + ComPtr<ID3D12Resource> m_queryResults; + + bool m_inLineDraw; + std::vector<LineData::Vertex> m_debugLineVertices; +}; + +} // namespace FlexSample + +#endif // DEMO_CONTEXT_D3D12_H
\ No newline at end of file diff --git a/demo/d3d12/diffusePointRenderPipelineD3D12.cpp b/demo/d3d12/diffusePointRenderPipelineD3D12.cpp new file mode 100644 index 0000000..3641a36 --- /dev/null +++ b/demo/d3d12/diffusePointRenderPipelineD3D12.cpp @@ -0,0 +1,223 @@ +#define NOMINMAX + +#include <NvCoDx12HelperUtil.h> + +#include <external/D3D12/include/d3dx12.h> + +#include "pipelineUtilD3D12.h" +#include "bufferD3D12.h" +#include "meshRendererD3D12.h" +#include "../d3d/shaderCommonD3D.h" + +// Shaders +#include "../d3d/shaders/diffuseVS.hlsl.h" +#include "../d3d/shaders/diffuseGS.hlsl.h" +#include "../d3d/shaders/diffusePS.hlsl.h" + +// this +#include "diffusePointRenderPipelineD3D12.h" + +namespace FlexSample { + +static const D3D12_INPUT_ELEMENT_DESC InputElementDescs[] = +{ + { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "VELOCITY", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +DiffusePointRenderPipelineD3D12::DiffusePointRenderPipelineD3D12(): + Parent(PRIMITIVE_POINT), + m_shadowMapLinearSamplerIndex(-1) +{ +} + +static D3D12_FILL_MODE _getFillMode(DiffusePointRenderPipelineD3D12::PipelineStateType type) +{ + return D3D12_FILL_MODE_SOLID; +} + +static D3D12_CULL_MODE _getCullMode(DiffusePointRenderPipelineD3D12::PipelineStateType type) +{ + return D3D12_CULL_MODE_NONE; +} + +static void _initRasterizerDesc(DiffusePointRenderPipelineD3D12::PipelineStateType type, D3D12_RASTERIZER_DESC& desc) +{ + PipelineUtilD3D::initRasterizerDesc(FRONT_WINDING_COUNTER_CLOCKWISE, desc); + desc.FillMode = _getFillMode(type); + desc.CullMode = _getCullMode(type); +} + +static void _initPipelineStateDesc(DiffusePointRenderPipelineD3D12::PipelineStateType type, NvCo::Dx12RenderTarget* shadowMap, AppGraphCtxD3D12* renderContext, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + PipelineUtilD3D::initTargetFormat(nullptr, renderContext, psoDesc); + + // Z test, but don't write + { + D3D12_DEPTH_STENCIL_DESC& desc = psoDesc.DepthStencilState; + desc.DepthEnable = TRUE; + desc.DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ZERO; + desc.DepthFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL; + } + + psoDesc.InputLayout.NumElements = _countof(InputElementDescs); + psoDesc.InputLayout.pInputElementDescs = InputElementDescs; + psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT; +} + +int DiffusePointRenderPipelineD3D12::initialize(const RenderStateD3D12& state, const std::wstring& shadersPath, int shadowMapLinearSamplerIndex, NvCo::Dx12RenderTarget* shadowMap) +{ + using namespace NvCo; + ID3D12Device* device = state.m_device; + + m_shadowMapLinearSamplerIndex = shadowMapLinearSamplerIndex; + + // create the pipeline state object + { + D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; + { + // create blend state + D3D12_BLEND_DESC& desc = psoDesc.BlendState; + desc.AlphaToCoverageEnable = FALSE; + desc.IndependentBlendEnable = FALSE; + { + const D3D12_RENDER_TARGET_BLEND_DESC defaultRenderTargetBlendDesc = + { + TRUE,FALSE, + D3D12_BLEND_ONE, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD, + D3D12_BLEND_ONE, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD, + D3D12_LOGIC_OP_NOOP, + D3D12_COLOR_WRITE_ENABLE_ALL, + }; + for (UINT i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + desc.RenderTarget[i] = defaultRenderTargetBlendDesc; + } + } + + + // create the root signature + ComPtr<ID3D12RootSignature> signiture; + { + CD3DX12_DESCRIPTOR_RANGE ranges[2]; + CD3DX12_ROOT_PARAMETER params[3]; + + UINT rootIndex = 0; + { + D3D12_ROOT_PARAMETER& param = params[rootIndex++]; + param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + param.Descriptor.ShaderRegister = 0u; + param.Descriptor.RegisterSpace = 0u; + param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + } + + D3D12_ROOT_SIGNATURE_DESC desc; + desc.NumParameters = rootIndex; + desc.pParameters = params; + desc.NumStaticSamplers = 0u; + desc.pStaticSamplers = nullptr; + desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; + + ComPtr<ID3DBlob> sigBlob; + NV_RETURN_ON_FAIL(Dx12HelperUtil::serializeRootSigniture(desc, D3D_ROOT_SIGNATURE_VERSION_1, sigBlob)); + NV_RETURN_ON_FAIL(device->CreateRootSignature(0u, sigBlob->GetBufferPointer(), sigBlob->GetBufferSize(), IID_PPV_ARGS(&signiture))); + } + + { + psoDesc.VS = Dx12Blob(g_diffuseVS); + psoDesc.GS = Dx12Blob(g_diffuseGS); + psoDesc.PS = Dx12Blob(g_diffusePS); + + NV_RETURN_ON_FAIL(_initPipelineState(state, shadowMap, PIPELINE_STATE_LIGHT_SOLID, signiture.Get(), psoDesc)); + } + } + + return NV_OK; +} + +int DiffusePointRenderPipelineD3D12::_initPipelineState(const RenderStateD3D12& state, NvCo::Dx12RenderTarget* shadowMap, PipelineStateType pipeType, ID3D12RootSignature* signiture, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + ID3D12Device* device = state.m_device; + + _initRasterizerDesc(pipeType, psoDesc.RasterizerState); + _initPipelineStateDesc(pipeType, shadowMap, state.m_renderContext, psoDesc); + + psoDesc.pRootSignature = signiture; + + PipelineStateD3D12& pipeState = m_states[pipeType]; + pipeState.m_rootSignature = signiture; + + NV_RETURN_ON_FAIL(device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pipeState.m_pipelineState))); + return NV_OK; +} + +int DiffusePointRenderPipelineD3D12::bind(const void* paramsIn, const void* platformState) +{ + const RenderStateD3D12& state = *(RenderStateD3D12*)platformState; + const DiffuseDrawParamsD3D& params = *(DiffuseDrawParamsD3D*)paramsIn; + + // Set up constant buffer + NvCo::Dx12CircularResourceHeap::Cursor cursor; + { + Hlsl::DiffuseShaderConst constBuf; + RenderParamsUtilD3D::calcDiffuseConstantBuffer(params, constBuf); + cursor = state.m_constantHeap->newConstantBuffer(constBuf); + if (!cursor.isValid()) + { + return NV_FAIL; + } + } + + const PipelineStateType pipeType = PIPELINE_STATE_LIGHT_SOLID; + PipelineStateD3D12& pipeState = m_states[pipeType]; + if (!pipeState.isValid()) + { + return NV_FAIL; + } + + ID3D12GraphicsCommandList* commandList = state.m_commandList; + commandList->SetGraphicsRootSignature(pipeState.m_rootSignature.Get()); + commandList->SetPipelineState(pipeState.m_pipelineState.Get()); + + D3D12_GPU_VIRTUAL_ADDRESS cbvHandle = state.m_constantHeap->getGpuHandle(cursor); + commandList->SetGraphicsRootConstantBufferView(0, cbvHandle); + + { + ID3D12DescriptorHeap* heaps[] = { state.m_srvCbvUavDescriptorHeap->getHeap() }; + commandList->SetDescriptorHeaps(_countof(heaps), heaps); + } + return NV_OK; +} + +int DiffusePointRenderPipelineD3D12::draw(const RenderAllocation& allocIn, size_t sizeOfAlloc, const void* platformState) +{ + typedef PointRenderAllocationD3D12 Alloc; + const RenderStateD3D12& state = *(RenderStateD3D12*)platformState; + + assert(sizeof(Alloc) == sizeOfAlloc); + const Alloc& alloc = static_cast<const Alloc&>(allocIn); + + assert(alloc.m_numPrimitives >= 0); + + ID3D12GraphicsCommandList* commandList = state.m_commandList; + D3D12_VERTEX_BUFFER_VIEW vertexBufferViews[] = + { + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_POSITION], + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY1], // Actually holds velocity + }; + + commandList->IASetVertexBuffers(0, _countof(vertexBufferViews), vertexBufferViews); + commandList->IASetIndexBuffer(&alloc.m_indexBufferView); + commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_POINTLIST); + + if (alloc.m_indexBufferView.SizeInBytes) + { + commandList->DrawIndexedInstanced((UINT)allocIn.m_numPrimitives, 1, 0, 0, 0); + } + else + { + commandList->DrawInstanced((UINT)allocIn.m_numPrimitives, 1, 0, 0); + } + return NV_OK; +} + +} // namespace FlexSample
\ No newline at end of file diff --git a/demo/d3d12/diffusePointRenderPipelineD3D12.h b/demo/d3d12/diffusePointRenderPipelineD3D12.h new file mode 100644 index 0000000..39f6292 --- /dev/null +++ b/demo/d3d12/diffusePointRenderPipelineD3D12.h @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#ifndef DIFFUSE_POINT_RENDER_PIPELINE_D3D12_H +#define DIFFUSE_POINT_RENDER_PIPELINE_D3D12_H + +#include <DirectXMath.h> +#include "../d3d/renderParamsD3D.h" +#include "renderStateD3D12.h" +#include "meshRenderer.h" + +#include <NvCoDx12RenderTarget.h> + +namespace FlexSample { +using namespace nvidia; + +struct DiffusePointRenderPipelineD3D12: public RenderPipeline +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS(DiffusePointRenderPipelineD3D12, RenderPipeline); +public: + typedef RenderPipeline Parent; + + enum PipelineStateType + { + PIPELINE_STATE_LIGHT_SOLID, + PIPELINE_STATE_COUNT_OF, + }; + + DiffusePointRenderPipelineD3D12(); + + /// Initialize + int initialize(const RenderStateD3D12& state, const std::wstring& shadersDir, int shadowMapLinearSamplerIndex, NvCo::Dx12RenderTarget* shadowMap); + /// Do the binding + virtual int bind(const void* paramsIn, const void* platformState) override; + virtual int draw(const RenderAllocation& alloc, size_t sizeOfAlloc, const void* platformState) override; + + protected: + + int _initPipelineState(const RenderStateD3D12& state, NvCo::Dx12RenderTarget* shadowMap, PipelineStateType pipeType, ID3D12RootSignature* signiture, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc); + + int m_shadowMapLinearSamplerIndex; //< The index to the linear sampler in the m_samplerHeap + PipelineStateD3D12 m_states[PIPELINE_STATE_COUNT_OF]; +}; + +} // namespace FlexSample + +#endif // DIFFUSE_POINT_RENDER_PIPELINE_D3D12_H
\ No newline at end of file diff --git a/demo/d3d12/fluidCompositeRenderPipelineD3D12.cpp b/demo/d3d12/fluidCompositeRenderPipelineD3D12.cpp new file mode 100644 index 0000000..87dafd2 --- /dev/null +++ b/demo/d3d12/fluidCompositeRenderPipelineD3D12.cpp @@ -0,0 +1,166 @@ +#define NOMINMAX + +#include <NvCoDx12HelperUtil.h> +#include <external/D3D12/include/d3dx12.h> + +#include "pipelineUtilD3D12.h" +#include "meshRenderer.h" +#include "bufferD3D12.h" +#include "meshRendererD3D12.h" +#include "../d3d/shaderCommonD3D.h" + +// Shaders +#include "../d3d/shaders/passThroughVS.hlsl.h" +#include "../d3d/shaders/compositePS.hlsl.h" + +// this +#include "fluidCompositeRenderPipelineD3D12.h" + +#define NOMINMAX +#include <wrl.h> +using namespace Microsoft::WRL; + +namespace FlexSample { + +FluidCompositeRenderPipelineD3D12::FluidCompositeRenderPipelineD3D12(): + Parent(PRIMITIVE_TRIANGLE) +{ +} + +static void _initPipelineStateDesc(FluidCompositeRenderPipelineD3D12::PipelineStateType type, AppGraphCtxD3D12* renderContext, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + PipelineUtilD3D::initTargetFormat(nullptr, renderContext, psoDesc); + + psoDesc.InputLayout.NumElements = _countof(MeshRendererD3D12::MeshInputElementDescs); + psoDesc.InputLayout.pInputElementDescs = MeshRendererD3D12::MeshInputElementDescs; + psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; +} + +int FluidCompositeRenderPipelineD3D12::initialize(const RenderStateD3D12& state, const std::wstring& shadersPath) +{ + using namespace NvCo; + ID3D12Device* device = state.m_device; + + // create the pipeline state object + { + D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; + PipelineUtilD3D::initSolidBlendDesc(psoDesc.BlendState); + + // create the root signature + ComPtr<ID3D12RootSignature> signiture; + { + CD3DX12_DESCRIPTOR_RANGE ranges[2]; + CD3DX12_ROOT_PARAMETER params[10]; + + int rangeIndex = 0; + UINT rootIndex = 0; + { + D3D12_ROOT_PARAMETER& param = params[rootIndex++]; + param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + param.Descriptor.ShaderRegister = 0u; + param.Descriptor.RegisterSpace = 0u; + param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + } + + // depthTex, sceneTex, shadowTex + const int numSrvs = 3; + if (numSrvs > 0) + { + ranges[0].Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, numSrvs, 0); + params[rootIndex++].InitAsDescriptorTable(1, &ranges[rangeIndex], D3D12_SHADER_VISIBILITY_PIXEL); + rangeIndex++; + } + + const int numSamplers = 2; + if (numSamplers > 1) + { + ranges[rangeIndex].Init(D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, numSamplers, 0); + params[rootIndex++].InitAsDescriptorTable(1, &ranges[rangeIndex], D3D12_SHADER_VISIBILITY_PIXEL); + rangeIndex++; + } + + D3D12_ROOT_SIGNATURE_DESC desc; + desc.NumParameters = rootIndex; + desc.pParameters = params; + desc.NumStaticSamplers = 0u; + desc.pStaticSamplers = nullptr; + desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; + + ComPtr<ID3DBlob> sigBlob; + NV_RETURN_ON_FAIL(Dx12HelperUtil::serializeRootSigniture(desc, D3D_ROOT_SIGNATURE_VERSION_1, sigBlob)); + NV_RETURN_ON_FAIL(device->CreateRootSignature(0u, sigBlob->GetBufferPointer(), sigBlob->GetBufferSize(), IID_PPV_ARGS(&signiture))); + } + + { + psoDesc.VS = Dx12Blob(g_passThroughVS); + psoDesc.PS = Dx12Blob(g_compositePS); + + NV_RETURN_ON_FAIL(_initPipelineState(state, PIPELINE_STATE_NORMAL, signiture.Get(), psoDesc)); + } + } + + return NV_OK; +} + +int FluidCompositeRenderPipelineD3D12::_initPipelineState(const RenderStateD3D12& state, PipelineStateType pipeType, ID3D12RootSignature* signiture, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + ID3D12Device* device = state.m_device; + + PipelineUtilD3D::initRasterizerDesc(FRONT_WINDING_CLOCKWISE, psoDesc.RasterizerState); + _initPipelineStateDesc(pipeType, state.m_renderContext, psoDesc); + + psoDesc.pRootSignature = signiture; + + PipelineStateD3D12& pipeState = m_states[pipeType]; + pipeState.m_rootSignature = signiture; + + NV_RETURN_ON_FAIL(device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pipeState.m_pipelineState))); + return NV_OK; +} + +int FluidCompositeRenderPipelineD3D12::bind(const void* paramsIn, const void* platformState) +{ + const RenderStateD3D12& state = *(RenderStateD3D12*)platformState; + const FluidDrawParamsD3D& params = *(FluidDrawParamsD3D*)paramsIn; + + PipelineStateD3D12& pipeState = m_states[PIPELINE_STATE_NORMAL]; + if (!pipeState.isValid()) + { + return NV_FAIL; + } + + NvCo::Dx12CircularResourceHeap::Cursor cursor; + { + Hlsl::FluidShaderConst constBuf; + RenderParamsUtilD3D::calcFluidCompositeConstantBuffer(params, constBuf); + cursor = state.m_constantHeap->newConstantBuffer(constBuf); + if (!cursor.isValid()) + { + return NV_FAIL; + } + } + + ID3D12GraphicsCommandList* commandList = state.m_commandList; + + commandList->SetGraphicsRootSignature(pipeState.m_rootSignature.Get()); + commandList->SetPipelineState(pipeState.m_pipelineState.Get()); + + D3D12_GPU_VIRTUAL_ADDRESS cbvHandle = state.m_constantHeap->getGpuHandle(cursor); + commandList->SetGraphicsRootConstantBufferView(0, cbvHandle); + + ID3D12DescriptorHeap* heaps[] = { state.m_srvCbvUavDescriptorHeap->getHeap(), state.m_samplerDescriptorHeap->getHeap() }; + commandList->SetDescriptorHeaps(_countof(heaps), heaps); + + // Bind the srvs + commandList->SetGraphicsRootDescriptorTable(1, state.m_srvCbvUavDescriptorHeap->getGpuHandle(params.m_srvDescriptorBase)); + // Bind the samplers + commandList->SetGraphicsRootDescriptorTable(2, state.m_samplerDescriptorHeap->getGpuHandle(params.m_sampleDescriptorBase)); + return NV_OK; +} + +int FluidCompositeRenderPipelineD3D12::draw(const RenderAllocation& allocIn, size_t sizeOfAlloc, const void* platformState) +{ + return MeshRendererD3D12::defaultDraw(allocIn, sizeOfAlloc, platformState); +} + +} // namespace FlexSample
\ No newline at end of file diff --git a/demo/d3d12/fluidCompositeRenderPipelineD3D12.h b/demo/d3d12/fluidCompositeRenderPipelineD3D12.h new file mode 100644 index 0000000..509acea --- /dev/null +++ b/demo/d3d12/fluidCompositeRenderPipelineD3D12.h @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#ifndef FLUID_COMPOSITE_RENDER_PIPELINE_D3D12_H +#define FLUID_COMPOSITE_RENDER_PIPELINE_D3D12_H + +#include <DirectXMath.h> +#include "../d3d/renderParamsD3D.h" +#include "renderStateD3D12.h" +#include "meshRenderer.h" + +#include <NvCoDx12RenderTarget.h> + +#include "fluidEllipsoidRenderPipelineD3D12.h" + +namespace FlexSample { + +struct FluidCompositeRenderPipelineD3D12: public RenderPipeline +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS(FluidCompositeRenderPipelineD3D12, RenderPipeline); +public: + typedef RenderPipeline Parent; + + enum PipelineStateType + { + PIPELINE_STATE_NORMAL, + PIPELINE_STATE_COUNT_OF, + }; + + FluidCompositeRenderPipelineD3D12(); + + /// Initialize + int initialize(const RenderStateD3D12& state, const std::wstring& shadersPath); + /// Do the binding + virtual int bind(const void* paramsIn, const void* platformState) override; + virtual int draw(const RenderAllocation& alloc, size_t sizeOfAlloc, const void* platformState) override; + + protected: + + int _initPipelineState(const RenderStateD3D12& state, PipelineStateType pipeType, ID3D12RootSignature* signiture, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc); + + PipelineStateD3D12 m_states[PIPELINE_STATE_COUNT_OF]; +}; + +} // namespace FlexSample + +#endif
\ No newline at end of file diff --git a/demo/d3d12/fluidEllipsoidRenderPipelineD3D12.cpp b/demo/d3d12/fluidEllipsoidRenderPipelineD3D12.cpp new file mode 100644 index 0000000..1c7ff53 --- /dev/null +++ b/demo/d3d12/fluidEllipsoidRenderPipelineD3D12.cpp @@ -0,0 +1,176 @@ +#define NOMINMAX + +#include <NvCoDx12HelperUtil.h> + +#include <external/D3D12/include/d3dx12.h> + +#include "pipelineUtilD3D12.h" +#include "meshRenderer.h" +#include "bufferD3D12.h" +#include "meshRendererD3D12.h" +#include "../d3d/shaderCommonD3D.h" + +#include "../d3d/shaders/ellipsoidDepthVS.hlsl.h" +#include "../d3d/shaders/ellipsoidDepthGS.hlsl.h" +#include "../d3d/shaders/ellipsoidDepthPS.hlsl.h" + +// this +#include "fluidEllipsoidRenderPipelineD3D12.h" + +namespace FlexSample { + +static const D3D12_INPUT_ELEMENT_DESC AnisotropicInputElementDescs[] = +{ + { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "U", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "V", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 2, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "W", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 3, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +FluidEllipsoidRenderPipelineD3D12::FluidEllipsoidRenderPipelineD3D12(): + Parent(PRIMITIVE_POINT) +{ +} + +static void _initPipelineStateDesc(FluidEllipsoidRenderPipelineD3D12::PipelineStateType type, NvCo::Dx12RenderTarget* renderTarget, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + PipelineUtilD3D::initTargetFormat(renderTarget, nullptr, psoDesc); + + psoDesc.InputLayout.NumElements = _countof(AnisotropicInputElementDescs); + psoDesc.InputLayout.pInputElementDescs = AnisotropicInputElementDescs; + psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT; +} + +int FluidEllipsoidRenderPipelineD3D12::initialize(const RenderStateD3D12& state, const std::wstring& shadersPath, NvCo::Dx12RenderTarget* renderTarget) +{ + using namespace NvCo; + ID3D12Device* device = state.m_device; + + // create the pipeline state object + { + D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; + PipelineUtilD3D::initSolidBlendDesc(psoDesc.BlendState); + + // create the root signature + ComPtr<ID3D12RootSignature> signiture; + { + CD3DX12_DESCRIPTOR_RANGE ranges[2]; + CD3DX12_ROOT_PARAMETER params[3]; + + UINT rootIndex = 0; + { + D3D12_ROOT_PARAMETER& param = params[rootIndex++]; + param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + param.Descriptor.ShaderRegister = 0u; + param.Descriptor.RegisterSpace = 0u; + param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + } + + D3D12_ROOT_SIGNATURE_DESC desc; + desc.NumParameters = rootIndex; + desc.pParameters = params; + desc.NumStaticSamplers = 0u; + desc.pStaticSamplers = nullptr; + desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; + + ComPtr<ID3DBlob> sigBlob; + NV_RETURN_ON_FAIL(Dx12HelperUtil::serializeRootSigniture(desc, D3D_ROOT_SIGNATURE_VERSION_1, sigBlob)); + NV_RETURN_ON_FAIL(device->CreateRootSignature(0u, sigBlob->GetBufferPointer(), sigBlob->GetBufferSize(), IID_PPV_ARGS(&signiture))); + } + + { + psoDesc.VS = Dx12Blob(g_ellipsoidDepthVS); + psoDesc.GS = Dx12Blob(g_ellipsoidDepthGS); + psoDesc.PS = Dx12Blob(g_ellipsoidDepthPS); + + NV_RETURN_ON_FAIL(_initPipelineState(state, FRONT_WINDING_COUNTER_CLOCKWISE, renderTarget, PIPELINE_NORMAL, signiture.Get(), psoDesc)); + } + } + + return NV_OK; +} + +int FluidEllipsoidRenderPipelineD3D12::_initPipelineState(const RenderStateD3D12& state, FrontWindingType winding, NvCo::Dx12RenderTarget* renderTarget, PipelineStateType pipeType, ID3D12RootSignature* signiture, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + ID3D12Device* device = state.m_device; + + PipelineUtilD3D::initRasterizerDesc(winding, psoDesc.RasterizerState); + + _initPipelineStateDesc(pipeType, renderTarget, psoDesc); + + psoDesc.pRootSignature = signiture; + + PipelineStateD3D12& pipeState = m_states[pipeType]; + pipeState.m_rootSignature = signiture; + + NV_RETURN_ON_FAIL(device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pipeState.m_pipelineState))); + return NV_OK; +} + +int FluidEllipsoidRenderPipelineD3D12::bind(const void* paramsIn, const void* platformState) +{ + const RenderStateD3D12& state = *(RenderStateD3D12*)platformState; + const FluidDrawParamsD3D& params = *(FluidDrawParamsD3D*)paramsIn; + + PipelineStateType pipeType = getPipelineStateType(params.renderStage, params.renderMode, params.cullMode); + PipelineStateD3D12& pipeState = m_states[pipeType]; + if (!pipeState.isValid()) + { + return NV_FAIL; + } + + NvCo::Dx12CircularResourceHeap::Cursor cursor; + { + Hlsl::FluidShaderConst constBuf; + RenderParamsUtilD3D::calcFluidConstantBuffer(params, constBuf); + cursor = state.m_constantHeap->newConstantBuffer(constBuf); + if (!cursor.isValid()) + { + return NV_FAIL; + } + } + + ID3D12GraphicsCommandList* commandList = state.m_commandList; + + commandList->SetGraphicsRootSignature(pipeState.m_rootSignature.Get()); + commandList->SetPipelineState(pipeState.m_pipelineState.Get()); + + D3D12_GPU_VIRTUAL_ADDRESS cbvHandle = state.m_constantHeap->getGpuHandle(cursor); + commandList->SetGraphicsRootConstantBufferView(0, cbvHandle); + + ID3D12DescriptorHeap* heaps[] = { nullptr }; + commandList->SetDescriptorHeaps(0, heaps); + + return NV_OK; +} + +int FluidEllipsoidRenderPipelineD3D12::draw(const RenderAllocation& allocIn, size_t sizeOfAlloc, const void* platformState) +{ + typedef PointRenderAllocationD3D12 Alloc; + const RenderStateD3D12& state = *(RenderStateD3D12*)platformState; + + assert(sizeof(Alloc) == sizeOfAlloc); + const Alloc& alloc = static_cast<const Alloc&>(allocIn); + + assert(allocIn.m_numPrimitives >= 0); + + ID3D12GraphicsCommandList* commandList = state.m_commandList; + + D3D12_VERTEX_BUFFER_VIEW vertexBufferViews[4] = + { + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_POSITION], + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY1], + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY2], + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY3], + }; + + commandList->IASetVertexBuffers(0, _countof(vertexBufferViews), vertexBufferViews); + commandList->IASetIndexBuffer(&alloc.m_indexBufferView); + + commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_POINTLIST); + + commandList->DrawIndexedInstanced((UINT)allocIn.m_numPrimitives, 1, 0, 0, 0); + return NV_OK; +} + +} // namespace FlexSample
\ No newline at end of file diff --git a/demo/d3d12/fluidEllipsoidRenderPipelineD3D12.h b/demo/d3d12/fluidEllipsoidRenderPipelineD3D12.h new file mode 100644 index 0000000..96d326b --- /dev/null +++ b/demo/d3d12/fluidEllipsoidRenderPipelineD3D12.h @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#ifndef FLUID_ELLIPSOID_RENDER_PIPELINE_D3D12_H +#define FLUID_ELLIPSOID_RENDER_PIPELINE_D3D12_H + +#include <DirectXMath.h> +#include "RenderStateD3D12.h" +#include "../d3d/renderParamsD3D.h" +#include "meshRenderer.h" + +#include <NvCoDx12RenderTarget.h> + +namespace FlexHlsl { +struct FluidShaderConst; +} // namespace FlexHlsl + +namespace FlexSample { +using namespace nvidia; + +struct FluidEllipsoidRenderPipelineD3D12: public RenderPipeline +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS(FluidEllipsoidRenderPipelineD3D12, RenderPipeline); +public: + typedef RenderPipeline Parent; + + enum PipelineStateType + { + PIPELINE_NORMAL, + PIPELINE_STATE_COUNT_OF, + }; + + FluidEllipsoidRenderPipelineD3D12(); + + /// Initialize + int initialize(const RenderStateD3D12& state, const std::wstring& shadersDir, NvCo::Dx12RenderTarget* renderTarget); + /// Do the binding + virtual int bind(const void* paramsIn, const void* platformState) override; + virtual int draw(const RenderAllocation& alloc, size_t sizeOfAlloc, const void* platformState) override; + + /// Convert into a single pipeline state type + static PipelineStateType getPipelineStateType(FluidDrawStage stage, FluidRenderMode mode, FluidCullMode cull) { return PIPELINE_NORMAL; } + + protected: + + int _initPipelineState(const RenderStateD3D12& state, FrontWindingType winding, NvCo::Dx12RenderTarget* renderTarget, PipelineStateType pipeType, ID3D12RootSignature* signiture, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc); + + PipelineStateD3D12 m_states[PIPELINE_STATE_COUNT_OF]; +}; + +} // namespace FlexSample + +#endif
\ No newline at end of file diff --git a/demo/d3d12/fluidSmoothRenderPipelineD3D12.cpp b/demo/d3d12/fluidSmoothRenderPipelineD3D12.cpp new file mode 100644 index 0000000..6d6c489 --- /dev/null +++ b/demo/d3d12/fluidSmoothRenderPipelineD3D12.cpp @@ -0,0 +1,158 @@ +#define NOMINMAX + +#include <NvCoDx12HelperUtil.h> +#include <external/D3D12/include/d3dx12.h> + +#include "meshRenderer.h" +#include "pipelineUtilD3D12.h" +#include "bufferD3D12.h" +#include "meshRendererD3D12.h" +#include "../d3d/shaderCommonD3D.h" + +// this +#include "fluidSmoothRenderPipelineD3D12.h" + +// Shaders +#include "../d3d/shaders/passThroughVS.hlsl.h" +#include "../d3d/shaders/blurDepthPS.hlsl.h" + +namespace FlexSample { + +FluidSmoothRenderPipelineD3D12::FluidSmoothRenderPipelineD3D12(int fluidPointDepthSrvIndex): + Parent(PRIMITIVE_TRIANGLE), + m_fluidPointDepthSrvIndex(fluidPointDepthSrvIndex) +{ +} + +static void _initPipelineStateDesc(FluidSmoothRenderPipelineD3D12::PipelineStateType type, NvCo::Dx12RenderTarget* renderTarget, AppGraphCtxD3D12* renderContext, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + PipelineUtilD3D::initTargetFormat(renderTarget, nullptr, psoDesc); + + psoDesc.InputLayout.NumElements = _countof(MeshRendererD3D12::MeshInputElementDescs); + psoDesc.InputLayout.pInputElementDescs = MeshRendererD3D12::MeshInputElementDescs; + psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; +} + +int FluidSmoothRenderPipelineD3D12::initialize(const RenderStateD3D12& state, const std::wstring& shadersPath, NvCo::Dx12RenderTarget* renderTarget) +{ + using namespace NvCo; + ID3D12Device* device = state.m_device; + + // create the pipeline state object + { + D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; + PipelineUtilD3D::initSolidBlendDesc(psoDesc.BlendState); + + // create the root signature + ComPtr<ID3D12RootSignature> signiture; + { + CD3DX12_DESCRIPTOR_RANGE ranges[2]; + CD3DX12_ROOT_PARAMETER params[3]; + + UINT rootIndex = 0; + { + D3D12_ROOT_PARAMETER& param = params[rootIndex++]; + param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + param.Descriptor.ShaderRegister = 0u; + param.Descriptor.RegisterSpace = 0u; + param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + } + + const int numSrvs = 1; + if (numSrvs > 0) + { + ranges[0].Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, numSrvs, 0); + params[rootIndex++].InitAsDescriptorTable(1, &ranges[0], D3D12_SHADER_VISIBILITY_PIXEL); + } + const int numSamplers = 0; + if (numSamplers > 0) + { + ranges[1].Init(D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, numSamplers, 0); + params[rootIndex++].InitAsDescriptorTable(1, &ranges[1], D3D12_SHADER_VISIBILITY_PIXEL); + } + + D3D12_ROOT_SIGNATURE_DESC desc; + desc.NumParameters = rootIndex; + desc.pParameters = params; + desc.NumStaticSamplers = 0u; + desc.pStaticSamplers = nullptr; + desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; + + ComPtr<ID3DBlob> sigBlob; + NV_RETURN_ON_FAIL(Dx12HelperUtil::serializeRootSigniture(desc, D3D_ROOT_SIGNATURE_VERSION_1, sigBlob)); + NV_RETURN_ON_FAIL(device->CreateRootSignature(0u, sigBlob->GetBufferPointer(), sigBlob->GetBufferSize(), IID_PPV_ARGS(&signiture))); + } + + { + psoDesc.VS = Dx12Blob(g_passThroughVS); + psoDesc.PS = Dx12Blob(g_blurDepthPS); + + NV_RETURN_ON_FAIL(_initPipelineState(state, renderTarget, PIPELINE_STATE_NORMAL, signiture.Get(), psoDesc)); + } + } + + return NV_OK; +} + +int FluidSmoothRenderPipelineD3D12::_initPipelineState(const RenderStateD3D12& state, NvCo::Dx12RenderTarget* renderTarget, PipelineStateType pipeType, ID3D12RootSignature* signiture, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + ID3D12Device* device = state.m_device; + + PipelineUtilD3D::initRasterizerDesc(FRONT_WINDING_CLOCKWISE, psoDesc.RasterizerState); + _initPipelineStateDesc(pipeType, renderTarget, state.m_renderContext, psoDesc); + + psoDesc.pRootSignature = signiture; + + PipelineStateD3D12& pipeState = m_states[pipeType]; + pipeState.m_rootSignature = signiture; + + NV_RETURN_ON_FAIL(device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pipeState.m_pipelineState))); + return NV_OK; +} + +int FluidSmoothRenderPipelineD3D12::bind(const void* paramsIn, const void* platformState) +{ + const RenderStateD3D12& state = *(RenderStateD3D12*)platformState; + const FluidDrawParamsD3D& params = *(FluidDrawParamsD3D*)paramsIn; + + PipelineStateD3D12& pipeState = m_states[PIPELINE_STATE_NORMAL]; + if (!pipeState.isValid()) + { + return NV_FAIL; + } + + NvCo::Dx12CircularResourceHeap::Cursor cursor; + { + Hlsl::FluidShaderConst constBuf; + RenderParamsUtilD3D::calcFluidConstantBuffer(params, constBuf); + cursor = state.m_constantHeap->newConstantBuffer(constBuf); + if (!cursor.isValid()) + { + return NV_FAIL; + } + } + + ID3D12GraphicsCommandList* commandList = state.m_commandList; + + commandList->SetGraphicsRootSignature(pipeState.m_rootSignature.Get()); + commandList->SetPipelineState(pipeState.m_pipelineState.Get()); + + D3D12_GPU_VIRTUAL_ADDRESS cbvHandle = state.m_constantHeap->getGpuHandle(cursor); + commandList->SetGraphicsRootConstantBufferView(0, cbvHandle); + + NvCo::Dx12RenderTarget* sourceMap = (NvCo::Dx12RenderTarget*)params.shadowMap; + + ID3D12DescriptorHeap* heaps[] = { state.m_srvCbvUavDescriptorHeap->getHeap(), state.m_samplerDescriptorHeap->getHeap() }; + commandList->SetDescriptorHeaps(_countof(heaps), heaps); + + // Bind the srvs + commandList->SetGraphicsRootDescriptorTable(1, state.m_srvCbvUavDescriptorHeap->getGpuHandle(m_fluidPointDepthSrvIndex)); + return NV_OK; +} + +int FluidSmoothRenderPipelineD3D12::draw(const RenderAllocation& allocIn, size_t sizeOfAlloc, const void* platformState) +{ + return MeshRendererD3D12::defaultDraw(allocIn, sizeOfAlloc, platformState); +} + +} // namespace FlexSample
\ No newline at end of file diff --git a/demo/d3d12/fluidSmoothRenderPipelineD3D12.h b/demo/d3d12/fluidSmoothRenderPipelineD3D12.h new file mode 100644 index 0000000..fc08981 --- /dev/null +++ b/demo/d3d12/fluidSmoothRenderPipelineD3D12.h @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#ifndef FLUID_SMOOTH_RENDER_PIPELINE_D3D12_H +#define FLUID_SMOOTH_RENDER_PIPELINE_D3D12_H + +#include <DirectXMath.h> +#include "RenderStateD3D12.h" +#include "MeshRenderer.h" + +#include <NvCoDx12RenderTarget.h> + +#include "FluidEllipsoidRenderPipelineD3D12.h" + +namespace FlexSample { + +struct FluidSmoothRenderPipelineD3D12: public RenderPipeline +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS(FluidSmoothRenderPipelineD3D12, RenderPipeline); +public: + typedef RenderPipeline Parent; + + enum PipelineStateType + { + PIPELINE_STATE_NORMAL, + PIPELINE_STATE_COUNT_OF, + }; + + FluidSmoothRenderPipelineD3D12(int fluidPointDepthSrvIndex); + + /// Initialize + int initialize(const RenderStateD3D12& state, const std::wstring& shadersPath, NvCo::Dx12RenderTarget* renderTarget); + /// Do the binding + virtual int bind(const void* paramsIn, const void* platformState) override; + virtual int draw(const RenderAllocation& alloc, size_t sizeOfAlloc, const void* platformState) override; + + protected: + + int _initPipelineState(const RenderStateD3D12& state, NvCo::Dx12RenderTarget* renderTarget, PipelineStateType pipeType, ID3D12RootSignature* signiture, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc); + + PipelineStateD3D12 m_states[PIPELINE_STATE_COUNT_OF]; + + int m_fluidPointDepthSrvIndex; +}; + +} // namespace FlexSample + +#endif
\ No newline at end of file diff --git a/demo/d3d12/imguiGraphD3D12.cpp b/demo/d3d12/imguiGraphD3D12.cpp new file mode 100644 index 0000000..64c507d --- /dev/null +++ b/demo/d3d12/imguiGraphD3D12.cpp @@ -0,0 +1,667 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +//direct3d headers +#define NOMINMAX +#include <d3d12.h> + +#include "imguiGraphD3D12.h" + +#include "../d3d/shaders/imguiVS.hlsl.h" +#include "../d3d/shaders/imguiPS.hlsl.h" + +namespace +{ + template <class T> + void inline COMRelease(T& t) + { + if (t) t->Release(); + t = nullptr; + } +} + +namespace +{ + ImguiGraphDescD3D12 m_desc = {}; + + struct Vertex + { + float x, y; + float u, v; + uint8_t rgba[4]; + }; + + ID3D12RootSignature* m_rootSignature = nullptr; + ID3D12PipelineState* m_pipelineState = nullptr; + ID3D12Resource* m_constantBuffer = nullptr; + UINT8* m_constantBufferData = nullptr; + ID3D12Resource* m_vertexBuffer = nullptr; + Vertex* m_vertexBufferData = nullptr; + D3D12_VERTEX_BUFFER_VIEW m_vertexBufferView = {}; + + struct Scissor + { + int beginIdx; + int stopIdx; + int x; + int y; + int width; + int height; + }; + Scissor m_stateScissor = {}; + + ID3D12Resource* m_textureUploadHeap = nullptr; + ID3D12Resource* m_texture = nullptr; + + ID3D12DescriptorHeap* m_srvUavHeapCPU = nullptr; + ID3D12DescriptorHeap* m_srvUavHeapGPU = nullptr; + + Vertex m_stateVert; + uint32_t m_stateVertIdx = 0u; + + struct Params + { + float projection[16]; + + float padding[64 - 16]; + }; + static const int frameCount = 4; + int frameIndex = 0; +} + +void imguiGraphContextInitD3D12(const ImguiGraphDesc* descIn) +{ + const auto desc = cast_to_imguiGraphDescD3D12(descIn); + + m_desc = *desc; + + // create the root signature + { + D3D12_DESCRIPTOR_RANGE ranges[1]; + ranges[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; + ranges[0].NumDescriptors = 1u; + ranges[0].BaseShaderRegister = 0u; + ranges[0].RegisterSpace = 0u; + ranges[0].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; + + D3D12_ROOT_PARAMETER params[2]; + params[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + params[0].Descriptor.ShaderRegister = 0u; + params[0].Descriptor.RegisterSpace = 0u; + params[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + params[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + params[1].DescriptorTable.NumDescriptorRanges = 1; + params[1].DescriptorTable.pDescriptorRanges = ranges; + params[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; + + D3D12_STATIC_SAMPLER_DESC sampler = {}; + sampler.Filter = D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT; + sampler.AddressU = D3D12_TEXTURE_ADDRESS_MODE_BORDER; + sampler.AddressV = D3D12_TEXTURE_ADDRESS_MODE_BORDER; + sampler.AddressW = D3D12_TEXTURE_ADDRESS_MODE_BORDER; + sampler.MipLODBias = 0; + sampler.MaxAnisotropy = 0; + sampler.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER; + sampler.BorderColor = D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK; + sampler.MinLOD = 0.f; + sampler.MaxLOD = D3D12_FLOAT32_MAX; + sampler.ShaderRegister = 0; + sampler.RegisterSpace = 0; + sampler.ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; + + D3D12_ROOT_SIGNATURE_DESC desc; + desc.NumParameters = 2; + desc.pParameters = params; + desc.NumStaticSamplers = 1u; + desc.pStaticSamplers = &sampler; + desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; + + ID3DBlob* signature = nullptr; + ID3DBlob* error = nullptr; + HRESULT hr = S_OK; + if (hr = D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error)) + { + return; + } + if (hr = m_desc.device->CreateRootSignature(0u, signature->GetBufferPointer(), signature->GetBufferSize(), IID_PPV_ARGS(&m_rootSignature))) + { + return; + } + COMRelease(signature); + COMRelease(error); + } + + // create the pipeline state object + { + D3D12_INPUT_ELEMENT_DESC inputElementDescs[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + }; + + const bool wireFrame = false; + + D3D12_RASTERIZER_DESC rasterDesc; + if (wireFrame) + { + rasterDesc.FillMode = D3D12_FILL_MODE_WIREFRAME; + rasterDesc.CullMode = D3D12_CULL_MODE_NONE; + } + else + { + rasterDesc.FillMode = D3D12_FILL_MODE_SOLID; + rasterDesc.CullMode = D3D12_CULL_MODE_BACK; + } + rasterDesc.FrontCounterClockwise = TRUE; // FALSE; + rasterDesc.DepthBias = D3D12_DEFAULT_DEPTH_BIAS; + rasterDesc.DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP; + rasterDesc.SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; + rasterDesc.DepthClipEnable = TRUE; + rasterDesc.MultisampleEnable = FALSE; + rasterDesc.AntialiasedLineEnable = FALSE; + rasterDesc.ForcedSampleCount = 0; + rasterDesc.ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; + + D3D12_BLEND_DESC blendDesc; + blendDesc.AlphaToCoverageEnable = FALSE; + blendDesc.IndependentBlendEnable = FALSE; + { + const D3D12_RENDER_TARGET_BLEND_DESC defaultRenderTargetBlendDesc = + { + TRUE,FALSE, + D3D12_BLEND_SRC_ALPHA, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD, + D3D12_BLEND_SRC_ALPHA, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD, + D3D12_LOGIC_OP_NOOP, + D3D12_COLOR_WRITE_ENABLE_ALL, + }; + for (UINT i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + blendDesc.RenderTarget[i] = defaultRenderTargetBlendDesc; + } + + D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; + psoDesc.InputLayout.NumElements = 3; + psoDesc.InputLayout.pInputElementDescs = inputElementDescs; + psoDesc.pRootSignature = m_rootSignature; + psoDesc.VS.pShaderBytecode = g_imguiVS; + psoDesc.VS.BytecodeLength = sizeof(g_imguiVS); + psoDesc.PS.pShaderBytecode = g_imguiPS; + psoDesc.PS.BytecodeLength = sizeof(g_imguiPS); + psoDesc.RasterizerState = rasterDesc; + psoDesc.BlendState = blendDesc; + psoDesc.DepthStencilState.DepthEnable = FALSE; + psoDesc.DepthStencilState.StencilEnable = FALSE; + psoDesc.SampleMask = UINT_MAX; + psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + psoDesc.NumRenderTargets = 1; + psoDesc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM; + psoDesc.SampleDesc.Count = desc->numMSAASamples; + HRESULT hr = S_OK; + if (hr = m_desc.device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&m_pipelineState))) + { + return; + } + } + + // create a constant buffer + { + Params params = { + 1.f, 0.f, 0.f, 0.f, + 0.f, 1.f, 0.f, 0.f, + 0.f, 0.f, 1.f, 0.f, + 0.f, 0.f, 0.f, 1.f + }; + + HRESULT hr = S_OK; + + D3D12_HEAP_PROPERTIES heapProps = {}; + heapProps.Type = D3D12_HEAP_TYPE_UPLOAD; + heapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; + heapProps.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; + heapProps.CreationNodeMask = 0u; + heapProps.VisibleNodeMask = 0u; + + D3D12_RESOURCE_DESC desc = {}; + desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; + desc.Alignment = 0u; + desc.Width = frameCount*sizeof(params); + desc.Height = 1u; + desc.DepthOrArraySize = 1u; + desc.MipLevels = 1; + desc.Format = DXGI_FORMAT_UNKNOWN; + desc.SampleDesc.Count = 1u; + desc.SampleDesc.Quality = 0u; + desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; + desc.Flags = D3D12_RESOURCE_FLAG_NONE; + + if (hr = m_desc.device->CreateCommittedResource(&heapProps, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_GENERIC_READ, + nullptr, IID_PPV_ARGS(&m_constantBuffer))) + { + return; + } + + UINT8* pdata; + D3D12_RANGE readRange = {}; + if (hr = m_constantBuffer->Map(0, &readRange, (void**)&pdata)) + { + return; + } + else + { + memcpy(pdata, ¶ms, sizeof(params)); + m_constantBufferData = pdata; + //m_constantBuffer->Unmap(0, nullptr); // leave mapped + } + } + + // create a vertex buffer + { + HRESULT hr = S_OK; + + UINT bufferSize = (UINT)(m_desc.maxVertices * frameCount) * sizeof(Vertex); + + D3D12_HEAP_PROPERTIES heapProps = {}; + heapProps.Type = D3D12_HEAP_TYPE_UPLOAD; + heapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; + heapProps.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; + heapProps.CreationNodeMask = 0u; + heapProps.VisibleNodeMask = 0u; + + D3D12_RESOURCE_DESC desc = {}; + desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; + desc.Alignment = 0u; + desc.Width = bufferSize; + desc.Height = 1u; + desc.DepthOrArraySize = 1u; + desc.MipLevels = 1; + desc.Format = DXGI_FORMAT_UNKNOWN; + desc.SampleDesc.Count = 1u; + desc.SampleDesc.Quality = 0u; + desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; + desc.Flags = D3D12_RESOURCE_FLAG_NONE; + + if (hr = m_desc.device->CreateCommittedResource(&heapProps, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_GENERIC_READ, + nullptr, IID_PPV_ARGS(&m_vertexBuffer))) + { + return; + } + + UINT8* pdata; + D3D12_RANGE readRange = {}; + if (hr = m_vertexBuffer->Map(0, &readRange, (void**)&pdata)) + { + return; + } + else + { + m_vertexBufferData = (Vertex*)pdata; + //m_vertexBufferUpload->Unmap(0, nullptr); + } + + m_vertexBufferView.BufferLocation = m_vertexBuffer->GetGPUVirtualAddress(); + m_vertexBufferView.StrideInBytes = sizeof(Vertex); + m_vertexBufferView.SizeInBytes = bufferSize; + } +} + +void imguiGraphContextUpdateD3D12(const ImguiGraphDesc* descIn) +{ + const auto desc = cast_to_imguiGraphDescD3D12(descIn); + + m_desc = *desc; +} + +void imguiGraphContextDestroyD3D12() +{ + COMRelease(m_rootSignature); + COMRelease(m_pipelineState); + COMRelease(m_constantBuffer); + COMRelease(m_vertexBuffer); +} + +void imguiGraphRecordBeginD3D12() +{ + frameIndex = (frameIndex + 1) % frameCount; + + Params params = { + 2.f / float(m_desc.winW), 0.f, 0.f, -1.f, + 0.f, 2.f / float(m_desc.winH), 0.f, -1.f, + 0.f, 0.f, 1.f, 0.f, + 0.f, 0.f, 0.f, 1.f + }; + + memcpy(m_constantBufferData + frameIndex*sizeof(Params), ¶ms, sizeof(Params)); + + // clear state + m_stateVert = Vertex{ 0.f, 0.f, -1.f, -1.f, 0,0,0,0 }; + m_stateVertIdx = 0u; + + m_stateScissor = Scissor { 0, 0, 0, 0, m_desc.winW, m_desc.winH }; + + // configure for triangle renderering + ID3D12GraphicsCommandList* commandList = m_desc.commandList; + + D3D12_CPU_DESCRIPTOR_HANDLE srvHandleCPU; + D3D12_GPU_DESCRIPTOR_HANDLE srvHandleGPU; + ID3D12DescriptorHeap* heap = nullptr; + if (m_desc.dynamicHeapCbvSrvUav.reserveDescriptors) + { + auto handle = m_desc.dynamicHeapCbvSrvUav.reserveDescriptors(m_desc.dynamicHeapCbvSrvUav.userdata, + 1u, m_desc.lastFenceCompleted, m_desc.nextFenceValue); + heap = handle.heap; + srvHandleCPU = handle.cpuHandle; + srvHandleGPU = handle.gpuHandle; + } + else + { + if (m_srvUavHeapGPU == nullptr) + { + D3D12_DESCRIPTOR_HEAP_DESC srvHeapDesc = {}; + srvHeapDesc.NumDescriptors = 1; + srvHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; + srvHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; + m_desc.device->CreateDescriptorHeap(&srvHeapDesc, IID_PPV_ARGS(&m_srvUavHeapGPU)); + } + heap = m_srvUavHeapGPU; + srvHandleCPU = m_srvUavHeapGPU->GetCPUDescriptorHandleForHeapStart(); + srvHandleGPU = m_srvUavHeapGPU->GetGPUDescriptorHandleForHeapStart(); + } + + commandList->SetDescriptorHeaps(1, &heap); + + m_desc.device->CopyDescriptorsSimple(1u, srvHandleCPU, m_srvUavHeapCPU->GetCPUDescriptorHandleForHeapStart(), D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + + commandList->SetGraphicsRootSignature(m_rootSignature); + commandList->SetPipelineState(m_pipelineState); + + D3D12_GPU_VIRTUAL_ADDRESS cbvHandle = m_constantBuffer->GetGPUVirtualAddress(); + commandList->SetGraphicsRootConstantBufferView(0, cbvHandle + frameIndex * sizeof(Params)); + + commandList->SetGraphicsRootDescriptorTable(1, srvHandleGPU); + + commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + commandList->IASetVertexBuffers(0, 1, &m_vertexBufferView); +} + +static void imguiGraphFlush() +{ + ID3D12GraphicsCommandList* commandList = m_desc.commandList; + + Scissor& p = m_stateScissor; + if (p.beginIdx < p.stopIdx) + { + int winH = m_desc.winH; + D3D12_RECT rect; + rect.left = p.x; + rect.right = p.x + p.width; + rect.top = (winH) - (p.y + p.height); + rect.bottom = (winH) - (p.y); + commandList->RSSetScissorRects(1, &rect); + + UINT vertexCount = (p.stopIdx - p.beginIdx); + UINT startIndex = p.beginIdx + frameIndex * m_desc.maxVertices; + commandList->DrawInstanced(vertexCount, 1, startIndex, 0); + } +} + +void imguiGraphRecordEndD3D12() +{ + ID3D12GraphicsCommandList* commandList = m_desc.commandList; + + // no need to hold onto this + COMRelease(m_textureUploadHeap); + + // restore scissor + Scissor& p = m_stateScissor; + int winH = m_desc.winH; + D3D12_RECT rect; + rect.left = p.x; + rect.right = p.x + p.width; + rect.top = (winH) - (p.y + p.height); + rect.bottom = (winH) - (p.y); + commandList->RSSetScissorRects(1, &rect); +} + +void imguiGraphEnableScissorD3D12(int x, int y, int width, int height) +{ + // mark end of last region + m_stateScissor.stopIdx = m_stateVertIdx; + + imguiGraphFlush(); + + m_stateScissor.beginIdx = m_stateVertIdx; + m_stateScissor.stopIdx = m_stateVertIdx; + m_stateScissor.x = x; + m_stateScissor.y = y; + m_stateScissor.width = width; + m_stateScissor.height = height; +} + +void imguiGraphDisableScissorD3D12() +{ + if (m_stateVertIdx == 0) return; + + // mark end of last region + m_stateScissor.stopIdx = m_stateVertIdx; + + imguiGraphFlush(); + + m_stateScissor.beginIdx = m_stateVertIdx; + m_stateScissor.stopIdx = m_stateVertIdx; + m_stateScissor.x = 0; + m_stateScissor.y = 0; + m_stateScissor.width = m_desc.winW; + m_stateScissor.height = m_desc.winH; +} + +void imguiGraphVertex2fD3D12(float x, float y) +{ + float v[2] = { x,y }; + imguiGraphVertex2fvD3D12(v); +} + +void imguiGraphVertex2fvD3D12(const float* v) +{ + // update state + m_stateVert.x = v[0]; + m_stateVert.y = v[1]; + + Vertex* vdata = &m_vertexBufferData[frameIndex * m_desc.maxVertices]; + + // push vertex + if ((m_stateVertIdx) < m_desc.maxVertices) + { + vdata[m_stateVertIdx++] = m_stateVert; + } +} + +void imguiGraphTexCoord2fD3D12(float u, float v) +{ + m_stateVert.u = u; + m_stateVert.v = v; +} + +void imguiGraphColor4ubD3D12(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) +{ + m_stateVert.rgba[0] = red; + m_stateVert.rgba[1] = green; + m_stateVert.rgba[2] = blue; + m_stateVert.rgba[3] = alpha; +} + +void imguiGraphColor4ubvD3D12(const uint8_t* v) +{ + m_stateVert.rgba[0] = v[0]; + m_stateVert.rgba[1] = v[1]; + m_stateVert.rgba[2] = v[2]; + m_stateVert.rgba[3] = v[3]; +} + +void imguiGraphFontTextureEnableD3D12() +{ + +} + +void imguiGraphFontTextureDisableD3D12() +{ + m_stateVert.u = -1.f; + m_stateVert.v = -1.f; +} + +void imguiGraphFontTextureInitD3D12(unsigned char* data) +{ + ID3D12GraphicsCommandList* commandList = m_desc.commandList; + + // Create the texture + { + UINT width = 512; + UINT height = 512; + + D3D12_HEAP_PROPERTIES heapProps = {}; + heapProps.Type = D3D12_HEAP_TYPE_DEFAULT; + heapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; + heapProps.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; + heapProps.CreationNodeMask = 0u; + heapProps.VisibleNodeMask = 0u; + + D3D12_RESOURCE_DESC texDesc = {}; + texDesc.MipLevels = 1u; + texDesc.Format = DXGI_FORMAT_R8_UNORM; + texDesc.Width = width; + texDesc.Height = height; + texDesc.Flags = D3D12_RESOURCE_FLAG_NONE; + texDesc.DepthOrArraySize = 1u; + texDesc.SampleDesc.Count = 1u; + texDesc.SampleDesc.Quality = 0u; + texDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + + if (m_desc.device->CreateCommittedResource( + &heapProps, + D3D12_HEAP_FLAG_NONE, + &texDesc, + D3D12_RESOURCE_STATE_COPY_DEST, + nullptr, + IID_PPV_ARGS(&m_texture) + )) + { + return; + } + + // get footprint information + D3D12_PLACED_SUBRESOURCE_FOOTPRINT footprint = {}; + UINT64 uploadHeapSize = 0u; + m_desc.device->GetCopyableFootprints(&texDesc, 0u, 1u, 0u, &footprint, nullptr, nullptr, &uploadHeapSize); + + heapProps.Type = D3D12_HEAP_TYPE_UPLOAD; + D3D12_RESOURCE_DESC bufferDesc = texDesc; + bufferDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; + bufferDesc.Alignment = 0u; + bufferDesc.Width = uploadHeapSize; + bufferDesc.Height = 1u; + bufferDesc.DepthOrArraySize = 1u; + bufferDesc.MipLevels = 1; + bufferDesc.Format = DXGI_FORMAT_UNKNOWN; + bufferDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; + bufferDesc.Flags = D3D12_RESOURCE_FLAG_NONE; + + if (m_desc.device->CreateCommittedResource( + &heapProps, + D3D12_HEAP_FLAG_NONE, + &bufferDesc, + D3D12_RESOURCE_STATE_GENERIC_READ, + nullptr, + IID_PPV_ARGS(&m_textureUploadHeap) + )) + { + return; + } + + // map upload heap, and convert rgb bitmap to rgba + UINT8* pdata; + D3D12_RANGE readRange = {}; + if (m_textureUploadHeap->Map(0, &readRange, (void**)&pdata)) + { + return; + } + else + { + UINT8* dst = pdata; + UINT elements = width*height; + UINT8* src = data; + for (UINT j = 0; j < height; j++) + { + for (UINT i = 0; i < width; i++) + { + UINT idx = j * (footprint.Footprint.RowPitch) + i; + + UINT8 a = src[j * width + i]; + dst[idx] = a; + } + } + + m_textureUploadHeap->Unmap(0, nullptr); + } + + // add copy from upload heap to default heap to command list + D3D12_TEXTURE_COPY_LOCATION dstCopy = {}; + D3D12_TEXTURE_COPY_LOCATION srcCopy = {}; + dstCopy.pResource = m_texture; + dstCopy.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + dstCopy.SubresourceIndex = 0u; + srcCopy.pResource = m_textureUploadHeap; + srcCopy.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + srcCopy.PlacedFootprint = footprint; + commandList->CopyTextureRegion(&dstCopy, 0, 0, 0, &srcCopy, nullptr); + + D3D12_RESOURCE_BARRIER barrier[1] = {}; + auto textureBarrier = [&barrier](UINT idx, ID3D12Resource* texture) + { + barrier[idx].Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + barrier[idx].Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE; + barrier[idx].Transition.pResource = texture; + barrier[idx].Transition.Subresource = 0u; + barrier[idx].Transition.StateBefore = D3D12_RESOURCE_STATE_COPY_DEST; + barrier[idx].Transition.StateAfter = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + }; + textureBarrier(0, m_texture); + commandList->ResourceBarrier(1, barrier); + + // create an SRV heap and descriptor for the texture + D3D12_DESCRIPTOR_HEAP_DESC srvHeapDesc = {}; + srvHeapDesc.NumDescriptors = 1; + srvHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; + srvHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; + if (m_desc.device->CreateDescriptorHeap(&srvHeapDesc, IID_PPV_ARGS(&m_srvUavHeapCPU))) + { + return; + } + + D3D12_CPU_DESCRIPTOR_HANDLE srvUavHandle = m_srvUavHeapCPU->GetCPUDescriptorHandleForHeapStart(); + + D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; + srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; + srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + srvDesc.Format = texDesc.Format; + srvDesc.Texture2D.MipLevels = 1; + srvDesc.Texture2D.MostDetailedMip = 0; + srvDesc.Texture2D.ResourceMinLODClamp = 0.f; + + m_desc.device->CreateShaderResourceView(m_texture, &srvDesc, srvUavHandle); + } + +} + +void imguiGraphFontTextureReleaseD3D12() +{ + COMRelease(m_texture); + COMRelease(m_textureUploadHeap); + COMRelease(m_srvUavHeapCPU); + COMRelease(m_srvUavHeapGPU); +}
\ No newline at end of file diff --git a/demo/d3d12/imguiGraphD3D12.h b/demo/d3d12/imguiGraphD3D12.h new file mode 100644 index 0000000..fc2e67e --- /dev/null +++ b/demo/d3d12/imguiGraphD3D12.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#ifndef IMGUI_GRAPH_D3D12_H +#define IMGUI_GRAPH_D3D12_H + +#include <stdint.h> + +#include "../d3d/imguiGraph.h" + +struct ImguiDescriptorReserveHandleD3D12 +{ + ID3D12DescriptorHeap* heap; + UINT descriptorSize; + D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle; + D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle; +}; + +struct ImguiDynamicDescriptorHeapD3D12 +{ + void* userdata; + ImguiDescriptorReserveHandleD3D12(*reserveDescriptors)(void* userdata, UINT numDescriptors, UINT64 lastFenceCompleted, UINT64 nextFenceValue); +}; + +struct ImguiGraphDescD3D12 +{ + ID3D12Device* device = nullptr; + ID3D12GraphicsCommandList* commandList = nullptr; + UINT64 lastFenceCompleted; + UINT64 nextFenceValue; + int winW; + int winH; + int numMSAASamples = 1; + + uint32_t maxVertices = 64 * 4096u; + + ImguiDynamicDescriptorHeapD3D12 dynamicHeapCbvSrvUav = {}; + + ImguiGraphDescD3D12() {} +}; + +inline const ImguiGraphDescD3D12* cast_to_imguiGraphDescD3D12(const ImguiGraphDesc* desc) +{ + return (const ImguiGraphDescD3D12*)(desc); +} + +inline ImguiGraphDesc* cast_from_imguiGraphDescD3D12(ImguiGraphDescD3D12* desc) +{ + return (ImguiGraphDesc*)(desc); +} + +IMGUI_GRAPH_API void imguiGraphContextInitD3D12(const ImguiGraphDesc* desc); + +IMGUI_GRAPH_API void imguiGraphContextUpdateD3D12(const ImguiGraphDesc* desc); + +IMGUI_GRAPH_API void imguiGraphContextDestroyD3D12(); + +IMGUI_GRAPH_API void imguiGraphRecordBeginD3D12(); + +IMGUI_GRAPH_API void imguiGraphRecordEndD3D12(); + +IMGUI_GRAPH_API void imguiGraphVertex2fD3D12(float x, float y); + +IMGUI_GRAPH_API void imguiGraphVertex2fvD3D12(const float* v); + +IMGUI_GRAPH_API void imguiGraphTexCoord2fD3D12(float u, float v); + +IMGUI_GRAPH_API void imguiGraphColor4ubD3D12(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha); + +IMGUI_GRAPH_API void imguiGraphColor4ubvD3D12(const uint8_t* v); + +IMGUI_GRAPH_API void imguiGraphFontTextureEnableD3D12(); + +IMGUI_GRAPH_API void imguiGraphFontTextureDisableD3D12(); + +IMGUI_GRAPH_API void imguiGraphEnableScissorD3D12(int x, int y, int width, int height); + +IMGUI_GRAPH_API void imguiGraphDisableScissorD3D12(); + +IMGUI_GRAPH_API void imguiGraphFontTextureInitD3D12(unsigned char* data); + +IMGUI_GRAPH_API void imguiGraphFontTextureReleaseD3D12(); + +#endif
\ No newline at end of file diff --git a/demo/d3d12/imguiInteropD3D12.cpp b/demo/d3d12/imguiInteropD3D12.cpp new file mode 100644 index 0000000..23d7422 --- /dev/null +++ b/demo/d3d12/imguiInteropD3D12.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + //direct3d headers +#define NOMINMAX +#include <d3d12.h> + +// include the Direct3D Library file +#pragma comment (lib, "d3d12.lib") + +#include "imguiGraphD3D12.h" + +#include "appD3D12Ctx.h" + +struct AppGraphCtx; + +namespace NvCo = nvidia::Common; + +inline void imguiInteropUpdateDesc(ImguiGraphDescD3D12& desc, AppGraphCtx* appctxIn) +{ + auto context = cast_to_AppGraphCtxD3D12(appctxIn); + + desc.device = context->m_device; + desc.commandList = context->m_commandList; + + desc.lastFenceCompleted = 0; + desc.nextFenceValue = 1; + + desc.winW = context->m_winW; + desc.winH = context->m_winH; + desc.numMSAASamples = context->m_numMsaaSamples; + desc.dynamicHeapCbvSrvUav.userdata = context; + desc.dynamicHeapCbvSrvUav.reserveDescriptors = nullptr; +} + +IMGUI_GRAPH_API bool imguiInteropGraphInitD3D12(imguiGraphInit_t func, const char* fontpath, AppGraphCtx* appctx); + +IMGUI_GRAPH_API void imguiInteropGraphUpdateD3D12(imguiGraphUpdate_t func, AppGraphCtx* appctx); + +bool imguiInteropGraphInitD3D12(imguiGraphInit_t func, const char* fontpath, AppGraphCtx* appctx) +{ + ImguiGraphDescD3D12 desc; + imguiInteropUpdateDesc(desc, appctx); + + return func(fontpath, cast_from_imguiGraphDescD3D12(&desc)); +} + +void imguiInteropGraphUpdateD3D12(imguiGraphUpdate_t func, AppGraphCtx* appctx) +{ + ImguiGraphDescD3D12 desc; + imguiInteropUpdateDesc(desc, appctx); + + return func(cast_from_imguiGraphDescD3D12(&desc)); +}
\ No newline at end of file diff --git a/demo/d3d12/lineRenderPipelineD3D12.cpp b/demo/d3d12/lineRenderPipelineD3D12.cpp new file mode 100644 index 0000000..e6d75a1 --- /dev/null +++ b/demo/d3d12/lineRenderPipelineD3D12.cpp @@ -0,0 +1,140 @@ +#define NOMINMAX + +#include <NvCoDx12HelperUtil.h> +#include <external/D3D12/include/d3dx12.h> + +#include "pipelineUtilD3D12.h" +#include "bufferD3D12.h" +#include "meshRendererD3D12.h" +#include "../d3d/shaderCommonD3D.h" + +// this +#include "lineRenderPipelineD3D12.h" + +// Shaders +#include "../d3d/shaders/debugLineVS.hlsl.h" +#include "../d3d/shaders/debugLinePS.hlsl.h" + +namespace FlexSample { + +static const D3D12_INPUT_ELEMENT_DESC InputElementDescs[] = +{ + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, sizeof(Vec3), D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +LineRenderPipelineD3D12::LineRenderPipelineD3D12(): + Parent(PRIMITIVE_LINE) +{ +} + +int LineRenderPipelineD3D12::initialize(const RenderStateD3D12& state, const std::wstring& shadersPath, NvCo::Dx12RenderTarget* shadowMap) +{ + using namespace NvCo; + ID3D12Device* device = state.m_device; + + // create the pipeline state object + { + D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; + PipelineUtilD3D::initSolidBlendDesc(psoDesc.BlendState); + PipelineUtilD3D::initRasterizerDesc(FRONT_WINDING_CLOCKWISE, psoDesc.RasterizerState); + + { + PipelineUtilD3D::initTargetFormat(nullptr, state.m_renderContext, psoDesc); + + psoDesc.InputLayout.NumElements = _countof(InputElementDescs); + psoDesc.InputLayout.pInputElementDescs = InputElementDescs; + psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE; + } + + //psoDesc.RasterizerState.MultisampleEnable = TRUE; + psoDesc.RasterizerState.FrontCounterClockwise = TRUE; + + // create the root signature + ComPtr<ID3D12RootSignature> signiture; + { + CD3DX12_DESCRIPTOR_RANGE ranges[2]; + CD3DX12_ROOT_PARAMETER params[3]; + + UINT rootIndex = 0; + { + D3D12_ROOT_PARAMETER& param = params[rootIndex++]; + param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + param.Descriptor.ShaderRegister = 0u; + param.Descriptor.RegisterSpace = 0u; + param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + } + + D3D12_ROOT_SIGNATURE_DESC desc; + desc.NumParameters = rootIndex; + desc.pParameters = params; + desc.NumStaticSamplers = 0u; + desc.pStaticSamplers = nullptr; + desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; + + ComPtr<ID3DBlob> sigBlob; + NV_RETURN_ON_FAIL(Dx12HelperUtil::serializeRootSigniture(desc, D3D_ROOT_SIGNATURE_VERSION_1, sigBlob)); + NV_RETURN_ON_FAIL(device->CreateRootSignature(0u, sigBlob->GetBufferPointer(), sigBlob->GetBufferSize(), IID_PPV_ARGS(&signiture))); + } + + psoDesc.VS = Dx12Blob(g_debugLineVS); + psoDesc.PS = Dx12Blob(g_debugLinePS); + psoDesc.pRootSignature = signiture.Get(); + + { + PipelineStateD3D12& pipeState = m_states[PIPELINE_STATE_NORMAL]; + pipeState.m_rootSignature = signiture.Get(); + NV_RETURN_ON_FAIL(device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pipeState.m_pipelineState))); + } + { + // Setup for shadow + PipelineUtilD3D::initTargetFormat(shadowMap, nullptr, psoDesc); + + PipelineStateD3D12& pipeState = m_states[PIPELINE_STATE_SHADOW]; + pipeState.m_rootSignature = signiture.Get(); + NV_RETURN_ON_FAIL(device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pipeState.m_pipelineState))); + } + } + + return NV_OK; +} + +int LineRenderPipelineD3D12::bind(const void* paramsIn, const void* platformState) +{ + const RenderStateD3D12& state = *(RenderStateD3D12*)platformState; + LineDrawParams& params = *(LineDrawParams*)paramsIn; + + // Set up constant buffer + NvCo::Dx12CircularResourceHeap::Cursor cursor = state.m_constantHeap->newConstantBuffer(params); + if (!cursor.isValid()) + { + return NV_FAIL; + } + + PipelineStateD3D12& pipeState = (params.m_drawStage == LINE_DRAW_NORMAL) ? m_states[PIPELINE_STATE_NORMAL] : m_states[PIPELINE_STATE_SHADOW]; + if (!pipeState.isValid()) + { + return NV_FAIL; + } + + ID3D12GraphicsCommandList* commandList = state.m_commandList; + commandList->SetGraphicsRootSignature(pipeState.m_rootSignature.Get()); + commandList->SetPipelineState(pipeState.m_pipelineState.Get()); + + D3D12_GPU_VIRTUAL_ADDRESS cbvHandle = state.m_constantHeap->getGpuHandle(cursor); + commandList->SetGraphicsRootConstantBufferView(0, cbvHandle); + + { + ID3D12DescriptorHeap* heaps[] = { state.m_srvCbvUavDescriptorHeap->getHeap() }; + commandList->SetDescriptorHeaps(_countof(heaps), heaps); + } + + return NV_OK; +} + +int LineRenderPipelineD3D12::draw(const RenderAllocation& allocIn, size_t sizeOfAlloc, const void* platformState) +{ + return MeshRendererD3D12::defaultDraw(allocIn, sizeOfAlloc, platformState); +} + +} // namespace FlexSample
\ No newline at end of file diff --git a/demo/d3d12/lineRenderPipelineD3D12.h b/demo/d3d12/lineRenderPipelineD3D12.h new file mode 100644 index 0000000..ce3db58 --- /dev/null +++ b/demo/d3d12/lineRenderPipelineD3D12.h @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#ifndef LINE_RENDER_PIPELINE_D3D12_H +#define LINE_RENDER_PIPELINE_D3D12_H + +#include <DirectXMath.h> +#include "renderStateD3D12.h" +#include "meshRenderer.h" + +#include <NvCoDx12RenderTarget.h> + +#include <string> + +namespace FlexSample { +using namespace nvidia; + +enum LineDrawStage +{ + LINE_DRAW_NORMAL, + LINE_DRAW_SHADOW, +}; + +struct LineDrawParams +{ + Hlsl::float4x4 m_modelWorldProjection; /// Transforms point from world-space to clip space + LineDrawStage m_drawStage; +}; + +struct LineRenderPipelineD3D12: public RenderPipeline +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS(LineRenderPipelineD3D12, RenderPipeline); +public: + typedef RenderPipeline Parent; + + enum PipelineStateType + { + PIPELINE_STATE_NORMAL, + PIPELINE_STATE_SHADOW, + PIPELINE_STATE_COUNT_OF, + }; + + LineRenderPipelineD3D12(); + + /// Initialize + int initialize(const RenderStateD3D12& state, const std::wstring& shadersDir, NvCo::Dx12RenderTarget* shadowMap); + /// Do the binding + virtual int bind(const void* paramsIn, const void* platformState) override; + virtual int draw(const RenderAllocation& alloc, size_t sizeOfAlloc, const void* platformState) override; + + protected: + + PipelineStateD3D12 m_states[PIPELINE_STATE_COUNT_OF]; +}; + +} // namespace FlexSample + +#endif
\ No newline at end of file diff --git a/demo/d3d12/meshRenderPipelineD3D12.cpp b/demo/d3d12/meshRenderPipelineD3D12.cpp new file mode 100644 index 0000000..167a032 --- /dev/null +++ b/demo/d3d12/meshRenderPipelineD3D12.cpp @@ -0,0 +1,284 @@ +#define NOMINMAX + +#include <NvCoDx12HelperUtil.h> +#include <external/D3D12/include/d3dx12.h> + +#include "pipelineUtilD3D12.h" +#include "meshRenderer.h" +#include "bufferD3D12.h" +#include "meshRendererD3D12.h" +#include "../d3d/shaderCommonD3D.h" + +// this +#include "meshRenderPipelineD3D12.h" + +// Shaders +#include "../d3d/shaders/meshVS.hlsl.h" +#include "../d3d/shaders/meshPS.hlsl.h" +#include "../d3d/shaders/meshShadowPS.hlsl.h" + +namespace FlexSample { + +// Make async compute benchmark shader have a unique name +namespace AsyncComputeBench +{ +#include "../d3d/shaders/meshAsyncComputeBenchPS.hlsl.h" +} + +MeshRenderPipelineD3D12::MeshRenderPipelineD3D12(): + Parent(PRIMITIVE_TRIANGLE), + m_shadowMapLinearSamplerIndex(-1) +{ +} + +/* static */MeshRenderPipelineD3D12::PipelineStateType MeshRenderPipelineD3D12::getPipelineStateType(MeshDrawStage stage, MeshRenderMode mode, MeshCullMode cull) +{ + switch (stage) + { + case MESH_DRAW_NULL: + case MESH_DRAW_REFLECTION: + case MESH_DRAW_LIGHT: + { + if (mode == MESH_RENDER_WIREFRAME) + { + return PIPELINE_STATE_LIGHT_WIREFRAME; + } + + switch (cull) + { + case MESH_CULL_BACK: return PIPELINE_STATE_LIGHT_SOLID_CULL_BACK; + case MESH_CULL_FRONT: return PIPELINE_STATE_LIGHT_SOLID_CULL_FRONT; + default: + case MESH_CULL_NONE: return PIPELINE_STATE_LIGHT_SOLID_CULL_NONE; + } + } + case MESH_DRAW_SHADOW: + { + switch (cull) + { + case MESH_CULL_BACK: return PIPELINE_STATE_SHADOW_CULL_BACK; + default: + case MESH_CULL_NONE: return PIPELINE_STATE_SHADOW_CULL_NONE; + } + } + } + + printf("Unhandled option!"); + return PIPELINE_STATE_LIGHT_SOLID_CULL_BACK; +} + +static D3D12_FILL_MODE _getFillMode(MeshRenderPipelineD3D12::PipelineStateType type) +{ + switch (type) + { + default: return D3D12_FILL_MODE_SOLID; + case MeshRenderPipelineD3D12::PIPELINE_STATE_LIGHT_WIREFRAME: return D3D12_FILL_MODE_WIREFRAME; + } +} + +static D3D12_CULL_MODE _getCullMode(MeshRenderPipelineD3D12::PipelineStateType type) +{ + switch (type) + { + case MeshRenderPipelineD3D12::PIPELINE_STATE_COUNT_OF: break; + + case MeshRenderPipelineD3D12::PIPELINE_STATE_SHADOW_CULL_BACK: return D3D12_CULL_MODE_BACK; + + case MeshRenderPipelineD3D12::PIPELINE_STATE_LIGHT_SOLID_CULL_FRONT: return D3D12_CULL_MODE_FRONT; + case MeshRenderPipelineD3D12::PIPELINE_STATE_LIGHT_SOLID_CULL_BACK: return D3D12_CULL_MODE_BACK; + + case MeshRenderPipelineD3D12::PIPELINE_STATE_SHADOW_CULL_NONE: + case MeshRenderPipelineD3D12::PIPELINE_STATE_LIGHT_WIREFRAME: + case MeshRenderPipelineD3D12::PIPELINE_STATE_LIGHT_SOLID_CULL_NONE: return D3D12_CULL_MODE_NONE; + } + + printf("Unhandled option!"); + return D3D12_CULL_MODE_NONE; +} + +static void _initRasterizerDesc(MeshRenderPipelineD3D12::PipelineStateType type, FrontWindingType winding, D3D12_RASTERIZER_DESC& desc) +{ + PipelineUtilD3D::initRasterizerDesc(winding, desc); + + desc.FillMode = _getFillMode(type); + desc.CullMode = _getCullMode(type); +} + +static void _initPipelineStateDesc(MeshRenderPipelineD3D12::PipelineStateType type, NvCo::Dx12RenderTarget* shadowMap, AppGraphCtxD3D12* renderContext, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + PipelineUtilD3D::initTargetFormat((shadowMap && MeshRenderPipelineD3D12::isShadow(type)) ? shadowMap : nullptr, renderContext, psoDesc); + + psoDesc.InputLayout.NumElements = _countof(MeshRendererD3D12::MeshInputElementDescs); + psoDesc.InputLayout.pInputElementDescs = MeshRendererD3D12::MeshInputElementDescs; + psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; +} + +int MeshRenderPipelineD3D12::initialize(const RenderStateD3D12& state, const std::wstring& shadersPath, FrontWindingType winding, int shadowMapLinearSamplerIndex, NvCo::Dx12RenderTarget* shadowMap, bool asyncComputeBenchmark) +{ + using namespace NvCo; + ID3D12Device* device = state.m_device; + + m_shadowMapLinearSamplerIndex = shadowMapLinearSamplerIndex; + + // create the pipeline state object + { + D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; + PipelineUtilD3D::initSolidBlendDesc(psoDesc.BlendState); + + // create the root signature + ComPtr<ID3D12RootSignature> signiture; + { + CD3DX12_DESCRIPTOR_RANGE ranges[2]; + CD3DX12_ROOT_PARAMETER params[3]; + + UINT rootIndex = 0; + { + D3D12_ROOT_PARAMETER& param = params[rootIndex++]; + param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + param.Descriptor.ShaderRegister = 0u; + param.Descriptor.RegisterSpace = 0u; + param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + } + + const int numSrvs = 1; + if (numSrvs > 0) + { + ranges[0].Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, numSrvs, 0); + params[rootIndex++].InitAsDescriptorTable(1, &ranges[0], D3D12_SHADER_VISIBILITY_PIXEL); + } + const int numSamplers = 1; + if (numSamplers > 0) + { + ranges[1].Init(D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, numSamplers, 0); + params[rootIndex++].InitAsDescriptorTable(1, &ranges[1], D3D12_SHADER_VISIBILITY_PIXEL); + } + + D3D12_ROOT_SIGNATURE_DESC desc; + desc.NumParameters = rootIndex; + desc.pParameters = params; + desc.NumStaticSamplers = 0; + desc.pStaticSamplers = nullptr; + desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; + + ComPtr<ID3DBlob> sigBlob; + NV_RETURN_ON_FAIL(Dx12HelperUtil::serializeRootSigniture(desc, D3D_ROOT_SIGNATURE_VERSION_1, sigBlob)); + NV_RETURN_ON_FAIL(device->CreateRootSignature(0u, sigBlob->GetBufferPointer(), sigBlob->GetBufferSize(), IID_PPV_ARGS(&signiture))); + } + + { + psoDesc.VS = Dx12Blob(g_meshVS); + psoDesc.PS = asyncComputeBenchmark ? Dx12Blob(AsyncComputeBench::g_meshPS) : Dx12Blob(g_meshPS);; + + NV_RETURN_ON_FAIL(_initPipelineState(state, winding, shadowMap, PIPELINE_STATE_LIGHT_SOLID_CULL_FRONT, signiture.Get(), psoDesc)); + NV_RETURN_ON_FAIL(_initPipelineState(state, winding, shadowMap, PIPELINE_STATE_LIGHT_SOLID_CULL_BACK, signiture.Get(), psoDesc)); + NV_RETURN_ON_FAIL(_initPipelineState(state, winding, shadowMap, PIPELINE_STATE_LIGHT_SOLID_CULL_NONE, signiture.Get(), psoDesc)); + NV_RETURN_ON_FAIL(_initPipelineState(state, winding, shadowMap, PIPELINE_STATE_LIGHT_WIREFRAME, signiture.Get(), psoDesc)); + } + + // Shadow rendering + + { + D3D12_ROOT_PARAMETER params[1]; + params[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + params[0].Descriptor.ShaderRegister = 0u; + params[0].Descriptor.RegisterSpace = 0u; + params[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + + D3D12_ROOT_SIGNATURE_DESC desc; + desc.NumParameters = 1; + desc.pParameters = params; + desc.NumStaticSamplers = 0; + desc.pStaticSamplers = nullptr; + desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; + + ComPtr<ID3DBlob> sigBlob; + NV_RETURN_ON_FAIL(Dx12HelperUtil::serializeRootSigniture(desc, D3D_ROOT_SIGNATURE_VERSION_1, sigBlob)); + NV_RETURN_ON_FAIL(device->CreateRootSignature(0u, sigBlob->GetBufferPointer(), sigBlob->GetBufferSize(), IID_PPV_ARGS(&signiture))); + } + + { + psoDesc.VS = Dx12Blob(g_meshVS); + psoDesc.PS = Dx12Blob(g_meshPS_Shadow); + + NV_RETURN_ON_FAIL(_initPipelineState(state, winding, shadowMap, PIPELINE_STATE_SHADOW_CULL_BACK, signiture.Get(), psoDesc)); + NV_RETURN_ON_FAIL(_initPipelineState(state, winding, shadowMap, PIPELINE_STATE_SHADOW_CULL_NONE, signiture.Get(), psoDesc)); + } + } + + return NV_OK; +} + +int MeshRenderPipelineD3D12::_initPipelineState(const RenderStateD3D12& state, FrontWindingType winding, NvCo::Dx12RenderTarget* shadowMap, PipelineStateType pipeType, ID3D12RootSignature* signiture, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + ID3D12Device* device = state.m_device; + + _initRasterizerDesc(pipeType, winding, psoDesc.RasterizerState); + _initPipelineStateDesc(pipeType, shadowMap, state.m_renderContext, psoDesc); + + psoDesc.pRootSignature = signiture; + + PipelineStateD3D12& pipeState = m_states[pipeType]; + pipeState.m_rootSignature = signiture; + + NV_RETURN_ON_FAIL(device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pipeState.m_pipelineState))); + return NV_OK; +} + +int MeshRenderPipelineD3D12::bind(const void* paramsIn, const void* platformState) +{ + const RenderStateD3D12& state = *(RenderStateD3D12*)platformState; + const MeshDrawParamsD3D& params = *(MeshDrawParamsD3D*)paramsIn; + + NvCo::Dx12CircularResourceHeap::Cursor cursor; + { + Hlsl::MeshShaderConst constBuf; + RenderParamsUtilD3D::calcMeshConstantBuffer(params, constBuf); + cursor = state.m_constantHeap->newConstantBuffer(constBuf); + if (!cursor.isValid()) + { + return NV_FAIL; + } + } + + const PipelineStateType pipeType = getPipelineStateType(params.renderStage, params.renderMode, params.cullMode); + PipelineStateD3D12& pipeState = m_states[pipeType]; + if (!pipeState.isValid()) + { + return NV_FAIL; + } + + ID3D12GraphicsCommandList* commandList = state.m_commandList; + + commandList->SetGraphicsRootSignature(pipeState.m_rootSignature.Get()); + commandList->SetPipelineState(pipeState.m_pipelineState.Get()); + + D3D12_GPU_VIRTUAL_ADDRESS cbvHandle = state.m_constantHeap->getGpuHandle(cursor); + commandList->SetGraphicsRootConstantBufferView(0, cbvHandle); + + if (isShadow(pipeType)) + { + ID3D12DescriptorHeap* heaps[] = { nullptr }; + commandList->SetDescriptorHeaps(0, heaps); + } + else + { + NvCo::Dx12RenderTarget* shadowMap = (NvCo::Dx12RenderTarget*)params.shadowMap; + + ID3D12DescriptorHeap* heaps[] = { state.m_srvCbvUavDescriptorHeap->getHeap(), state.m_samplerDescriptorHeap->getHeap() }; + commandList->SetDescriptorHeaps(_countof(heaps), heaps); + + // Bind the srvs + commandList->SetGraphicsRootDescriptorTable(1, state.m_srvCbvUavDescriptorHeap->getGpuHandle(shadowMap->getSrvHeapIndex(shadowMap->getPrimaryBufferType()))); + // Bind the samplers + commandList->SetGraphicsRootDescriptorTable(2, state.m_samplerDescriptorHeap->getGpuHandle(m_shadowMapLinearSamplerIndex)); + } + + return NV_OK; +} + +int MeshRenderPipelineD3D12::draw(const RenderAllocation& allocIn, size_t sizeOfAlloc, const void* platformState) +{ + return MeshRendererD3D12::defaultDraw(allocIn, sizeOfAlloc, platformState); +} + +} // namespace FlexSample
\ No newline at end of file diff --git a/demo/d3d12/meshRenderPipelineD3D12.h b/demo/d3d12/meshRenderPipelineD3D12.h new file mode 100644 index 0000000..be2511f --- /dev/null +++ b/demo/d3d12/meshRenderPipelineD3D12.h @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#ifndef MESH_RENDER_PIPELINE_D3D12_H +#define MESH_RENDER_PIPELINE_D3D12_H + +#include <DirectXMath.h> +#include "renderStateD3D12.h" +#include "../d3d/shaderCommonD3D.h" +#include "meshRenderer.h" +#include "../d3d/renderParamsD3D.h" + +#include <NvCoDx12RenderTarget.h> + +namespace FlexSample { +using namespace nvidia; + +struct MeshRenderPipelineD3D12: public RenderPipeline +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS(MeshRenderPipelineD3D12, RenderPipeline); +public: + typedef RenderPipeline Parent; + + enum PipelineStateType + { + PIPELINE_STATE_SHADOW_CULL_BACK, // Is cull back + PIPELINE_STATE_SHADOW_CULL_NONE, + PIPELINE_STATE_LIGHT_WIREFRAME, // No culling + PIPELINE_STATE_LIGHT_SOLID_CULL_FRONT, + PIPELINE_STATE_LIGHT_SOLID_CULL_BACK, + PIPELINE_STATE_LIGHT_SOLID_CULL_NONE, + PIPELINE_STATE_COUNT_OF, + }; + + MeshRenderPipelineD3D12(); + + /// Initialize + int initialize(const RenderStateD3D12& state, const std::wstring& shadersDir, FrontWindingType winding, int shadowMapLinearSamplerIndex, NvCo::Dx12RenderTarget* shadowMap, bool asyncComputeBenchmark); + /// Do the binding + virtual int bind(const void* paramsIn, const void* platformState) override; + virtual int draw(const RenderAllocation& alloc, size_t sizeOfAlloc, const void* platformState) override; + + /// Convert into a single pipeline state type + static PipelineStateType getPipelineStateType(MeshDrawStage stage, MeshRenderMode mode, MeshCullMode cull); + /// true if it's a shadowing type + static bool isShadow(PipelineStateType type) { return type == PIPELINE_STATE_SHADOW_CULL_BACK || type == PIPELINE_STATE_SHADOW_CULL_NONE; } + + protected: + + int _initPipelineState(const RenderStateD3D12& state, FrontWindingType winding, NvCo::Dx12RenderTarget* shadowMap, PipelineStateType pipeType, ID3D12RootSignature* signiture, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc); + + int m_shadowMapLinearSamplerIndex; //< The index to the linear sampler in the m_samplerHeap + + PipelineStateD3D12 m_states[PIPELINE_STATE_COUNT_OF]; +}; + +} // namespace FlexSample + +#endif
\ No newline at end of file diff --git a/demo/d3d12/meshRenderer.cpp b/demo/d3d12/meshRenderer.cpp new file mode 100644 index 0000000..5b8a41e --- /dev/null +++ b/demo/d3d12/meshRenderer.cpp @@ -0,0 +1,15 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#include "meshRenderer.h" + +namespace FlexSample { + +} // namespace FlexSample
\ No newline at end of file diff --git a/demo/d3d12/meshRenderer.h b/demo/d3d12/meshRenderer.h new file mode 100644 index 0000000..5acc701 --- /dev/null +++ b/demo/d3d12/meshRenderer.h @@ -0,0 +1,194 @@ + +#ifndef MESH_RENDERER_H +#define MESH_RENDERER_H + +#include "core/maths.h" + +namespace FlexSample { + +enum FrontWindingType +{ + FRONT_WINDING_CLOCKWISE, + FRONT_WINDING_COUNTER_CLOCKWISE, +}; + +struct RenderAllocation; + +enum PrimitiveType +{ + PRIMITIVE_UNKNOWN, + PRIMITIVE_POINT, + PRIMITIVE_LINE, + PRIMITIVE_TRIANGLE, +}; + +/* Abstraction for how something is rendered. A pipeline indicates what kind of rendering it can be used with via the usage type */ +struct RenderPipeline +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS_BASE(RenderPipeline); +public: + /// Bind with platform specific state + virtual int bind(const void* paramsIn, const void* platformState) = 0; + virtual int draw(const RenderAllocation& pointAlloc, size_t sizeOfAlloc, const void* platformState) = 0; + + /// Get the usage type + inline PrimitiveType getPrimitiveType() const { return m_primitiveType; } + + /// Ctor + RenderPipeline(PrimitiveType primitiveType): m_primitiveType(primitiveType) {} + + virtual ~RenderPipeline() {} + private: + PrimitiveType m_primitiveType; +}; + +struct MeshData +{ + void init() + { + positions = nullptr; + normals = nullptr; + texcoords = nullptr; + colors = nullptr; + indices = nullptr; + numFaces = 0; + numVertices = 0; + } + + const Vec3* positions; + const Vec3* normals; + const Vec2* texcoords; + const Vec4* colors; + const uint32_t* indices; + int numVertices; + int numFaces; +}; + +struct MeshData2 +{ + void init() + { + positions = nullptr; + normals = nullptr; + texcoords = nullptr; + colors = nullptr; + indices = nullptr; + numFaces = 0; + numVertices = 0; + } + + const Vec4* positions; + const Vec4* normals; + const Vec2* texcoords; + const Vec4* colors; + const uint32_t* indices; + ptrdiff_t numVertices; + ptrdiff_t numFaces; +}; + + +struct LineData +{ + struct Vertex + { + Vec3 position; + Vec4 color; + }; + void init() + { + vertices = nullptr; + indices = nullptr; + numLines = 0; + numVertices = 0; + } + const Vertex* vertices; ///< Must be set, and holds numPositions. If indices is nullptr, must hold at least numLines * 2 + const uint32_t* indices; ///< If not nullptr holds 2 * numLines + ptrdiff_t numVertices; ///< The total amount of positions + ptrdiff_t numLines; ///< The total number of lines +}; + +struct PointData +{ + void init() + { + positions = nullptr; + density = nullptr; + phase = nullptr; + numPoints = 0; + for (int i = 0; i < 3; i++) + { + anisotropy[i] = nullptr; + } + indices = nullptr; + numIndices = 0; + } + + const Vec4* positions; + const float* density; + const int* phase; + ptrdiff_t numPoints; //< The number of values in position, density and phase. It must be +1 the maximum particle indexed + + const Vec4* anisotropy[3]; // Holds anisotropy or can be nullptr if not used + + const uint32_t* indices; //< The indices to used particles + ptrdiff_t numIndices; +}; + +struct RenderMesh +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS_BASE(RenderMesh); +public: + virtual ~RenderMesh() {}; +}; + +struct RenderAllocation +{ + void init(PrimitiveType primType) + { + m_numPositions = -1; + m_numPrimitives = -1; + m_primitiveType = primType; + } + + PrimitiveType m_primitiveType; ///< The primitive type to draw + ptrdiff_t m_numPositions; ///< The total number of positions + ptrdiff_t m_numPrimitives; ///< The total number of primitives +}; + +struct MeshRenderer +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS_BASE(MeshRenderer); +public: + /// Draw a pre-created mesh + virtual int draw(RenderMesh* mesh, RenderPipeline* pipeline, const void* params) = 0; + + /// Do an immediate mode draw + virtual int drawImmediate(const MeshData& meshData, RenderPipeline* pipeline, const void* params) = 0; + /// Do an immediate mode draw + virtual int drawImmediate(const MeshData2& meshData, RenderPipeline* pipeline, const void* params) = 0; + /// Draw particles immediately + virtual int drawImmediate(const PointData& pointData, RenderPipeline* pipeline, const void* params) = 0; + /// Draw lines immediately + virtual int drawImmediate(const LineData& lineData, RenderPipeline* pipeline, const void* params) = 0; + + /// Render immediately using a previously transitory allocation + virtual int drawTransitory(RenderAllocation& allocation, size_t sizeOfAlloc, RenderPipeline* pipeline, const void* params) = 0; + + /// Allocate rendering data temporarily in gpu accessible memory. Render with drawTransitory. + /// A transitory allocations lifetime is dependent on rendering API, but typically stays in scope for a frame, so multiple + /// draw Transitory allocation can be done for a single allocation - but only in drawing a single frame. + /// NOTE! The PointAllocation/MeshAllocation structures must be the derived type for the API being used (say Dx12PointAllocation) + /// this is verified by the sizeOfAlloc being that size. + virtual int allocateTransitory(const PointData& pointData, RenderAllocation& allocation, size_t sizeOfAlloc) = 0; + virtual int allocateTransitory(const MeshData& meshData, RenderAllocation& allocation, size_t sizeOfAlloc) = 0; + virtual int allocateTransitory(const MeshData2& meshData, RenderAllocation& allocation, size_t sizeOfAlloc) = 0; + virtual int allocateTransitory(const LineData& lineData, RenderAllocation& allocation, size_t sizeOfAlloc) = 0; + + /// Create a render mesh from mesh data + virtual RenderMesh* createMesh(const MeshData& meshData) = 0; + virtual RenderMesh* createMesh(const MeshData2& meshData) = 0; +}; + +} // namespace FlexSample + +#endif
\ No newline at end of file diff --git a/demo/d3d12/meshRendererD3D12.cpp b/demo/d3d12/meshRendererD3D12.cpp new file mode 100644 index 0000000..3ea4012 --- /dev/null +++ b/demo/d3d12/meshRendererD3D12.cpp @@ -0,0 +1,419 @@ + +// this +#include "meshRendererD3D12.h" + +namespace FlexSample { + +/* static */ const D3D12_INPUT_ELEMENT_DESC MeshRendererD3D12::MeshInputElementDescs[4] = +{ + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 2, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 3, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 } +}; + +/* static */ const D3D12_INPUT_ELEMENT_DESC MeshRendererD3D12::PointInputElementDescs[3] = +{ + { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "DENSITY", 0, DXGI_FORMAT_R32_FLOAT, 1, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "PHASE", 0, DXGI_FORMAT_R32_SINT, 2, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Dx12RenderMesh !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + +RenderMeshD3D12::RenderMeshD3D12() +{ + m_numVertices = 0; + m_numFaces = 0; +} + +int RenderMeshD3D12::initialize(const RenderStateD3D12& state, const MeshData& meshData) +{ + NV_RETURN_ON_FAIL(m_positionBuffer.init(state, sizeof(Vec3), meshData.numVertices, meshData.positions)); + NV_RETURN_ON_FAIL(m_normalBuffer.init(state, sizeof(Vec3), meshData.numVertices, meshData.normals)); + NV_RETURN_ON_FAIL(m_texcoordBuffer.init(state, sizeof(Vec2), meshData.numVertices, meshData.texcoords)); + NV_RETURN_ON_FAIL(m_colorBuffer.init(state, sizeof(Vec4), meshData.numVertices, meshData.colors)); + NV_RETURN_ON_FAIL(m_indexBuffer.init(state, sizeof(uint32_t), meshData.numFaces * 3, meshData.indices)); + + m_numVertices = meshData.numVertices; + m_numFaces = meshData.numFaces; + + _setBufferNames(); + return NV_OK; +} + +int RenderMeshD3D12::initialize(const RenderStateD3D12& state, const MeshData2& meshData) +{ + NV_RETURN_ON_FAIL(m_positionBuffer.init(state, sizeof(Vec4), sizeof(Vec3), meshData.numVertices, meshData.positions)); + NV_RETURN_ON_FAIL(m_normalBuffer.init(state, sizeof(Vec4), sizeof(Vec3), meshData.numVertices, meshData.normals)); + NV_RETURN_ON_FAIL(m_texcoordBuffer.init(state, sizeof(Vec2), meshData.numVertices, meshData.texcoords)); + NV_RETURN_ON_FAIL(m_colorBuffer.init(state, sizeof(Vec4), meshData.numVertices, meshData.colors)); + NV_RETURN_ON_FAIL(m_indexBuffer.init(state, sizeof(uint32_t), meshData.numFaces * 3, meshData.indices)); + + m_numVertices = meshData.numVertices; + m_numFaces = meshData.numFaces; + + _setBufferNames(); + return NV_OK; +} + +void RenderMeshD3D12::_setBufferNames() +{ + m_positionBuffer.setDebugName(L"positions"); + m_normalBuffer.setDebugName(L"normals"); + m_texcoordBuffer.setDebugName(L"texcoords"); + m_colorBuffer.setDebugName(L"colors"); + m_indexBuffer.setDebugName(L"indices"); +} + +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Dx12MeshRenderer !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + + +MeshRendererD3D12::MeshRendererD3D12() +{ +} + +int MeshRendererD3D12::initialize(const RenderStateD3D12& state) +{ + m_renderState = state; + return NV_OK; +} + +D3D12_VERTEX_BUFFER_VIEW MeshRendererD3D12::_newImmediateVertexBuffer(const void* data, int stride, ptrdiff_t numVertices) +{ + D3D12_VERTEX_BUFFER_VIEW view = {}; + if (data) + { + const size_t bufferSize = stride * numVertices; + NvCo::Dx12CircularResourceHeap::Cursor cursor = m_renderState.m_constantHeap->allocateVertexBuffer(bufferSize); + + memcpy(cursor.m_position, data, bufferSize); + + view.BufferLocation = m_renderState.m_constantHeap->getGpuHandle(cursor); + view.SizeInBytes = UINT(bufferSize); + view.StrideInBytes = stride; + } + return view; +} + +D3D12_VERTEX_BUFFER_VIEW MeshRendererD3D12::_newStridedImmediateVertexBuffer(const void* data, int srcStride, int dstStride, ptrdiff_t numElements) +{ + if (srcStride == dstStride) + { + return _newImmediateVertexBuffer(data, srcStride, numElements); + } + + D3D12_VERTEX_BUFFER_VIEW view = {}; + if (srcStride == 4 * 4 && dstStride == 4 * 3) + { + const size_t bufferSize = dstStride * numElements; + NvCo::Dx12CircularResourceHeap::Cursor cursor = m_renderState.m_constantHeap->allocateVertexBuffer(bufferSize); + + uint32_t* dst = (uint32_t*)cursor.m_position; + const uint32_t* src = (const uint32_t*)data; + + // Copy taking into account stride difference + for (ptrdiff_t i = 0; i < numElements; i++, dst += 3, src += 4) + { + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + } + + view.BufferLocation = m_renderState.m_constantHeap->getGpuHandle(cursor); + view.SizeInBytes = UINT(bufferSize); + view.StrideInBytes = dstStride; + + return view; + } + + printf("Unhandled conversion"); + return view; +} + +D3D12_INDEX_BUFFER_VIEW MeshRendererD3D12::_newImmediateIndexBuffer(const void* data, int stride, ptrdiff_t numIndices) +{ + assert(stride == sizeof(uint32_t)); + D3D12_INDEX_BUFFER_VIEW view = {}; + + if (data) + { + const size_t bufferSize = stride * numIndices; + NvCo::Dx12CircularResourceHeap::Cursor cursor = m_renderState.m_constantHeap->allocateVertexBuffer(bufferSize); + + memcpy(cursor.m_position, data, bufferSize); + + view.BufferLocation = m_renderState.m_constantHeap->getGpuHandle(cursor); + view.SizeInBytes = UINT(bufferSize); + view.Format = DXGI_FORMAT_R32_UINT; + } + + return view; +} + +int MeshRendererD3D12::draw(RenderMesh* meshIn, RenderPipeline* pipeline, const void* params) +{ + RenderMeshD3D12* mesh = static_cast<RenderMeshD3D12*>(meshIn); + + // Set up the allocation block + MeshRenderAllocationD3D12 alloc; + alloc.init(PRIMITIVE_TRIANGLE); + + alloc.m_vertexBufferViews[0] = mesh->m_positionBuffer.m_vertexBufferView; + alloc.m_vertexBufferViews[1] = mesh->m_normalBuffer.m_vertexBufferView; + alloc.m_vertexBufferViews[2] = mesh->m_texcoordBuffer.m_vertexBufferView; + alloc.m_vertexBufferViews[3] = mesh->m_colorBuffer.m_vertexBufferView; + + alloc.m_indexBufferView = mesh->m_indexBuffer.m_indexBufferView; + alloc.m_numPrimitives = mesh->m_numFaces; + alloc.m_numPositions = mesh->m_numVertices; + + return drawTransitory(alloc, sizeof(MeshRenderAllocationD3D12), pipeline, params); +} + +int MeshRendererD3D12::drawImmediate(const MeshData& mesh, RenderPipeline* pipeline, const void* params) +{ + MeshRenderAllocationD3D12 alloc; + allocateTransitory(mesh, alloc, sizeof(alloc)); + return drawTransitory(alloc, sizeof(alloc), pipeline, params); +} + +int MeshRendererD3D12::drawImmediate(const MeshData2& mesh, RenderPipeline* pipeline, const void* params) +{ + MeshRenderAllocationD3D12 alloc; + allocateTransitory(mesh, alloc, sizeof(alloc)); + return drawTransitory(alloc, sizeof(alloc), pipeline, params); +} + +int MeshRendererD3D12::drawImmediate(const LineData& lineData, RenderPipeline* pipeline, const void* params) +{ + LineRenderAllocationD3D12 alloc; + allocateTransitory(lineData, alloc, sizeof(alloc)); + return drawTransitory(alloc, sizeof(alloc), pipeline, params); +} + +int MeshRendererD3D12::drawImmediate(const PointData& pointData, RenderPipeline* pipeline, const void* params) +{ + PointRenderAllocationD3D12 alloc; + allocateTransitory(pointData, alloc, sizeof(alloc)); + return drawTransitory(alloc, sizeof(alloc), pipeline, params); +} + +int MeshRendererD3D12::allocateTransitory(const PointData& pointData, RenderAllocation& allocIn, size_t sizeOfAlloc) +{ + typedef PointRenderAllocationD3D12 Alloc; + + assert(sizeof(Alloc) == sizeOfAlloc); + + Alloc& alloc = static_cast<Alloc&>(allocIn); + alloc.init(PRIMITIVE_POINT); + + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_POSITION] = _newImmediateVertexBuffer(pointData.positions, sizeof(Vec4), pointData.numPoints); + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_DENSITY] = _newImmediateVertexBuffer(pointData.density, sizeof(float), pointData.numPoints); + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_PHASE] = _newImmediateVertexBuffer(pointData.phase, sizeof(int), pointData.numPoints); + + if (pointData.anisotropy[0]) + { + for (int i = 0; i < 3; i++) + { + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_ANISOTROPY1 + i] = _newImmediateVertexBuffer(pointData.anisotropy[i], sizeof(Vec4), pointData.numPoints); + } + } + + alloc.m_indexBufferView = _newImmediateIndexBuffer(pointData.indices, sizeof(uint32_t), pointData.numIndices); + + alloc.m_numPrimitives = pointData.numIndices; + alloc.m_numPositions = pointData.numPoints; + return NV_OK; +} + +int MeshRendererD3D12::allocateTransitory(const MeshData2& mesh, RenderAllocation& allocIn, size_t sizeOfAlloc) +{ + typedef MeshRenderAllocationD3D12 Alloc; + assert(sizeof(Alloc) == sizeOfAlloc); + + Alloc& alloc = static_cast<Alloc&>(allocIn); + alloc.init(PRIMITIVE_TRIANGLE); + + const int numIndices = int(mesh.numFaces * 3); + alloc.m_indexBufferView = _newImmediateIndexBuffer(mesh.indices, sizeof(uint32_t), numIndices); + + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_POSITION] = _newStridedImmediateVertexBuffer(mesh.positions, sizeof(Vec4), sizeof(Vec3), mesh.numVertices); + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_NORMAL] = _newStridedImmediateVertexBuffer(mesh.normals, sizeof(Vec4), sizeof(Vec3), mesh.numVertices); + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_TEX_COORDS] = _newImmediateVertexBuffer(mesh.texcoords, sizeof(Vec2), mesh.numVertices); + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_COLOR] = _newImmediateVertexBuffer(mesh.colors, sizeof(Vec4), mesh.numVertices); + + alloc.m_numPrimitives = mesh.numFaces; + alloc.m_numPositions = mesh.numVertices; + return NV_OK; +} + +int MeshRendererD3D12::allocateTransitory(const LineData& lineData, RenderAllocation& allocIn, size_t sizeOfAlloc) +{ + typedef LineRenderAllocationD3D12 Alloc; + assert(sizeof(Alloc) == sizeOfAlloc); + + Alloc& alloc = static_cast<Alloc&>(allocIn); + alloc.init(PRIMITIVE_LINE); + + alloc.m_vertexBufferView = _newImmediateVertexBuffer(lineData.vertices, sizeof(LineData::Vertex), lineData.numVertices); + alloc.m_indexBufferView = _newImmediateIndexBuffer(lineData.indices, sizeof(uint32_t), lineData.numLines * 2); + + alloc.m_numPrimitives = lineData.numLines; + alloc.m_numPositions = lineData.numVertices; + return NV_OK; +} + +int MeshRendererD3D12::allocateTransitory(const MeshData& mesh, RenderAllocation& allocIn, size_t sizeOfAlloc) +{ + typedef MeshRenderAllocationD3D12 Alloc; + assert(sizeof(Alloc) == sizeOfAlloc); + + Alloc& alloc = static_cast<Alloc&>(allocIn); + + alloc.init(PRIMITIVE_TRIANGLE); + + const int numIndices = int(mesh.numFaces * 3); + alloc.m_indexBufferView = _newImmediateIndexBuffer(mesh.indices, sizeof(uint32_t), numIndices); + + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_POSITION] = _newImmediateVertexBuffer(mesh.positions, sizeof(Vec3), mesh.numVertices); + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_NORMAL] = _newImmediateVertexBuffer(mesh.normals, sizeof(Vec3), mesh.numVertices); + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_TEX_COORDS] = _newImmediateVertexBuffer(mesh.texcoords, sizeof(Vec2), mesh.numVertices); + alloc.m_vertexBufferViews[Alloc::VERTEX_VIEW_COLOR] = _newImmediateVertexBuffer(mesh.colors, sizeof(Vec4), mesh.numVertices); + + alloc.m_numPrimitives = mesh.numFaces; + alloc.m_numPositions = mesh.numVertices; + + return NV_OK; +} + +int MeshRendererD3D12::drawTransitory(RenderAllocation& allocIn, size_t sizeOfAlloc, RenderPipeline* pipeline, const void* params) +{ + if (allocIn.m_primitiveType == PRIMITIVE_UNKNOWN) + { + return NV_OK; + } + if (allocIn.m_primitiveType != pipeline->getPrimitiveType()) + { + printf("Wrong pipeline primitive type"); + return NV_FAIL; + } + + NV_RETURN_ON_FAIL(pipeline->bind(params, &m_renderState)); + NV_RETURN_ON_FAIL(pipeline->draw(allocIn, sizeOfAlloc, &m_renderState)); + return NV_OK; +} + +RenderMesh* MeshRendererD3D12::createMesh(const MeshData& meshData) +{ + RenderMeshD3D12* mesh = new RenderMeshD3D12; + if (NV_FAILED(mesh->initialize(m_renderState, meshData))) + { + delete mesh; + return nullptr; + } + return mesh; +} + +RenderMesh* MeshRendererD3D12::createMesh(const MeshData2& meshData) +{ + RenderMeshD3D12* mesh = new RenderMeshD3D12; + if (NV_FAILED(mesh->initialize(m_renderState, meshData))) + { + delete mesh; + return nullptr; + } + return mesh; +} + + +/* static */int MeshRendererD3D12::defaultDraw(const RenderAllocation& allocIn, size_t sizeOfAlloc, const void* platformState) +{ + const RenderStateD3D12& state = *(RenderStateD3D12*)platformState; + ID3D12GraphicsCommandList* commandList = state.m_commandList; + + switch (allocIn.m_primitiveType) + { + case PRIMITIVE_POINT: + { + typedef PointRenderAllocationD3D12 Alloc; + const RenderStateD3D12& state = *(RenderStateD3D12*)platformState; + + assert(sizeof(Alloc) == sizeOfAlloc); + const Alloc& alloc = static_cast<const Alloc&>(allocIn); + + assert(allocIn.m_numPrimitives >= 0); + + ID3D12GraphicsCommandList* commandList = state.m_commandList; + + commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_POINTLIST); + commandList->IASetVertexBuffers(0, Alloc::NUM_DEFAULT_VERTEX_VIEWS, alloc.m_vertexBufferViews); + commandList->IASetIndexBuffer(&alloc.m_indexBufferView); + + if (alloc.m_indexBufferView.SizeInBytes) + { + commandList->DrawIndexedInstanced((UINT)allocIn.m_numPrimitives, 1, 0, 0, 0); + } + else + { + commandList->DrawInstanced((UINT)allocIn.m_numPrimitives, 1, 0, 0); + } + break; + } + case PRIMITIVE_LINE: + { + typedef LineRenderAllocationD3D12 Alloc; + assert(sizeof(Alloc) == sizeOfAlloc); + const Alloc& alloc = static_cast<const Alloc&>(allocIn); + + assert(alloc.m_numPrimitives >= 0); + + const int numIndices = int(alloc.m_numPrimitives * 2); + + commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_LINELIST); + commandList->IASetVertexBuffers(0, 1, &alloc.m_vertexBufferView); + + if (alloc.m_indexBufferView.SizeInBytes) + { + commandList->IASetIndexBuffer(nullptr); + commandList->DrawIndexedInstanced((UINT)numIndices, 1, 0, 0, 0); + } + else + { + commandList->IASetIndexBuffer(&alloc.m_indexBufferView); + commandList->DrawInstanced((UINT)numIndices, 1, 0, 0); + } + break; + } + case PRIMITIVE_TRIANGLE: + { + typedef MeshRenderAllocationD3D12 Alloc; + assert(sizeof(Alloc) == sizeOfAlloc); + const Alloc& alloc = static_cast<const Alloc&>(allocIn); + + const int numIndices = int(alloc.m_numPrimitives * 3); + + commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + commandList->IASetVertexBuffers(0, _countof(alloc.m_vertexBufferViews), alloc.m_vertexBufferViews); + commandList->IASetIndexBuffer(&alloc.m_indexBufferView); + + if (alloc.m_indexBufferView.SizeInBytes) + { + commandList->DrawIndexedInstanced((UINT)numIndices, 1, 0, 0, 0); + } + else + { + commandList->DrawInstanced((UINT)numIndices, 1, 0, 0); + } + break; + } + default: + { + printf("Unhandled primitive type"); + } + } + + return NV_OK; +} + +} // namespace FlexSample
\ No newline at end of file diff --git a/demo/d3d12/meshRendererD3D12.h b/demo/d3d12/meshRendererD3D12.h new file mode 100644 index 0000000..1afb6b3 --- /dev/null +++ b/demo/d3d12/meshRendererD3D12.h @@ -0,0 +1,175 @@ +#ifndef MESH_RENDERER_D3D12_H +#define MESH_RENDERER_D3D12_H + +#include "bufferD3D12.h" + +#include "renderStateD3D12.h" +#include "meshRenderer.h" + +// Predeclare so all use the same +struct ShadowMap; + +namespace FlexSample { +using namespace nvidia; + +struct MeshRendererD3D12; +struct RenderMeshD3D12: public RenderMesh +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS(RenderMeshD3D12, RenderMesh); +public: + typedef RenderMesh Parent; + + friend struct MeshRendererD3D12; + + RenderMeshD3D12(); + int initialize(const RenderStateD3D12& state, const MeshData& meshData); + int initialize(const RenderStateD3D12& state, const MeshData2& meshData); + + protected: + void _setBufferNames(); + + VertexBufferD3D12 m_positionBuffer; + VertexBufferD3D12 m_normalBuffer; + VertexBufferD3D12 m_texcoordBuffer; + VertexBufferD3D12 m_colorBuffer; + IndexBufferD3D12 m_indexBuffer; + + ptrdiff_t m_numVertices; + ptrdiff_t m_numFaces; +}; + +struct PointRenderAllocationD3D12: public RenderAllocation +{ + typedef RenderAllocation Parent; + enum VertexViewType + { + // NOTE! Do not change order without fixing pipelines that use it! + VERTEX_VIEW_POSITION, + VERTEX_VIEW_DENSITY, + VERTEX_VIEW_PHASE, + + VERTEX_VIEW_ANISOTROPY1, + VERTEX_VIEW_ANISOTROPY2, + VERTEX_VIEW_ANISOTROPY3, + + VERTEX_VIEW_COUNT_OF, + }; + enum + { + // For typical point rendering we don't need anisotropy, so typically just bind the first 3 + NUM_DEFAULT_VERTEX_VIEWS = VERTEX_VIEW_PHASE + 1 + }; + + /// Initialize state + void init(PrimitiveType primitiveType) + { + Parent::init(primitiveType); + D3D12_VERTEX_BUFFER_VIEW nullView = {}; + for (int i = 0; i < _countof(m_vertexBufferViews); i++) + { + m_vertexBufferViews[i] = nullView; + } + D3D12_INDEX_BUFFER_VIEW nullIndexView = {}; + m_indexBufferView = nullIndexView; + } + + D3D12_VERTEX_BUFFER_VIEW m_vertexBufferViews[VERTEX_VIEW_COUNT_OF]; + D3D12_INDEX_BUFFER_VIEW m_indexBufferView; +}; + +struct MeshRenderAllocationD3D12:public RenderAllocation +{ + typedef RenderAllocation Parent; + + // Vertex buffer viewer are in the order to be set + enum VertexViewType + { + // NOTE! Do not change order without fixing pipelines that use it! + VERTEX_VIEW_POSITION, + VERTEX_VIEW_NORMAL, + VERTEX_VIEW_TEX_COORDS, + VERTEX_VIEW_COLOR, + + VERTEX_VIEW_COUNT_OF, + }; + + void init(PrimitiveType primType) + { + Parent::init(primType); + D3D12_VERTEX_BUFFER_VIEW nullView = {}; + for (int i = 0; i < _countof(m_vertexBufferViews); i++) + { + m_vertexBufferViews[i] = nullView; + } + D3D12_INDEX_BUFFER_VIEW nullIndexView = {}; + m_indexBufferView = nullIndexView; + } + + D3D12_VERTEX_BUFFER_VIEW m_vertexBufferViews[VERTEX_VIEW_COUNT_OF]; + D3D12_INDEX_BUFFER_VIEW m_indexBufferView; +}; + +struct LineRenderAllocationD3D12 :public RenderAllocation +{ + typedef RenderAllocation Parent; + + void init(PrimitiveType primType) + { + Parent::init(primType); + const D3D12_VERTEX_BUFFER_VIEW nullView = {}; + m_vertexBufferView = nullView; + const D3D12_INDEX_BUFFER_VIEW nullIndexView = {}; + m_indexBufferView = nullIndexView; + } + + D3D12_VERTEX_BUFFER_VIEW m_vertexBufferView; + D3D12_INDEX_BUFFER_VIEW m_indexBufferView; +}; + +struct MeshRendererD3D12: public MeshRenderer +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS(MeshRendererD3D12, MeshRenderer); +public: + typedef MeshRenderer Parent; + + /// MeshRenderer + virtual int draw(RenderMesh* mesh, RenderPipeline* pipeline, const void* params) override; + virtual int drawImmediate(const MeshData& mesh, RenderPipeline* pipeline, const void* params) override; + virtual int drawImmediate(const MeshData2& meshData, RenderPipeline* pipeline, const void* params) override; + virtual int drawImmediate(const PointData& pointData, RenderPipeline* pipeline, const void* params) override; + virtual int drawImmediate(const LineData& lineData, RenderPipeline* pipeline, const void* params) override; + + virtual RenderMesh* createMesh(const MeshData& meshData) override; + virtual RenderMesh* createMesh(const MeshData2& meshData) override; + + virtual int allocateTransitory(const PointData& pointData, RenderAllocation& allocation, size_t sizeOfAlloc) override; + virtual int allocateTransitory(const MeshData& meshData, RenderAllocation& allocIn, size_t sizeofAlloc) override; + virtual int allocateTransitory(const MeshData2& meshData, RenderAllocation& allocation, size_t sizeofAlloc) override; + virtual int allocateTransitory(const LineData& lineData, RenderAllocation& allocation, size_t sizeOfAlloc) override; + + virtual int drawTransitory(RenderAllocation& allocation, size_t sizeOfAlloc, RenderPipeline* pipeline, const void* params) override; + + int initialize(const RenderStateD3D12& state); + + MeshRendererD3D12(); + + /// Default drawing impls, can be used in pipelines + static int defaultDraw(const RenderAllocation& allocIn, size_t sizeOfAlloc, const void* platformState); + + /// The input desc layout used + static const D3D12_INPUT_ELEMENT_DESC MeshInputElementDescs[4]; + /// Layout for points + static const D3D12_INPUT_ELEMENT_DESC PointInputElementDescs[3]; + + protected: + + D3D12_VERTEX_BUFFER_VIEW _newImmediateVertexBuffer(const void* data, int stride, ptrdiff_t numVertices); + D3D12_VERTEX_BUFFER_VIEW _newStridedImmediateVertexBuffer(const void* data, int srcStride, int dstStride, ptrdiff_t numElements); + D3D12_INDEX_BUFFER_VIEW _newImmediateIndexBuffer(const void* data, int stride, ptrdiff_t numIndices); + + RenderStateD3D12 m_renderState; +}; + +} // namespace FlexSample + +#endif
\ No newline at end of file diff --git a/demo/d3d12/meshUtil.cpp b/demo/d3d12/meshUtil.cpp new file mode 100644 index 0000000..b83a3f4 --- /dev/null +++ b/demo/d3d12/meshUtil.cpp @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#include "meshUtil.h" + +namespace FlexSample { + +/* static */RenderMesh* MeshUtil::createRenderMesh(MeshRenderer* renderer, const Mesh& mesh) +{ + int numFaces = mesh.GetNumFaces(); + int numVertices = mesh.GetNumVertices(); + + MeshData data; + data.colors = (mesh.m_colours.size() > 0) ? (const Vec4*)&mesh.m_colours[0] : nullptr; + data.positions = (mesh.m_positions.size() > 0) ? (const Vec3*)&mesh.m_positions[0] : nullptr; + data.normals = (mesh.m_normals.size() > 0) ? (const Vec3*)&mesh.m_normals[0] : nullptr; + data.indices = (mesh.m_indices.size() > 0) ? (const uint32_t*)&mesh.m_indices[0] : nullptr; + data.texcoords = (mesh.m_texcoords[0].size() > 0) ? (const Vec2*)&mesh.m_texcoords[0] : nullptr; + + data.numFaces = numFaces; + data.numVertices = numVertices; + + return renderer->createMesh(data); +} + +} // namespace FlexSample
\ No newline at end of file diff --git a/demo/d3d12/meshUtil.h b/demo/d3d12/meshUtil.h new file mode 100644 index 0000000..a9070b7 --- /dev/null +++ b/demo/d3d12/meshUtil.h @@ -0,0 +1,26 @@ +#ifndef MESH_UTIL_H +#define MESH_UTIL_H + +// Needed for mesh.h +#pragma warning( disable : 4458 ) + +#include "meshRenderer.h" + +#include <core/mesh.h> + +typedef ::Vec4 FlexVec4; +typedef ::Vec3 FlexVec3; +typedef ::Vec2 FlexVec2; + +namespace FlexSample { +//using namespace nvidia; + +/* Tools/types to implify use of the flex 'Mesh' types */ +struct MeshUtil +{ + static RenderMesh* createRenderMesh(MeshRenderer* renderer, const Mesh& mesh); +}; + +} // namespace FlexSample + +#endif
\ No newline at end of file diff --git a/demo/d3d12/pipelineUtilD3D12.cpp b/demo/d3d12/pipelineUtilD3D12.cpp new file mode 100644 index 0000000..81e2581 --- /dev/null +++ b/demo/d3d12/pipelineUtilD3D12.cpp @@ -0,0 +1,78 @@ + +// this +#include "pipelineUtilD3D12.h" + +namespace NvCo = nvidia::Common; + +namespace FlexSample { + +/* static */void PipelineUtilD3D::initRasterizerDesc(FrontWindingType winding, D3D12_RASTERIZER_DESC& desc) +{ + desc.FillMode = D3D12_FILL_MODE_SOLID; + desc.CullMode = D3D12_CULL_MODE_NONE; + + desc.FrontCounterClockwise = (winding == FRONT_WINDING_COUNTER_CLOCKWISE); + + desc.DepthBias = D3D12_DEFAULT_DEPTH_BIAS; + desc.DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP; + desc.SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; + desc.DepthClipEnable = TRUE; + desc.MultisampleEnable = FALSE; + desc.AntialiasedLineEnable = FALSE; + desc.ForcedSampleCount = 0; + desc.ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; +} + +/* static */void PipelineUtilD3D::initSolidBlendDesc(D3D12_BLEND_DESC& desc) +{ + desc.AlphaToCoverageEnable = FALSE; + desc.IndependentBlendEnable = FALSE; + { + const D3D12_RENDER_TARGET_BLEND_DESC defaultRenderTargetBlendDesc = + { + FALSE,FALSE, + D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD, + D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD, + D3D12_LOGIC_OP_NOOP, + D3D12_COLOR_WRITE_ENABLE_ALL, + }; + for (UINT i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + desc.RenderTarget[i] = defaultRenderTargetBlendDesc; + } +} + +/* static */void PipelineUtilD3D::initTargetFormat(NvCo::Dx12RenderTarget* renderTarget, AppGraphCtxD3D12* renderContext, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + psoDesc.DepthStencilState.DepthEnable = TRUE; + psoDesc.DepthStencilState.DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL; + psoDesc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL; + psoDesc.DepthStencilState.StencilEnable = FALSE; + psoDesc.SampleMask = UINT_MAX; + + // Normally single render target + psoDesc.NumRenderTargets = 1; + + if (renderTarget) + { + psoDesc.RTVFormats[0] = renderTarget->getTargetFormat(NvCo::Dx12RenderTarget::BUFFER_TARGET); + psoDesc.DSVFormat = renderTarget->getTargetFormat(NvCo::Dx12RenderTarget::BUFFER_DEPTH_STENCIL); + psoDesc.NumRenderTargets = renderTarget->getNumRenderTargets(); + psoDesc.SampleDesc.Count = 1; + } + else + { + const NvCo::Dx12TargetInfo& targetInfo = renderContext->m_targetInfo; + + psoDesc.RTVFormats[0] = targetInfo.m_renderTargetFormats[0]; + psoDesc.DSVFormat = targetInfo.m_depthStencilFormat; + psoDesc.SampleDesc.Count = targetInfo.m_numSamples; + } + + // If no depth buffer, disable + if (psoDesc.DSVFormat == DXGI_FORMAT_UNKNOWN) + { + psoDesc.DepthStencilState.DepthEnable = FALSE; + } +} + +} // namespace FlexSample
\ No newline at end of file diff --git a/demo/d3d12/pipelineUtilD3D12.h b/demo/d3d12/pipelineUtilD3D12.h new file mode 100644 index 0000000..2949bd3 --- /dev/null +++ b/demo/d3d12/pipelineUtilD3D12.h @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#ifndef PIPELINE_UTIL_D3D12_H +#define PIPELINE_UTIL_D3D12_H + +#define NOMINMAX +#include <dxgi.h> +#include <d3d12.h> + +#include "meshRenderer.h" +#include <NvCoDx12RenderTarget.h> + +namespace FlexSample { +using namespace nvidia; + +struct PipelineUtilD3D +{ + /// Default initializes rasterizer + static void initRasterizerDesc(FrontWindingType winding, D3D12_RASTERIZER_DESC& desc); + /// Initialize default blend desc for solid rendering + static void initSolidBlendDesc(D3D12_BLEND_DESC& desc); + /// Set on psoDesc the format/samples and set up other default state. + /// If renderTarget is NV_NULL then the format that's set on the Dx12RenderInterface/RenderContext is used + static void initTargetFormat(Common::Dx12RenderTarget* renderTarget, AppGraphCtxD3D12* renderContext, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc); +}; + +} // namespace FlexSample + +#endif
\ No newline at end of file diff --git a/demo/d3d12/pointRenderPipelineD3D12.cpp b/demo/d3d12/pointRenderPipelineD3D12.cpp new file mode 100644 index 0000000..7650c49 --- /dev/null +++ b/demo/d3d12/pointRenderPipelineD3D12.cpp @@ -0,0 +1,227 @@ +#define NOMINMAX + +#include <NvCoDx12HelperUtil.h> +#include <external/D3D12/include/d3dx12.h> + +#include "pipelineUtilD3D12.h" +#include "bufferD3D12.h" +#include "meshRendererD3D12.h" +#include "../d3d/shaderCommonD3D.h" + +// this +#include "pointRenderPipelineD3D12.h" + +// Shaders +#include "../d3d/shaders/pointVS.hlsl.h" +#include "../d3d/shaders/pointGS.hlsl.h" +#include "../d3d/shaders/pointPS.hlsl.h" +#include "../d3d/shaders/pointShadowPS.hlsl.h" + +namespace FlexSample { + +PointRenderPipelineD3D12::PointRenderPipelineD3D12(): + Parent(PRIMITIVE_POINT), + m_shadowMapLinearSamplerIndex(-1) +{ +} + +/* static */PointRenderPipelineD3D12::PipelineStateType PointRenderPipelineD3D12::getPipelineStateType(PointDrawStage stage, PointRenderMode mode, PointCullMode cull) +{ + switch (stage) + { + case POINT_DRAW_SHADOW: return PIPELINE_STATE_SHADOW; + default: return PIPELINE_STATE_LIGHT_SOLID; + } +} + +static D3D12_FILL_MODE _getFillMode(PointRenderPipelineD3D12::PipelineStateType type) +{ + return D3D12_FILL_MODE_SOLID; +} + +static D3D12_CULL_MODE _getCullMode(PointRenderPipelineD3D12::PipelineStateType type) +{ + return D3D12_CULL_MODE_NONE; +} + +static void _initRasterizerDesc(PointRenderPipelineD3D12::PipelineStateType type, D3D12_RASTERIZER_DESC& desc) +{ + PipelineUtilD3D::initRasterizerDesc(FRONT_WINDING_COUNTER_CLOCKWISE, desc); + desc.FillMode = _getFillMode(type); + desc.CullMode = _getCullMode(type); +} + +static void _initPipelineStateDesc(PointRenderPipelineD3D12::PipelineStateType type, NvCo::Dx12RenderTarget* shadowMap, AppGraphCtxD3D12* renderContext, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + PipelineUtilD3D::initTargetFormat((shadowMap && type == PointRenderPipelineD3D12::PIPELINE_STATE_SHADOW) ? shadowMap : nullptr, renderContext, psoDesc); + + psoDesc.InputLayout.NumElements = _countof(MeshRendererD3D12::PointInputElementDescs); + psoDesc.InputLayout.pInputElementDescs = MeshRendererD3D12::PointInputElementDescs; + psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT; +} + +int PointRenderPipelineD3D12::initialize(const RenderStateD3D12& state, const std::wstring& shadersPath, int shadowMapLinearSamplerIndex, NvCo::Dx12RenderTarget* shadowMap) +{ + using namespace NvCo; + ID3D12Device* device = state.m_device; + + m_shadowMapLinearSamplerIndex = shadowMapLinearSamplerIndex; + + // create the pipeline state object + { + D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; + PipelineUtilD3D::initSolidBlendDesc(psoDesc.BlendState); + + // create the root signature + ComPtr<ID3D12RootSignature> signiture; + { + CD3DX12_DESCRIPTOR_RANGE ranges[2]; + CD3DX12_ROOT_PARAMETER params[3]; + + UINT rootIndex = 0; + { + D3D12_ROOT_PARAMETER& param = params[rootIndex++]; + param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + param.Descriptor.ShaderRegister = 0u; + param.Descriptor.RegisterSpace = 0u; + param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + } + + const int numSrvs = 1; + if (numSrvs > 0) + { + ranges[0].Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, numSrvs, 0); + params[rootIndex++].InitAsDescriptorTable(1, &ranges[0], D3D12_SHADER_VISIBILITY_PIXEL); + } + const int numSamplers = 1; + if (numSamplers > 0) + { + ranges[1].Init(D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, numSamplers, 0); + params[rootIndex++].InitAsDescriptorTable(1, &ranges[1], D3D12_SHADER_VISIBILITY_PIXEL); + } + + D3D12_ROOT_SIGNATURE_DESC desc; + desc.NumParameters = rootIndex; + desc.pParameters = params; + desc.NumStaticSamplers = 0; + desc.pStaticSamplers = nullptr; + desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; + + ComPtr<ID3DBlob> sigBlob; + NV_RETURN_ON_FAIL(Dx12HelperUtil::serializeRootSigniture(desc, D3D_ROOT_SIGNATURE_VERSION_1, sigBlob)); + NV_RETURN_ON_FAIL(device->CreateRootSignature(0u, sigBlob->GetBufferPointer(), sigBlob->GetBufferSize(), IID_PPV_ARGS(&signiture))); + } + + { + psoDesc.VS = Dx12Blob(g_pointVS); + psoDesc.GS = Dx12Blob(g_pointGS); + psoDesc.PS = Dx12Blob(g_pointPS); + + NV_RETURN_ON_FAIL(_initPipelineState(state, shadowMap, PIPELINE_STATE_LIGHT_SOLID, signiture.Get(), psoDesc)); + } + + // Shadow rendering + { + D3D12_ROOT_PARAMETER params[1]; + params[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + params[0].Descriptor.ShaderRegister = 0u; + params[0].Descriptor.RegisterSpace = 0u; + params[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + + D3D12_ROOT_SIGNATURE_DESC desc; + desc.NumParameters = 1; + desc.pParameters = params; + desc.NumStaticSamplers = 0u; + desc.pStaticSamplers = nullptr; + desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; + + ComPtr<ID3DBlob> sigBlob; + NV_RETURN_ON_FAIL(Dx12HelperUtil::serializeRootSigniture(desc, D3D_ROOT_SIGNATURE_VERSION_1, sigBlob)); + NV_RETURN_ON_FAIL(device->CreateRootSignature(0u, sigBlob->GetBufferPointer(), sigBlob->GetBufferSize(), IID_PPV_ARGS(&signiture))); + } + + { + psoDesc.VS = Dx12Blob(g_pointVS); + psoDesc.GS = Dx12Blob(g_pointGS); + psoDesc.PS = Dx12Blob(g_pointShadowPS); + + NV_RETURN_ON_FAIL(_initPipelineState(state, shadowMap, PIPELINE_STATE_SHADOW, signiture.Get(), psoDesc)); + } + } + + return NV_OK; +} + +int PointRenderPipelineD3D12::_initPipelineState(const RenderStateD3D12& state, NvCo::Dx12RenderTarget* shadowMap, PipelineStateType pipeType, ID3D12RootSignature* signiture, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc) +{ + ID3D12Device* device = state.m_device; + + _initRasterizerDesc(pipeType, psoDesc.RasterizerState); + _initPipelineStateDesc(pipeType, shadowMap, state.m_renderContext, psoDesc); + + psoDesc.pRootSignature = signiture; + + PipelineStateD3D12& pipeState = m_states[pipeType]; + pipeState.m_rootSignature = signiture; + + NV_RETURN_ON_FAIL(device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pipeState.m_pipelineState))); + return NV_OK; +} + +int PointRenderPipelineD3D12::bind(const void* paramsIn, const void* platformState) +{ + const RenderStateD3D12& state = *(RenderStateD3D12*)platformState; + const PointDrawParamsD3D& params = *(PointDrawParamsD3D*)paramsIn; + + // Set up constant buffer + NvCo::Dx12CircularResourceHeap::Cursor cursor; + { + Hlsl::PointShaderConst constBuf; + RenderParamsUtilD3D::calcPointConstantBuffer(params, constBuf); + cursor = state.m_constantHeap->newConstantBuffer(constBuf); + if (!cursor.isValid()) + { + return NV_FAIL; + } + } + + const PipelineStateType pipeType = getPipelineStateType(params.renderStage, params.renderMode, params.cullMode); + PipelineStateD3D12& pipeState = m_states[pipeType]; + if (!pipeState.isValid()) + { + return NV_FAIL; + } + + ID3D12GraphicsCommandList* commandList = state.m_commandList; + commandList->SetGraphicsRootSignature(pipeState.m_rootSignature.Get()); + commandList->SetPipelineState(pipeState.m_pipelineState.Get()); + + D3D12_GPU_VIRTUAL_ADDRESS cbvHandle = state.m_constantHeap->getGpuHandle(cursor); + commandList->SetGraphicsRootConstantBufferView(0, cbvHandle); + + if (pipeType == PIPELINE_STATE_SHADOW) + { + ID3D12DescriptorHeap* heaps[] = { nullptr }; + commandList->SetDescriptorHeaps(0, heaps); + } + else + { + NvCo::Dx12RenderTarget* shadowMap = (NvCo::Dx12RenderTarget*)params.shadowMap; + + ID3D12DescriptorHeap* heaps[] = { state.m_srvCbvUavDescriptorHeap->getHeap(), state.m_samplerDescriptorHeap->getHeap() }; + commandList->SetDescriptorHeaps(_countof(heaps), heaps); + // Bind the srvs + commandList->SetGraphicsRootDescriptorTable(1, state.m_srvCbvUavDescriptorHeap->getGpuHandle(shadowMap->getSrvHeapIndex(shadowMap->getPrimaryBufferType()))); + // Bind the samplers + commandList->SetGraphicsRootDescriptorTable(2, state.m_samplerDescriptorHeap->getGpuHandle(m_shadowMapLinearSamplerIndex)); + } + + return NV_OK; +} + +int PointRenderPipelineD3D12::draw(const RenderAllocation& allocIn, size_t sizeOfAlloc, const void* platformState) +{ + return MeshRendererD3D12::defaultDraw(allocIn, sizeOfAlloc, platformState); +} + +} // namespace FlexSample
\ No newline at end of file diff --git a/demo/d3d12/pointRenderPipelineD3D12.h b/demo/d3d12/pointRenderPipelineD3D12.h new file mode 100644 index 0000000..cdd03bc --- /dev/null +++ b/demo/d3d12/pointRenderPipelineD3D12.h @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#ifndef POINT_RENDER_PIPELINE_D3D12_H +#define POINT_RENDER_PIPELINE_D3D12_H + +#include <DirectXMath.h> +#include "renderStateD3D12.h" +#include "meshRenderer.h" + +#include <NvCoDx12RenderTarget.h> + +#include "../d3d/renderParamsD3D.h" + +namespace FlexSample { +using namespace nvidia; + +struct PointRenderPipelineD3D12: public RenderPipeline +{ + //NV_CO_DECLARE_POLYMORPHIC_CLASS(PointRenderPipelineD3D12, RenderPipeline); +public: + typedef RenderPipeline Parent; + + enum PipelineStateType + { + PIPELINE_STATE_SHADOW, + PIPELINE_STATE_LIGHT_SOLID, + PIPELINE_STATE_COUNT_OF, + }; + + PointRenderPipelineD3D12(); + + /// Initialize + int initialize(const RenderStateD3D12& state, const std::wstring& shadersDir, int shadowMapLinearSamplerIndex, NvCo::Dx12RenderTarget* shadowMap); + /// Do the binding + virtual int bind(const void* paramsIn, const void* platformState) override; + virtual int draw(const RenderAllocation& alloc, size_t sizeOfAlloc, const void* platformState) override; + + /// Convert into a single pipeline state type + static PipelineStateType getPipelineStateType(PointDrawStage stage, PointRenderMode mode, PointCullMode cull); + + protected: + + int _initPipelineState(const RenderStateD3D12& state, NvCo::Dx12RenderTarget* shadowMap, PipelineStateType pipeType, ID3D12RootSignature* signiture, D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc); + + int m_shadowMapLinearSamplerIndex; //< The index to the linear sampler in the m_samplerHeap + + PipelineStateD3D12 m_states[PIPELINE_STATE_COUNT_OF]; +}; + +} // namespace FlexSample + +#endif
\ No newline at end of file diff --git a/demo/d3d12/renderStateD3D12.cpp b/demo/d3d12/renderStateD3D12.cpp new file mode 100644 index 0000000..28a69f4 --- /dev/null +++ b/demo/d3d12/renderStateD3D12.cpp @@ -0,0 +1,67 @@ + +#include "renderStateD3D12.h" + +namespace FlexSample { + +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Dx12RenderStateManager !!!!!!!!!!!!!!!!!!!!!!!!!! */ + +int RenderStateManagerD3D12::initialize(AppGraphCtxD3D12* renderContext, size_t maxHeapAlloc) +{ + m_renderContext = renderContext; + m_device = renderContext->m_device; + + m_fence.init(m_device); + m_scopeManager.init(m_device, &m_fence); + m_srvCbvUavDescriptorHeap.init(m_device, 256, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE); + m_samplerDescriptorHeap.init(m_device, 64, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE); + + { + NvCo::Dx12CircularResourceHeap::Desc desc; + desc.init(); + desc.m_blockSize = maxHeapAlloc; + m_constantHeap.init(m_device, desc, &m_fence); + } + + return NV_OK; +} + +void RenderStateManagerD3D12::updateCompleted() +{ + m_scopeManager.updateCompleted(); + m_constantHeap.updateCompleted(); +} + +void RenderStateManagerD3D12::onGpuWorkSubmitted(ID3D12CommandQueue* commandQueue) +{ + assert(commandQueue); + if (!commandQueue) + { + printf("Must pass a ID3D12CommandQueue to onGpuWorkSubmitted"); + return; + } + + const uint64_t signalValue = m_fence.nextSignal(commandQueue); + + m_scopeManager.addSync(signalValue); + m_constantHeap.addSync(signalValue); +} + +RenderStateD3D12 RenderStateManagerD3D12::getState() +{ + RenderStateD3D12 state; + + state.m_renderContext = m_renderContext; + state.m_commandList = m_renderContext->m_commandList; + state.m_device = m_device; + + state.m_constantHeap = &m_constantHeap; + state.m_srvCbvUavDescriptorHeap = &m_srvCbvUavDescriptorHeap; + state.m_fence = &m_fence; + state.m_scopeManager = &m_scopeManager; + state.m_samplerDescriptorHeap = &m_samplerDescriptorHeap; + + return state; +} + + +} // namespace FlexSample
\ No newline at end of file diff --git a/demo/d3d12/renderStateD3D12.h b/demo/d3d12/renderStateD3D12.h new file mode 100644 index 0000000..1fb1f7d --- /dev/null +++ b/demo/d3d12/renderStateD3D12.h @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2008-2016, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#ifndef RENDER_STATE_D3D12_H +#define RENDER_STATE_D3D12_H + +#include <NvCoDx12ResourceScopeManager.h> +#include <NvCoDx12CircularResourceHeap.h> +#include <NvCoDx12DescriptorHeap.h> +#include "appD3D12Ctx.h" + +namespace NvCo = nvidia::Common; + +namespace FlexSample { +using namespace nvidia; + +struct PipelineStateD3D12 +{ + /// True if contents is all set and therefore 'valid' + inline bool isValid() const { return m_rootSignature && m_pipelineState; } + + ComPtr<ID3D12RootSignature> m_rootSignature; + ComPtr<ID3D12PipelineState> m_pipelineState; +}; + +struct RenderStateD3D12 +{ + AppGraphCtxD3D12* m_renderContext; + + ID3D12Device* m_device; + ID3D12GraphicsCommandList* m_commandList; + + NvCo::Dx12ResourceScopeManager* m_scopeManager; ///< Holds resources in scope + NvCo::Dx12DescriptorHeap* m_srvCbvUavDescriptorHeap; ///< Can hold cbv, srv, uavs + NvCo::Dx12DescriptorHeap* m_samplerDescriptorHeap; ///< Descriptor heap + NvCo::Dx12CircularResourceHeap* m_constantHeap; ///< Can hold transitory constant buffers, and vertex buffers + NvCo::Dx12CounterFence* m_fence; ///< Main fence to track lifetimes +}; + +struct RenderStateManagerD3D12 +{ + RenderStateManagerD3D12(): + m_renderContext(nullptr), + m_device(nullptr) + {} + + int initialize(AppGraphCtxD3D12* renderContext, size_t maxHeapAlloc); + + void onGpuWorkSubmitted(ID3D12CommandQueue* handle); + void updateCompleted(); + + /// Get the render state + RenderStateD3D12 getState(); + + AppGraphCtxD3D12* m_renderContext; + ID3D12Device* m_device; + + NvCo::Dx12ResourceScopeManager m_scopeManager; ///< Holds resources in scope + NvCo::Dx12DescriptorHeap m_srvCbvUavDescriptorHeap; ///< Can hold cbv, srv, uavs + NvCo::Dx12DescriptorHeap m_samplerDescriptorHeap; ///< Holds sampler descriptions + NvCo::Dx12CircularResourceHeap m_constantHeap; ///< Can hold transitory constant buffers, and vertex buffers + NvCo::Dx12CounterFence m_fence; ///< Main fence to track lifetimes +}; + +} // namespace FlexSample + +#endif
\ No newline at end of file diff --git a/demo/helpers.h b/demo/helpers.h index 5aec028..adc9af5 100644 --- a/demo/helpers.h +++ b/demo/helpers.h @@ -214,7 +214,7 @@ void CreateParticleShape(const Mesh* srcMesh, Vec3 lower, Vec3 scale, float rota meshLower -= meshOffset; //Voxelize(*mesh, dx, dy, dz, &voxels[0], meshLower - Vec3(spacing*0.05f) , meshLower + Vec3(maxDim*spacing) + Vec3(spacing*0.05f)); - Voxelize((const float*)&mesh.m_positions[0], mesh.m_positions.size(), (const int*)&mesh.m_indices[0], mesh.m_indices.size(), maxDim, maxDim, maxDim, &voxels[0], meshLower, meshLower + Vec3(maxDim*spacing)); + Voxelize((const Vec3*)&mesh.m_positions[0], mesh.m_positions.size(), (const int*)&mesh.m_indices[0], mesh.m_indices.size(), maxDim, maxDim, maxDim, &voxels[0], meshLower, meshLower + Vec3(maxDim*spacing)); vector<int> indices(maxDim*maxDim*maxDim); vector<float> sdf(maxDim*maxDim*maxDim); @@ -330,7 +330,7 @@ void CreateParticleShape(const Mesh* srcMesh, Vec3 lower, Vec3 scale, float rota float distances[g_numSkinWeights] = {FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX }; if (LengthSq(color) == 0.0f) - g_mesh->m_colours[i] = 1.25f*colors[phase%7]; + g_mesh->m_colours[i] = 1.25f*colors[((unsigned int)(phase))%7]; else g_mesh->m_colours[i] = Colour(color); @@ -439,7 +439,7 @@ void SkinMesh() } } -void AddBox(Vec3 halfEdge = Vec3(2.0f), Vec3 center=Vec3(0.0f), Quat quat=Quat(), bool dynamic=false) +void AddBox(Vec3 halfEdge = Vec3(2.0f), Vec3 center=Vec3(0.0f), Quat quat=Quat(), bool dynamic=false, int channels=eNvFlexPhaseShapeChannelMask) { // transform g_buffers->shapePositions.push_back(Vec4(center.x, center.y, center.z, 0.0f)); @@ -454,7 +454,7 @@ void AddBox(Vec3 halfEdge = Vec3(2.0f), Vec3 center=Vec3(0.0f), Quat quat=Quat() geo.box.halfExtents[2] = halfEdge.z; g_buffers->shapeGeometry.push_back(geo); - g_buffers->shapeFlags.push_back(NvFlexMakeShapeFlags(eNvFlexShapeBox, dynamic)); + g_buffers->shapeFlags.push_back(NvFlexMakeShapeFlagsWithChannels(eNvFlexShapeBox, dynamic, channels)); } // helper that creates a plinth whose center matches the particle bounds @@ -513,7 +513,7 @@ void CreateSDF(const Mesh* mesh, uint32_t dim, Vec3 lower, Vec3 upper, float* sd double startVoxelize = GetSeconds(); uint32_t* volume = new uint32_t[dim*dim*dim]; - Voxelize((const float*)&mesh->m_positions[0], mesh->m_positions.size(), (const int*)&mesh->m_indices[0], mesh->m_indices.size(), dim, dim, dim, volume, lower, upper); + Voxelize((const Vec3*)&mesh->m_positions[0], mesh->m_positions.size(), (const int*)&mesh->m_indices[0], mesh->m_indices.size(), dim, dim, dim, volume, lower, upper); printf("End mesh voxelization (%.2fs)\n", (GetSeconds()-startVoxelize)); @@ -1161,14 +1161,11 @@ int PickParticle(Vec3 origin, Vec3 dir, Vec4* particles, int* phases, int n, flo return minIndex; } -// calculates local space positions given a set of particles and rigid indices -void CalculateRigidLocalPositions(const Vec4* restPositions, int numRestPositions, const int* offsets, const int* indices, int numRigids, Vec3* localPositions) +// calculates the center of mass of every rigid given a set of particle positions and rigid indices +void CalculateRigidCentersOfMass(const Vec4* restPositions, int numRestPositions, const int* offsets, Vec3* translations, const int* indices, int numRigids) { - - // To improve the accuracy of the result, first transform the restPositions to relative coordinates (by finding the mean and subtracting that from all points) + // To improve the accuracy of the result, first transform the restPositions to relative coordinates (by finding the mean and subtracting that from all positions) // Note: If this is not done, one might see ghost forces if the mean of the restPositions is far from the origin. - - // Calculate mean Vec3 shapeOffset(0.0f); for (int i = 0; i < numRestPositions; i++) @@ -1178,12 +1175,10 @@ void CalculateRigidLocalPositions(const Vec4* restPositions, int numRestPosition shapeOffset /= float(numRestPositions); - int count = 0; - - for (int r=0; r < numRigids; ++r) + for (int i=0; i < numRigids; ++i) { - const int startIndex = offsets[r]; - const int endIndex = offsets[r+1]; + const int startIndex = offsets[i]; + const int endIndex = offsets[i+1]; const int n = endIndex-startIndex; @@ -1191,22 +1186,41 @@ void CalculateRigidLocalPositions(const Vec4* restPositions, int numRestPosition Vec3 com; - for (int i=startIndex; i < endIndex; ++i) + for (int j=startIndex; j < endIndex; ++j) { - const int r = indices[i]; + const int r = indices[j]; - // By substracting meshOffset the calculation is done in relative coordinates + // By subtracting shapeOffset the calculation is done in relative coordinates com += Vec3(restPositions[r]) - shapeOffset; } com /= float(n); - for (int i=startIndex; i < endIndex; ++i) + // Add the shapeOffset to switch back to absolute coordinates + com += shapeOffset; + + translations[i] = com; + + } +} + +// calculates local space positions given a set of particle positions, rigid indices and centers of mass of the rigids +void CalculateRigidLocalPositions(const Vec4* restPositions, const int* offsets, const Vec3* translations, const int* indices, int numRigids, Vec3* localPositions) +{ + int count = 0; + + for (int i=0; i < numRigids; ++i) + { + const int startIndex = offsets[i]; + const int endIndex = offsets[i+1]; + + assert(endIndex-startIndex); + + for (int j=startIndex; j < endIndex; ++j) { - const int r = indices[i]; + const int r = indices[j]; - // By substracting meshOffset the calculation is done in relative coordinates - localPositions[count++] = (Vec3(restPositions[r]) - shapeOffset) - com; + localPositions[count++] = Vec3(restPositions[r]) - translations[i]; } } } @@ -1224,6 +1238,48 @@ void DrawImguiString(int x, int y, Vec3 color, int align, const char* s, ...) imguiDrawText(x, y, align, buf, imguiRGBA((unsigned char)(color.x*255), (unsigned char)(color.y*255), (unsigned char)(color.z*255))); } +enum +{ + HELPERS_SHADOW_OFFSET = 1, +}; + +void DrawShadowedText(int x, int y, Vec3 color, int align, const char* s, ...) +{ + char buf[2048]; + + va_list args; + + va_start(args, s); + vsnprintf(buf, 2048, s, args); + va_end(args); + + + imguiDrawText(x + HELPERS_SHADOW_OFFSET, y - HELPERS_SHADOW_OFFSET, align, buf, imguiRGBA(0, 0, 0)); + imguiDrawText(x, y, align, buf, imguiRGBA((unsigned char)(color.x * 255), (unsigned char)(color.y * 255), (unsigned char)(color.z * 255))); +} + +void DrawRect(float x, float y, float w, float h, Vec3 color) +{ + imguiDrawRect(x, y, w, h, imguiRGBA((unsigned char)(color.x * 255), (unsigned char)(color.y * 255), (unsigned char)(color.z * 255))); +} + +void DrawShadowedRect(float x, float y, float w, float h, Vec3 color) +{ + imguiDrawRect(x + HELPERS_SHADOW_OFFSET, y - HELPERS_SHADOW_OFFSET, w, h, imguiRGBA(0, 0, 0)); + imguiDrawRect(x, y, w, h, imguiRGBA((unsigned char)(color.x * 255), (unsigned char)(color.y * 255), (unsigned char)(color.z * 255))); +} + +void DrawLine(float x0, float y0, float x1, float y1, float r, Vec3 color) +{ + imguiDrawLine(x0, y0, x1, y1, r, imguiRGBA((unsigned char)(color.x * 255), (unsigned char)(color.y * 255), (unsigned char)(color.z * 255))); +} + +void DrawShadowedLine(float x0, float y0, float x1, float y1, float r, Vec3 color) +{ + imguiDrawLine(x0 + HELPERS_SHADOW_OFFSET, y0 - HELPERS_SHADOW_OFFSET, x1 + HELPERS_SHADOW_OFFSET, y1 - HELPERS_SHADOW_OFFSET, r, imguiRGBA(0, 0, 0)); + imguiDrawLine(x0, y0, x1, y1, r, imguiRGBA((unsigned char)(color.x * 255), (unsigned char)(color.y * 255), (unsigned char)(color.z * 255))); +} + // Soft body support functions Vec3 CalculateMean(const Vec3* particles, const int* indices, int numIndices) @@ -1545,7 +1601,7 @@ void SampleMesh(Mesh* mesh, Vec3 lower, Vec3 scale, float rotation, float radius meshLower -= meshOffset; //Voxelize(*mesh, dx, dy, dz, &voxels[0], meshLower - Vec3(spacing*0.05f) , meshLower + Vec3(maxDim*spacing) + Vec3(spacing*0.05f)); - Voxelize((const float*)&mesh->m_positions[0], mesh->m_positions.size(), (const int*)&mesh->m_indices[0], mesh->m_indices.size(), maxDim, maxDim, maxDim, &voxels[0], meshLower, meshLower + Vec3(maxDim*spacing)); + Voxelize((const Vec3*)&mesh->m_positions[0], mesh->m_positions.size(), (const int*)&mesh->m_indices[0], mesh->m_indices.size(), maxDim, maxDim, maxDim, &voxels[0], meshLower, meshLower + Vec3(maxDim*spacing)); // sample interior for (int x = 0; x < maxDim; ++x) diff --git a/demo/imgui.cpp b/demo/imgui.cpp index bc42082..cccaf3f 100644 --- a/demo/imgui.cpp +++ b/demo/imgui.cpp @@ -33,10 +33,10 @@ static char g_textPool[TEXT_POOL_SIZE]; static unsigned g_textPoolSize = 0; static const char* allocText(const char* text) { - int len = (int)(strlen(text)+1); + int len = (int)(strlen(text) + 1); if (g_textPoolSize + len >= TEXT_POOL_SIZE) return 0; - char* dst = &g_textPool[g_textPoolSize]; + char* dst = &g_textPool[g_textPoolSize]; memcpy(dst, text, len); g_textPoolSize += len; return dst; @@ -147,13 +147,13 @@ struct GuiState mx(-1), my(-1), scroll(0), active(0), hot(0), hotToBe(0), isHot(false), isActive(false), wentActive(false), dragX(0), dragY(0), dragOrig(0), widgetX(0), widgetY(0), widgetW(100), - insideCurrentScroll(false), areaId(0), widgetId(0) + insideCurrentScroll(false), areaId(0), widgetId(0) { } bool left; bool leftPressed, leftReleased; - int mx,my; + int mx, my; int scroll; unsigned int active; unsigned int hot; @@ -165,7 +165,7 @@ struct GuiState float dragOrig; int widgetX, widgetY, widgetW; bool insideCurrentScroll; - + unsigned int areaId; unsigned int widgetId; }; @@ -198,7 +198,7 @@ inline bool isHot(unsigned int id) inline bool inRect(int x, int y, int w, int h, bool checkScroll = true) { - return (!checkScroll || g_state.insideCurrentScroll) && g_state.mx >= x && g_state.mx <= x+w && g_state.my >= y && g_state.my <= y+h; + return (!checkScroll || g_state.insideCurrentScroll) && g_state.mx >= x && g_state.mx <= x + w && g_state.my >= y && g_state.my <= y + h; } inline void clearInput() @@ -223,12 +223,12 @@ inline void setActive(unsigned int id) inline void setHot(unsigned int id) { - g_state.hotToBe = id; -// Begin Add Android Support + g_state.hotToBe = id; + // Begin Add Android Support #ifdef ANDROID - g_state.hot = id; + g_state.hot = id; #endif -// End Add Android Support + // End Add Android Support } @@ -240,7 +240,7 @@ static bool buttonLogic(unsigned int id, bool over) { if (over) setHot(id); -// Begin Add Android Support + // Begin Add Android Support #ifdef ANDROID if (isHot(id) && g_state.leftPressed && over) setActive(id); @@ -248,7 +248,7 @@ static bool buttonLogic(unsigned int id, bool over) if (isHot(id) && g_state.leftPressed) setActive(id); #endif -// End Add Android Support + // End Add Android Support } // if button is active, then react on left up @@ -286,7 +286,7 @@ static void updateInput(int mx, int my, unsigned char mbut, int scroll) void imguiBeginFrame(int mx, int my, unsigned char mbut, int scroll) { - updateInput(mx,my,mbut,scroll); + updateInput(mx, my, mbut, scroll); g_state.hot = g_state.hotToBe; g_state.hotToBe = 0; @@ -346,29 +346,29 @@ bool imguiBeginScrollArea(const char* name, int x, int y, int w, int h, int* scr { g_state.areaId++; g_state.widgetId = 0; - g_scrollId = (g_state.areaId<<16) | g_state.widgetId; + g_scrollId = (g_state.areaId << 16) | g_state.widgetId; g_state.widgetX = x + SCROLL_AREA_PADDING; - g_state.widgetY = y+h-AREA_HEADER + (*scroll); - g_state.widgetW = w - SCROLL_AREA_PADDING*4; - g_scrollTop = y-AREA_HEADER+h; - g_scrollBottom = y+SCROLL_AREA_PADDING; - g_scrollRight = x+w - SCROLL_AREA_PADDING*3; + g_state.widgetY = y + h - AREA_HEADER + (*scroll); + g_state.widgetW = w - SCROLL_AREA_PADDING * 4; + g_scrollTop = y - AREA_HEADER + h; + g_scrollBottom = y + SCROLL_AREA_PADDING; + g_scrollRight = x + w - SCROLL_AREA_PADDING * 3; g_scrollVal = scroll; g_scrollAreaTop = g_state.widgetY; - g_focusTop = y-AREA_HEADER; - g_focusBottom = y-AREA_HEADER+h; + g_focusTop = y - AREA_HEADER; + g_focusBottom = y - AREA_HEADER + h; g_insideScrollArea = inRect(x, y, w, h, false); g_state.insideCurrentScroll = g_insideScrollArea; - addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, 6, imguiRGBA(0,0,0,192)); + addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, 6, imguiRGBA(0, 0, 0, 192)); - addGfxCmdText(x+AREA_HEADER/2, y+h-AREA_HEADER/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, name, imguiRGBA(255,255,255,128)); + addGfxCmdText(x + AREA_HEADER / 2, y + h - AREA_HEADER / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, name, imguiRGBA(255, 255, 255, 128)); - addGfxCmdScissor(x+SCROLL_AREA_PADDING, y+SCROLL_AREA_PADDING, w-SCROLL_AREA_PADDING*4, h-AREA_HEADER-SCROLL_AREA_PADDING); + addGfxCmdScissor(x + SCROLL_AREA_PADDING, y + SCROLL_AREA_PADDING, w - SCROLL_AREA_PADDING * 4, h - AREA_HEADER - SCROLL_AREA_PADDING); return g_insideScrollArea; } @@ -376,39 +376,39 @@ bool imguiBeginScrollArea(const char* name, int x, int y, int w, int h, int* scr void imguiEndScrollArea() { // Disable scissoring. - addGfxCmdScissor(-1,-1,-1,-1); + addGfxCmdScissor(-1, -1, -1, -1); // Draw scroll bar - int x = g_scrollRight+SCROLL_AREA_PADDING/2; + int x = g_scrollRight + SCROLL_AREA_PADDING / 2; int y = g_scrollBottom; - int w = SCROLL_AREA_PADDING*2; + int w = SCROLL_AREA_PADDING * 2; int h = g_scrollTop - g_scrollBottom; int stop = g_scrollAreaTop; int sbot = g_state.widgetY; int sh = stop - sbot; // The scrollable area height. - float barHeight = (float)h/(float)sh; - + float barHeight = (float)h / (float)sh; + if (barHeight < 1) { - float barY = (float)(y - sbot)/(float)sh; + float barY = (float)(y - sbot) / (float)sh; if (barY < 0) barY = 0; if (barY > 1) barY = 1; - + // Handle scroll bar logic. unsigned int hid = g_scrollId; int hx = x; int hy = y + (int)(barY*h); int hw = w; int hh = (int)(barHeight*h); - - const int range = h - (hh-1); + + const int range = h - (hh - 1); bool over = inRect(hx, hy, hw, hh); buttonLogic(hid, over); if (isActive(hid)) { - float u = (float)(hy-y) / (float)range; + float u = (float)(hy - y) / (float)range; if (g_state.wentActive) { g_state.dragY = g_state.my; @@ -419,26 +419,26 @@ void imguiEndScrollArea() u = g_state.dragOrig + (g_state.my - g_state.dragY) / (float)range; if (u < 0) u = 0; if (u > 1) u = 1; - *g_scrollVal = (int)((1-u) * (sh - h)); + *g_scrollVal = (int)((1 - u) * (sh - h)); } } - + // BG - addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, (float)w/2-1, imguiRGBA(0,0,0,196)); + addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, (float)w / 2 - 1, imguiRGBA(0, 0, 0, 196)); // Bar if (isActive(hid)) - addGfxCmdRoundedRect((float)hx, (float)hy, (float)hw, (float)hh, (float)w/2-1, imguiRGBA(255,196,0,196)); + addGfxCmdRoundedRect((float)hx, (float)hy, (float)hw, (float)hh, (float)w / 2 - 1, imguiRGBA(255, 196, 0, 196)); else - addGfxCmdRoundedRect((float)hx, (float)hy, (float)hw, (float)hh, (float)w/2-1, isHot(hid) ? imguiRGBA(255,196,0,96) : imguiRGBA(255,255,255,64)); + addGfxCmdRoundedRect((float)hx, (float)hy, (float)hw, (float)hh, (float)w / 2 - 1, isHot(hid) ? imguiRGBA(255, 196, 0, 96) : imguiRGBA(255, 255, 255, 64)); // Handle mouse scrolling. if (g_insideScrollArea) // && !anyActive()) { if (g_state.scroll) { - *g_scrollVal += 20*g_state.scroll; + *g_scrollVal += 20 * g_state.scroll; if (*g_scrollVal < 0) *g_scrollVal = 0; - if (*g_scrollVal > (sh - h)) *g_scrollVal = (sh - h); + if (*g_scrollVal >(sh - h)) *g_scrollVal = (sh - h); } } } @@ -448,8 +448,8 @@ void imguiEndScrollArea() bool imguiButton(const char* text, bool enabled) { g_state.widgetId++; - unsigned int id = (g_state.areaId<<16) | g_state.widgetId; - + unsigned int id = (g_state.areaId << 16) | g_state.widgetId; + int x = g_state.widgetX; int y = g_state.widgetY - BUTTON_HEIGHT; int w = g_state.widgetW; @@ -459,16 +459,16 @@ bool imguiButton(const char* text, bool enabled) bool over = enabled && inRect(x, y, w, h); bool res = buttonLogic(id, over); - addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, (float)BUTTON_HEIGHT/2-1, imguiRGBA(128,128,128, isActive(id)?196:96)); + addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, (float)BUTTON_HEIGHT / 2 - 1, imguiRGBA(128, 128, 128, isActive(id) ? 196 : 96)); if (enabled) - addGfxCmdText(x+BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); + addGfxCmdText(x + BUTTON_HEIGHT / 2, y + BUTTON_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255, 196, 0, 255) : imguiRGBA(255, 255, 255, 200)); else - addGfxCmdText(x+BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200)); + addGfxCmdText(x + BUTTON_HEIGHT / 2, y + BUTTON_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128, 128, 128, 200)); return res; } -bool imguiItem(const char* text, bool enabled, unsigned int color, bool forceHot) +bool imguiItem(const char* text, bool enabled, unsigned int color) { g_state.widgetId++; unsigned int id = (g_state.areaId << 16) | g_state.widgetId; @@ -484,8 +484,6 @@ bool imguiItem(const char* text, bool enabled, unsigned int color, bool forceHot if (isHot(id)) addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, 2.0f, imguiRGBA(255, 196, 0, isActive(id) ? 196 : 96)); - else if (forceHot) - addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, 2.0f, imguiRGBA(128, 128, 128, 96)); if (enabled) addGfxCmdText(x + BUTTON_HEIGHT / 2, y + BUTTON_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, text, color); @@ -498,8 +496,8 @@ bool imguiItem(const char* text, bool enabled, unsigned int color, bool forceHot bool imguiCheck(const char* text, bool checked, bool enabled) { g_state.widgetId++; - unsigned int id = (g_state.areaId<<16) | g_state.widgetId; - + unsigned int id = (g_state.areaId << 16) | g_state.widgetId; + int x = g_state.widgetX; int y = g_state.widgetY - BUTTON_HEIGHT; int w = g_state.widgetW; @@ -508,22 +506,22 @@ bool imguiCheck(const char* text, bool checked, bool enabled) bool over = enabled && inRect(x, y, w, h); bool res = buttonLogic(id, over); - - const int cx = x+BUTTON_HEIGHT/2-CHECK_SIZE/2; - const int cy = y+BUTTON_HEIGHT/2-CHECK_SIZE/2; - addGfxCmdRoundedRect((float)cx-3, (float)cy-3, (float)CHECK_SIZE+6, (float)CHECK_SIZE+6, 4, imguiRGBA(128,128,128, isActive(id)?196:96)); + + const int cx = x + BUTTON_HEIGHT / 2 - CHECK_SIZE / 2; + const int cy = y + BUTTON_HEIGHT / 2 - CHECK_SIZE / 2; + addGfxCmdRoundedRect((float)cx - 3, (float)cy - 3, (float)CHECK_SIZE + 6, (float)CHECK_SIZE + 6, 4, imguiRGBA(128, 128, 128, isActive(id) ? 196 : 96)); if (checked) { if (enabled) - addGfxCmdRoundedRect((float)cx, (float)cy, (float)CHECK_SIZE, (float)CHECK_SIZE, (float)CHECK_SIZE/2-1, imguiRGBA(255,255,255,isActive(id)?255:200)); + addGfxCmdRoundedRect((float)cx, (float)cy, (float)CHECK_SIZE, (float)CHECK_SIZE, (float)CHECK_SIZE / 2 - 1, imguiRGBA(255, 255, 255, isActive(id) ? 255 : 200)); else - addGfxCmdRoundedRect((float)cx, (float)cy, (float)CHECK_SIZE, (float)CHECK_SIZE, (float)CHECK_SIZE/2-1, imguiRGBA(128,128,128,200)); + addGfxCmdRoundedRect((float)cx, (float)cy, (float)CHECK_SIZE, (float)CHECK_SIZE, (float)CHECK_SIZE / 2 - 1, imguiRGBA(128, 128, 128, 200)); } if (enabled) - addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); + addGfxCmdText(x + BUTTON_HEIGHT, y + BUTTON_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255, 196, 0, 255) : imguiRGBA(255, 255, 255, 200)); else - addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200)); + addGfxCmdText(x + BUTTON_HEIGHT, y + BUTTON_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128, 128, 128, 200)); return res; } @@ -531,33 +529,33 @@ bool imguiCheck(const char* text, bool checked, bool enabled) bool imguiCollapse(const char* text, const char* subtext, bool checked, bool enabled) { g_state.widgetId++; - unsigned int id = (g_state.areaId<<16) | g_state.widgetId; - + unsigned int id = (g_state.areaId << 16) | g_state.widgetId; + int x = g_state.widgetX; int y = g_state.widgetY - BUTTON_HEIGHT; int w = g_state.widgetW; int h = BUTTON_HEIGHT; g_state.widgetY -= BUTTON_HEIGHT; // + DEFAULT_SPACING; - const int cx = x+BUTTON_HEIGHT/2-CHECK_SIZE/2; - const int cy = y+BUTTON_HEIGHT/2-CHECK_SIZE/2; + const int cx = x + BUTTON_HEIGHT / 2 - CHECK_SIZE / 2; + const int cy = y + BUTTON_HEIGHT / 2 - CHECK_SIZE / 2; bool over = enabled && inRect(x, y, w, h); bool res = buttonLogic(id, over); - + if (checked) - addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 2, imguiRGBA(255,255,255,isActive(id)?255:200)); + addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 2, imguiRGBA(255, 255, 255, isActive(id) ? 255 : 200)); else - addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 1, imguiRGBA(255,255,255,isActive(id)?255:200)); + addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 1, imguiRGBA(255, 255, 255, isActive(id) ? 255 : 200)); if (enabled) - addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); + addGfxCmdText(x + BUTTON_HEIGHT, y + BUTTON_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255, 196, 0, 255) : imguiRGBA(255, 255, 255, 200)); else - addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200)); + addGfxCmdText(x + BUTTON_HEIGHT, y + BUTTON_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128, 128, 128, 200)); if (subtext) - addGfxCmdText(x+w-BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_RIGHT, subtext, imguiRGBA(255,255,255,128)); - + addGfxCmdText(x + w - BUTTON_HEIGHT / 2, y + BUTTON_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_RIGHT, subtext, imguiRGBA(255, 255, 255, 128)); + return res; } @@ -566,7 +564,7 @@ void imguiLabel(const char* text) int x = g_state.widgetX; int y = g_state.widgetY - BUTTON_HEIGHT; g_state.widgetY -= BUTTON_HEIGHT; - addGfxCmdText(x, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(255,255,255,255)); + addGfxCmdText(x, y + BUTTON_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, text, imguiRGBA(255, 255, 255, 255)); } void imguiValue(const char* text) @@ -575,31 +573,31 @@ void imguiValue(const char* text) const int y = g_state.widgetY - BUTTON_HEIGHT; const int w = g_state.widgetW; g_state.widgetY -= BUTTON_HEIGHT; - - addGfxCmdText(x+w-BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_RIGHT, text, imguiRGBA(255,255,255,200)); + + addGfxCmdText(x + w - BUTTON_HEIGHT / 2, y + BUTTON_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_RIGHT, text, imguiRGBA(255, 255, 255, 200)); } bool imguiSlider(const char* text, float* val, float vmin, float vmax, float vinc, bool enabled) { g_state.widgetId++; - unsigned int id = (g_state.areaId<<16) | g_state.widgetId; - + unsigned int id = (g_state.areaId << 16) | g_state.widgetId; + int x = g_state.widgetX; int y = g_state.widgetY - BUTTON_HEIGHT; int w = g_state.widgetW; int h = SLIDER_HEIGHT; g_state.widgetY -= SLIDER_HEIGHT + DEFAULT_SPACING; - addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, 4.0f, imguiRGBA(0,0,0,128)); + addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, 4.0f, imguiRGBA(0, 0, 0, 128)); const int range = w - SLIDER_MARKER_WIDTH; - float u = (*val - vmin) / (vmax-vmin); + float u = (*val - vmin) / (vmax - vmin); if (u < 0) u = 0; if (u > 1) u = 1; int m = (int)(u * range); - bool over = enabled && inRect(x+m, y, SLIDER_MARKER_WIDTH, SLIDER_HEIGHT); + bool over = enabled && inRect(x + m, y, SLIDER_MARKER_WIDTH, SLIDER_HEIGHT); bool res = buttonLogic(id, over); bool valChanged = false; @@ -615,17 +613,17 @@ bool imguiSlider(const char* text, float* val, float vmin, float vmax, float vin u = g_state.dragOrig + (float)(g_state.mx - g_state.dragX) / (float)range; if (u < 0) u = 0; if (u > 1) u = 1; - *val = vmin + u*(vmax-vmin); - *val = floorf(*val/vinc+0.5f)*vinc; // Snap to vinc + *val = vmin + u*(vmax - vmin); + *val = floorf(*val / vinc + 0.5f)*vinc; // Snap to vinc m = (int)(u * range); valChanged = true; } } if (isActive(id)) - addGfxCmdRoundedRect((float)(x+m), (float)y, (float)SLIDER_MARKER_WIDTH, (float)SLIDER_HEIGHT, 4.0f, imguiRGBA(255,255,255,255)); + addGfxCmdRoundedRect((float)(x + m), (float)y, (float)SLIDER_MARKER_WIDTH, (float)SLIDER_HEIGHT, 4.0f, imguiRGBA(255, 255, 255, 255)); else - addGfxCmdRoundedRect((float)(x+m), (float)y, (float)SLIDER_MARKER_WIDTH, (float)SLIDER_HEIGHT, 4.0f, isHot(id) ? imguiRGBA(255,196,0,128) : imguiRGBA(255,255,255,64)); + addGfxCmdRoundedRect((float)(x + m), (float)y, (float)SLIDER_MARKER_WIDTH, (float)SLIDER_HEIGHT, 4.0f, isHot(id) ? imguiRGBA(255, 196, 0, 128) : imguiRGBA(255, 255, 255, 64)); // TODO: fix this, take a look at 'nicenum'. int digits = (int)(ceilf(log10f(vinc))); @@ -633,16 +631,16 @@ bool imguiSlider(const char* text, float* val, float vmin, float vmax, float vin snprintf(fmt, 16, "%%.%df", digits >= 0 ? 0 : -digits); char msg[128]; snprintf(msg, 128, fmt, *val); - + if (enabled) { - addGfxCmdText(x+SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); - addGfxCmdText(x+w-SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_RIGHT, msg, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); + addGfxCmdText(x + SLIDER_HEIGHT / 2, y + SLIDER_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255, 196, 0, 255) : imguiRGBA(255, 255, 255, 200)); + addGfxCmdText(x + w - SLIDER_HEIGHT / 2, y + SLIDER_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_RIGHT, msg, isHot(id) ? imguiRGBA(255, 196, 0, 255) : imguiRGBA(255, 255, 255, 200)); } else { - addGfxCmdText(x+SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200)); - addGfxCmdText(x+w-SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_RIGHT, msg, imguiRGBA(128,128,128,200)); + addGfxCmdText(x + SLIDER_HEIGHT / 2, y + SLIDER_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128, 128, 128, 200)); + addGfxCmdText(x + w - SLIDER_HEIGHT / 2, y + SLIDER_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_RIGHT, msg, imguiRGBA(128, 128, 128, 200)); } return res || valChanged; @@ -663,18 +661,18 @@ void imguiUnindent() void imguiSeparator() { - g_state.widgetY -= DEFAULT_SPACING*3; + g_state.widgetY -= DEFAULT_SPACING * 3; } void imguiSeparatorLine() { int x = g_state.widgetX; - int y = g_state.widgetY - DEFAULT_SPACING*2; + int y = g_state.widgetY - DEFAULT_SPACING * 2; int w = g_state.widgetW; int h = 1; - g_state.widgetY -= DEFAULT_SPACING*4; + g_state.widgetY -= DEFAULT_SPACING * 4; - addGfxCmdRect((float)x, (float)y, (float)w, (float)h, imguiRGBA(255,255,255,32)); + addGfxCmdRect((float)x, (float)y, (float)w, (float)h, imguiRGBA(255, 255, 255, 32)); } void imguiDrawText(int x, int y, int align, const char* text, unsigned int color) diff --git a/demo/imgui.h b/demo/imgui.h index 10ff3ab..e01f374 100644 --- a/demo/imgui.h +++ b/demo/imgui.h @@ -21,8 +21,8 @@ enum imguiMouseButton { - IMGUI_MBUT_LEFT = 0x01, - IMGUI_MBUT_RIGHT = 0x02, + IMGUI_MBUT_LEFT = 0x01, + IMGUI_MBUT_RIGHT = 0x02, }; enum imguiTextAlign @@ -32,13 +32,11 @@ enum imguiTextAlign IMGUI_ALIGN_RIGHT, }; -inline unsigned int imguiRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) +inline unsigned int imguiRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 255) { return (r) | (g << 8) | (b << 16) | (a << 24); } -struct imguiGfxRect; - void imguiBeginFrame(int mx, int my, unsigned char mbut, int scroll); void imguiEndFrame(); @@ -51,7 +49,7 @@ void imguiSeparator(); void imguiSeparatorLine(); bool imguiButton(const char* text, bool enabled = true); -bool imguiItem(const char* text, bool enabled = true, unsigned int color = imguiRGBA(255, 255, 255, 200), bool forceHot = false); +bool imguiItem(const char* text, bool enabled = true, unsigned int color = imguiRGBA(255, 255, 255, 200)); bool imguiCheck(const char* text, bool checked, bool enabled = true); bool imguiCollapse(const char* text, const char* subtext, bool checked, bool enabled = true); void imguiLabel(const char* text); @@ -75,18 +73,18 @@ enum imguiGfxCmdType struct imguiGfxRect { - short x,y,w,h,r; + short x, y, w, h, r; }; struct imguiGfxText { - short x,y,align; + short x, y, align; const char* text; }; struct imguiGfxLine { - short x0,y0,x1,y1,r; + short x0, y0, x1, y1, r; }; struct imguiGfxCmd @@ -107,4 +105,4 @@ const imguiGfxCmd* imguiGetRenderQueue(); int imguiGetRenderQueueSize(); -#endif // IMGUI_H +#endif // IMGUI_H
\ No newline at end of file diff --git a/demo/main.cpp b/demo/main.cpp index 1ee4049..df05ef7 100644 --- a/demo/main.cpp +++ b/demo/main.cpp @@ -49,6 +49,13 @@ #include "shaders.h" #include "imgui.h" +#if FLEX_DX +#include "d3d/shadersDemoContext.h" +class DemoContext; +extern DemoContext* CreateDemoContextD3D12(); +extern DemoContext* CreateDemoContextD3D11(); +#endif // FLEX_DX + SDL_Window* g_window; // window handle unsigned int g_windowId; // window id @@ -116,12 +123,15 @@ bool g_extensions = true; bool g_teamCity = false; bool g_interop = true; bool g_d3d12 = false; +bool g_useAsyncCompute = true; +bool g_increaseGfxLoadForAsyncComputeTesting = false; FluidRenderer* g_fluidRenderer; -FluidRenderBuffers g_fluidRenderBuffers; -DiffuseRenderBuffers g_diffuseRenderBuffers; +FluidRenderBuffers* g_fluidRenderBuffers; +DiffuseRenderBuffers* g_diffuseRenderBuffers; -NvFlexSolver* g_flex; +NvFlexSolver* g_solver; +NvFlexSolverDesc g_solverDesc; NvFlexLibrary* g_flexLib; NvFlexParams g_params; NvFlexTimers g_timers; @@ -148,6 +158,19 @@ std::map<NvFlexDistanceFieldId, GpuMesh*> g_fields; // flag to request collision shapes be updated bool g_shapesChanged = false; +/* Note that this array of colors is altered by demo code, and is also read from global by graphics API impls */ +Colour g_colors[] = +{ + Colour(0.0f, 0.5f, 1.0f), + Colour(0.797f, 0.354f, 0.000f), + Colour(0.092f, 0.465f, 0.820f), + Colour(0.000f, 0.349f, 0.173f), + Colour(0.875f, 0.782f, 0.051f), + Colour(0.000f, 0.170f, 0.453f), + Colour(0.673f, 0.111f, 0.000f), + Colour(0.612f, 0.194f, 0.394f) +}; + struct SimBuffers { NvFlexVector<Vec4> positions; @@ -162,7 +185,8 @@ struct SimBuffers NvFlexVector<Vec4> smoothPositions; NvFlexVector<Vec4> diffusePositions; NvFlexVector<Vec4> diffuseVelocities; - NvFlexVector<int> diffuseIndices; + NvFlexVector<int> diffuseCount; + NvFlexVector<int> activeIndices; // convexes @@ -178,6 +202,8 @@ struct SimBuffers NvFlexVector<int> rigidIndices; NvFlexVector<int> rigidMeshSize; NvFlexVector<float> rigidCoefficients; + NvFlexVector<float> rigidPlasticThresholds; + NvFlexVector<float> rigidPlasticCreeps; NvFlexVector<Quat> rigidRotations; NvFlexVector<Vec3> rigidTranslations; NvFlexVector<Vec3> rigidLocalPositions; @@ -202,10 +228,10 @@ struct SimBuffers SimBuffers(NvFlexLibrary* l) : positions(l), restPositions(l), velocities(l), phases(l), densities(l), anisotropy1(l), anisotropy2(l), anisotropy3(l), normals(l), smoothPositions(l), - diffusePositions(l), diffuseVelocities(l), diffuseIndices(l), activeIndices(l), + diffusePositions(l), diffuseVelocities(l), diffuseCount(l), activeIndices(l), shapeGeometry(l), shapePositions(l), shapeRotations(l), shapePrevPositions(l), shapePrevRotations(l), shapeFlags(l), rigidOffsets(l), rigidIndices(l), rigidMeshSize(l), - rigidCoefficients(l), rigidRotations(l), rigidTranslations(l), + rigidCoefficients(l), rigidPlasticThresholds(l), rigidPlasticCreeps(l), rigidRotations(l), rigidTranslations(l), rigidLocalPositions(l), rigidLocalNormals(l), inflatableTriOffsets(l), inflatableTriCounts(l), inflatableVolumes(l), inflatableCoefficients(l), inflatablePressures(l), springIndices(l), springLengths(l), @@ -228,7 +254,7 @@ void MapBuffers(SimBuffers* buffers) buffers->normals.map(); buffers->diffusePositions.map(); buffers->diffuseVelocities.map(); - buffers->diffuseIndices.map(); + buffers->diffuseCount.map(); buffers->smoothPositions.map(); buffers->activeIndices.map(); @@ -244,6 +270,8 @@ void MapBuffers(SimBuffers* buffers) buffers->rigidIndices.map(); buffers->rigidMeshSize.map(); buffers->rigidCoefficients.map(); + buffers->rigidPlasticThresholds.map(); + buffers->rigidPlasticCreeps.map(); buffers->rigidRotations.map(); buffers->rigidTranslations.map(); buffers->rigidLocalPositions.map(); @@ -279,7 +307,7 @@ void UnmapBuffers(SimBuffers* buffers) buffers->normals.unmap(); buffers->diffusePositions.unmap(); buffers->diffuseVelocities.unmap(); - buffers->diffuseIndices.unmap(); + buffers->diffuseCount.unmap(); buffers->smoothPositions.unmap(); buffers->activeIndices.unmap(); @@ -296,6 +324,8 @@ void UnmapBuffers(SimBuffers* buffers) buffers->rigidIndices.unmap(); buffers->rigidMeshSize.unmap(); buffers->rigidCoefficients.unmap(); + buffers->rigidPlasticThresholds.unmap(); + buffers->rigidPlasticCreeps.unmap(); buffers->rigidRotations.unmap(); buffers->rigidTranslations.unmap(); buffers->rigidLocalPositions.unmap(); @@ -339,7 +369,7 @@ void DestroyBuffers(SimBuffers* buffers) buffers->normals.destroy(); buffers->diffusePositions.destroy(); buffers->diffuseVelocities.destroy(); - buffers->diffuseIndices.destroy(); + buffers->diffuseCount.destroy(); buffers->smoothPositions.destroy(); buffers->activeIndices.destroy(); @@ -356,6 +386,8 @@ void DestroyBuffers(SimBuffers* buffers) buffers->rigidIndices.destroy(); buffers->rigidMeshSize.destroy(); buffers->rigidCoefficients.destroy(); + buffers->rigidPlasticThresholds.destroy(); + buffers->rigidPlasticCreeps.destroy(); buffers->rigidRotations.destroy(); buffers->rigidTranslations.destroy(); buffers->rigidLocalPositions.destroy(); @@ -476,6 +508,8 @@ int g_lasty; int g_lastb = -1; bool g_profile = false; +bool g_outputAllFrameTimes = false; +bool g_asyncComputeBenchmark = false; ShadowMap* g_shadowMap; @@ -525,7 +559,7 @@ void Init(int scene, bool centerCamera = true) { RandInit(); - if (g_flex) + if (g_solver) { if (g_buffers) DestroyBuffers(g_buffers); @@ -556,8 +590,8 @@ void Init(int scene, bool centerCamera = true) g_meshes.clear(); g_convexes.clear(); - NvFlexDestroySolver(g_flex); - g_flex = NULL; + NvFlexDestroySolver(g_solver); + g_solver = NULL; } // alloc buffers @@ -576,6 +610,8 @@ void Init(int scene, bool centerCamera = true) g_buffers->rigidRotations.resize(0); g_buffers->rigidTranslations.resize(0); g_buffers->rigidCoefficients.resize(0); + g_buffers->rigidPlasticThresholds.resize(0); + g_buffers->rigidPlasticCreeps.resize(0); g_buffers->rigidLocalPositions.resize(0); g_buffers->rigidLocalNormals.resize(0); @@ -592,6 +628,8 @@ void Init(int scene, bool centerCamera = true) g_emitters.resize(1); g_emitters[0].mEnabled = false; g_emitters[0].mSpeed = 1.0f; + g_emitters[0].mLeftOver = 0.0f; + g_emitters[0].mWidth = 8; g_buffers->shapeGeometry.resize(0); g_buffers->shapePositions.resize(0); @@ -670,9 +708,6 @@ void Init(int scene, bool centerCamera = true) g_params.particleCollisionMargin = 0.0f; g_params.shapeCollisionMargin = 0.0f; g_params.collisionDistance = 0.0f; - g_params.plasticThreshold = 0.0f; - g_params.plasticCreep = 0.0f; - g_params.fluid = false; g_params.sleepThreshold = 0.0f; g_params.shockPropagation = 0.0f; g_params.restitution = 0.0f; @@ -692,9 +727,6 @@ void Init(int scene, bool centerCamera = true) g_params.diffuseBuoyancy = 1.0f; g_params.diffuseDrag = 0.8f; g_params.diffuseBallistic = 16; - g_params.diffuseSortAxis[0] = 0.0f; - g_params.diffuseSortAxis[1] = 0.0f; - g_params.diffuseSortAxis[2] = 0.0f; g_params.diffuseLifetime = 2.0f; g_numSubsteps = 2; @@ -710,8 +742,7 @@ void Init(int scene, bool centerCamera = true) g_diffuseOutscatter = 0.53f; // reset phase 0 particle color to blue - extern Colour gColors[]; - gColors[0] = Colour(0.0f, 0.5f, 1.0f); + g_colors[0] = Colour(0.0f, 0.5f, 1.0f); g_numSolidParticles = 0; @@ -730,26 +761,27 @@ void Init(int scene, bool centerCamera = true) g_sceneLower = FLT_MAX; g_sceneUpper = -FLT_MAX; + // initialize solver desc + NvFlexSetSolverDescDefaults(&g_solverDesc); + // create scene + StartGpuWork(); g_scenes[g_scene]->Initialize(); + EndGpuWork(); uint32_t numParticles = g_buffers->positions.size(); uint32_t maxParticles = numParticles + g_numExtraParticles*g_numExtraMultiplier; + + if (g_params.solidRestDistance == 0.0f) + g_params.solidRestDistance = g_params.radius; - // by default solid particles use the maximum radius - if (g_params.fluid && g_params.solidRestDistance == 0.0f) + // if fluid present then we assume solid particles have the same radius + if (g_params.fluidRestDistance > 0.0f) g_params.solidRestDistance = g_params.fluidRestDistance; - else - g_params.solidRestDistance = g_params.radius; - // collision distance with shapes half the radius + // set collision distance automatically based on rest distance if not alraedy set if (g_params.collisionDistance == 0.0f) - { - g_params.collisionDistance = g_params.radius*0.5f; - - if (g_params.fluid) - g_params.collisionDistance = g_params.fluidRestDistance*0.5f; - } + g_params.collisionDistance = Max(g_params.solidRestDistance, g_params.fluidRestDistance)*0.5f; // default particle friction to 10% of shape friction if (g_params.particleFriction == 0.0f) @@ -788,7 +820,7 @@ void Init(int scene, bool centerCamera = true) g_buffers->diffusePositions.resize(g_maxDiffuseParticles); g_buffers->diffuseVelocities.resize(g_maxDiffuseParticles); - g_buffers->diffuseIndices.resize(g_maxDiffuseParticles); + g_buffers->diffuseCount.resize(1, 0); // for fluid rendering these are the Laplacian smoothed positions g_buffers->smoothPositions.resize(maxParticles); @@ -825,8 +857,12 @@ void Init(int scene, bool centerCamera = true) g_meshRestPositions.resize(0); } + g_solverDesc.maxParticles = maxParticles; + g_solverDesc.maxDiffuseParticles = g_maxDiffuseParticles; + g_solverDesc.maxNeighborsPerParticle = g_maxNeighborsPerParticle; + // main create method for the Flex solver - g_flex = NvFlexCreateSolver(g_flexLib, maxParticles, g_maxDiffuseParticles, g_maxNeighborsPerParticle); + g_solver = NvFlexCreateSolver(g_flexLib, &g_solverDesc); // give scene a chance to do some post solver initialization g_scenes[g_scene]->PostInitialize(); @@ -868,13 +904,20 @@ void Init(int scene, bool centerCamera = true) const int numRigids = g_buffers->rigidOffsets.size() - 1; + // If the centers of mass for the rigids are not yet computed, this is done here + // (If the CreateParticleShape method is used instead of the NvFlexExt methods, the centers of mass will be calculated here) + if (g_buffers->rigidTranslations.size() == 0) + { + g_buffers->rigidTranslations.resize(g_buffers->rigidOffsets.size() - 1, Vec3()); + CalculateRigidCentersOfMass(&g_buffers->positions[0], g_buffers->positions.size(), &g_buffers->rigidOffsets[0], &g_buffers->rigidTranslations[0], &g_buffers->rigidIndices[0], numRigids); + } + // calculate local rest space positions g_buffers->rigidLocalPositions.resize(g_buffers->rigidOffsets.back()); - CalculateRigidLocalPositions(&g_buffers->positions[0], g_buffers->positions.size(), &g_buffers->rigidOffsets[0], &g_buffers->rigidIndices[0], numRigids, &g_buffers->rigidLocalPositions[0]); + CalculateRigidLocalPositions(&g_buffers->positions[0], &g_buffers->rigidOffsets[0], &g_buffers->rigidTranslations[0], &g_buffers->rigidIndices[0], numRigids, &g_buffers->rigidLocalPositions[0]); + // set rigidRotations to correct length, probably NULL up until here g_buffers->rigidRotations.resize(g_buffers->rigidOffsets.size() - 1, Quat()); - g_buffers->rigidTranslations.resize(g_buffers->rigidOffsets.size() - 1, Vec3()); - } // unmap so we can start transferring data to GPU @@ -883,47 +926,53 @@ void Init(int scene, bool centerCamera = true) //----------------------------- // Send data to Flex - NvFlexSetParams(g_flex, &g_params); - NvFlexSetParticles(g_flex, g_buffers->positions.buffer, numParticles); - NvFlexSetVelocities(g_flex, g_buffers->velocities.buffer, numParticles); - NvFlexSetNormals(g_flex, g_buffers->normals.buffer, numParticles); - NvFlexSetPhases(g_flex, g_buffers->phases.buffer, g_buffers->phases.size()); - NvFlexSetRestParticles(g_flex, g_buffers->restPositions.buffer, g_buffers->restPositions.size()); + NvFlexCopyDesc copyDesc; + copyDesc.dstOffset = 0; + copyDesc.srcOffset = 0; + copyDesc.elementCount = numParticles; - NvFlexSetActive(g_flex, g_buffers->activeIndices.buffer, numParticles); + NvFlexSetParams(g_solver, &g_params); + NvFlexSetParticles(g_solver, g_buffers->positions.buffer, ©Desc); + NvFlexSetVelocities(g_solver, g_buffers->velocities.buffer, ©Desc); + NvFlexSetNormals(g_solver, g_buffers->normals.buffer, ©Desc); + NvFlexSetPhases(g_solver, g_buffers->phases.buffer, ©Desc); + NvFlexSetRestParticles(g_solver, g_buffers->restPositions.buffer, ©Desc); + NvFlexSetActive(g_solver, g_buffers->activeIndices.buffer, ©Desc); + NvFlexSetActiveCount(g_solver, numParticles); + // springs if (g_buffers->springIndices.size()) { assert((g_buffers->springIndices.size() & 1) == 0); assert((g_buffers->springIndices.size() / 2) == g_buffers->springLengths.size()); - NvFlexSetSprings(g_flex, g_buffers->springIndices.buffer, g_buffers->springLengths.buffer, g_buffers->springStiffness.buffer, g_buffers->springLengths.size()); + NvFlexSetSprings(g_solver, g_buffers->springIndices.buffer, g_buffers->springLengths.buffer, g_buffers->springStiffness.buffer, g_buffers->springLengths.size()); } // rigids if (g_buffers->rigidOffsets.size()) { - NvFlexSetRigids(g_flex, g_buffers->rigidOffsets.buffer, g_buffers->rigidIndices.buffer, g_buffers->rigidLocalPositions.buffer, g_buffers->rigidLocalNormals.buffer, g_buffers->rigidCoefficients.buffer, g_buffers->rigidRotations.buffer, g_buffers->rigidTranslations.buffer, g_buffers->rigidOffsets.size() - 1, g_buffers->rigidIndices.size()); + NvFlexSetRigids(g_solver, g_buffers->rigidOffsets.buffer, g_buffers->rigidIndices.buffer, g_buffers->rigidLocalPositions.buffer, g_buffers->rigidLocalNormals.buffer, g_buffers->rigidCoefficients.buffer, g_buffers->rigidPlasticThresholds.buffer, g_buffers->rigidPlasticCreeps.buffer, g_buffers->rigidRotations.buffer, g_buffers->rigidTranslations.buffer, g_buffers->rigidOffsets.size() - 1, g_buffers->rigidIndices.size()); } // inflatables if (g_buffers->inflatableTriOffsets.size()) { - NvFlexSetInflatables(g_flex, g_buffers->inflatableTriOffsets.buffer, g_buffers->inflatableTriCounts.buffer, g_buffers->inflatableVolumes.buffer, g_buffers->inflatablePressures.buffer, g_buffers->inflatableCoefficients.buffer, g_buffers->inflatableTriOffsets.size()); + NvFlexSetInflatables(g_solver, g_buffers->inflatableTriOffsets.buffer, g_buffers->inflatableTriCounts.buffer, g_buffers->inflatableVolumes.buffer, g_buffers->inflatablePressures.buffer, g_buffers->inflatableCoefficients.buffer, g_buffers->inflatableTriOffsets.size()); } // dynamic triangles if (g_buffers->triangles.size()) { - NvFlexSetDynamicTriangles(g_flex, g_buffers->triangles.buffer, g_buffers->triangleNormals.buffer, g_buffers->triangles.size() / 3); + NvFlexSetDynamicTriangles(g_solver, g_buffers->triangles.buffer, g_buffers->triangleNormals.buffer, g_buffers->triangles.size() / 3); } // collision shapes if (g_buffers->shapeFlags.size()) { NvFlexSetShapes( - g_flex, + g_solver, g_buffers->shapeGeometry.buffer, g_buffers->shapePositions.buffer, g_buffers->shapeRotations.buffer, @@ -946,20 +995,20 @@ void Init(int scene, bool centerCamera = true) NvFlexParams copy = g_params; copy.numIterations = 4; - NvFlexSetParams(g_flex, ©); + NvFlexSetParams(g_solver, ©); const int kWarmupIterations = 100; for (int i = 0; i < kWarmupIterations; ++i) { - NvFlexUpdateSolver(g_flex, 0.0001f, 1, false); - NvFlexSetVelocities(g_flex, g_buffers->velocities.buffer, maxParticles); + NvFlexUpdateSolver(g_solver, 0.0001f, 1, false); + NvFlexSetVelocities(g_solver, g_buffers->velocities.buffer, NULL); } // udpate host copy - NvFlexGetParticles(g_flex, g_buffers->positions.buffer, g_buffers->positions.size()); - NvFlexGetSmoothParticles(g_flex, g_buffers->smoothPositions.buffer, g_buffers->smoothPositions.size()); - NvFlexGetAnisotropy(g_flex, g_buffers->anisotropy1.buffer, g_buffers->anisotropy2.buffer, g_buffers->anisotropy3.buffer); + NvFlexGetParticles(g_solver, g_buffers->positions.buffer, NULL); + NvFlexGetSmoothParticles(g_solver, g_buffers->smoothPositions.buffer, NULL); + NvFlexGetAnisotropy(g_solver, g_buffers->anisotropy1.buffer, g_buffers->anisotropy2.buffer, g_buffers->anisotropy3.buffer, NULL); printf("Finished warm up.\n"); } @@ -996,7 +1045,7 @@ void Shutdown() g_fields.clear(); g_meshes.clear(); - NvFlexDestroySolver(g_flex); + NvFlexDestroySolver(g_solver); NvFlexShutdown(g_flexLib); #if _WIN32 @@ -1019,7 +1068,7 @@ void UpdateEmitters() // process emitters if (g_emit) { - int activeCount = NvFlexGetActiveCount(g_flex); + int activeCount = NvFlexGetActiveCount(g_solver); size_t e = 0; @@ -1036,19 +1085,9 @@ void UpdateEmitters() Vec3 emitterRight = g_emitters[e].mRight; Vec3 emitterPos = g_emitters[e].mPos; - float r; - int phase; - if (g_params.fluid) - { - r = g_params.fluidRestDistance; - phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid); - } - else - { - r = g_params.solidRestDistance; - phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide); - } + float r = g_params.fluidRestDistance; + int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid); float numParticles = (g_emitters[e].mSpeed / r)*g_dt; @@ -1124,7 +1163,7 @@ void UpdateMouse() Vec3 origin, dir; GetViewRay(g_lastx, g_screenHeight - g_lasty, origin, dir); - const int numActive = NvFlexGetActiveCount(g_flex); + const int numActive = NvFlexGetActiveCount(g_solver); g_mouseParticle = PickParticle(origin, dir, &g_buffers->positions[0], &g_buffers->phases[0], numActive, g_params.radius*0.8f, g_mouseT); @@ -1190,8 +1229,8 @@ void UpdateScene() void RenderScene() { - const int numParticles = NvFlexGetActiveCount(g_flex); - const int numDiffuse = NvFlexGetDiffuseParticles(g_flex, NULL, NULL, NULL); + const int numParticles = NvFlexGetActiveCount(g_solver); + const int numDiffuse = g_buffers->diffuseCount[0]; //--------------------------------------------------- // use VBO buffer wrappers to allow Flex to write directly to the OpenGL buffers @@ -1203,7 +1242,7 @@ void RenderScene() if (g_interop) { // copy data directly from solver to the renderer buffers - UpdateFluidRenderBuffers(g_fluidRenderBuffers, g_flex, g_drawEllipsoids, g_drawDensity); + UpdateFluidRenderBuffers(g_fluidRenderBuffers, g_solver, g_drawEllipsoids, g_drawDensity); } else { @@ -1235,13 +1274,16 @@ void RenderScene() } } } + + // GPU Render time doesn't include CPU->GPU copy time + GraphicsTimerBegin(); if (numDiffuse) { if (g_interop) { // copy data directly from solver to the renderer buffers - UpdateDiffuseRenderBuffers(g_diffuseRenderBuffers, g_flex); + UpdateDiffuseRenderBuffers(g_diffuseRenderBuffers, g_solver); } else { @@ -1249,7 +1291,6 @@ void RenderScene() UpdateDiffuseRenderBuffers(g_diffuseRenderBuffers, &g_buffers->diffusePositions[0], &g_buffers->diffuseVelocities[0], - &g_buffers->diffuseIndices[0], numDiffuse); } } @@ -1287,15 +1328,8 @@ void RenderScene() Matrix44 lightView = LookAtMatrix(Point3(g_lightPos), Point3(g_lightTarget)); Matrix44 lightTransform = lightPerspective*lightView; - // non-fluid particles maintain radius distance (not 2.0f*radius) so multiply by a half - float radius = g_params.solidRestDistance; - - // fluid particles overlap twice as much again, so half the radius again - if (g_params.fluid) - radius = g_params.fluidRestDistance; - - radius *= 0.5f; - radius *= g_pointScale; + // radius used for drawing + float radius = Max(g_params.solidRestDistance, g_params.fluidRestDistance)*0.5f*g_pointScale; //------------------------------------- // shadowing pass @@ -1335,7 +1369,7 @@ void RenderScene() { shadowParticles = 0; - if (g_drawEllipsoids && g_params.fluid) + if (g_drawEllipsoids) { shadowParticles = numParticles - g_numSolidParticles; shadowParticlesOffset = g_numSolidParticles; @@ -1350,7 +1384,7 @@ void RenderScene() } if (g_buffers->activeIndices.size()) - DrawPoints(g_fluidRenderBuffers.mPositionVBO, g_fluidRenderBuffers.mDensityVBO, g_fluidRenderBuffers.mIndices, shadowParticles, shadowParticlesOffset, radius, 2048, 1.0f, lightFov, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_drawDensity); + DrawPoints(g_fluidRenderBuffers, shadowParticles, shadowParticlesOffset, radius, 2048, 1.0f, lightFov, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_drawDensity); ShadowEnd(); @@ -1362,26 +1396,33 @@ void RenderScene() SetView(view, proj); SetCullMode(true); - DrawPlanes((Vec4*)g_params.planes, g_params.numPlanes, g_drawPlaneBias); + // When the benchmark measures async compute, we need a graphics workload that runs for a whole frame. + // We do this by rerendering our simple graphics many times. + int passes = g_increaseGfxLoadForAsyncComputeTesting ? 50 : 1; - if (g_drawMesh) - DrawMesh(g_mesh, g_meshColor); + for (int i = 0; i != passes; i++) + { + DrawPlanes((Vec4*)g_params.planes, g_params.numPlanes, g_drawPlaneBias); - DrawShapes(); + if (g_drawMesh) + DrawMesh(g_mesh, g_meshColor); - if (g_drawCloth && g_buffers->triangles.size()) - DrawCloth(&g_buffers->positions[0], &g_buffers->normals[0], g_buffers->uvs.size() ? &g_buffers->uvs[0].x : NULL, &g_buffers->triangles[0], g_buffers->triangles.size() / 3, g_buffers->positions.size(), 3, g_expandCloth); - if (g_drawRopes) - { - for (size_t i = 0; i < g_ropes.size(); ++i) - DrawRope(&g_buffers->positions[0], &g_ropes[i].mIndices[0], g_ropes[i].mIndices.size(), g_params.radius*0.5f*g_ropeScale, i); - } + DrawShapes(); - // give scene a chance to do custom drawing - g_scenes[g_scene]->Draw(0); + if (g_drawCloth && g_buffers->triangles.size()) + DrawCloth(&g_buffers->positions[0], &g_buffers->normals[0], g_buffers->uvs.size() ? &g_buffers->uvs[0].x : NULL, &g_buffers->triangles[0], g_buffers->triangles.size() / 3, g_buffers->positions.size(), 3, g_expandCloth); + + if (g_drawRopes) + { + for (size_t i = 0; i < g_ropes.size(); ++i) + DrawRope(&g_buffers->positions[0], &g_ropes[i].mIndices[0], g_ropes[i].mIndices.size(), g_params.radius*0.5f*g_ropeScale, i); + } + // give scene a chance to do custom drawing + g_scenes[g_scene]->Draw(0); + } UnbindSolidShader(); @@ -1389,11 +1430,11 @@ void RenderScene() if (g_drawDiffuse) RenderDiffuse(g_fluidRenderer, g_diffuseRenderBuffers, numDiffuse, radius*g_diffuseScale, float(g_screenWidth), aspect, fov, g_diffuseColor, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_diffuseMotionScale, g_diffuseInscatter, g_diffuseOutscatter, g_diffuseShadow, false); - if (g_drawEllipsoids && g_params.fluid) + if (g_drawEllipsoids) { // draw solid particles separately if (g_numSolidParticles && g_drawPoints) - DrawPoints(g_fluidRenderBuffers.mPositionVBO, g_fluidRenderBuffers.mDensityVBO, g_fluidRenderBuffers.mIndices, g_numSolidParticles, 0, radius, float(g_screenWidth), aspect, fov, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_drawDensity); + DrawPoints(g_fluidRenderBuffers, g_numSolidParticles, 0, radius, float(g_screenWidth), aspect, fov, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_drawDensity); // render fluid surface RenderEllipsoids(g_fluidRenderer, g_fluidRenderBuffers, numParticles - g_numSolidParticles, g_numSolidParticles, radius, float(g_screenWidth), aspect, fov, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_fluidColor, g_blur, g_ior, g_drawOpaque); @@ -1410,10 +1451,11 @@ void RenderScene() int offset = g_drawMesh ? g_numSolidParticles : 0; if (g_buffers->activeIndices.size()) - DrawPoints(g_fluidRenderBuffers.mPositionVBO, g_fluidRenderBuffers.mDensityVBO, g_fluidRenderBuffers.mIndices, numParticles - offset, offset, radius, float(g_screenWidth), aspect, fov, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_drawDensity); + DrawPoints(g_fluidRenderBuffers, numParticles - offset, offset, radius, float(g_screenWidth), aspect, fov, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_drawDensity); } } + GraphicsTimerEnd(); } void RenderDebug() @@ -1472,7 +1514,7 @@ void RenderDebug() NvFlexVector<int> contactIndices(g_flexLib, g_buffers->positions.size()); NvFlexVector<unsigned int> contactCounts(g_flexLib, g_buffers->positions.size()); - NvFlexGetContacts(g_flex, contactPlanes.buffer, contactVelocities.buffer, contactIndices.buffer, contactCounts.buffer); + NvFlexGetContacts(g_solver, contactPlanes.buffer, contactVelocities.buffer, contactIndices.buffer, contactCounts.buffer); // ensure transfers have finished contactPlanes.map(); @@ -1528,7 +1570,7 @@ void RenderDebug() if (g_drawNormals) { - NvFlexGetNormals(g_flex, g_buffers->normals.buffer, g_buffers->normals.size()); + NvFlexGetNormals(g_solver, g_buffers->normals.buffer, NULL); BeginLines(); @@ -1655,8 +1697,8 @@ int DoUI() if (g_showHelp) { - const int numParticles = NvFlexGetActiveCount(g_flex); - const int numDiffuse = NvFlexGetDiffuseParticles(g_flex, NULL, NULL, NULL); + const int numParticles = NvFlexGetActiveCount(g_solver); + const int numDiffuse = g_buffers->diffuseCount[0]; int x = g_screenWidth - 200; int y = g_screenHeight - 23; @@ -1687,6 +1729,8 @@ int DoUI() { DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Sim Time (CPU): %.2fms", g_updateTime*1000.0f); y -= fontHeight; DrawImguiString(x, y, Vec3(0.97f, 0.59f, 0.27f), IMGUI_ALIGN_RIGHT, "Sim Latency (GPU): %.2fms", g_simLatency); y -= fontHeight * 2; + + BenchmarkUpdateGraph(); } else { @@ -1750,7 +1794,7 @@ int DoUI() for (int i = 0; i < int(g_scenes.size()); ++i) { unsigned int color = g_scene == i ? imguiRGBA(255, 151, 61, 255) : imguiRGBA(255, 255, 255, 200); - if (imguiItem(g_scenes[i]->GetName(), true, color, i == g_selectedScene)) + if (imguiItem(g_scenes[i]->GetName(), true, color)) // , i == g_selectedScene)) { newScene = i; } @@ -1842,11 +1886,6 @@ int DoUI() imguiSlider("Collision Distance", &g_params.collisionDistance, 0.0f, 0.5f, 0.001f); imguiSlider("Collision Margin", &g_params.shapeCollisionMargin, 0.0f, 5.0f, 0.01f); - // rigid params - imguiSeparatorLine(); - imguiSlider("Plastic Creep", &g_params.plasticCreep, 0.0f, 1.0f, 0.001f); - imguiSlider("Plastic Threshold", &g_params.plasticThreshold, 0.0f, 0.5f, 0.001f); - // cloth params imguiSeparatorLine(); imguiSlider("Wind", &g_windStrength, -1.0f, 1.0f, 0.01f); @@ -1855,9 +1894,6 @@ int DoUI() imguiSeparatorLine(); // fluid params - if (imguiCheck("Fluid", g_params.fluid)) - g_params.fluid = !g_params.fluid; - imguiSlider("Adhesion", &g_params.adhesion, 0.0f, 10.0f, 0.01f); imguiSlider("Cohesion", &g_params.cohesion, 0.0f, 0.2f, 0.0001f); imguiSlider("Surface Tension", &g_params.surfaceTension, 0.0f, 50.0f, 0.01f); @@ -1891,13 +1927,9 @@ int DoUI() imguiEndFrame(); // kick render commands - imguiGraphDraw(); + DrawImguiGraph(); } - // update benchmark and change scene if one is requested - if (g_benchmark) - newScene = BenchmarkUpdate(); - return newScene; } @@ -2003,6 +2035,11 @@ void UpdateFrame() double waitEndTime = GetSeconds(); + // Getting timers causes CPU/GPU sync, so we do it after a map + float newSimLatency = NvFlexGetDeviceLatency(g_solver, &g_GpuTimers.computeBegin, &g_GpuTimers.computeEnd, &g_GpuTimers.computeFreq); + float newGfxLatency = RendererGetDeviceTimestamps(&g_GpuTimers.renderBegin, &g_GpuTimers.renderEnd,&g_GpuTimers.renderFreq); + (void)newGfxLatency; + UpdateCamera(); if (!g_pause || g_step) @@ -2018,27 +2055,33 @@ void UpdateFrame() double renderBeginTime = GetSeconds(); - if (g_profile && (!g_pause || g_step)) { - if (g_benchmark) { - g_numDetailTimers = NvFlexGetDetailTimers(g_flex, &g_detailTimers); + if (g_profile && (!g_pause || g_step)) + { + if (g_benchmark) + { + g_numDetailTimers = NvFlexGetDetailTimers(g_solver, &g_detailTimers); } - else { + else + { memset(&g_timers, 0, sizeof(g_timers)); - NvFlexGetTimers(g_flex, &g_timers); + NvFlexGetTimers(g_solver, &g_timers); } } - float newSimLatency = NvFlexGetDeviceLatency(g_flex); - StartFrame(Vec4(g_clearColor, 1.0f)); // main scene render RenderScene(); RenderDebug(); + int newScene = DoUI(); + EndFrame(); - const int newScene = DoUI(); + // If user has disabled async compute, ensure that no compute can overlap + // graphics by placing a sync between them + if (!g_useAsyncCompute) + NvFlexComputeWaitForGraphics(g_flexLib); UnmapBuffers(g_buffers); @@ -2074,26 +2117,18 @@ void UpdateFrame() g_resetScene = false; } - // if gui requested a scene change process it now - if (newScene != -1) - { - g_scene = newScene; - Init(g_scene); - return; - } - - - //------------------------------------------------------------------- // Flex Update double updateBeginTime = GetSeconds(); // send any particle updates to the solver - NvFlexSetParticles(g_flex, g_buffers->positions.buffer, g_buffers->positions.size()); - NvFlexSetVelocities(g_flex, g_buffers->velocities.buffer, g_buffers->velocities.size()); - NvFlexSetPhases(g_flex, g_buffers->phases.buffer, g_buffers->phases.size()); - NvFlexSetActive(g_flex, g_buffers->activeIndices.buffer, g_buffers->activeIndices.size()); + NvFlexSetParticles(g_solver, g_buffers->positions.buffer, NULL); + NvFlexSetVelocities(g_solver, g_buffers->velocities.buffer, NULL); + NvFlexSetPhases(g_solver, g_buffers->phases.buffer, NULL); + NvFlexSetActive(g_solver, g_buffers->activeIndices.buffer, NULL); + + NvFlexSetActiveCount(g_solver, g_buffers->activeIndices.size()); // allow scene to update constraints etc SyncScene(); @@ -2101,7 +2136,7 @@ void UpdateFrame() if (g_shapesChanged) { NvFlexSetShapes( - g_flex, + g_solver, g_buffers->shapeGeometry.buffer, g_buffers->shapePositions.buffer, g_buffers->shapeRotations.buffer, @@ -2116,8 +2151,8 @@ void UpdateFrame() if (!g_pause || g_step) { // tick solver - NvFlexSetParams(g_flex, &g_params); - NvFlexUpdateSolver(g_flex, g_dt, g_numSubsteps, g_profile); + NvFlexSetParams(g_solver, &g_params); + NvFlexUpdateSolver(g_solver, g_dt, g_numSubsteps, g_profile); g_frame++; g_step = false; @@ -2128,36 +2163,42 @@ void UpdateFrame() // to be executed later. // When we're ready to read the fetched buffers we'll Map them, and that's when // the CPU will wait for the GPU flex update and GPU copy to finish. - NvFlexGetParticles(g_flex, g_buffers->positions.buffer, g_buffers->positions.size()); - NvFlexGetVelocities(g_flex, g_buffers->velocities.buffer, g_buffers->velocities.size()); - NvFlexGetNormals(g_flex, g_buffers->normals.buffer, g_buffers->normals.size()); + NvFlexGetParticles(g_solver, g_buffers->positions.buffer, NULL); + NvFlexGetVelocities(g_solver, g_buffers->velocities.buffer, NULL); + NvFlexGetNormals(g_solver, g_buffers->normals.buffer, NULL); // readback triangle normals if (g_buffers->triangles.size()) - NvFlexGetDynamicTriangles(g_flex, g_buffers->triangles.buffer, g_buffers->triangleNormals.buffer, g_buffers->triangles.size() / 3); + NvFlexGetDynamicTriangles(g_solver, g_buffers->triangles.buffer, g_buffers->triangleNormals.buffer, g_buffers->triangles.size() / 3); // readback rigid transforms if (g_buffers->rigidOffsets.size()) - NvFlexGetRigidTransforms(g_flex, g_buffers->rigidRotations.buffer, g_buffers->rigidTranslations.buffer); + NvFlexGetRigids(g_solver, NULL, NULL, NULL, NULL, NULL, NULL, NULL, g_buffers->rigidRotations.buffer, g_buffers->rigidTranslations.buffer); if (!g_interop) { // if not using interop then we read back fluid data to host if (g_drawEllipsoids) { - NvFlexGetSmoothParticles(g_flex, g_buffers->smoothPositions.buffer, g_buffers->smoothPositions.size()); - NvFlexGetAnisotropy(g_flex, g_buffers->anisotropy1.buffer, g_buffers->anisotropy2.buffer, g_buffers->anisotropy3.buffer); + NvFlexGetSmoothParticles(g_solver, g_buffers->smoothPositions.buffer, NULL); + NvFlexGetAnisotropy(g_solver, g_buffers->anisotropy1.buffer, g_buffers->anisotropy2.buffer, g_buffers->anisotropy3.buffer, NULL); } // read back diffuse data to host if (g_drawDensity) - NvFlexGetDensities(g_flex, g_buffers->densities.buffer, g_buffers->positions.size()); + NvFlexGetDensities(g_solver, g_buffers->densities.buffer, NULL); - if (g_diffuseRenderBuffers.mNumDiffuseParticles) + if (GetNumDiffuseRenderParticles(g_diffuseRenderBuffers)) { - NvFlexGetDiffuseParticles(g_flex, g_buffers->diffusePositions.buffer, g_buffers->diffuseVelocities.buffer, g_buffers->diffuseIndices.buffer); + NvFlexGetDiffuseParticles(g_solver, g_buffers->diffusePositions.buffer, g_buffers->diffuseVelocities.buffer, g_buffers->diffuseCount.buffer); } } + else + { + // read back just the new diffuse particle count, render buffers will be updated during rendering + NvFlexGetDiffuseParticles(g_solver, NULL, NULL, g_buffers->diffuseCount.buffer); + } + double updateEndTime = GetSeconds(); @@ -2176,6 +2217,15 @@ void UpdateFrame() g_waitTime = (g_waitTime == 0.0f) ? newWaitTime : Lerp(g_waitTime, newWaitTime, timerSmoothing); g_simLatency = (g_simLatency == 0.0f) ? newSimLatency : Lerp(g_simLatency, newSimLatency, timerSmoothing); + if(g_benchmark) newScene = BenchmarkUpdate(); + + // if gui or benchmark requested a scene change process it now + if (newScene != -1) + { + g_scene = newScene; + Init(g_scene); + } + PresentFrame(g_vsync); } @@ -2548,10 +2598,10 @@ void MouseMotionFunc(unsigned state, int x, int y) bool g_Error = false; -void ErrorCallback(NvFlexErrorSeverity, const char* msg, const char* file, int line) +void ErrorCallback(NvFlexErrorSeverity severity, const char* msg, const char* file, int line) { printf("Flex: %s - %s:%d\n", msg, file, line); - g_Error = true; + g_Error = (severity == eNvFlexLogError); //assert(0); asserts are bad for TeamCity } @@ -2606,9 +2656,14 @@ void SDLInit(const char* title) if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) < 0) // Initialize SDL's Video subsystem and game controllers printf("Unable to initialize SDL"); - // Create our window centered +#if FLEX_DX + unsigned int flags = SDL_WINDOW_RESIZABLE; +#else + unsigned int flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL; +#endif + g_window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - g_screenWidth, g_screenHeight, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); + g_screenWidth, g_screenHeight, flags); g_windowId = SDL_GetWindowID(g_window); } @@ -2692,17 +2747,32 @@ int main(int argc, char* argv[]) if (sscanf(argv[i], "-extensions=%d", &d)) g_extensions = d != 0; - if (strstr(argv[i], "-benchmark")) + if (strcmp(argv[i], "-benchmark") == 0) { g_benchmark = true; g_profile = true; + g_outputAllFrameTimes = false; + g_vsync = false; + g_fullscreen = true; } - if (strstr(argv[i], "-d3d12")) + if (strcmp(argv[i], "-d3d12") == 0) + { g_d3d12 = true; + // Currently interop doesn't work on d3d12 + g_interop = false; + } + + if (strcmp(argv[i], "-benchmarkAllFrameTimes") == 0) + { + g_benchmark = true; + g_outputAllFrameTimes = true; + } - if (strstr(argv[i], "-tc")) + if (strcmp(argv[i], "-tc") == 0) + { g_teamCity = true; + } if (sscanf(argv[i], "-msaa=%d", &d)) g_msaaSamples = d; @@ -2715,13 +2785,26 @@ int main(int argc, char* argv[]) g_screenHeight = h; g_fullscreen = true; } - else if (strstr(argv[i], "-fullscreen")) + else if (strcmp(argv[i], "-fullscreen") == 0) { g_screenWidth = w; g_screenHeight = h; g_fullscreen = true; } + if (sscanf(argv[i], "-windowed=%dx%d", &w, &h) == 2) + { + g_screenWidth = w; + g_screenHeight = h; + g_fullscreen = false; + } + else if (strstr(argv[i], "-windowed")) + { + g_screenWidth = w; + g_screenHeight = h; + g_fullscreen = false; + } + if (sscanf(argv[i], "-vsync=%d", &d)) g_vsync = d != 0; @@ -2730,100 +2813,174 @@ int main(int argc, char* argv[]) g_numExtraMultiplier = d; } - if (strstr(argv[i], "-disabletweak")) + if (strcmp(argv[i], "-disabletweak") == 0) { g_tweakPanel = false; } - if (strstr(argv[i], "-disableinterop")) + if (strcmp(argv[i], "-disableinterop") == 0) { g_interop = false; } + if (sscanf(argv[i], "-asynccompute=%d", &d) == 1) + { + g_useAsyncCompute = (d != 0); + } } // opening scene g_scenes.push_back(new PotPourri("Pot Pourri")); - // soft body scenes - SoftBody* softOctopus = new SoftBody("Soft Octopus", "../../data/softs/octopus.obj"); - softOctopus->mScale = Vec3(32.0f); - softOctopus->mClusterSpacing = 2.75f; - softOctopus->mClusterRadius = 3.0f; - softOctopus->mClusterStiffness = 0.15f; - softOctopus->mSurfaceSampling = 1.0f; - softOctopus->mStack[1] = 3; - - SoftBody* softRope = new SoftBody("Soft Rope", "../../data/rope.obj"); - softRope->mScale = Vec3(50.0f); - softRope->mClusterSpacing = 1.5f; - softRope->mClusterRadius = 0.0f; - softRope->mClusterStiffness = 0.55f; - - SoftBody* softBowl = new SoftBody("Soft Bowl", "../../data/bowl_high.ply"); - softBowl->mScale = Vec3(10.0f); - softBowl->mClusterSpacing = 2.0f; - softBowl->mClusterRadius = 2.0f; - softBowl->mClusterStiffness = 0.55f; - - SoftBody* softCloth = new SoftBody("Soft Cloth", "../../data/box_ultra_high.ply"); - softCloth->mScale = Vec3(20.0f, 0.2f, 20.0f); - softCloth->mRadius = 0.05f; - softCloth->mClusterSpacing = 1.0f; - softCloth->mClusterRadius = 2.0f; - softCloth->mClusterStiffness = 0.2f; - softCloth->mLinkRadius = 2.0f; - softCloth->mLinkStiffness = 1.0f; - softCloth->mSkinningFalloff = 1.0f; - softCloth->mSkinningMaxDistance = 100.f; - - SoftBodyFixed* softRod = new SoftBodyFixed("Soft Rod", "../../data/box_very_high.ply"); - softRod->mScale = Vec3(20.0f, 2.0f, 2.0f); - softRod->mOffset = Vec3(-0.3f, 1.0f, 0.0f); - softRod->mClusterSpacing = 2.0f; - softRod->mClusterRadius = 2.0f; - softRod->mClusterStiffness = 0.225f; - softRod->mStack[2] = 3; - - SoftBody* softTeapot = new SoftBody("Soft Teapot", "../../data/teapot.ply"); - softTeapot->mScale = Vec3(25.0f); - softTeapot->mClusterSpacing = 3.0f; - softTeapot->mClusterRadius = 0.0f; - softTeapot->mClusterStiffness = 0.1f; - - SoftBody* softArmadillo = new SoftBody("Soft Armadillo", "../../data/armadillo.ply"); - softArmadillo->mScale = Vec3(25.0f); - softArmadillo->mClusterSpacing = 3.0f; - softArmadillo->mClusterRadius = 0.0f; - - SoftBody* softBunny = new SoftBody("Soft Bunny", "../../data/bunny.ply"); - softBunny->mScale = Vec3(20.0f); - softBunny->mClusterSpacing = 3.5f; - softBunny->mClusterRadius = 0.0f; - softBunny->mClusterStiffness = 0.2f; - - SoftBody* plasticBunnies = new SoftBody("Plastic Bunnies", "../../data/bunny.ply"); - plasticBunnies->mScale = Vec3(10.0f); - plasticBunnies->mClusterSpacing = 1.0f; - plasticBunnies->mClusterRadius = 0.0f; - plasticBunnies->mClusterStiffness = 0.0f; - plasticBunnies->mGlobalStiffness = 1.0f; - plasticBunnies->mPlasticThreshold = 0.0015f; - plasticBunnies->mPlasticCreep = 0.15f; - plasticBunnies->mRelaxationFactor = 1.0f; - plasticBunnies->mOffset[1] = 5.0f; - plasticBunnies->mStack[1] = 10; - plasticBunnies->mPlinth = true; - - g_scenes.push_back(softOctopus); - g_scenes.push_back(softTeapot); - g_scenes.push_back(softRope); - g_scenes.push_back(softCloth); - g_scenes.push_back(softBowl); - g_scenes.push_back(softRod); - g_scenes.push_back(softArmadillo); - g_scenes.push_back(softBunny); - g_scenes.push_back(plasticBunnies); + SoftBody::Instance octopus("../../data/softs/octopus.obj"); + octopus.mScale = Vec3(32.0f); + octopus.mClusterSpacing = 2.75f; + octopus.mClusterRadius = 3.0f; + octopus.mClusterStiffness = 0.15f; + octopus.mSurfaceSampling = 1.0f; + SoftBody* softOctopusSceneNew = new SoftBody("Soft Octopus"); + softOctopusSceneNew->AddStack(octopus, 1, 3, 1); + + SoftBody::Instance rope("../../data/rope.obj"); + rope.mScale = Vec3(50.0f); + rope.mClusterSpacing = 1.5f; + rope.mClusterRadius = 0.0f; + rope.mClusterStiffness = 0.55f; + SoftBody* softRopeSceneNew = new SoftBody("Soft Rope"); + softRopeSceneNew->AddInstance(rope); + + SoftBody::Instance bowl("../../data/bowl_high.ply"); + bowl.mScale = Vec3(10.0f); + bowl.mClusterSpacing = 2.0f; + bowl.mClusterRadius = 2.0f; + bowl.mClusterStiffness = 0.55f; + SoftBody* softBowlSceneNew = new SoftBody("Soft Bowl"); + softBowlSceneNew->AddInstance(bowl); + + SoftBody::Instance cloth("../../data/box_ultra_high.ply"); + cloth.mScale = Vec3(20.0f, 0.2f, 20.0f); + cloth.mClusterSpacing = 1.0f; + cloth.mClusterRadius = 2.0f; + cloth.mClusterStiffness = 0.2f; + cloth.mLinkRadius = 2.0f; + cloth.mLinkStiffness = 1.0f; + cloth.mSkinningFalloff = 1.0f; + cloth.mSkinningMaxDistance = 100.f; + SoftBody* softClothSceneNew = new SoftBody("Soft Cloth"); + softClothSceneNew->mRadius = 0.05f; + softClothSceneNew->AddInstance(cloth); + + SoftBody::Instance rod("../../data/box_very_high.ply"); + rod.mScale = Vec3(20.0f, 2.0f, 2.0f); + rod.mTranslation = Vec3(-0.3f, 1.0f, 0.0f); + rod.mClusterSpacing = 2.0f; + rod.mClusterRadius = 2.0f; + rod.mClusterStiffness = 0.225f; + SoftBodyFixed* softRodSceneNew = new SoftBodyFixed("Soft Rod"); + softRodSceneNew->AddStack(rod, 3); + + SoftBody::Instance teapot("../../data/teapot.ply"); + teapot.mScale = Vec3(25.0f); + teapot.mClusterSpacing = 3.0f; + teapot.mClusterRadius = 0.0f; + teapot.mClusterStiffness = 0.1f; + SoftBody* softTeapotSceneNew = new SoftBody("Soft Teapot"); + softTeapotSceneNew->AddInstance(teapot); + + SoftBody::Instance armadillo("../../data/armadillo.ply"); + armadillo.mScale = Vec3(25.0f); + armadillo.mClusterSpacing = 3.0f; + armadillo.mClusterRadius = 0.0f; + SoftBody* softArmadilloSceneNew = new SoftBody("Soft Armadillo"); + softArmadilloSceneNew->AddInstance(armadillo); + + SoftBody::Instance softbunny("../../data/bunny.ply"); + softbunny.mScale = Vec3(20.0f); + softbunny.mClusterSpacing = 3.5f; + softbunny.mClusterRadius = 0.0f; + softbunny.mClusterStiffness = 0.2f; + SoftBody* softBunnySceneNew = new SoftBody("Soft Bunny"); + softBunnySceneNew->AddInstance(softbunny); + + // plastic scenes + SoftBody::Instance plasticbunny("../../data/bunny.ply"); + plasticbunny.mScale = Vec3(10.0f); + plasticbunny.mClusterSpacing = 1.0f; + plasticbunny.mClusterRadius = 0.0f; + plasticbunny.mClusterStiffness = 0.0f; + plasticbunny.mGlobalStiffness = 1.0f; + plasticbunny.mClusterPlasticThreshold = 0.0015f; + plasticbunny.mClusterPlasticCreep = 0.15f; + plasticbunny.mTranslation[1] = 5.0f; + SoftBody* plasticBunniesSceneNew = new SoftBody("Plastic Bunnies"); + plasticBunniesSceneNew->mPlinth = true; + plasticBunniesSceneNew->AddStack(plasticbunny, 1, 10, 1, true); + + SoftBody::Instance bunny1("../../data/bunny.ply"); + bunny1.mScale = Vec3(10.0f); + bunny1.mClusterSpacing = 1.0f; + bunny1.mClusterRadius = 0.0f; + bunny1.mClusterStiffness = 0.0f; + bunny1.mGlobalStiffness = 1.0f; + bunny1.mClusterPlasticThreshold = 0.0015f; + bunny1.mClusterPlasticCreep = 0.15f; + bunny1.mTranslation[1] = 5.0f; + SoftBody::Instance bunny2("../../data/bunny.ply"); + bunny2.mScale = Vec3(10.0f); + bunny2.mClusterSpacing = 1.0f; + bunny2.mClusterRadius = 0.0f; + bunny2.mClusterStiffness = 0.0f; + bunny2.mGlobalStiffness = 1.0f; + bunny2.mClusterPlasticThreshold = 0.0015f; + bunny2.mClusterPlasticCreep = 0.30f; + bunny2.mTranslation[1] = 5.0f; + bunny2.mTranslation[0] = 2.0f; + SoftBody* plasticComparisonScene = new SoftBody("Plastic Comparison"); + plasticComparisonScene->AddInstance(bunny1); + plasticComparisonScene->AddInstance(bunny2); + plasticComparisonScene->mPlinth = true; + + SoftBody::Instance stackBox("../../data/box_high.ply"); + stackBox.mScale = Vec3(10.0f); + stackBox.mClusterSpacing = 1.5f; + stackBox.mClusterRadius = 0.0f; + stackBox.mClusterStiffness = 0.0f; + stackBox.mGlobalStiffness = 1.0f; + stackBox.mClusterPlasticThreshold = 0.0015f; + stackBox.mClusterPlasticCreep = 0.25f; + stackBox.mTranslation[1] = 1.0f; + SoftBody::Instance stackSphere("../../data/sphere.ply"); + stackSphere.mScale = Vec3(10.0f); + stackSphere.mClusterSpacing = 1.5f; + stackSphere.mClusterRadius = 0.0f; + stackSphere.mClusterStiffness = 0.0f; + stackSphere.mGlobalStiffness = 1.0f; + stackSphere.mClusterPlasticThreshold = 0.0015f; + stackSphere.mClusterPlasticCreep = 0.25f; + stackSphere.mTranslation[1] = 2.0f; + SoftBody* plasticStackScene = new SoftBody("Plastic Stack"); + plasticStackScene->AddInstance(stackBox); + plasticStackScene->AddInstance(stackSphere); + for (int i = 0; i < 3; i++) { + stackBox.mTranslation[1] += 2.0f; + stackSphere.mTranslation[1] += 2.0f; + plasticStackScene->AddInstance(stackBox); + plasticStackScene->AddInstance(stackSphere); + } + + + g_scenes.push_back(softOctopusSceneNew); + g_scenes.push_back(softTeapotSceneNew); + g_scenes.push_back(softRopeSceneNew); + g_scenes.push_back(softClothSceneNew); + g_scenes.push_back(softBowlSceneNew); + g_scenes.push_back(softRodSceneNew); + g_scenes.push_back(softArmadilloSceneNew); + g_scenes.push_back(softBunnySceneNew); + + g_scenes.push_back(plasticBunniesSceneNew); + g_scenes.push_back(plasticComparisonScene); + g_scenes.push_back(plasticStackScene); // collision scenes @@ -2832,6 +2989,7 @@ int main(int argc, char* argv[]) g_scenes.push_back(new FrictionMovingShape("Friction Moving Sphere", 1)); g_scenes.push_back(new FrictionMovingShape("Friction Moving Capsule", 2)); g_scenes.push_back(new ShapeCollision("Shape Collision")); + g_scenes.push_back(new ShapeChannels("Shape Channels")); g_scenes.push_back(new TriangleCollision("Triangle Collision")); g_scenes.push_back(new LocalSpaceFluid("Local Space Fluid")); g_scenes.push_back(new LocalSpaceCloth("Local Space Cloth")); @@ -2886,7 +3044,6 @@ int main(int argc, char* argv[]) g_scenes.push_back(new RigidPile("Rigid8", 12)); g_scenes.push_back(new BananaPile("Bananas")); g_scenes.push_back(new LowDimensionalShapes("Low Dimensional Shapes")); - g_scenes.push_back(new PlasticStack("Plastic Stack")); // granular scenes g_scenes.push_back(new GranularPile("Granular Pile")); @@ -2911,7 +3068,34 @@ int main(int argc, char* argv[]) SDLInit(title); - InitRender(g_window, g_fullscreen, g_msaaSamples); + RenderInitOptions options; + options.window = g_window; + options.numMsaaSamples = g_msaaSamples; + options.asyncComputeBenchmark = g_asyncComputeBenchmark; + options.defaultFontHeight = -1; + options.fullscreen = g_fullscreen; + +#if FLEX_DX + { + DemoContext* demoContext = nullptr; + + if (g_d3d12) + { + // workaround for a driver issue with D3D12 with msaa, force it to off + options.numMsaaSamples = 1; + + demoContext = CreateDemoContextD3D12(); + } + else + { + demoContext = CreateDemoContextD3D11(); + } + // Set the demo context + SetDemoContext(demoContext); + } +#endif + + InitRender(options); if (g_fullscreen) SDL_SetWindowFullscreen(g_window, SDL_WINDOW_FULLSCREEN_DESKTOP); @@ -2922,16 +3106,16 @@ int main(int argc, char* argv[]) #if !FLEX_DX - // use the PhysX GPU selected from the NVIDIA control panel + // use the PhysX GPU selected from the NVIDIA control panel if (g_device == -1) g_device = NvFlexDeviceGetSuggestedOrdinal(); - + // Create an optimized CUDA context for Flex and set it on the // calling thread. This is an optional call, it is fine to use // a regular CUDA context, although creating one through this API // is recommended for best performance. bool success = NvFlexDeviceCreateCudaContext(g_device); - + if (!success) { printf("Error creating CUDA context.\n"); @@ -2945,6 +3129,7 @@ int main(int argc, char* argv[]) desc.enableExtensions = g_extensions; desc.renderDevice = 0; desc.renderContext = 0; + desc.computeContext = 0; desc.computeType = eNvFlexCUDA; #if FLEX_DX @@ -2954,18 +3139,36 @@ int main(int argc, char* argv[]) else desc.computeType = eNvFlexD3D11; - if (g_device == -1 && !g_d3d12) + bool userSpecifiedGpuToUseForFlex = (g_device != -1); + + if (userSpecifiedGpuToUseForFlex) { - // use the renderer device - GetRenderDevice((ID3D11Device**)&desc.renderDevice, - (ID3D11DeviceContext**)&desc.renderContext); - } + // Flex doesn't currently support interop between different D3DDevices. + // If the user specifies which physical device to use, then Flex always + // creates its own D3DDevice, even if graphics is on the same physical device. + // So specified physical device always means no interop. + g_interop = false; + } else { - // disable shared resources - g_interop = false; + // Ask Flex to run on the same GPU as rendering + GetRenderDevice(&desc.renderDevice, + &desc.renderContext); } + // Shared resources are unimplemented on D3D12, + // so disable it for now. + if (g_d3d12) + g_interop = false; + + // Setting runOnRenderContext = true doesn't prevent async compute, it just + // makes Flex send compute and graphics to the GPU on the same queue. + // + // So to allow the user to toggle async compute, we set runOnRenderContext = false + // and provide a toggleable sync between compute and graphics in the app. + // + // Search for g_useAsyncCompute for details + desc.runOnRenderContext = false; #endif // Init Flex library, note that no CUDA methods should be called before this @@ -2983,14 +3186,15 @@ int main(int argc, char* argv[]) printf("Compute Device: %s\n\n", g_deviceName); if (g_benchmark) - BenchmarkInit(); - + g_scene = BenchmarkInit(); // create shadow maps g_shadowMap = ShadowCreate(); // init default scene + StartGpuWork(); Init(g_scene); + EndGpuWork(); SDLMainLoop(); @@ -3001,9 +3205,9 @@ int main(int argc, char* argv[]) DestroyDiffuseRenderBuffers(g_diffuseRenderBuffers); ShadowDestroy(g_shadowMap); - DestroyRender(); - + Shutdown(); + DestroyRender(); SDL_DestroyWindow(g_window); SDL_Quit(); diff --git a/demo/opengl/shadersGL.cpp b/demo/opengl/shadersGL.cpp index b4023db..1005be2 100644 --- a/demo/opengl/shadersGL.cpp +++ b/demo/opengl/shadersGL.cpp @@ -46,6 +46,93 @@ #define CudaCheck(x) { cudaError_t err = x; if (err != cudaSuccess) { printf("Cuda error: %d in %s at %s:%d\n", err, #x, __FILE__, __LINE__); assert(0); } } +typedef unsigned int VertexBuffer; +typedef unsigned int IndexBuffer; +typedef unsigned int Texture; + +struct FluidRenderBuffersGL +{ + FluidRenderBuffersGL(int numParticles = 0): + mPositionVBO(0), + mDensityVBO(0), + mIndices(0), + mPositionBuf(nullptr), + mDensitiesBuf(nullptr), + mIndicesBuf(nullptr) + { + mNumParticles = numParticles; + for (int i = 0; i < 3; i++) + { + mAnisotropyVBO[i] = 0; + mAnisotropyBuf[i] = nullptr; + } + } + ~FluidRenderBuffersGL() + { + glDeleteBuffers(1, &mPositionVBO); + glDeleteBuffers(3, mAnisotropyVBO); + glDeleteBuffers(1, &mDensityVBO); + glDeleteBuffers(1, &mIndices); + + NvFlexUnregisterOGLBuffer(mPositionBuf); + NvFlexUnregisterOGLBuffer(mDensitiesBuf); + NvFlexUnregisterOGLBuffer(mIndicesBuf); + + NvFlexUnregisterOGLBuffer(mAnisotropyBuf[0]); + NvFlexUnregisterOGLBuffer(mAnisotropyBuf[1]); + NvFlexUnregisterOGLBuffer(mAnisotropyBuf[2]); + } + + int mNumParticles; + VertexBuffer mPositionVBO; + VertexBuffer mDensityVBO; + VertexBuffer mAnisotropyVBO[3]; + IndexBuffer mIndices; + + // wrapper buffers that allow Flex to write directly to VBOs + NvFlexBuffer* mPositionBuf; + NvFlexBuffer* mDensitiesBuf; + NvFlexBuffer* mAnisotropyBuf[3]; + NvFlexBuffer* mIndicesBuf; +}; + +// vertex buffers for diffuse particles +struct DiffuseRenderBuffersGL +{ + DiffuseRenderBuffersGL(int numParticles = 0): + mDiffusePositionVBO(0), + mDiffuseVelocityVBO(0), + mDiffuseIndicesIBO(0), + mDiffuseIndicesBuf(nullptr), + mDiffusePositionsBuf(nullptr), + mDiffuseVelocitiesBuf(nullptr) + { + mNumParticles = numParticles; + } + ~DiffuseRenderBuffersGL() + { + if (mNumParticles > 0) + { + glDeleteBuffers(1, &mDiffusePositionVBO); + glDeleteBuffers(1, &mDiffuseVelocityVBO); + glDeleteBuffers(1, &mDiffuseIndicesIBO); + + NvFlexUnregisterOGLBuffer(mDiffuseIndicesBuf); + NvFlexUnregisterOGLBuffer(mDiffusePositionsBuf); + NvFlexUnregisterOGLBuffer(mDiffuseVelocitiesBuf); + } + } + + int mNumParticles; + VertexBuffer mDiffusePositionVBO; + VertexBuffer mDiffuseVelocityVBO; + IndexBuffer mDiffuseIndicesIBO; + + NvFlexBuffer* mDiffuseIndicesBuf; + NvFlexBuffer* mDiffusePositionsBuf; + NvFlexBuffer* mDiffuseVelocitiesBuf; +}; + namespace { @@ -59,24 +146,13 @@ int g_screenHeight; SDL_Window* g_window; -static float gSpotMin = 0.5f; -static float gSpotMax = 1.0f; -float gShadowBias = 0.05f; +static float g_spotMin = 0.5f; +static float g_spotMax = 1.0f; +float g_shadowBias = 0.05f; } // anonymous namespace -Colour gColors[] = -{ - Colour(0.0f, 0.5f, 1.0f), - Colour(0.797f, 0.354f, 0.000f), - Colour(0.092f, 0.465f, 0.820f), - Colour(0.000f, 0.349f, 0.173f), - Colour(0.875f, 0.782f, 0.051f), - Colour(0.000f, 0.170f, 0.453f), - Colour(0.673f, 0.111f, 0.000f), - Colour(0.612f, 0.194f, 0.394f) -}; - +extern Colour g_colors[]; struct ShadowMap { @@ -85,8 +161,11 @@ struct ShadowMap }; -void InitRender(SDL_Window* window, bool fullscreen, int msaaSamples) +void InitRender(const RenderInitOptions& options) { + SDL_Window* window = options.window; + int msaaSamples = options.numMsaaSamples; + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); @@ -625,7 +704,7 @@ void ShadowApply(GLint sprogram, Vec3 lightPos, Vec3 lightTarget, Matrix44 light glUniform3fv(uLightDir, 1, Normalize(lightTarget-lightPos)); GLint uBias = glGetUniformLocation(sprogram, "bias"); - glUniform1f(uBias, gShadowBias); + glUniform1f(uBias, g_shadowBias); const Vec2 taps[] = { @@ -646,8 +725,13 @@ void ShadowApply(GLint sprogram, Vec3 lightPos, Vec3 lightTarget, Matrix44 light } -void DrawPoints(GLuint positions, GLuint colors, GLuint indices, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, bool showDensity) +void DrawPoints(FluidRenderBuffers* buffersIn, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, bool showDensity) { + FluidRenderBuffersGL* buffers = reinterpret_cast<FluidRenderBuffersGL*>(buffersIn); + GLuint positions = buffers->mPositionVBO; + GLuint colors = buffers->mDensityVBO; + GLuint indices = buffers->mIndices; + static int sprogram = -1; if (sprogram == -1) { @@ -671,10 +755,10 @@ void DrawPoints(GLuint positions, GLuint colors, GLuint indices, int n, int offs glVerify(glUseProgram(sprogram)); glVerify(glUniform1f( glGetUniformLocation(sprogram, "pointRadius"), radius)); glVerify(glUniform1f( glGetUniformLocation(sprogram, "pointScale"), screenWidth/screenAspect * (1.0f / (tanf(fov*0.5f))))); - glVerify(glUniform1f( glGetUniformLocation(sprogram, "spotMin"), gSpotMin)); - glVerify(glUniform1f( glGetUniformLocation(sprogram, "spotMax"), gSpotMax)); + glVerify(glUniform1f( glGetUniformLocation(sprogram, "spotMin"), g_spotMin)); + glVerify(glUniform1f( glGetUniformLocation(sprogram, "spotMax"), g_spotMax)); glVerify(glUniform1i( glGetUniformLocation(sprogram, "mode"), mode)); - glVerify(glUniform4fv( glGetUniformLocation(sprogram, "colors"), 8, (float*)&gColors[0].r)); + glVerify(glUniform4fv( glGetUniformLocation(sprogram, "colors"), 8, (float*)&g_colors[0].r)); // set shadow parameters ShadowApply(sprogram, lightPos, lightTarget, lightTransform, shadowMap->texture); @@ -817,8 +901,8 @@ void BindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, S glVerify(glUseProgram(s_diffuseProgram)); glVerify(glUniform1i(glGetUniformLocation(s_diffuseProgram, "grid"), 0)); - glVerify(glUniform1f( glGetUniformLocation(s_diffuseProgram, "spotMin"), gSpotMin)); - glVerify(glUniform1f( glGetUniformLocation(s_diffuseProgram, "spotMax"), gSpotMax)); + glVerify(glUniform1f( glGetUniformLocation(s_diffuseProgram, "spotMin"), g_spotMin)); + glVerify(glUniform1f( glGetUniformLocation(s_diffuseProgram, "spotMax"), g_spotMax)); glVerify(glUniform4fv( glGetUniformLocation(s_diffuseProgram, "fogColor"), 1, fogColor)); glVerify(glUniformMatrix4fv( glGetUniformLocation(s_diffuseProgram, "objectTransform"), 1, false, Matrix44::kIdentity)); @@ -858,7 +942,7 @@ void DrawPlanes(Vec4* planes, int n, float bias) } glVerify(glUniform1i(uGrid, 0)); - glVerify(glUniform1f(uBias, gShadowBias)); + glVerify(glUniform1f(uBias, g_shadowBias)); } void DrawMesh(const Mesh* m, Vec3 color) @@ -915,8 +999,8 @@ void DrawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, con } #endif - glColor3fv(gColors[colorIndex+1]*1.5f); - glSecondaryColor3fv(gColors[colorIndex]*1.5f); + glColor3fv(g_colors[colorIndex+1]*1.5f); + glSecondaryColor3fv(g_colors[colorIndex]*1.5f); glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0)); glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); @@ -939,7 +1023,7 @@ void DrawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, con if (program == GLint(s_diffuseProgram)) { GLint uBias = glGetUniformLocation(s_diffuseProgram, "bias"); - glUniform1f(uBias, gShadowBias); + glUniform1f(uBias, g_shadowBias); GLint uExpand = glGetUniformLocation(s_diffuseProgram, "expand"); glUniform1f(uExpand, 0.0f); @@ -971,8 +1055,8 @@ void DrawRope(Vec4* positions, int* indices, int numIndices, float radius, int c Extrude(&curve[0], int(curve.size()), vertices, normals, triangles, radius, resolution, smoothing); glVerify(glDisable(GL_CULL_FACE)); - glVerify(glColor3fv(gColors[color%8]*1.5f)); - glVerify(glSecondaryColor3fv(gColors[color%8]*1.5f)); + glVerify(glColor3fv(g_colors[color%8]*1.5f)); + glVerify(glSecondaryColor3fv(g_colors[color%8]*1.5f)); glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0)); @@ -1807,206 +1891,185 @@ void DestroyFluidRenderer(FluidRenderer* renderer) glVerify(glDeleteTextures(1, &renderer->mThicknessTex)); } -FluidRenderBuffers CreateFluidRenderBuffers(int numFluidParticles, bool enableInterop) +FluidRenderBuffers* CreateFluidRenderBuffers(int numFluidParticles, bool enableInterop) { - FluidRenderBuffers buffers = {}; - buffers.mNumFluidParticles = numFluidParticles; - + FluidRenderBuffersGL* buffers = new FluidRenderBuffersGL(numFluidParticles); + // vbos - glVerify(glGenBuffers(1, &buffers.mPositionVBO)); - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mPositionVBO)); + glVerify(glGenBuffers(1, &buffers->mPositionVBO)); + glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers->mPositionVBO)); glVerify(glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 4 * numFluidParticles, 0, GL_DYNAMIC_DRAW)); // density - glVerify(glGenBuffers(1, &buffers.mDensityVBO)); - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDensityVBO)); + glVerify(glGenBuffers(1, &buffers->mDensityVBO)); + glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers->mDensityVBO)); glVerify(glBufferData(GL_ARRAY_BUFFER, sizeof(int)*numFluidParticles, 0, GL_DYNAMIC_DRAW)); for (int i = 0; i < 3; ++i) { - glVerify(glGenBuffers(1, &buffers.mAnisotropyVBO[i])); - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[i])); + glVerify(glGenBuffers(1, &buffers->mAnisotropyVBO[i])); + glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers->mAnisotropyVBO[i])); glVerify(glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 4 * numFluidParticles, 0, GL_DYNAMIC_DRAW)); } - glVerify(glGenBuffers(1, &buffers.mIndices)); - glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers.mIndices)); + glVerify(glGenBuffers(1, &buffers->mIndices)); + glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers->mIndices)); glVerify(glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(int)*numFluidParticles, 0, GL_DYNAMIC_DRAW)); if (enableInterop) { extern NvFlexLibrary* g_flexLib; - buffers.mPositionBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mPositionVBO, numFluidParticles, sizeof(Vec4)); - buffers.mDensitiesBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mDensityVBO, numFluidParticles, sizeof(float)); - buffers.mIndicesBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mIndices, numFluidParticles, sizeof(int)); + buffers->mPositionBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers->mPositionVBO, numFluidParticles, sizeof(Vec4)); + buffers->mDensitiesBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers->mDensityVBO, numFluidParticles, sizeof(float)); + buffers->mIndicesBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers->mIndices, numFluidParticles, sizeof(int)); - buffers.mAnisotropyBuf[0] = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mAnisotropyVBO[0], numFluidParticles, sizeof(Vec4)); - buffers.mAnisotropyBuf[1] = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mAnisotropyVBO[1], numFluidParticles, sizeof(Vec4)); - buffers.mAnisotropyBuf[2] = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mAnisotropyVBO[2], numFluidParticles, sizeof(Vec4)); + buffers->mAnisotropyBuf[0] = NvFlexRegisterOGLBuffer(g_flexLib, buffers->mAnisotropyVBO[0], numFluidParticles, sizeof(Vec4)); + buffers->mAnisotropyBuf[1] = NvFlexRegisterOGLBuffer(g_flexLib, buffers->mAnisotropyVBO[1], numFluidParticles, sizeof(Vec4)); + buffers->mAnisotropyBuf[2] = NvFlexRegisterOGLBuffer(g_flexLib, buffers->mAnisotropyVBO[2], numFluidParticles, sizeof(Vec4)); } - return buffers; + return reinterpret_cast<FluidRenderBuffers*>(buffers); } -void DestroyFluidRenderBuffers(FluidRenderBuffers buffers) +void DestroyFluidRenderBuffers(FluidRenderBuffers* buffers) { - glDeleteBuffers(1, &buffers.mPositionVBO); - glDeleteBuffers(3, buffers.mAnisotropyVBO); - glDeleteBuffers(1, &buffers.mDensityVBO); - glDeleteBuffers(1, &buffers.mIndices); - - NvFlexUnregisterOGLBuffer(buffers.mPositionBuf); - NvFlexUnregisterOGLBuffer(buffers.mDensitiesBuf); - NvFlexUnregisterOGLBuffer(buffers.mIndicesBuf); - - NvFlexUnregisterOGLBuffer(buffers.mAnisotropyBuf[0]); - NvFlexUnregisterOGLBuffer(buffers.mAnisotropyBuf[1]); - NvFlexUnregisterOGLBuffer(buffers.mAnisotropyBuf[2]); + delete reinterpret_cast<FluidRenderBuffersGL*>(buffers); } -void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, NvFlexSolver* solver, bool anisotropy, bool density) +void UpdateFluidRenderBuffers(FluidRenderBuffers* buffersIn, NvFlexSolver* solver, bool anisotropy, bool density) { + FluidRenderBuffersGL* buffers = reinterpret_cast<FluidRenderBuffersGL*>(buffersIn); // use VBO buffer wrappers to allow Flex to write directly to the OpenGL buffers // Flex will take care of any CUDA interop mapping/unmapping during the get() operations if (!anisotropy) { // regular particles - NvFlexGetParticles(solver, buffers.mPositionBuf, buffers.mNumFluidParticles); + NvFlexGetParticles(solver, buffers->mPositionBuf, NULL); } else { // fluid buffers - NvFlexGetSmoothParticles(solver, buffers.mPositionBuf, buffers.mNumFluidParticles); - NvFlexGetAnisotropy(solver, buffers.mAnisotropyBuf[0], buffers.mAnisotropyBuf[1], buffers.mAnisotropyBuf[2]); + NvFlexGetSmoothParticles(solver, buffers->mPositionBuf, NULL); + NvFlexGetAnisotropy(solver, buffers->mAnisotropyBuf[0], buffers->mAnisotropyBuf[1], buffers->mAnisotropyBuf[2], NULL); } if (density) { - NvFlexGetDensities(solver, buffers.mDensitiesBuf, buffers.mNumFluidParticles); + NvFlexGetDensities(solver, buffers->mDensitiesBuf, NULL); } else { - NvFlexGetPhases(solver, buffers.mDensitiesBuf, buffers.mNumFluidParticles); + NvFlexGetPhases(solver, buffers->mDensitiesBuf, NULL); } - NvFlexGetActive(solver, buffers.mIndicesBuf); + NvFlexGetActive(solver, buffers->mIndicesBuf, NULL); } -void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices) +void UpdateFluidRenderBuffers(FluidRenderBuffers* buffersIn, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices) { + FluidRenderBuffersGL* buffers = reinterpret_cast<FluidRenderBuffersGL*>(buffersIn); // regular particles - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mPositionVBO)); - glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumFluidParticles*sizeof(Vec4), particles)); + glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers->mPositionVBO)); + glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers->mNumParticles*sizeof(Vec4), particles)); - if (anisotropy1) + Vec4*const anisotropies[] = { - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[0])); - glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumFluidParticles*sizeof(Vec4), anisotropy1)); - } - - if (anisotropy2) - { - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[1])); - glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumFluidParticles*sizeof(Vec4), anisotropy2)); - } + anisotropy1, + anisotropy2, + anisotropy3, + }; - if (anisotropy3) + for (int i = 0; i < 3; i++) { - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[2])); - glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumFluidParticles*sizeof(Vec4), anisotropy3)); + Vec4* anisotropy = anisotropies[i]; + if (anisotropy) + { + glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers->mAnisotropyVBO[i])); + glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers->mNumParticles * sizeof(Vec4), anisotropy)); + } } // density /phase buffer if (densities) { - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDensityVBO)); - glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumFluidParticles*sizeof(float), densities)); + glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers->mDensityVBO)); + glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers->mNumParticles*sizeof(float), densities)); } if (indices) { - glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers.mIndices)); + glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers->mIndices)); glVerify(glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, numIndices*sizeof(int), indices)); } // reset glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0)); - } -DiffuseRenderBuffers CreateDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop) +DiffuseRenderBuffers* CreateDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop) { - DiffuseRenderBuffers buffers = {}; - buffers.mNumDiffuseParticles = numDiffuseParticles; - + DiffuseRenderBuffersGL* buffers = new DiffuseRenderBuffersGL(numDiffuseParticles); + if (numDiffuseParticles > 0) { - glVerify(glGenBuffers(1, &buffers.mDiffusePositionVBO)); - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDiffusePositionVBO)); + glVerify(glGenBuffers(1, &buffers->mDiffusePositionVBO)); + glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers->mDiffusePositionVBO)); glVerify(glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 4 * numDiffuseParticles, 0, GL_DYNAMIC_DRAW)); glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0)); - glVerify(glGenBuffers(1, &buffers.mDiffuseVelocityVBO)); - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDiffuseVelocityVBO)); + glVerify(glGenBuffers(1, &buffers->mDiffuseVelocityVBO)); + glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers->mDiffuseVelocityVBO)); glVerify(glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 4 * numDiffuseParticles, 0, GL_DYNAMIC_DRAW)); glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0)); - glVerify(glGenBuffers(1, &buffers.mDiffuseIndicesIBO)); - glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers.mDiffuseIndicesIBO)); - glVerify(glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(int)*numDiffuseParticles, 0, GL_DYNAMIC_DRAW)); - glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); - if (enableInterop) { extern NvFlexLibrary* g_flexLib; - buffers.mDiffuseIndicesBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mDiffuseIndicesIBO, numDiffuseParticles, sizeof(int)); - buffers.mDiffusePositionsBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mDiffusePositionVBO, numDiffuseParticles, sizeof(Vec4)); - buffers.mDiffuseVelocitiesBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mDiffuseVelocityVBO, numDiffuseParticles, sizeof(Vec4)); + buffers->mDiffusePositionsBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers->mDiffusePositionVBO, numDiffuseParticles, sizeof(Vec4)); + buffers->mDiffuseVelocitiesBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers->mDiffuseVelocityVBO, numDiffuseParticles, sizeof(Vec4)); } } - return buffers; + return reinterpret_cast<DiffuseRenderBuffers*>(buffers); } -void DestroyDiffuseRenderBuffers(DiffuseRenderBuffers buffers) +void DestroyDiffuseRenderBuffers(DiffuseRenderBuffers* buffersIn) { - if (buffers.mNumDiffuseParticles > 0) + DiffuseRenderBuffersGL* buffers = reinterpret_cast<DiffuseRenderBuffersGL*>(buffersIn); + if (buffers->mNumParticles > 0) { - glDeleteBuffers(1, &buffers.mDiffusePositionVBO); - glDeleteBuffers(1, &buffers.mDiffuseVelocityVBO); - glDeleteBuffers(1, &buffers.mDiffuseIndicesIBO); + glDeleteBuffers(1, &buffers->mDiffusePositionVBO); + glDeleteBuffers(1, &buffers->mDiffuseVelocityVBO); - NvFlexUnregisterOGLBuffer(buffers.mDiffuseIndicesBuf); - NvFlexUnregisterOGLBuffer(buffers.mDiffusePositionsBuf); - NvFlexUnregisterOGLBuffer(buffers.mDiffuseVelocitiesBuf); + NvFlexUnregisterOGLBuffer(buffers->mDiffusePositionsBuf); + NvFlexUnregisterOGLBuffer(buffers->mDiffuseVelocitiesBuf); } } -void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, NvFlexSolver* solver) +void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers* buffersIn, NvFlexSolver* solver) { + DiffuseRenderBuffersGL* buffers = reinterpret_cast<DiffuseRenderBuffersGL*>(buffersIn); // diffuse particles - if (buffers.mNumDiffuseParticles) + if (buffers->mNumParticles) { - NvFlexGetDiffuseParticles(solver, buffers.mDiffusePositionsBuf, buffers.mDiffuseVelocitiesBuf, buffers.mDiffuseIndicesBuf); + NvFlexGetDiffuseParticles(solver, buffers->mDiffusePositionsBuf, buffers->mDiffuseVelocitiesBuf, NULL); } } -void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, Vec4* diffusePositions, Vec4* diffuseVelocities, int* diffuseIndices, int numDiffuseParticles) +void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers* buffersIn, Vec4* diffusePositions, Vec4* diffuseVelocities, int numDiffuseParticles) { + DiffuseRenderBuffersGL* buffers = reinterpret_cast<DiffuseRenderBuffersGL*>(buffersIn); // diffuse particles - if (buffers.mNumDiffuseParticles) + if (buffers->mNumParticles) { - glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers.mDiffuseIndicesIBO)); - glVerify(glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, buffers.mNumDiffuseParticles*sizeof(int), diffuseIndices)); + glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers->mDiffusePositionVBO)); + glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers->mNumParticles*sizeof(Vec4), diffusePositions)); - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDiffusePositionVBO)); - glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumDiffuseParticles*sizeof(Vec4), diffusePositions)); - - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDiffuseVelocityVBO)); - glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumDiffuseParticles*sizeof(Vec4), diffuseVelocities)); + glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers->mDiffuseVelocityVBO)); + glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers->mNumParticles*sizeof(Vec4), diffuseVelocities)); } } @@ -2033,8 +2096,10 @@ void RenderFullscreenQuad() extern Mesh* g_mesh; void DrawShapes(); -void RenderEllipsoids(FluidRenderer* render, FluidRenderBuffers buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, Vec4 color, float blur, float ior, bool debug) +void RenderEllipsoids(FluidRenderer* render, FluidRenderBuffers* buffersIn, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, Vec4 color, float blur, float ior, bool debug) { + FluidRenderBuffersGL* buffers = reinterpret_cast<FluidRenderBuffersGL*>(buffersIn); + #if !ENABLE_SIMPLE_FLUID // resolve msaa back buffer to texture glVerify(glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, g_msaaFbo)); @@ -2076,7 +2141,7 @@ void RenderEllipsoids(FluidRenderer* render, FluidRenderBuffers buffers, int n, glUniform1f( glGetUniformLocation(render->mPointThicknessProgram, "pointScale"), screenWidth/screenAspect * (1.0f / (tanf(fov*0.5f)))); glEnableClientState(GL_VERTEX_ARRAY); - glBindBuffer(GL_ARRAY_BUFFER, buffers.mPositionVBO); + glBindBuffer(GL_ARRAY_BUFFER, buffers->mPositionVBO); glVertexPointer(3, GL_FLOAT, sizeof(float)*4, (void*)(offset*sizeof(float)*4)); glDrawArrays(GL_POINTS, 0, n); @@ -2110,23 +2175,23 @@ void RenderEllipsoids(FluidRenderer* render, FluidRenderBuffers buffers, int n, glUniform3fv( glGetUniformLocation(render->mEllipsoidDepthProgram, "invProjection"), 1, Vec3(screenAspect*viewHeight, viewHeight, 1.0f)); glEnableClientState(GL_VERTEX_ARRAY); - glBindBuffer(GL_ARRAY_BUFFER, buffers.mPositionVBO); + glBindBuffer(GL_ARRAY_BUFFER, buffers->mPositionVBO); glVertexPointer(3, GL_FLOAT, sizeof(float)*4, 0);//(void*)(offset*sizeof(float)*4)); // ellipsoid eigenvectors int s1 = glGetAttribLocation(render->mEllipsoidDepthProgram, "q1"); glEnableVertexAttribArray(s1); - glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[0]); + glBindBuffer(GL_ARRAY_BUFFER, buffers->mAnisotropyVBO[0]); glVertexAttribPointer(s1, 4, GL_FLOAT, GL_FALSE, 0, 0);// (void*)(offset*sizeof(float)*4)); int s2 = glGetAttribLocation(render->mEllipsoidDepthProgram, "q2"); glEnableVertexAttribArray(s2); - glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[1]); + glBindBuffer(GL_ARRAY_BUFFER, buffers->mAnisotropyVBO[1]); glVertexAttribPointer(s2, 4, GL_FLOAT, GL_FALSE, 0, 0);//(void*)(offset*sizeof(float)*4)); int s3 = glGetAttribLocation(render->mEllipsoidDepthProgram, "q3"); glEnableVertexAttribArray(s3); - glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[2]); + glBindBuffer(GL_ARRAY_BUFFER, buffers->mAnisotropyVBO[2]); glVertexAttribPointer(s3, 4, GL_FLOAT, GL_FALSE, 0, 0);// (void*)(offset*sizeof(float)*4)); glVerify(glDrawArrays(GL_POINTS, offset, n)); @@ -2185,8 +2250,8 @@ void RenderEllipsoids(FluidRenderer* render, FluidRenderBuffers buffers, int n, glVerify(glUniform2fv(glGetUniformLocation(render->mCompositeProgram, "clipPosToEye"), 1, Vec2(tanf(fov*0.5f)*screenAspect, tanf(fov*0.5f)))); glVerify(glUniform4fv(glGetUniformLocation(render->mCompositeProgram, "color"), 1, color)); glVerify(glUniform1f(glGetUniformLocation(render->mCompositeProgram, "ior"), ior)); - glVerify(glUniform1f(glGetUniformLocation(render->mCompositeProgram, "spotMin"), gSpotMin)); - glVerify(glUniform1f(glGetUniformLocation(render->mCompositeProgram, "spotMax"), gSpotMax)); + glVerify(glUniform1f(glGetUniformLocation(render->mCompositeProgram, "spotMin"), g_spotMin)); + glVerify(glUniform1f(glGetUniformLocation(render->mCompositeProgram, "spotMax"), g_spotMax)); glVerify(glUniform1i(glGetUniformLocation(render->mCompositeProgram, "debug"), debug)); glVerify(glUniform3fv(glGetUniformLocation(render->mCompositeProgram, "lightPos"), 1, lightPos)); @@ -2431,8 +2496,14 @@ void main() } ); -void RenderDiffuse(FluidRenderer* render, DiffuseRenderBuffers buffers, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadow, bool front) +int GetNumDiffuseRenderParticles(DiffuseRenderBuffers* buffers) { + return reinterpret_cast<DiffuseRenderBuffersGL*>(buffers)->mNumParticles; +} + +void RenderDiffuse(FluidRenderer* render, DiffuseRenderBuffers* buffersIn, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadow, bool front) +{ + DiffuseRenderBuffersGL* buffers = reinterpret_cast<DiffuseRenderBuffersGL*>(buffersIn); static int sprogram = -1; if (sprogram == -1) sprogram = CompileProgram(vertexDiffuseShader, fragmentDiffuseShader, geometryDiffuseShader); @@ -2483,8 +2554,8 @@ void RenderDiffuse(FluidRenderer* render, DiffuseRenderBuffers buffers, int n, f GLint uLightDir = glGetUniformLocation(sprogram, "lightDir"); glUniform3fv(uLightDir, 1, Normalize(lightTarget-lightPos)); - glUniform1f( glGetUniformLocation(sprogram, "spotMin"), gSpotMin); - glUniform1f( glGetUniformLocation(sprogram, "spotMax"), gSpotMax); + glUniform1f( glGetUniformLocation(sprogram, "spotMin"), g_spotMin); + glUniform1f( glGetUniformLocation(sprogram, "spotMax"), g_spotMax); const Vec2 taps[] = { @@ -2522,16 +2593,16 @@ void RenderDiffuse(FluidRenderer* render, DiffuseRenderBuffers buffers, int n, f glClientActiveTexture(GL_TEXTURE1); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDiffuseVelocityVBO)); + glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers->mDiffuseVelocityVBO)); glTexCoordPointer(4, GL_FLOAT, sizeof(float)*4, 0); glEnableClientState(GL_VERTEX_ARRAY); - glBindBuffer(GL_ARRAY_BUFFER, buffers.mDiffusePositionVBO); + glBindBuffer(GL_ARRAY_BUFFER, buffers->mDiffusePositionVBO); glVertexPointer(4, GL_FLOAT, sizeof(float)*4, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers.mDiffuseIndicesIBO); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - glDrawElements(GL_POINTS, n, GL_UNSIGNED_INT, 0); + glDrawArrays(GL_POINTS, 0, n); glUseProgram(0); glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -2770,3 +2841,31 @@ void EndPoints() glEnd(); } + + +float SyncAndGetRenderTime(unsigned long long* begin, unsigned long long* end, unsigned long long* freq) +{ + *begin = 0; + *end = 0; + *freq = 1; + return 0.0f; +} + +float RendererGetDeviceTimestamps(unsigned long long* begin, unsigned long long* end, unsigned long long* freq) { return 0.0f; } +void* GetGraphicsCommandQueue() { return nullptr; } +void GraphicsTimerBegin() { } +void GraphicsTimerEnd() { } + +void StartGpuWork() { } +void EndGpuWork() { } + +void GetRenderDevice(void** deviceOut, void** contextOut) +{ + *deviceOut = nullptr; + *contextOut = nullptr; +} + +void DrawImguiGraph() +{ + imguiGraphDraw(); +}
\ No newline at end of file diff --git a/demo/scenes.h b/demo/scenes.h index 94e6913..331927b 100644 --- a/demo/scenes.h +++ b/demo/scenes.h @@ -93,7 +93,6 @@ public: #include "scenes/nonconvex.h" #include "scenes/parachutingbunnies.h" #include "scenes/pasta.h" -#include "scenes/plasticstack.h" #include "scenes/player.h" #include "scenes/potpourri.h" #include "scenes/rayleightaylor.h" @@ -104,6 +103,7 @@ public: #include "scenes/rockpool.h" #include "scenes/sdfcollision.h" #include "scenes/shapecollision.h" +#include "scenes/shapechannels.h" #include "scenes/softbody.h" #include "scenes/spherecloth.h" #include "scenes/surfacetension.h" diff --git a/demo/scenes/adhesion.h b/demo/scenes/adhesion.h index efbdec2..10c614a 100644 --- a/demo/scenes/adhesion.h +++ b/demo/scenes/adhesion.h @@ -11,7 +11,6 @@ public: g_params.radius = radius; - g_params.fluid = true; g_params.numIterations = 3; g_params.vorticityConfinement = 0.0f; g_params.fluidRestDistance = g_params.radius*0.55f; diff --git a/demo/scenes/armadilloshower.h b/demo/scenes/armadilloshower.h index fdbf194..0fd2cfe 100644 --- a/demo/scenes/armadilloshower.h +++ b/demo/scenes/armadilloshower.h @@ -18,7 +18,6 @@ public: g_params.radius = radius; - g_params.fluid = true; g_params.numIterations = 3; g_params.vorticityConfinement = 0.0f; g_params.fluidRestDistance = g_params.radius*0.5f; diff --git a/demo/scenes/bouyancy.h b/demo/scenes/bouyancy.h index 816146f..9f5b0d2 100644 --- a/demo/scenes/bouyancy.h +++ b/demo/scenes/bouyancy.h @@ -34,7 +34,6 @@ public: g_params.radius = radius; g_params.dynamicFriction = 0.1f; - g_params.fluid = true; g_params.viscosity = 2.0f; g_params.numIterations = 4; g_params.vorticityConfinement = 180.f; diff --git a/demo/scenes/bunnybath.h b/demo/scenes/bunnybath.h index db9e6ac..eeec5ac 100644 --- a/demo/scenes/bunnybath.h +++ b/demo/scenes/bunnybath.h @@ -37,7 +37,6 @@ public: g_params.radius = radius; g_params.dynamicFriction = 0.01f; - g_params.fluid = true; g_params.viscosity = 2.0f; g_params.numIterations = 4; g_params.vorticityConfinement = 40.0f; diff --git a/demo/scenes/ccdfluid.h b/demo/scenes/ccdfluid.h index 356eec7..9ba018e 100644 --- a/demo/scenes/ccdfluid.h +++ b/demo/scenes/ccdfluid.h @@ -50,7 +50,6 @@ public: g_numSubsteps = 2; - g_params.fluid = true; g_params.radius = radius; g_params.fluidRestDistance = restDistance; g_params.dynamicFriction = 0.1f; diff --git a/demo/scenes/dambreak.h b/demo/scenes/dambreak.h index c2f9a40..cf45c29 100644 --- a/demo/scenes/dambreak.h +++ b/demo/scenes/dambreak.h @@ -22,7 +22,6 @@ public: g_numSubsteps = 2; - g_params.fluid = true; g_params.radius = radius; g_params.fluidRestDistance = restDistance; g_params.dynamicFriction = 0.f; diff --git a/demo/scenes/debris.h b/demo/scenes/debris.h index 39013ff..5454b76 100644 --- a/demo/scenes/debris.h +++ b/demo/scenes/debris.h @@ -112,7 +112,7 @@ public: // emit new debris int numToEmit = 1;//Rand()%8; - int particleOffset = NvFlexGetActiveCount(g_flex); + int particleOffset = NvFlexGetActiveCount(g_solver); for (int i = 0; i < numToEmit; ++i) { @@ -265,7 +265,7 @@ public: virtual void Sync() { - NvFlexSetRigids(g_flex, g_buffers->rigidOffsets.buffer, g_buffers->rigidIndices.buffer, g_buffers->rigidLocalPositions.buffer, g_buffers->rigidLocalNormals.buffer, g_buffers->rigidCoefficients.buffer, g_buffers->rigidRotations.buffer, g_buffers->rigidTranslations.buffer, g_buffers->rigidOffsets.size() - 1, g_buffers->rigidIndices.size()); + NvFlexSetRigids(g_solver, g_buffers->rigidOffsets.buffer, g_buffers->rigidIndices.buffer, g_buffers->rigidLocalPositions.buffer, g_buffers->rigidLocalNormals.buffer, g_buffers->rigidCoefficients.buffer, g_buffers->rigidPlasticThresholds.buffer, g_buffers->rigidPlasticCreeps.buffer, g_buffers->rigidRotations.buffer, g_buffers->rigidTranslations.buffer, g_buffers->rigidOffsets.size() - 1, g_buffers->rigidIndices.size()); } virtual void KeyDown(int key) @@ -303,8 +303,7 @@ public: { if (mBatches[b].mInstanceTransforms.size()) { - extern Colour gColors[]; - DrawGpuMeshInstances(mBatches[b].mMesh, &mBatches[b].mInstanceTransforms[0], mBatches[b].mInstanceTransforms.size(), Vec3(gColors[b % 8])); + DrawGpuMeshInstances(mBatches[b].mMesh, &mBatches[b].mInstanceTransforms[0], mBatches[b].mInstanceTransforms.size(), Vec3(g_colors[b % 8])); } } } diff --git a/demo/scenes/envcloth.h b/demo/scenes/envcloth.h index 7405739..50a703a 100644 --- a/demo/scenes/envcloth.h +++ b/demo/scenes/envcloth.h @@ -34,7 +34,7 @@ public: int gridz = mGridZ; int clothIndex = 0; - int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide); + int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseSelfCollideFilter); for (int x=0; x < gridx; ++x) { @@ -49,6 +49,9 @@ public: } } + // only simple collision necessary + g_solverDesc.featureMode = eNvFlexFeatureModeSimpleSolids; + g_params.radius = radius*1.05f; g_params.dynamicFriction = 0.25f; g_params.dissipation = 0.0f; diff --git a/demo/scenes/fluidblock.h b/demo/scenes/fluidblock.h index 82de2cb..abf508b 100644 --- a/demo/scenes/fluidblock.h +++ b/demo/scenes/fluidblock.h @@ -45,7 +45,6 @@ public: g_params.radius = radius; g_params.dynamicFriction = 0.0f; - g_params.fluid = true; g_params.viscosity = 0.0f; g_params.numIterations = 3; g_params.vorticityConfinement = 40.f; diff --git a/demo/scenes/fluidclothcoupling.h b/demo/scenes/fluidclothcoupling.h index 403a775..d9802b0 100644 --- a/demo/scenes/fluidclothcoupling.h +++ b/demo/scenes/fluidclothcoupling.h @@ -138,7 +138,6 @@ public: g_numExtraParticles = 64*1024; g_params.radius = radius; - g_params.fluid = true; g_params.numIterations = 5; g_params.vorticityConfinement = 0.0f; g_params.anisotropyScale = 30.0f; diff --git a/demo/scenes/forcefield.h b/demo/scenes/forcefield.h index 1ffcd12..6510e87 100644 --- a/demo/scenes/forcefield.h +++ b/demo/scenes/forcefield.h @@ -40,7 +40,7 @@ public: NvFlexExtDestroyForceFieldCallback(callback); // create new callback - callback = NvFlexExtCreateForceFieldCallback(g_flex); + callback = NvFlexExtCreateForceFieldCallback(g_solver); // expand scene bounds to include force field g_sceneLower -= Vec3(1.0f); diff --git a/demo/scenes/gamemesh.h b/demo/scenes/gamemesh.h index 6de6bd0..11824db 100644 --- a/demo/scenes/gamemesh.h +++ b/demo/scenes/gamemesh.h @@ -40,7 +40,6 @@ public: g_params.radius = radius; g_params.dynamicFriction = 0.3f; g_params.dissipation = 0.0f; - g_params.fluid = false; g_params.fluidRestDistance = g_params.radius*0.5f; g_params.viscosity = 0.05f; g_params.anisotropyScale = 20.0f; @@ -73,7 +72,6 @@ public: g_params.dissipation = 0.0f; g_params.numIterations = 4; g_params.numPlanes = 1; - g_params.fluid = false; g_params.particleCollisionMargin = g_params.radius*0.1f; g_params.restitution = 0.0f; @@ -103,7 +101,6 @@ public: g_params.numIterations = 3; g_params.anisotropyScale = 30.0f; g_params.smoothing = 0.5f; - g_params.fluid = true; g_params.relaxationFactor = 1.0f; g_params.restitution = 0.0f; g_params.smoothing = 0.5f; diff --git a/demo/scenes/googun.h b/demo/scenes/googun.h index 79ff396..71d1c51 100644 --- a/demo/scenes/googun.h +++ b/demo/scenes/googun.h @@ -17,7 +17,6 @@ public: g_params.radius = radius; - g_params.fluid = true; g_params.numIterations = 3; g_params.vorticityConfinement = 0.0f; g_params.fluidRestDistance = g_params.radius*0.55f; diff --git a/demo/scenes/granularpile.h b/demo/scenes/granularpile.h index 56a85ea..d71c7a9 100644 --- a/demo/scenes/granularpile.h +++ b/demo/scenes/granularpile.h @@ -19,7 +19,7 @@ public: CreateParticleShape(GetFilePathByPlatform("../../data/sandcastle.obj").c_str(), Vec3(-2.0f, -radius*0.15f, 0.0f), 4.0f, 0.0f, radius*1.0001f, 0.0f, 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide), false, 0.00f); g_numSubsteps = 2; - + g_params.radius = radius; g_params.staticFriction = 1.0f; g_params.dynamicFriction = 0.5f; @@ -37,9 +37,8 @@ public: g_drawPoints = true; g_warmup = false; - // hack, change the color of phase 0 particles to 'sand' - extern Colour gColors[]; - gColors[0] = Colour(0.805f, 0.702f, 0.401f); + // hack, change the color of phase 0 particles to 'sand' + g_colors[0] = Colour(0.805f, 0.702f, 0.401f); } void Update() diff --git a/demo/scenes/granularshape.h b/demo/scenes/granularshape.h index 6d21738..b07581d 100644 --- a/demo/scenes/granularshape.h +++ b/demo/scenes/granularshape.h @@ -27,8 +27,7 @@ public: g_numSubsteps = 3; - extern Colour gColors[]; - gColors[1] = Colour(0.805f, 0.702f, 0.401f); + g_colors[1] = Colour(0.805f, 0.702f, 0.401f); // draw options g_drawPoints = true; diff --git a/demo/scenes/inflatable.h b/demo/scenes/inflatable.h index 58f5f08..b3e97f6 100644 --- a/demo/scenes/inflatable.h +++ b/demo/scenes/inflatable.h @@ -135,7 +135,7 @@ public: virtual void Sync() { - NvFlexSetInflatables(g_flex, g_buffers->inflatableTriOffsets.buffer, g_buffers->inflatableTriCounts.buffer, g_buffers->inflatableVolumes.buffer, g_buffers->inflatablePressures.buffer, g_buffers->inflatableCoefficients.buffer, mCloths.size()); + NvFlexSetInflatables(g_solver, g_buffers->inflatableTriOffsets.buffer, g_buffers->inflatableTriCounts.buffer, g_buffers->inflatableVolumes.buffer, g_buffers->inflatablePressures.buffer, g_buffers->inflatableCoefficients.buffer, mCloths.size()); } virtual void Draw(int pass) diff --git a/demo/scenes/lighthouse.h b/demo/scenes/lighthouse.h index e4b410a..41e5d2f 100644 --- a/demo/scenes/lighthouse.h +++ b/demo/scenes/lighthouse.h @@ -23,7 +23,6 @@ public: g_params.radius = radius; g_params.dynamicFriction = 0.f; - g_params.fluid = true; g_params.viscosity = 0.01f; g_params.numIterations = 3; g_params.vorticityConfinement = 50.0f; diff --git a/demo/scenes/localspacecloth.h b/demo/scenes/localspacecloth.h index f28912e..1030f8b 100644 --- a/demo/scenes/localspacecloth.h +++ b/demo/scenes/localspacecloth.h @@ -65,7 +65,6 @@ public: g_numSubsteps = 2; - g_params.fluid = false; g_params.radius = radius; g_params.dynamicFriction = 0.f; g_params.restitution = 0.0f; diff --git a/demo/scenes/localspacefluid.h b/demo/scenes/localspacefluid.h index 494249a..7bcbd8b 100644 --- a/demo/scenes/localspacefluid.h +++ b/demo/scenes/localspacefluid.h @@ -46,7 +46,6 @@ public: g_numSubsteps = 2; - g_params.fluid = true; g_params.radius = radius; g_params.fluidRestDistance = restDistance; g_params.dynamicFriction = 0.f; diff --git a/demo/scenes/lowdimensionalshapes.h b/demo/scenes/lowdimensionalshapes.h index 5d32ea5..3c91394 100644 --- a/demo/scenes/lowdimensionalshapes.h +++ b/demo/scenes/lowdimensionalshapes.h @@ -21,7 +21,6 @@ public: g_params.radius = radius; g_params.dynamicFriction = 1.0f; - g_params.fluid = false; g_params.fluidRestDistance = radius; g_params.viscosity = 0.0f; g_params.numIterations = 4; diff --git a/demo/scenes/melting.h b/demo/scenes/melting.h index c7da792..f8d7083 100644 --- a/demo/scenes/melting.h +++ b/demo/scenes/melting.h @@ -13,7 +13,6 @@ public: g_params.dynamicFriction = 0.25f; g_params.dissipation = 0.0f; g_params.viscosity = 0.0f; - g_params.fluid = true; g_params.cohesion = 0.0f; g_params.fluidRestDistance = g_params.radius*0.6f; g_params.anisotropyScale = 4.0f / g_params.radius; @@ -63,7 +62,7 @@ public: virtual void Sync() { - NvFlexSetRigids(g_flex, g_buffers->rigidOffsets.buffer, g_buffers->rigidIndices.buffer, g_buffers->rigidLocalPositions.buffer, g_buffers->rigidLocalNormals.buffer, g_buffers->rigidCoefficients.buffer, g_buffers->rigidRotations.buffer, g_buffers->rigidTranslations.buffer, g_buffers->rigidOffsets.size() - 1, g_buffers->rigidIndices.size()); + NvFlexSetRigids(g_solver, g_buffers->rigidOffsets.buffer, g_buffers->rigidIndices.buffer, g_buffers->rigidLocalPositions.buffer, g_buffers->rigidLocalNormals.buffer, g_buffers->rigidCoefficients.buffer, g_buffers->rigidPlasticThresholds.buffer, g_buffers->rigidPlasticCreeps.buffer, g_buffers->rigidRotations.buffer, g_buffers->rigidTranslations.buffer, g_buffers->rigidOffsets.size() - 1, g_buffers->rigidIndices.size()); } int mFrame; diff --git a/demo/scenes/mixedpile.h b/demo/scenes/mixedpile.h index 61bc5a5..35333ff 100644 --- a/demo/scenes/mixedpile.h +++ b/demo/scenes/mixedpile.h @@ -186,7 +186,6 @@ public: g_params.shockPropagation = 0.0f; g_params.restitution = 0.0f; g_params.collisionDistance = g_params.radius*0.5f; - g_params.fluid = false; g_params.maxSpeed = 2.0f*g_params.radius*g_numSubsteps/g_dt; // separte solid particle count @@ -207,13 +206,13 @@ public: g_emitters[0].mSpeed = (g_params.radius*0.5f/g_dt); g_emitters[0].mSpeed = (g_params.radius/g_dt); - extern Colour gColors[]; - gColors[0] = Colour(0.805f, 0.702f, 0.401f); + extern Colour g_colors[]; + g_colors[0] = Colour(0.805f, 0.702f, 0.401f); } virtual void Update() { - NvFlexSetInflatables(g_flex, &mTriOffset[0], &mTriCount[0], &mRestVolume[0], &mOverPressure[0], &mConstraintScale[0], mCloths.size(), eFlexMemoryHost); + NvFlexSetInflatables(g_solver, &mTriOffset[0], &mTriCount[0], &mRestVolume[0], &mOverPressure[0], &mConstraintScale[0], mCloths.size(), eFlexMemoryHost); } int mHeight; diff --git a/demo/scenes/parachutingbunnies.h b/demo/scenes/parachutingbunnies.h index 04f2052..bfb18bb 100644 --- a/demo/scenes/parachutingbunnies.h +++ b/demo/scenes/parachutingbunnies.h @@ -124,7 +124,6 @@ public: } } - g_params.fluid = true; g_params.radius = 0.1f; g_params.fluidRestDistance = radius; g_params.numIterations = 4; diff --git a/demo/scenes/plasticstack.h b/demo/scenes/plasticstack.h deleted file mode 100644 index e1543ca..0000000 --- a/demo/scenes/plasticstack.h +++ /dev/null @@ -1,50 +0,0 @@ - -class PlasticStack : public Scene -{ -public: - - PlasticStack(const char* name) : Scene(name) {} - - virtual void Initialize() - { - g_params.radius = 0.225f; - - g_params.numIterations = 2; - g_params.dynamicFriction = 0.5f; - g_params.particleFriction = 0.15f; - g_params.dissipation = 0.0f; - g_params.viscosity = 0.0f; - - AddPlinth(); - - const float rotation = -kPi*0.5f; - const float spacing = g_params.radius*0.5f; - - // alternative box and sphere shapes - const char* mesh[] = - { - "../../data/box_high.ply", - "../../data/sphere.ply" - }; - - Vec3 lower = Vec3(4.0f, 1.0f, 0.0f); - float sizeInc = 0.0f; - float size = 1.0f; - int group = 0; - - for (int i=0; i < 8; ++i) - { - CreateParticleShape(GetFilePathByPlatform(mesh[i%2]).c_str(), lower, size + i*sizeInc, rotation, spacing, Vec3(.0f, 0.0f, 0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f, 0.0f, g_params.radius*0.5f); - - lower += Vec3(0.0f, size + i*sizeInc + 0.2f, 0.0f); - } - - g_params.plasticThreshold = 0.00025f; - g_params.plasticCreep = 0.165f; - - g_numSubsteps = 4; - - // draw options - g_drawPoints = false; - } -}; diff --git a/demo/scenes/player.h b/demo/scenes/player.h index 83407ac..46f4ca5 100644 --- a/demo/scenes/player.h +++ b/demo/scenes/player.h @@ -40,7 +40,7 @@ public: { g_buffers->activeIndices = mInitialActive; - NvFlexSetActive(g_flex, &mInitialActive[0], mInitialActive.size(), eFlexMemoryHost); + NvFlexSetActive(g_solver, &mInitialActive[0], mInitialActive.size(), eFlexMemoryHost); } virtual Matrix44 GetBasis() @@ -166,6 +166,8 @@ public: ReadArray(g_buffers->rigidLocalNormals, true); ReadArray(g_buffers->rigidCoefficients, true); + ReadArray(g_buffers->rigidPlasticThresholds, true); + ReadArray(g_buffers->rigidPlasticCreeps, true); ReadArray(g_buffers->rigidOffsets, true); ReadArray(g_buffers->rigidRotations, true); ReadArray(g_buffers->rigidTranslations, true); diff --git a/demo/scenes/rayleightaylor.h b/demo/scenes/rayleightaylor.h index f07fb46..b4f7ebd 100644 --- a/demo/scenes/rayleightaylor.h +++ b/demo/scenes/rayleightaylor.h @@ -31,7 +31,6 @@ public: g_params.gravity[1] = -9.f; g_params.radius = radius; g_params.dynamicFriction = 0.00f; - g_params.fluid = true; g_params.viscosity = 2.0f; g_params.numIterations = 10; g_params.vorticityConfinement = 0.0f; @@ -109,7 +108,6 @@ public: g_params.gravity[1] = -9.f; g_params.radius = radius; g_params.dynamicFriction = 0.00f; - g_params.fluid = true; g_params.viscosity = 0.0f; g_params.numIterations = 10; g_params.vorticityConfinement = 0.0f; diff --git a/demo/scenes/rigidfluidcoupling.h b/demo/scenes/rigidfluidcoupling.h index b978eb8..0bde7d9 100644 --- a/demo/scenes/rigidfluidcoupling.h +++ b/demo/scenes/rigidfluidcoupling.h @@ -43,13 +43,12 @@ public: g_params.radius = radius; g_params.dynamicFriction = 0.5f; - g_params.fluid = true; g_params.viscosity = 0.1f; g_params.numIterations = 3; g_params.vorticityConfinement = 0.0f; g_params.anisotropyScale = 25.0f; - g_params.fluidRestDistance = g_params.radius*0.55f; - + g_params.fluidRestDistance = g_params.radius*0.55f; + g_params.solidRestDistance = g_params.radius*0.5f; g_emitters[0].mEnabled = true; g_emitters[0].mSpeed = 2.0f*(g_params.fluidRestDistance)/g_dt; diff --git a/demo/scenes/rigidrotation.h b/demo/scenes/rigidrotation.h index 8abcb98..6d2e1d7 100644 --- a/demo/scenes/rigidrotation.h +++ b/demo/scenes/rigidrotation.h @@ -12,9 +12,9 @@ public: { float radius = 0.1f; - float dimx = 1.0f; - float dimy = 5.0f; - float dimz = 1.0f; + float dimx = 3.0f; + float dimy = 3.0f; + float dimz = 3.0f; CreateParticleShape(GetFilePathByPlatform("../../data/box.ply").c_str(), Vec3(0.0f, 1.0f, 0.0f), Vec3(dimx, dimy, dimz)*radius, 0.0f, radius, Vec3(0.0f), 1.0f, true, 1.0f, 0, true, 0.0f, 0.0f, 0.0f); @@ -22,7 +22,7 @@ public: g_params.gravity[1] = 0; g_params.numIterations = 1; - g_numSubsteps = 1; + g_numSubsteps = 3; g_pause = true; @@ -39,17 +39,19 @@ public: Vec3 center = (lower + upper)*0.5f; - Matrix44 rotation = RotationMatrix(DegToRad(95.0f), Vec3(0.0f, 0.0f, 1.0f)); + //Matrix44 rotation = RotationMatrix(DegToRad(40.0f), Vec3(0.0f, 0.0f, 1.0f)); for (int i = 0; i < int(g_buffers->positions.size()); ++i) { Vec3 delta = Vec3(g_buffers->positions[i]) - center; - delta = Vec3(rotation*Vec4(delta, 1.0f)); + //delta = Vec3(rotation*Vec4(delta, 1.0f)); - g_buffers->positions[i].x = center.x + delta.x; - g_buffers->positions[i].y = center.y + delta.y; - g_buffers->positions[i].z = center.z + delta.z; + //g_buffers->positions[i].x = center.x + delta.x; + //g_buffers->positions[i].y = center.y + delta.y; + //g_buffers->positions[i].z = center.z + delta.z; + + g_buffers->velocities[i] = Cross(delta, Vec3(0.0f, 0.0f, 1.0f))*10.0f; } } } diff --git a/demo/scenes/rockpool.h b/demo/scenes/rockpool.h index e7c0034..f596de2 100644 --- a/demo/scenes/rockpool.h +++ b/demo/scenes/rockpool.h @@ -21,11 +21,12 @@ public: CreateParticleGrid(Vec3(0.0f, radius*0.5f, -1.0f), 32, 32, 32, radius*0.55f, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid), 0.005f); + g_solverDesc.featureMode = eNvFlexFeatureModeSimpleFluids; + g_numSubsteps = 2; g_params.radius = radius; g_params.dynamicFriction = 0.00f; - g_params.fluid = true; g_params.viscosity = 0.01f; g_params.numIterations = 2; g_params.vorticityConfinement = 75.0f; diff --git a/demo/scenes/shapechannels.h b/demo/scenes/shapechannels.h new file mode 100644 index 0000000..22ee649 --- /dev/null +++ b/demo/scenes/shapechannels.h @@ -0,0 +1,48 @@ + + +// demonstrates how to make particles collide with +// selected collision shapes based on the channel mask +class ShapeChannels : public Scene +{ +public: + + ShapeChannels(const char* name) : Scene(name) {} + + void Initialize() + { + const float radius = 0.05f; + + Vec3 offset = Vec3(-0.25f, 6.0f, -0.25f); + + // layers of particles each set to collide with a different shape channel + int numLayers = 8; + + for (int i=0; i < numLayers; ++i) + { + CreateParticleGrid(offset + Vec3(0.0f, 2.0f*i*radius, 0.0f), 10, 1, 10, radius, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhaseWithChannels(i, eNvFlexPhaseSelfCollide, eNvFlexPhaseShapeChannel0<<i), 0.0f); + //CreateParticleGrid(offset + Vec3(0.0f, 2.0f*radius, 0.0f), 10, 1, 10, radius, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhaseWithChannels(0, eNvFlexPhaseSelfCollide, eNvFlexPhaseShapeChannel1), 0.0f); + //CreateParticleGrid(offset + Vec3(0.0f, 4.0f*radius, 0.0f), 10, 1, 10, radius, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhaseWithChannels(0, eNvFlexPhaseSelfCollide, eNvFlexPhaseShapeChannel2), 0.0f); + + AddBox(Vec3(0.5f, 0.1f, 0.5f), Vec3(0.0f, 0.5f + i*0.5f, 0.0f), Quat(), false, eNvFlexPhaseShapeChannel0<<i); + } + + // regular box + //AddBox(Vec3(0.5f, 0.1f, 0.5f), Vec3(0.0f, 0.5f, 0.0f), Quat(), false, eNvFlexPhaseShapeChannel0); + //AddBox(Vec3(0.5f, 0.1f, 0.5f), Vec3(0.0f, 1.0f, 0.0f), Quat(), false, eNvFlexPhaseShapeChannel1); + //AddBox(Vec3(0.5f, 0.1f, 0.5f), Vec3(0.0f, 1.5f, 0.0f), Quat(), false, eNvFlexPhaseShapeChannel2); + + g_params.radius = radius; + g_params.dynamicFriction = 0.025f; + g_params.dissipation = 0.0f; + g_params.restitution = 0.0; + g_params.numIterations = 4; + g_params.particleCollisionMargin = g_params.radius*0.05f; + + g_numSubsteps = 1; + } + + virtual void Update() + { + + } +};
\ No newline at end of file diff --git a/demo/scenes/softbody.h b/demo/scenes/softbody.h index c12680c..265626b 100644 --- a/demo/scenes/softbody.h +++ b/demo/scenes/softbody.h @@ -2,51 +2,145 @@ class SoftBody : public Scene { -public: - SoftBody(const char* name, const char* mesh) : +public: + SoftBody(const char* name) : Scene(name), - mFile(mesh), - mScale(2.0f), - mOffset(0.0f, 1.0f, 0.0f), mRadius(0.1f), - mClusterSpacing(1.0f), - mClusterRadius(0.0f), - mClusterStiffness(0.5f), - mLinkRadius(0.0f), - mLinkStiffness(1.0f), - mGlobalStiffness(0.0f), - mSurfaceSampling(0.0f), - mVolumeSampling(4.0f), - mSkinningFalloff(2.0f), - mSkinningMaxDistance(100.0f), - mPlasticThreshold(0.0f), - mPlasticCreep(0.0f), mRelaxationFactor(1.0f), - mPlinth(false) + mPlinth(false), + plasticDeformation(false) { - mStack[0] = 1; - mStack[1] = 1; - mStack[2] = 1; + const Vec3 colorPicker[7] = + { + Vec3(0.0f, 0.5f, 1.0f), + Vec3(0.797f, 0.354f, 0.000f), + Vec3(0.000f, 0.349f, 0.173f), + Vec3(0.875f, 0.782f, 0.051f), + Vec3(0.01f, 0.170f, 0.453f), + Vec3(0.673f, 0.111f, 0.000f), + Vec3(0.612f, 0.194f, 0.394f) + }; + memcpy(mColorPicker, colorPicker, sizeof(Vec3) * 7); + } + + float mRadius; + float mRelaxationFactor; + bool mPlinth; + + Vec3 mColorPicker[7]; + + struct Instance + { + Instance(const char* mesh) : + + mFile(mesh), + mColor(0.5f, 0.5f, 1.0f), + + mScale(2.0f), + mTranslation(0.0f, 1.0f, 0.0f), + + mClusterSpacing(1.0f), + mClusterRadius(0.0f), + mClusterStiffness(0.5f), + + mLinkRadius(0.0f), + mLinkStiffness(1.0f), + + mGlobalStiffness(0.0f), + + mSurfaceSampling(0.0f), + mVolumeSampling(4.0f), + + mSkinningFalloff(2.0f), + mSkinningMaxDistance(100.0f), + + mClusterPlasticThreshold(0.0f), + mClusterPlasticCreep(0.0f) + {} + + const char* mFile; + Vec3 mColor; + + Vec3 mScale; + Vec3 mTranslation; + + float mClusterSpacing; + float mClusterRadius; + float mClusterStiffness; + + float mLinkRadius; + float mLinkStiffness; + + float mGlobalStiffness; + + float mSurfaceSampling; + float mVolumeSampling; + + float mSkinningFalloff; + float mSkinningMaxDistance; + + float mClusterPlasticThreshold; + float mClusterPlasticCreep; + }; + + std::vector<Instance> mInstances; + +private: + + struct RenderingInstance + { + Mesh* mMesh; + std::vector<int> mSkinningIndices; + std::vector<float> mSkinningWeights; + vector<Vec3> mRigidRestPoses; + Vec3 mColor; + int mOffset; + }; + + std::vector<RenderingInstance> mRenderingInstances; + + bool plasticDeformation; + + +public: + virtual void AddInstance(Instance instance) + { + this->mInstances.push_back(instance); + } + + virtual void AddStack(Instance instance, int xStack, int yStack, int zStack, bool rotateColors = false) + { + Vec3 translation = instance.mTranslation; + for (int x = 0; x < xStack; ++x) + { + for (int y = 0; y < yStack; ++y) + { + for (int z = 0; z < zStack; ++z) + { + instance.mTranslation = translation + Vec3(x*(instance.mScale.x + 1), y*(instance.mScale.y + 1), z*(instance.mScale.z + 1))*mRadius; + if (rotateColors) { + instance.mColor = mColorPicker[(x*yStack*zStack + y*zStack + z) % 7]; + } + this->mInstances.push_back(instance); + } + } + } } virtual void Initialize() { float radius = mRadius; + // no fluids or sdf based collision + g_solverDesc.featureMode = eNvFlexFeatureModeSimpleSolids; + g_params.radius = radius; g_params.dynamicFriction = 0.35f; g_params.particleFriction = 0.25f; - g_params.dissipation = 0.0f; g_params.numIterations = 4; - g_params.viscosity = 0.0f; - g_params.drag = 0.0f; - g_params.lift = 0.0f; g_params.collisionDistance = radius*0.75f; - g_params.plasticThreshold = mPlasticThreshold; - g_params.plasticCreep = mPlasticCreep; - g_params.relaxationFactor = mRelaxationFactor; g_windStrength = 0.0f; @@ -61,14 +155,14 @@ public: g_buffers->rigidOffsets.push_back(0); - mInstances.resize(0); + mRenderingInstances.resize(0); + // build soft bodies + for (int i = 0; i < int(mInstances.size()); i++) + CreateSoftBody(mInstances[i], mRenderingInstances.size()); - CreateBodies(); - - if (mPlinth) { + if (mPlinth) AddPlinth(); - } // fix any particles below the ground plane in place for (int i = 0; i < int(g_buffers->positions.size()); ++i) @@ -81,73 +175,60 @@ public: g_lightDistance *= 1.5f; } - virtual void CreateBodies() + void CreateSoftBody(Instance instance, int group = 0) { - // build soft body - for (int x = 0; x < mStack[0]; ++x) - { - for (int y = 0; y < mStack[1]; ++y) - { - for (int z = 0; z < mStack[2]; ++z) - { - CreateSoftBody(mRadius, mOffset + Vec3(x*(mScale.x + 1), y*(mScale.y + 1), z*(mScale.z + 1))*mRadius, mClusterStiffness, mInstances.size()); - } - } - } - } - - void CreateSoftBody(float radius, Vec3 position, float clusterStiffness, int group = 0) - { - Instance instance; + RenderingInstance renderingInstance; - Mesh* mesh = ImportMesh(GetFilePathByPlatform(mFile).c_str()); + Mesh* mesh = ImportMesh(GetFilePathByPlatform(instance.mFile).c_str()); mesh->Normalize(); - mesh->Transform(TranslationMatrix(Point3(position))*ScaleMatrix(mScale*radius)); + mesh->Transform(TranslationMatrix(Point3(instance.mTranslation))*ScaleMatrix(instance.mScale*mRadius)); - instance.mMesh = mesh; - instance.mColor = Vec3(0.5f, 0.5f, 1.0f); - instance.mOffset = g_buffers->rigidTranslations.size(); + renderingInstance.mMesh = mesh; + renderingInstance.mColor = instance.mColor; + renderingInstance.mOffset = g_buffers->rigidTranslations.size(); double createStart = GetSeconds(); // create soft body definition NvFlexExtAsset* asset = NvFlexExtCreateSoftFromMesh( - (float*)&instance.mMesh->m_positions[0], - instance.mMesh->m_positions.size(), - (int*)&instance.mMesh->m_indices[0], - instance.mMesh->m_indices.size(), - radius, - mVolumeSampling, - mSurfaceSampling, - mClusterSpacing*radius, - mClusterRadius*radius, - clusterStiffness, - mLinkRadius*radius, - mLinkStiffness, - mGlobalStiffness); + (float*)&renderingInstance.mMesh->m_positions[0], + renderingInstance.mMesh->m_positions.size(), + (int*)&renderingInstance.mMesh->m_indices[0], + renderingInstance.mMesh->m_indices.size(), + mRadius, + instance.mVolumeSampling, + instance.mSurfaceSampling, + instance.mClusterSpacing*mRadius, + instance.mClusterRadius*mRadius, + instance.mClusterStiffness, + instance.mLinkRadius*mRadius, + instance.mLinkStiffness, + instance.mGlobalStiffness, + instance.mClusterPlasticThreshold, + instance.mClusterPlasticCreep); double createEnd = GetSeconds(); // create skinning const int maxWeights = 4; - instance.mSkinningIndices.resize(instance.mMesh->m_positions.size()*maxWeights); - instance.mSkinningWeights.resize(instance.mMesh->m_positions.size()*maxWeights); + renderingInstance.mSkinningIndices.resize(renderingInstance.mMesh->m_positions.size()*maxWeights); + renderingInstance.mSkinningWeights.resize(renderingInstance.mMesh->m_positions.size()*maxWeights); for (int i = 0; i < asset->numShapes; ++i) - instance.mRigidRestPoses.push_back(Vec3(&asset->shapeCenters[i * 3])); + renderingInstance.mRigidRestPoses.push_back(Vec3(&asset->shapeCenters[i * 3])); double skinStart = GetSeconds(); NvFlexExtCreateSoftMeshSkinning( - (float*)&instance.mMesh->m_positions[0], - instance.mMesh->m_positions.size(), + (float*)&renderingInstance.mMesh->m_positions[0], + renderingInstance.mMesh->m_positions.size(), asset->shapeCenters, asset->numShapes, - mSkinningFalloff, - mSkinningMaxDistance, - &instance.mSkinningWeights[0], - &instance.mSkinningIndices[0]); + instance.mSkinningFalloff, + instance.mSkinningMaxDistance, + &renderingInstance.mSkinningWeights[0], + &renderingInstance.mSkinningIndices[0]); double skinEnd = GetSeconds(); @@ -178,6 +259,52 @@ public: g_buffers->rigidCoefficients.push_back(asset->shapeCoefficients[i]); } + + // add plastic deformation data to solver, if at least one asset has non-zero plastic deformation coefficients, leave the according pointers at NULL otherwise + if (plasticDeformation) + { + if (asset->shapePlasticThresholds && asset->shapePlasticCreeps) + { + for (int i = 0; i < asset->numShapes; ++i) + { + g_buffers->rigidPlasticThresholds.push_back(asset->shapePlasticThresholds[i]); + g_buffers->rigidPlasticCreeps.push_back(asset->shapePlasticCreeps[i]); + } + } + else + { + for (int i = 0; i < asset->numShapes; ++i) + { + g_buffers->rigidPlasticThresholds.push_back(0.0f); + g_buffers->rigidPlasticCreeps.push_back(0.0f); + } + } + } + else + { + if (asset->shapePlasticThresholds && asset->shapePlasticCreeps) + { + int oldBufferSize = g_buffers->rigidCoefficients.size() - asset->numShapes; + + g_buffers->rigidPlasticThresholds.resize(oldBufferSize); + g_buffers->rigidPlasticCreeps.resize(oldBufferSize); + + for (int i = 0; i < oldBufferSize; i++) + { + g_buffers->rigidPlasticThresholds[i] = 0.0f; + g_buffers->rigidPlasticCreeps[i] = 0.0f; + } + + for (int i = 0; i < asset->numShapes; ++i) + { + g_buffers->rigidPlasticThresholds.push_back(asset->shapePlasticThresholds[i]); + g_buffers->rigidPlasticCreeps.push_back(asset->shapePlasticCreeps[i]); + } + + plasticDeformation = true; + } + } + // add link data to the solver for (int i = 0; i < asset->numSprings; ++i) { @@ -190,7 +317,7 @@ public: NvFlexExtDestroyAsset(asset); - mInstances.push_back(instance); + mRenderingInstances.push_back(renderingInstance); } virtual void Draw(int pass) @@ -198,9 +325,9 @@ public: if (!g_drawMesh) return; - for (int s = 0; s < int(mInstances.size()); ++s) + for (int s = 0; s < int(mRenderingInstances.size()); ++s) { - const Instance& instance = mInstances[s]; + const RenderingInstance& instance = mRenderingInstances[s]; Mesh m; m.m_positions.resize(instance.mMesh->m_positions.size()); @@ -239,58 +366,15 @@ public: DrawMesh(&m, instance.mColor); } } - - struct Instance - { - Mesh* mMesh; - std::vector<int> mSkinningIndices; - std::vector<float> mSkinningWeights; - vector<Vec3> mRigidRestPoses; - Vec3 mColor; - int mOffset; - }; - - std::vector<Instance> mInstances; - - const char* mFile; - Vec3 mScale; - Vec3 mOffset; - - float mRadius; - - float mClusterSpacing; - float mClusterRadius; - float mClusterStiffness; - - float mLinkRadius; - float mLinkStiffness; - - float mGlobalStiffness; - - float mSurfaceSampling; - float mVolumeSampling; - - float mSkinningFalloff; - float mSkinningMaxDistance; - - float mPlasticThreshold; - float mPlasticCreep; - - float mRelaxationFactor; - - bool mPlinth; - - int mStack[3]; }; - - class SoftBodyFixed : public SoftBody { public: - SoftBodyFixed(const char* name, const char* mesh) : SoftBody(name, mesh) {} + SoftBodyFixed(const char* name) : SoftBody(name) + {} virtual void Initialize() { @@ -302,16 +386,16 @@ public: g_buffers->positions[i].w = 0.0f; } - virtual void CreateBodies() + virtual void AddStack(Instance instance, int zStack) { - int x = 0; - int y = 0; + float clusterStiffness = instance.mClusterStiffness; + Vec3 translation = instance.mTranslation; - for (int z = 0; z < 4; ++z) + for (int z = 0; z < zStack; ++z) { - float stiffness = sqr(mClusterStiffness*(z + 1)); - - CreateSoftBody(mRadius, mOffset + Vec3(x*(mScale.x + 1), y*(mScale.y + 1), -z*(mScale.z + 1))*mRadius, stiffness, mInstances.size()); + instance.mClusterStiffness = sqr(clusterStiffness*(z + 1)); + instance.mTranslation = translation + Vec3(0.0f, 0.0f, -z*(instance.mScale.z + 1))*mRadius; + this->mInstances.push_back(instance); } } @@ -322,4 +406,4 @@ public: (Vec4&)g_params.planes[1] = Vec4(1.0f, 0.0f, 0.0f, 0.0f); g_params.numPlanes = 2; } -}; +};
\ No newline at end of file diff --git a/demo/scenes/surfacetension.h b/demo/scenes/surfacetension.h index b22ad6d..60f1836 100644 --- a/demo/scenes/surfacetension.h +++ b/demo/scenes/surfacetension.h @@ -17,7 +17,6 @@ public: g_params.radius = radius; - g_params.fluid = true; g_params.numIterations = 3; g_params.vorticityConfinement = 0.0f; g_params.fluidRestDistance = restDistance; diff --git a/demo/scenes/tearing.h b/demo/scenes/tearing.h index c36ca7a..ce9dacc 100644 --- a/demo/scenes/tearing.h +++ b/demo/scenes/tearing.h @@ -123,9 +123,9 @@ public: virtual void Sync() { // update solver data not already updated in the main loop - NvFlexSetSprings(g_flex, g_buffers->springIndices.buffer, g_buffers->springLengths.buffer, g_buffers->springStiffness.buffer, g_buffers->springLengths.size()); - NvFlexSetDynamicTriangles(g_flex, g_buffers->triangles.buffer, g_buffers->triangleNormals.buffer, g_buffers->triangles.size() / 3); - NvFlexSetRestParticles(g_flex, g_buffers->restPositions.buffer, g_buffers->restPositions.size()); + NvFlexSetSprings(g_solver, g_buffers->springIndices.buffer, g_buffers->springLengths.buffer, g_buffers->springStiffness.buffer, g_buffers->springLengths.size()); + NvFlexSetDynamicTriangles(g_solver, g_buffers->triangles.buffer, g_buffers->triangleNormals.buffer, g_buffers->triangles.size() / 3); + NvFlexSetRestParticles(g_solver, g_buffers->restPositions.buffer, NULL); } NvFlexExtAsset* mCloth; diff --git a/demo/scenes/thinbox.h b/demo/scenes/thinbox.h index a77f258..d9005c9 100644 --- a/demo/scenes/thinbox.h +++ b/demo/scenes/thinbox.h @@ -47,7 +47,6 @@ public: g_params.gravity[1] = -9.f; g_params.radius = radius; g_params.dynamicFriction = 0.0f; - g_params.fluid = false; g_params.numIterations = 5; g_params.numPlanes = 1; g_params.restitution = 0.0f; diff --git a/demo/scenes/triggervolume.h b/demo/scenes/triggervolume.h index 0e4c1a4..8c078de 100644 --- a/demo/scenes/triggervolume.h +++ b/demo/scenes/triggervolume.h @@ -45,14 +45,14 @@ public: NvFlexVector<int> contactIndices(g_flexLib, g_buffers->positions.size()); NvFlexVector<unsigned int> contactCounts(g_flexLib, g_buffers->positions.size()); - NvFlexGetContacts(g_flex, contactPlanes.buffer, contactVelocities.buffer, contactIndices.buffer, contactCounts.buffer); + NvFlexGetContacts(g_solver, contactPlanes.buffer, contactVelocities.buffer, contactIndices.buffer, contactCounts.buffer); contactPlanes.map(); contactVelocities.map(); contactIndices.map(); contactCounts.map(); - int activeCount = NvFlexGetActiveCount(g_flex); + int activeCount = NvFlexGetActiveCount(g_solver); for (int i = 0; i < activeCount; ++i) { diff --git a/demo/scenes/viscosity.h b/demo/scenes/viscosity.h index 0615855..52db6d5 100644 --- a/demo/scenes/viscosity.h +++ b/demo/scenes/viscosity.h @@ -10,9 +10,10 @@ public: float radius = 0.1f; float restDistance = radius*0.5f; + g_solverDesc.featureMode = eNvFlexFeatureModeSimpleFluids; + g_params.radius = radius; - g_params.fluid = true; g_params.numIterations = 3; g_params.vorticityConfinement = 0.0f; g_params.fluidRestDistance = restDistance; diff --git a/demo/scenes/waterballoon.h b/demo/scenes/waterballoon.h index 544bf78..0e59f40 100644 --- a/demo/scenes/waterballoon.h +++ b/demo/scenes/waterballoon.h @@ -88,8 +88,6 @@ public: g_params.collisionDistance = 0.01f; g_params.solidPressure = 0.0f; - g_params.fluid = true; - g_params.fluidRestDistance = radius*0.65f; g_params.viscosity = 0.0; g_params.adhesion = 0.0f; @@ -190,11 +188,11 @@ public: virtual void Sync() { // send new particle data to the GPU - NvFlexSetRestParticles(g_flex, g_buffers->restPositions.buffer, g_buffers->restPositions.size()); + NvFlexSetRestParticles(g_solver, g_buffers->restPositions.buffer, NULL); // update solver - NvFlexSetSprings(g_flex, g_buffers->springIndices.buffer, g_buffers->springLengths.buffer, g_buffers->springStiffness.buffer, g_buffers->springLengths.size()); - NvFlexSetDynamicTriangles(g_flex, g_buffers->triangles.buffer, g_buffers->triangleNormals.buffer, g_buffers->triangles.size() / 3); + NvFlexSetSprings(g_solver, g_buffers->springIndices.buffer, g_buffers->springLengths.buffer, g_buffers->springStiffness.buffer, g_buffers->springLengths.size()); + NvFlexSetDynamicTriangles(g_solver, g_buffers->triangles.buffer, g_buffers->triangleNormals.buffer, g_buffers->triangles.size() / 3); } virtual void Update() diff --git a/demo/shaders.h b/demo/shaders.h index 937c2a2..168a333 100644 --- a/demo/shaders.h +++ b/demo/shaders.h @@ -34,32 +34,41 @@ #include "../include/NvFlex.h" +void GetRenderDevice(void** device, void** context); -#if FLEX_DX - -#include <d3d11.h> -typedef ID3D11Buffer* VertexBuffer; -typedef ID3D11Buffer* IndexBuffer; - -void GetRenderDevice(ID3D11Device** device, ID3D11DeviceContext** context); - -#else - -typedef unsigned int VertexBuffer; -typedef unsigned int IndexBuffer; -typedef unsigned int Texture; - -#endif +struct DiffuseRenderBuffers; +struct FluidRenderBuffers; struct SDL_Window; -void InitRender(SDL_Window* window, bool fullscreen, int msaa); +struct RenderInitOptions +{ + RenderInitOptions(): + defaultFontHeight(-1), + asyncComputeBenchmark(false), + fullscreen(false), + numMsaaSamples(1), + window(nullptr) + {} + int defaultFontHeight; ///< Set to -1 for the default + bool asyncComputeBenchmark; ///< When set, will configure renderer to perform extra (unnecessary) rendering work to make sure async compute can take place. + bool fullscreen; + int numMsaaSamples; + SDL_Window* window; +}; + +void InitRender(const RenderInitOptions& options); void DestroyRender(); void ReshapeRender(SDL_Window* window); void StartFrame(Vec4 clearColor); void EndFrame(); +void StartGpuWork(); +void EndGpuWork(); + +void FlushGraphicsAndWait(); + // set to true to enable vsync void PresentFrame(bool fullsync); @@ -86,7 +95,7 @@ void ShadowEnd(); // primitive draw methods void DrawPlanes(Vec4* planes, int n, float bias); -void DrawPoints(VertexBuffer positions, VertexBuffer color, IndexBuffer indices, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, bool showDensity); +void DrawPoints(FluidRenderBuffers* buffer, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, bool showDensity); void DrawMesh(const Mesh*, Vec3 color); void DrawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex=3, float expand=0.0f, bool twosided=true, bool smooth=true); void DrawBuffer(float* buffer, Vec3 camPos, Vec3 lightPos); @@ -103,6 +112,11 @@ void DrawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const Vec3& void BindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, float bias, Vec4 fogColor); void UnbindSolidShader(); +float RendererGetDeviceTimestamps(unsigned long long* begin, unsigned long long* end, unsigned long long* freq); +void* GetGraphicsCommandQueue(); +void GraphicsTimerBegin(); +void GraphicsTimerEnd(); + // new fluid renderer struct FluidRenderer; @@ -110,32 +124,14 @@ struct FluidRenderer; FluidRenderer* CreateFluidRenderer(uint32_t width, uint32_t height); void DestroyFluidRenderer(FluidRenderer*); -struct FluidRenderBuffers -{ - VertexBuffer mPositionVBO; - VertexBuffer mDensityVBO; - VertexBuffer mAnisotropyVBO[3]; - IndexBuffer mIndices; - - VertexBuffer mFluidVBO; // to be removed - - // wrapper buffers that allow Flex to write directly to VBOs - NvFlexBuffer* mPositionBuf; - NvFlexBuffer* mDensitiesBuf; - NvFlexBuffer* mAnisotropyBuf[3]; - NvFlexBuffer* mIndicesBuf; - - int mNumFluidParticles; -}; - -FluidRenderBuffers CreateFluidRenderBuffers(int numParticles, bool enableInterop); -void DestroyFluidRenderBuffers(FluidRenderBuffers buffers); +FluidRenderBuffers* CreateFluidRenderBuffers(int numParticles, bool enableInterop); +void DestroyFluidRenderBuffers(FluidRenderBuffers* buffers); // update fluid particle buffers from a FlexSovler -void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, NvFlexSolver* flex, bool anisotropy, bool density); +void UpdateFluidRenderBuffers(FluidRenderBuffers* buffers, NvFlexSolver* flex, bool anisotropy, bool density); // update fluid particle buffers from host memory -void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, +void UpdateFluidRenderBuffers(FluidRenderBuffers* buffers, Vec4* particles, float* densities, Vec4* anisotropy1, @@ -145,38 +141,26 @@ void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, int* indices, int numIndices); -// vertex buffers for diffuse particles -struct DiffuseRenderBuffers -{ - VertexBuffer mDiffusePositionVBO; - VertexBuffer mDiffuseVelocityVBO; - IndexBuffer mDiffuseIndicesIBO; - - NvFlexBuffer* mDiffuseIndicesBuf; - NvFlexBuffer* mDiffusePositionsBuf; - NvFlexBuffer* mDiffuseVelocitiesBuf; - - int mNumDiffuseParticles; -}; - // owns diffuse particle vertex buffers -DiffuseRenderBuffers CreateDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop); -void DestroyDiffuseRenderBuffers(DiffuseRenderBuffers buffers); +DiffuseRenderBuffers* CreateDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop); +void DestroyDiffuseRenderBuffers(DiffuseRenderBuffers* buffers); // update diffuse particle vertex buffers from a NvFlexSolver -void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, NvFlexSolver* solver); +void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, NvFlexSolver* solver); // update diffuse particle vertex buffers from host memory -void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, +void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, Vec4* diffusePositions, Vec4* diffuseVelocities, - int* diffuseIndices, int numDiffuseParticles); +// Returns the number of particles in the diffuse buffers +int GetNumDiffuseRenderParticles(DiffuseRenderBuffers* buffers); + // screen space fluid rendering -void RenderEllipsoids(FluidRenderer* render, FluidRenderBuffers buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, Vec4 color, float blur, float ior, bool debug); -void RenderDiffuse(FluidRenderer* render, DiffuseRenderBuffers buffer, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, float motionBlur, float inscatter, float outscatter, bool shadow, bool front); +void RenderEllipsoids(FluidRenderer* render, FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, Vec4 color, float blur, float ior, bool debug); +void RenderDiffuse(FluidRenderer* render, DiffuseRenderBuffers* buffer, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, float motionBlur, float inscatter, float outscatter, bool shadow, bool front); // UI rendering -void imguiGraphDraw(); -void imguiGraphInit(const char* fontpath);
\ No newline at end of file + +void DrawImguiGraph(); |