From 051ee49098fdff4db6b5d79c7c893d56f50ee9d4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 12 Aug 2015 10:18:09 +0000 Subject: [PATCH] Updated shaders from OpenSceneGraph-Data with refactor of workaround to NVidia driver bug git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15110 16af8721-9629-0410-8352-f15c8da7e697 --- src/osgVolume/Shaders/volume_frag.cpp | 9 ++++----- src/osgVolume/Shaders/volume_iso_frag.cpp | 9 ++++----- src/osgVolume/Shaders/volume_lit_frag.cpp | 9 ++++----- src/osgVolume/Shaders/volume_lit_tf_frag.cpp | 9 ++++----- src/osgVolume/Shaders/volume_mip_frag.cpp | 9 ++++----- src/osgVolume/Shaders/volume_tf_frag.cpp | 9 ++++----- src/osgVolume/Shaders/volume_tf_iso_frag.cpp | 9 ++++----- src/osgVolume/Shaders/volume_tf_mip_frag.cpp | 9 ++++----- 8 files changed, 32 insertions(+), 40 deletions(-) diff --git a/src/osgVolume/Shaders/volume_frag.cpp b/src/osgVolume/Shaders/volume_frag.cpp index 8f57ffced..0dc54a573 100644 --- a/src/osgVolume/Shaders/volume_frag.cpp +++ b/src/osgVolume/Shaders/volume_frag.cpp @@ -71,13 +71,12 @@ char volume_frag[] = "#version 110\n" "\n" " float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n" "\n" - " #ifdef NVIDIA_Corporation\n" - " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" - " if (num_iterations!=num_iterations) num_iterations = min_iteratrions;\n" - " #endif\n" - "\n" " if (num_iterationsmax_iteratrions) num_iterations = max_iteratrions;\n" + " #ifdef NVIDIA_Corporation\n" + " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" + " else if (num_iterations!=num_iterations) num_iterations = max_iteratrions;\n" + " #endif\n" "\n" " vec3 deltaTexCoord=(te-t0).xyz/(num_iterations-1.0);\n" " vec3 texcoord = t0.xyz;\n" diff --git a/src/osgVolume/Shaders/volume_iso_frag.cpp b/src/osgVolume/Shaders/volume_iso_frag.cpp index f062ed19f..77edbeeb2 100644 --- a/src/osgVolume/Shaders/volume_iso_frag.cpp +++ b/src/osgVolume/Shaders/volume_iso_frag.cpp @@ -71,13 +71,12 @@ char volume_iso_frag[] = "#version 110\n" "\n" " float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n" "\n" - " #ifdef NVIDIA_Corporation\n" - " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" - " if (num_iterations!=num_iterations) num_iterations = min_iteratrions;\n" - " #endif\n" - "\n" " if (num_iterationsmax_iteratrions) num_iterations = max_iteratrions;\n" + " #ifdef NVIDIA_Corporation\n" + " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" + " else if (num_iterations!=num_iterations) num_iterations = max_iteratrions;\n" + " #endif\n" "\n" " vec3 deltaTexCoord=(t0-te).xyz/float(num_iterations-1.0);\n" " vec3 texcoord = te.xyz;\n" diff --git a/src/osgVolume/Shaders/volume_lit_frag.cpp b/src/osgVolume/Shaders/volume_lit_frag.cpp index 5263e81ed..ef1ecc1d9 100644 --- a/src/osgVolume/Shaders/volume_lit_frag.cpp +++ b/src/osgVolume/Shaders/volume_lit_frag.cpp @@ -71,13 +71,12 @@ char volume_lit_frag[] = "#version 110\n" "\n" " float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n" "\n" - " #ifdef NVIDIA_Corporation\n" - " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" - " if (num_iterations!=num_iterations) num_iterations = min_iteratrions;\n" - " #endif\n" - "\n" " if (num_iterationsmax_iteratrions) num_iterations = max_iteratrions;\n" + " #ifdef NVIDIA_Corporation\n" + " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" + " else if (num_iterations!=num_iterations) num_iterations = max_iteratrions;\n" + " #endif\n" "\n" " vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n" " vec3 texcoord = t0.xyz;\n" diff --git a/src/osgVolume/Shaders/volume_lit_tf_frag.cpp b/src/osgVolume/Shaders/volume_lit_tf_frag.cpp index 662f15bad..9f1b5cd63 100644 --- a/src/osgVolume/Shaders/volume_lit_tf_frag.cpp +++ b/src/osgVolume/Shaders/volume_lit_tf_frag.cpp @@ -78,13 +78,12 @@ char volume_lit_tf_frag[] = "#version 110\n" "\n" " float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n" "\n" - " #ifdef NVIDIA_Corporation\n" - " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" - " if (num_iterations!=num_iterations) num_iterations = min_iteratrions;\n" - " #endif\n" - "\n" " if (num_iterationsmax_iteratrions) num_iterations = max_iteratrions;\n" + " #ifdef NVIDIA_Corporation\n" + " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" + " else if (num_iterations!=num_iterations) num_iterations = max_iteratrions;\n" + " #endif\n" "\n" " vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n" " vec3 texcoord = t0.xyz;\n" diff --git a/src/osgVolume/Shaders/volume_mip_frag.cpp b/src/osgVolume/Shaders/volume_mip_frag.cpp index 73b6468df..b3f3c03a8 100644 --- a/src/osgVolume/Shaders/volume_mip_frag.cpp +++ b/src/osgVolume/Shaders/volume_mip_frag.cpp @@ -70,13 +70,12 @@ char volume_mip_frag[] = "#version 110\n" "\n" " float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n" "\n" - " #ifdef NVIDIA_Corporation\n" - " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" - " if (num_iterations!=num_iterations) num_iterations = min_iteratrions;\n" - " #endif\n" - "\n" " if (num_iterationsmax_iteratrions) num_iterations = max_iteratrions;\n" + " #ifdef NVIDIA_Corporation\n" + " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" + " else if (num_iterations!=num_iterations) num_iterations = max_iteratrions;\n" + " #endif\n" "\n" " vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n" " vec3 texcoord = t0.xyz;\n" diff --git a/src/osgVolume/Shaders/volume_tf_frag.cpp b/src/osgVolume/Shaders/volume_tf_frag.cpp index 46bae8c44..81dc92e41 100644 --- a/src/osgVolume/Shaders/volume_tf_frag.cpp +++ b/src/osgVolume/Shaders/volume_tf_frag.cpp @@ -75,13 +75,12 @@ char volume_tf_frag[] = "#version 110\n" "\n" " float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n" "\n" - " #ifdef NVIDIA_Corporation\n" - " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" - " if (num_iterations!=num_iterations) num_iterations = min_iteratrions;\n" - " #endif\n" - "\n" " if (num_iterationsmax_iteratrions) num_iterations = max_iteratrions;\n" + " #ifdef NVIDIA_Corporation\n" + " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" + " else if (num_iterations!=num_iterations) num_iterations = max_iteratrions;\n" + " #endif\n" "\n" " vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n" " vec3 texcoord = t0.xyz;\n" diff --git a/src/osgVolume/Shaders/volume_tf_iso_frag.cpp b/src/osgVolume/Shaders/volume_tf_iso_frag.cpp index 2df672f4f..8a029e41c 100644 --- a/src/osgVolume/Shaders/volume_tf_iso_frag.cpp +++ b/src/osgVolume/Shaders/volume_tf_iso_frag.cpp @@ -76,13 +76,12 @@ char volume_tf_iso_frag[] = "#version 110\n" "\n" " float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n" "\n" - " #ifdef NVIDIA_Corporation\n" - " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" - " if (num_iterations!=num_iterations) num_iterations = min_iteratrions;\n" - " #endif\n" - "\n" " if (num_iterationsmax_iteratrions) num_iterations = max_iteratrions;\n" + " #ifdef NVIDIA_Corporation\n" + " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" + " else if (num_iterations!=num_iterations) num_iterations = max_iteratrions;\n" + " #endif\n" "\n" " vec3 deltaTexCoord=(t0-te).xyz/float(num_iterations-1.0);\n" " vec3 texcoord = te.xyz;\n" diff --git a/src/osgVolume/Shaders/volume_tf_mip_frag.cpp b/src/osgVolume/Shaders/volume_tf_mip_frag.cpp index 2aaea2201..91290dfbd 100644 --- a/src/osgVolume/Shaders/volume_tf_mip_frag.cpp +++ b/src/osgVolume/Shaders/volume_tf_mip_frag.cpp @@ -75,13 +75,12 @@ char volume_tf_mip_frag[] = "#version 110\n" "\n" " float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n" "\n" - " #ifdef NVIDIA_Corporation\n" - " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" - " if (num_iterations!=num_iterations) num_iterations = min_iteratrions;\n" - " #endif\n" - "\n" " if (num_iterationsmax_iteratrions) num_iterations = max_iteratrions;\n" + " #ifdef NVIDIA_Corporation\n" + " // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n" + " else if (num_iterations!=num_iterations) num_iterations = max_iteratrions;\n" + " #endif\n" "\n" " vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n" " vec3 texcoord = t0.xyz;\n"