From 1454cbac14d93e3bdd12d6ce1d6085dd89f89e6e Mon Sep 17 00:00:00 2001 From: castano Date: Fri, 28 May 2010 07:45:11 +0000 Subject: [PATCH] Fix build. --- src/nvcore/FileSystem.cpp | 4 +- src/nvcore/Ptr.h | 11 +- src/nvcore/nvcore.h | 6 +- src/nvmath/CMakeLists.txt | 2 +- src/nvtt/CompressorDXT.cpp | 8 +- src/nvtt/InputOptions.cpp | 2 +- src/nvtt/OptimalCompressDXT.cpp | 2 +- src/nvtt/QuickCompressDXT.cpp | 26 +- src/nvtt/TexImage.cpp | 42 +- src/nvtt/TexImage.h | 2 +- src/nvtt/cuda/CudaCompressorDXT.cpp | 9 +- src/nvtt/tools/cmdline.h | 2 +- src/nvtt/tools/ddsview.cpp | 2 +- src/nvtt/tools/imgdiff.cpp | 3 +- src/nvtt/tools/resize.cpp | 1 - src/nvtt/tools/thumbnailer.cpp | 1 - src/nvtt/tools/ui/configdialog.ui | 591 ++++++++++++++-------------- 17 files changed, 347 insertions(+), 367 deletions(-) diff --git a/src/nvcore/FileSystem.cpp b/src/nvcore/FileSystem.cpp index f58034c..16bb48c 100644 --- a/src/nvcore/FileSystem.cpp +++ b/src/nvcore/FileSystem.cpp @@ -7,12 +7,12 @@ //#include // PathFileExists #include // GetFileAttributes #include // _mkdir -#include // remove, unlink #else #include #include #include #endif +#include // remove, unlink using namespace nv; @@ -59,4 +59,4 @@ bool FileSystem::removeFile(const char * path) { // @@ Use unlink or remove? return remove(path) == 0; -} \ No newline at end of file +} diff --git a/src/nvcore/Ptr.h b/src/nvcore/Ptr.h index 70f6174..2d58f28 100644 --- a/src/nvcore/Ptr.h +++ b/src/nvcore/Ptr.h @@ -5,13 +5,12 @@ #include "nvcore.h" #include "Debug.h" +#include "RefCounted.h" // WeakProxy namespace nv { - class WeakProxy; - /** Simple auto pointer template class. * * This is very similar to the standard auto_ptr class, but with some @@ -274,10 +273,10 @@ namespace nv void operator=(T * p) { - if (p) { + if (p != NULL) { m_proxy = p->getWeakProxy(); - assert(m_proxy != NULL); - assert(m_proxy->ptr() == p); + nvDebugCheck(m_proxy != NULL); + nvDebugCheck(m_proxy->ptr() == p); } else { m_proxy = NULL; @@ -298,7 +297,7 @@ namespace nv T * operator->() const { T * p = ptr(); - assert(p != NULL); + nvDebugCheck(p != NULL); return p; } diff --git a/src/nvcore/nvcore.h b/src/nvcore/nvcore.h index d0adab8..7317667 100644 --- a/src/nvcore/nvcore.h +++ b/src/nvcore/nvcore.h @@ -132,7 +132,8 @@ #define NV_STRING2(x) #x #define NV_STRING(x) NV_STRING2(x) #if NV_CC_GNUC -#define NV_FILE_LINE __FILE__ ":" NV_STRING(__LINE__) ": " +//#define NV_FILE_LINE __FILE__ ":" NV_STRING(__LINE__) ": " +#define NV_FILE_LINE #else #define NV_FILE_LINE __FILE__ "(" NV_STRING(__LINE__) ") : " #endif @@ -153,6 +154,9 @@ /// Null index. @@ Move this somewhere else... This could have collisions with other definitions! #define NIL uint(~0) +// @@ Move this to DefsGnuc? +#include // size_t, NULL + /// Null pointer. #ifndef NULL #define NULL 0 diff --git a/src/nvmath/CMakeLists.txt b/src/nvmath/CMakeLists.txt index 2b6349f..53c6b13 100644 --- a/src/nvmath/CMakeLists.txt +++ b/src/nvmath/CMakeLists.txt @@ -5,7 +5,7 @@ SET(MATH_SRCS Vector.h Matrix.h Plane.h Plane.cpp - Box.h Box.cpp + Box.h Color.h Half.h Half.cpp Fitting.h Fitting.cpp) diff --git a/src/nvtt/CompressorDXT.cpp b/src/nvtt/CompressorDXT.cpp index 5d195f6..917e776 100644 --- a/src/nvtt/CompressorDXT.cpp +++ b/src/nvtt/CompressorDXT.cpp @@ -213,7 +213,7 @@ void FastCompressorBC5::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMo void NormalCompressorDXT1::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output) { nvsquish::WeightedClusterFit fit; - fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z()); + fit.SetMetric(compressionOptions.colorWeight.x, compressionOptions.colorWeight.y, compressionOptions.colorWeight.z); if (rgba.isSingleColor()) { @@ -250,7 +250,7 @@ void NormalCompressorDXT1a::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alp else { nvsquish::WeightedClusterFit fit; - fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z()); + fit.SetMetric(compressionOptions.colorWeight.x, compressionOptions.colorWeight.y, compressionOptions.colorWeight.z); int flags = nvsquish::kDxt1; if (alphaMode == nvtt::AlphaMode_Transparency) flags |= nvsquish::kWeightColourByAlpha; @@ -278,7 +278,7 @@ void NormalCompressorDXT3::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alph else { nvsquish::WeightedClusterFit fit; - fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z()); + fit.SetMetric(compressionOptions.colorWeight.x, compressionOptions.colorWeight.y, compressionOptions.colorWeight.z); int flags = 0; if (alphaMode == nvtt::AlphaMode_Transparency) flags |= nvsquish::kWeightColourByAlpha; @@ -312,7 +312,7 @@ void NormalCompressorDXT5::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alph else { nvsquish::WeightedClusterFit fit; - fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z()); + fit.SetMetric(compressionOptions.colorWeight.x, compressionOptions.colorWeight.y, compressionOptions.colorWeight.z); int flags = 0; if (alphaMode == nvtt::AlphaMode_Transparency) flags |= nvsquish::kWeightColourByAlpha; diff --git a/src/nvtt/InputOptions.cpp b/src/nvtt/InputOptions.cpp index ff89888..8101236 100644 --- a/src/nvtt/InputOptions.cpp +++ b/src/nvtt/InputOptions.cpp @@ -23,7 +23,7 @@ #include // memcpy -#include // nextPowerOfTwo +#include // nextPowerOfTwo #include #include diff --git a/src/nvtt/OptimalCompressDXT.cpp b/src/nvtt/OptimalCompressDXT.cpp index 3070519..474b768 100644 --- a/src/nvtt/OptimalCompressDXT.cpp +++ b/src/nvtt/OptimalCompressDXT.cpp @@ -29,7 +29,7 @@ #include -#include // swap +#include // swap #include diff --git a/src/nvtt/QuickCompressDXT.cpp b/src/nvtt/QuickCompressDXT.cpp index 9328f69..8b6b2bf 100644 --- a/src/nvtt/QuickCompressDXT.cpp +++ b/src/nvtt/QuickCompressDXT.cpp @@ -21,7 +21,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. -#include // swap +#include // swap #include #include @@ -86,23 +86,23 @@ inline static void selectDiagonal(const Vector3 * block, uint num, Vector3 * res for (uint i = 0; i < num; i++) { Vector3 t = block[i] - center; - covariance += t.xy() * t.z(); + covariance += t.xy() * t.z; } - float x0 = maxColor->x(); - float y0 = maxColor->y(); - float x1 = minColor->x(); - float y1 = minColor->y(); + float x0 = maxColor->x; + float y0 = maxColor->y; + float x1 = minColor->x; + float y1 = minColor->y; - if (covariance.x() < 0) { + if (covariance.x < 0) { swap(x0, x1); } - if (covariance.y() < 0) { + if (covariance.y < 0) { swap(y0, y1); } - maxColor->set(x0, y0, maxColor->z()); - minColor->set(x1, y1, minColor->z()); + maxColor->set(x0, y0, maxColor->z); + minColor->set(x1, y1, minColor->z); } inline static void insetBBox(Vector3 * restrict maxColor, Vector3 * restrict minColor) @@ -114,9 +114,9 @@ inline static void insetBBox(Vector3 * restrict maxColor, Vector3 * restrict min inline static uint16 roundAndExpand(Vector3 * restrict v) { - uint r = uint(clamp(v->x() * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f); - uint g = uint(clamp(v->y() * (63.0f / 255.0f), 0.0f, 63.0f) + 0.5f); - uint b = uint(clamp(v->z() * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f); + uint r = uint(clamp(v->x * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f); + uint g = uint(clamp(v->y * (63.0f / 255.0f), 0.0f, 63.0f) + 0.5f); + uint b = uint(clamp(v->z * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f); uint16 w = (r << 11) | (g << 5) | b; diff --git a/src/nvtt/TexImage.cpp b/src/nvtt/TexImage.cpp index 2499301..8d51071 100644 --- a/src/nvtt/TexImage.cpp +++ b/src/nvtt/TexImage.cpp @@ -501,10 +501,10 @@ bool TexImage::setImage2D(Format format, Decoder decoder, int w, int h, int idx, if (x * 4 + xx < w && y * 4 + yy < h) { - img->setPixel(float(c.r) * 1.0f/255.0f, x*4 + xx, y*4 + yy, 0); - img->setPixel(float(c.g) * 1.0f/255.0f, x*4 + xx, y*4 + yy, 1); - img->setPixel(float(c.b) * 1.0f/255.0f, x*4 + xx, y*4 + yy, 2); - img->setPixel(float(c.a) * 1.0f/255.0f, x*4 + xx, y*4 + yy, 3); + img->pixel(x*4 + xx, y*4 + yy, 0) = float(c.r) * 1.0f/255.0f; + img->pixel(x*4 + xx, y*4 + yy, 1) = float(c.g) * 1.0f/255.0f; + img->pixel(x*4 + xx, y*4 + yy, 2) = float(c.b) * 1.0f/255.0f; + img->pixel(x*4 + xx, y*4 + yy, 3) = float(c.a) * 1.0f/255.0f; } } } @@ -908,28 +908,28 @@ void TexImage::setBorder(float r, float g, float b, float a) for (int i = 0; i < w; i++) { - img->setPixel(r, i, 0, 0); - img->setPixel(g, i, 0, 1); - img->setPixel(b, i, 0, 2); - img->setPixel(a, i, 0, 3); + img->pixel(i, 0, 0) = r; + img->pixel(i, 0, 1) = g; + img->pixel(i, 0, 2) = b; + img->pixel(i, 0, 3) = a; - img->setPixel(r, i, h-1, 0); - img->setPixel(g, i, h-1, 1); - img->setPixel(b, i, h-1, 2); - img->setPixel(a, i, h-1, 3); + img->pixel(i, h-1, 0) = r; + img->pixel(i, h-1, 1) = g; + img->pixel(i, h-1, 2) = b; + img->pixel(i, h-1, 3) = a; } for (int i = 0; i < h; i++) { - img->setPixel(r, 0, i, 0); - img->setPixel(g, 0, i, 1); - img->setPixel(b, 0, i, 2); - img->setPixel(a, 0, i, 3); + img->pixel(0, i, 0) = r; + img->pixel(0, i, 1) = g; + img->pixel(0, i, 2) = b; + img->pixel(0, i, 3) = a; - img->setPixel(r, w-1, i, 0); - img->setPixel(g, w-1, i, 1); - img->setPixel(b, w-1, i, 2); - img->setPixel(a, w-1, i, 3); + img->pixel(w-1, i, 0) = r; + img->pixel(w-1, i, 1) = g; + img->pixel(w-1, i, 2) = b; + img->pixel(w-1, i, 3) = a; } } } @@ -1134,4 +1134,4 @@ void TexImage::flipVertically() { m->imageArray[i]->flip(); } -} \ No newline at end of file +} diff --git a/src/nvtt/TexImage.h b/src/nvtt/TexImage.h index c2aa017..d35aba1 100644 --- a/src/nvtt/TexImage.h +++ b/src/nvtt/TexImage.h @@ -26,7 +26,7 @@ #include "nvtt.h" -#include +#include #include #include diff --git a/src/nvtt/cuda/CudaCompressorDXT.cpp b/src/nvtt/cuda/CudaCompressorDXT.cpp index 452480a..b330244 100644 --- a/src/nvtt/cuda/CudaCompressorDXT.cpp +++ b/src/nvtt/cuda/CudaCompressorDXT.cpp @@ -21,8 +21,11 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. +#include "CudaCompressorDXT.h" +#include "CudaUtils.h" + #include -#include +#include #include #include #include @@ -32,10 +35,6 @@ #include #include -#include "CudaCompressorDXT.h" -#include "CudaUtils.h" - - #if defined HAVE_CUDA #include #endif diff --git a/src/nvtt/tools/cmdline.h b/src/nvtt/tools/cmdline.h index f4b48b6..c9900ee 100644 --- a/src/nvtt/tools/cmdline.h +++ b/src/nvtt/tools/cmdline.h @@ -57,7 +57,7 @@ struct MyAssertHandler : public nv::AssertHandler { } // Handler method, note that func might be NULL! - virtual int assert( const char *exp, const char *file, int line, const char *func ) { + virtual int assertion( const char *exp, const char *file, int line, const char *func ) { fprintf(stderr, "Assertion failed: %s\nIn %s:%d\n", exp, file, line); nv::debug::dumpInfo(); exit(1); diff --git a/src/nvtt/tools/ddsview.cpp b/src/nvtt/tools/ddsview.cpp index 7d033c7..7b3dead 100644 --- a/src/nvtt/tools/ddsview.cpp +++ b/src/nvtt/tools/ddsview.cpp @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) uint w = dds.width(); uint h = dds.height(); - // @@ Clamp window size is texture larger than desktop? + // @@ Clamp window size if texture larger than desktop? glutInit(&argc, argv); diff --git a/src/nvtt/tools/imgdiff.cpp b/src/nvtt/tools/imgdiff.cpp index 0d2e339..60e3f4d 100644 --- a/src/nvtt/tools/imgdiff.cpp +++ b/src/nvtt/tools/imgdiff.cpp @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -123,7 +122,7 @@ struct NormalError vc = nv::normalize(2.0f * (vc / 255.0f) - 1.0f); ade += acosf(nv::clamp(dot(vo, vc), -1.0f, 1.0f)); - mse += length_squared((vo - vc) * (255 / 2.0f)); + mse += lengthSquared((vo - vc) * (255 / 2.0f)); samples++; } diff --git a/src/nvtt/tools/resize.cpp b/src/nvtt/tools/resize.cpp index 3dc8282..40b5781 100644 --- a/src/nvtt/tools/resize.cpp +++ b/src/nvtt/tools/resize.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/src/nvtt/tools/thumbnailer.cpp b/src/nvtt/tools/thumbnailer.cpp index 8f5ea2c..8b56f8c 100644 --- a/src/nvtt/tools/thumbnailer.cpp +++ b/src/nvtt/tools/thumbnailer.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/src/nvtt/tools/ui/configdialog.ui b/src/nvtt/tools/ui/configdialog.ui index 42d2b49..126f5d6 100644 --- a/src/nvtt/tools/ui/configdialog.ui +++ b/src/nvtt/tools/ui/configdialog.ui @@ -1,7 +1,8 @@ - + + ConfigDialog - - + + 0 0 @@ -9,70 +10,71 @@ 475 - + NVIDIA Texture Tools - + true - + - + - + - - + + 64 0 - + 128 16777215 - + Qt::ScrollBarAlwaysOff - + QListView::Static - + QListView::TopToBottom - + false - + QListView::Adjust - + QListView::ListMode - + Input Options - + Compression Options - + Output Options - + Preview - - ../../../../../../castano-stuff/qshaderedit/src/images/colorpicker.png + + + ../../../../../../castano-stuff/qshaderedit/src/images/colorpicker.png../../../../../../castano-stuff/qshaderedit/src/images/colorpicker.png @@ -80,63 +82,54 @@ - - - + + + 0 0 - - 3 + + 2 - - - - -1 + + + + 6 - - 0 - - - 0 - - - 0 - - + 0 - - + + 0 - + Qt::ElideNone - + false - - + + File Path - + - + - + - - - + + + 0 0 - + Open @@ -144,48 +137,48 @@ - + - - + + Image Settings - + - + - - - + + + 0 0 - + Color Mode - + Qt::AlignHCenter - - + + 0 - - + + RGB - + true - - + + Normal Map @@ -194,46 +187,46 @@ - - - + + + 0 0 - + Alpha Mode - + Qt::AlignHCenter - - + + 0 - - + + None - + false - - + + Transparency - + true - - + + Premultiplied @@ -244,46 +237,46 @@ - - + + 0 - - - + + + 0 0 - + Wrap Mode: - + mipmapFilterComboBox - - + + 16777215 26 - + Mirror - + Repeat - + Clamp @@ -292,44 +285,44 @@ - + - - - + + + 0 0 - + Input Gamma: - + inputGammaSpinBox - - - + + + 0 0 - + QAbstractSpinBox::UpDownArrows - + 0.050000000000000 - + 4.000000000000000 - + 0.050000000000000 - + 2.200000000000000 @@ -337,44 +330,44 @@ - + - - - + + + 0 0 - + Output Gamma: - + inputGammaSpinBox - - - + + + 0 0 - + QAbstractSpinBox::UpDownArrows - + 0.050000000000000 - + 4.000000000000000 - + 0.050000000000000 - + 2.200000000000000 @@ -383,10 +376,10 @@ - + Qt::Vertical - + 433 16 @@ -396,91 +389,97 @@ - - + + Mipmaps - + - - + + + + 0 + 0 + + + Generate mipmaps - + true - - + + 1 - - - + + + 0 0 - + Mipmap filter: - + mipmapFilterComboBox - - + + 16777215 26 - + Box - + Triangle - + Kaiser - - + + false - - + + 0 0 - + 16777215 24 - + false - + ... - + Qt::ToolButtonTextOnly @@ -488,48 +487,48 @@ - + - - - + + + 0 0 - + Limit Mipmaps - - + + false - - + + 0 0 - + Max Level: - - + + false - - + + 0 0 - + 80 16777215 @@ -541,10 +540,10 @@ - + Qt::Vertical - + 204 71 @@ -554,8 +553,8 @@ - - + + Normal Map @@ -563,78 +562,69 @@ - - - - 0 - - - 0 - - - 0 - - + + + 0 - + - - - + + + 0 0 - + Format: - + Qt::PlainText - + Qt::NoTextInteraction - + formatComboBox - + - + Uncompressed - + BC1 (DXT1) - + BC1a (DXT1a) - + BC2 (DXT3) - + BC3 (DXT5) - + BC4 - + BC5 @@ -643,51 +633,51 @@ - + - - - + + + 0 0 - + Quality: - + Qt::PlainText - + Qt::NoTextInteraction - + formatComboBox - - + + 1 - + Fastest - + Normal - + Production - + Highest @@ -696,13 +686,13 @@ - + - + Qt::Horizontal - + 40 20 @@ -711,41 +701,41 @@ - - - + + + 0 0 - + Color Weights - + Qt::AlignHCenter - + - + - - + + Red - + redSpinBox - - + + 1.000000000000000 - + 0.050000000000000 - + 1.000000000000000 @@ -753,26 +743,26 @@ - + - - + + Green - + greenSpinBox - - + + 1.000000000000000 - + 0.050000000000000 - + 1.000000000000000 @@ -780,26 +770,26 @@ - + - - + + Blue - + blueSpinBox - - + + 1.000000000000000 - + 0.050000000000000 - + 1.000000000000000 @@ -807,38 +797,38 @@ - + - - + + 16777215 22 - + Uniform Weights - + true - + true - - + + 16777215 22 - + Luminance Weights - + true @@ -850,10 +840,10 @@ - + Qt::Horizontal - + 40 20 @@ -865,10 +855,10 @@ - + Qt::Vertical - + 484 31 @@ -878,43 +868,34 @@ - - - - - 0 - - - 0 - - - 0 - - + + + + 0 - + - + - + - - + + Bilinear Filter - + true - - + + View difference @@ -928,43 +909,43 @@ - - + + Qt::Horizontal - + - - + + Default - - + + true - + 0 - + true - + Qt::Horizontal - + false - - + + Quit @@ -981,11 +962,11 @@ stackedWidget setCurrentIndex(int) - + 118 193 - + 154 220 @@ -997,11 +978,11 @@ ConfigDialog accept() - + 565 491 - + 582 506 @@ -1013,11 +994,11 @@ maxLevelSpinBox setEnabled(bool) - + 451 120 - + 524 120 @@ -1029,11 +1010,11 @@ maxLevelLabel setEnabled(bool) - + 337 120 - + 482 124