Merge changes from the-witness.

This commit is contained in:
castano
2010-10-21 18:44:10 +00:00
parent 5d498d6824
commit bd74a9ffc6
27 changed files with 217 additions and 126 deletions

View File

@ -224,7 +224,7 @@ Compressor::Compressor() : m(*new Compressor::Private())
if (m.cudaEnabled)
{
#pragma message(NV_FILE_LINE "FIXME: This code is duplicated below.")
#pragma NV_MESSAGE("FIXME: This code is duplicated below.")
// Select fastest CUDA device.
int device = cuda::getFastestDevice();
if (!cuda::setDevice(device))
@ -944,7 +944,7 @@ bool Compressor::Private::compressMipmaps(uint f, const InputOptions::Private &
premultiplyAlphaMipmap(mipmap, inputOptions);
}
#pragma message(NV_FILE_LINE "TODO: All color transforms should be done here!")
#pragma NV_MESSAGE("TODO: All color transforms should be done here!")
// Apply gamma space color transforms:
if (inputOptions.colorTransform == ColorTransform_YCoCg)
@ -1231,7 +1231,7 @@ void Compressor::Private::processInputImage(Mipmap & mipmap, const InputOptions:
mipmap.toFloatImage(inputOptions);
}
#pragma message(NV_FILE_LINE "FIXME: Do not perform color transforms here!")
#pragma NV_MESSAGE("FIXME: Do not perform color transforms here!")
/*// Apply linear transforms in linear space.
if (inputOptions.colorTransform == ColorTransform_Linear)

View File

@ -61,7 +61,7 @@ namespace
}
}
#pragma message(NV_FILE_LINE "TODO: Move these functions to a common location.")
#pragma NV_MESSAGE("TODO: Move these functions to a common location.")
static int blockSize(Format format)
{
@ -288,7 +288,7 @@ bool TexImage::load(const char * fileName)
bool TexImage::save(const char * fileName) const
{
#pragma message(NV_FILE_LINE "TODO: Add support for DDS textures in TexImage::save")
#pragma NV_MESSAGE("TODO: Add support for DDS textures in TexImage::save")
if (m->imageArray.count() == 0)
{
@ -433,7 +433,7 @@ bool TexImage::setImage2D(Format format, Decoder decoder, int w, int h, int idx,
return false;
}
#pragma message(NV_FILE_LINE "TODO: Add support for all compressed formats in TexImage::setImage2D.")
#pragma NV_MESSAGE("TODO: Add support for all compressed formats in TexImage::setImage2D.")
if (format != nvtt::Format_BC1 && format != nvtt::Format_BC2 && format != nvtt::Format_BC3)
{
@ -526,7 +526,7 @@ bool TexImage::setImage2D(Format format, Decoder decoder, int w, int h, int idx,
}
#pragma message(NV_FILE_LINE "TODO: provide a TexImage::resize that can override filter width and parameters.")
#pragma NV_MESSAGE("TODO: provide a TexImage::resize that can override filter width and parameters.")
void TexImage::resize(int w, int h, ResizeFilter filter)
{
@ -537,7 +537,7 @@ void TexImage::resize(int w, int h, ResizeFilter filter)
if (m->type == TextureType_Cube)
{
#pragma message(NV_FILE_LINE "TODO: Output error when image is cubemap and w != h.")
#pragma NV_MESSAGE("TODO: Output error when image is cubemap and w != h.")
h = w;
}
@ -1014,7 +1014,7 @@ void TexImage::toNormalMap(float sm, float medium, float big, float large)
const FloatImage * img = m->imageArray[i];
m->imageArray[i] = nv::createNormalMap(img, (FloatImage::WrapMode)m->wrapMode, filterWeights);
#pragma message(NV_FILE_LINE "TODO: Pack and expand normals explicitly?")
#pragma NV_MESSAGE("TODO: Pack and expand normals explicitly?")
m->imageArray[i]->packNormals(0);
delete img;

View File

@ -37,7 +37,6 @@
#include <time.h>
#include <stdio.h>
#if defined HAVE_CUDA
#include <cuda_runtime_api.h>
@ -129,6 +128,8 @@ void CudaCompressor::compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alp
{
nvDebugCheck(cuda::isHardwarePresent());
#if defined HAVE_CUDA
// Allocate image as a cuda array.
cudaArray * d_image;
if (inputFormat == nvtt::InputFormat_BGRA_8UB)
@ -141,7 +142,7 @@ void CudaCompressor::compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alp
}
else
{
#pragma message(NV_FILE_LINE "FIXME: Floating point textures not really supported by CUDA compressors.") // @@ What's missing???
#pragma NV_MESSAGE("FIXME: Floating point textures not really supported by CUDA compressors.") // @@ What's missing???
cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(32, 32, 32, 32, cudaChannelFormatKindFloat);
cudaMallocArray(&d_image, &channelDesc, w, h);
@ -189,8 +190,14 @@ void CudaCompressor::compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alp
free(h_result);
cudaFreeArray(d_image);
#else
outputOptions.error(Error_CudaError);
#endif
}
#if defined HAVE_CUDA
void CudaCompressorDXT1::setup(cudaArray * image, const nvtt::CompressionOptions::Private & compressionOptions)
{
@ -589,3 +596,5 @@ void CudaCompressor::compressDXT5n(const nvtt::CompressionOptions::Private & com
}
#endif // 0
#endif // defined HAVE_CUDA

View File

@ -55,6 +55,3 @@ void nvttCompressImage(NvttImage * img, NvttFormat format)
// @@ Invoke appropriate compressor.
}
#endif // NVTT_EXPERIMENTAL_H

View File

@ -26,7 +26,7 @@
#ifndef SQUISH_ALPHA_H
#define SQUISH_ALPHA_H
#include <squish.h>
#include "squish.h"
namespace squish {

View File

@ -23,7 +23,7 @@
-------------------------------------------------------------------------- */
#include <squish.h>
#include "squish.h"
#include "colourset.h"
#include "maths.h"
#include "rangefit.h"

View File

@ -373,6 +373,8 @@ int main(int argc, char *argv[])
printf(" 1: \tWaterloo.\n");
printf(" 2: \tEpic.\n");
printf(" 3: \tFarbrausch.\n");
printf(" 4: \Lugaru.\n");
printf(" 5: \Quake 3.\n");
printf(" -dec x \tDecompressor.\n");
printf(" 0: \tReference.\n");
printf(" 1: \tNVIDIA.\n");
@ -422,7 +424,7 @@ int main(int argc, char *argv[])
FileSystem::createDirectory(outPath);
Path csvFileName;
csvFileName.format("%s/result.csv", outPath);
csvFileName.format("%s/result-%d.csv", outPath, set);
StdOutputStream csvStream(csvFileName.str());
TextWriter csvWriter(&csvStream);

View File

@ -116,7 +116,7 @@ int main(int argc, char *argv[])
}
nv::Image image;
if (!loadImage(image, input.str())) return 1;
if (!loadImage(image, input.str())) return 1;
nv::ImageIO::ImageMetaData metaData;
metaData.tagMap.add("Thumb::Image::Width", nv::StringBuilder().number (image.width()));
@ -143,13 +143,13 @@ int main(int argc, char *argv[])
nv::AutoPtr<nv::Image> result(fresult->createImageGammaCorrect(gamma));
result->setFormat(nv::Image::Format_ARGB);
nv::StdOutputStream stream(output.str());
nv::ImageIO::save(output.str(), stream, result.ptr(), &metaData);
nv::StdOutputStream stream(output.str());
nv::ImageIO::save(output.str(), stream, result.ptr(), &metaData);
}
else
{
nv::StdOutputStream stream(output.str());
nv::ImageIO::save(output.str(), stream, &image, &metaData);
nv::StdOutputStream stream(output.str());
nv::ImageIO::save(output.str(), stream, &image, &metaData);
}
return 0;