Merge recent changes from the witness.
This commit is contained in:
parent
47e8f23e9f
commit
e8dc679874
@ -1,4 +1,4 @@
|
|||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
|
||||||
PROJECT(NV)
|
PROJECT(NV)
|
||||||
ENABLE_TESTING()
|
ENABLE_TESTING()
|
||||||
|
|
||||||
|
2386
cmake/FindCUDA.cmake
2386
cmake/FindCUDA.cmake
File diff suppressed because it is too large
Load Diff
@ -13,25 +13,13 @@ IF (WIN32)
|
|||||||
${GLEW_ROOT_DIR}/include
|
${GLEW_ROOT_DIR}/include
|
||||||
DOC "The directory where GL/glew.h resides")
|
DOC "The directory where GL/glew.h resides")
|
||||||
|
|
||||||
IF (NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
|
FIND_LIBRARY( GLEW_LIBRARY
|
||||||
FIND_LIBRARY( GLEW_LIBRARY
|
NAMES glew GLEW glew32 glew32s
|
||||||
NAMES glew64 glew64s
|
PATHS
|
||||||
PATHS
|
$ENV{PROGRAMFILES}/GLEW/lib
|
||||||
$ENV{PROGRAMFILES}/GLEW/lib
|
${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
|
||||||
${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
|
${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
|
||||||
${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
|
DOC "The GLEW library")
|
||||||
DOC "The GLEW library (64-bit)"
|
|
||||||
)
|
|
||||||
ELSE(NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
|
|
||||||
FIND_LIBRARY( GLEW_LIBRARY
|
|
||||||
NAMES glew GLEW glew32 glew32s
|
|
||||||
PATHS
|
|
||||||
$ENV{PROGRAMFILES}/GLEW/lib
|
|
||||||
${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
|
|
||||||
${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
|
|
||||||
DOC "The GLEW library"
|
|
||||||
)
|
|
||||||
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
|
|
||||||
ELSE (WIN32)
|
ELSE (WIN32)
|
||||||
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
|
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
|
||||||
/usr/include
|
/usr/include
|
||||||
@ -59,4 +47,3 @@ IF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY)
|
|||||||
SET(GLEW_LIBRARIES ${GLEW_LIBRARY})
|
SET(GLEW_LIBRARIES ${GLEW_LIBRARY})
|
||||||
SET(GLEW_FOUND "YES")
|
SET(GLEW_FOUND "YES")
|
||||||
ENDIF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY)
|
ENDIF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY)
|
||||||
|
|
||||||
|
@ -1,79 +1,61 @@
|
|||||||
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
|
|
||||||
# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
|
# For more information, please see: http://software.sci.utah.edu
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
|
# The MIT License
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007-2009
|
# Copyright (c) 2007
|
||||||
# Scientific Computing and Imaging Institute, University of Utah
|
# Scientific Computing and Imaging Institute, University of Utah
|
||||||
#
|
#
|
||||||
# This code is licensed under the MIT License. See the FindCUDA.cmake script
|
# License for the specific language governing rights and limitations under
|
||||||
# for the text of the license.
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
# copy of this software and associated documentation files (the "Software"),
|
||||||
# The MIT License
|
# to deal in the Software without restriction, including without limitation
|
||||||
#
|
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
# License for the specific language governing rights and limitations under
|
# and/or sell copies of the Software, and to permit persons to whom the
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
# Software is furnished to do so, subject to the following conditions:
|
||||||
# copy of this software and associated documentation files (the "Software"),
|
#
|
||||||
# to deal in the Software without restriction, including without limitation
|
# The above copyright notice and this permission notice shall be included
|
||||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
# in all copies or substantial portions of the Software.
|
||||||
# and/or sell copies of the Software, and to permit persons to whom the
|
#
|
||||||
# Software is furnished to do so, subject to the following conditions:
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
#
|
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
# The above copyright notice and this permission notice shall be included
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
# in all copies or substantial portions of the Software.
|
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
#
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
# DEALINGS IN THE SOFTWARE.
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
# Make2cmake CMake Script
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
# Abe Stephens and James Bigler
|
||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
# (c) 2007 Scientific Computing and Imaging Institute, University of Utah
|
||||||
# DEALINGS IN THE SOFTWARE.
|
# Note that the REGEX expressions may need to be tweaked for different dependency generators.
|
||||||
#
|
|
||||||
|
file(READ ${input_file} depend_text)
|
||||||
#######################################################################
|
|
||||||
# This converts a file written in makefile syntax into one that can be included
|
if (${depend_text} MATCHES ".+")
|
||||||
# by CMake.
|
|
||||||
|
# message("FOUND DEPENDS")
|
||||||
file(READ ${input_file} depend_text)
|
|
||||||
|
# Remember, four backslashes is escaped to one backslash in the string.
|
||||||
if (${depend_text} MATCHES ".+")
|
string(REGEX REPLACE "\\\\ " " " depend_text ${depend_text})
|
||||||
|
|
||||||
# message("FOUND DEPENDS")
|
# This works for the nvcc -M generated dependency files.
|
||||||
|
string(REGEX REPLACE "^.* : " "" depend_text ${depend_text})
|
||||||
# Remember, four backslashes is escaped to one backslash in the string.
|
string(REGEX REPLACE "[ \\\\]*\n" ";" depend_text ${depend_text})
|
||||||
string(REGEX REPLACE "\\\\ " " " depend_text ${depend_text})
|
|
||||||
|
foreach(file ${depend_text})
|
||||||
# This works for the nvcc -M generated dependency files.
|
|
||||||
string(REGEX REPLACE "^.* : " "" depend_text ${depend_text})
|
string(REGEX REPLACE "^ +" "" file ${file})
|
||||||
string(REGEX REPLACE "[ \\\\]*\n" ";" depend_text ${depend_text})
|
|
||||||
|
if(NOT IS_DIRECTORY ${file})
|
||||||
set(dependency_list "")
|
set(cuda_nvcc_depend "${cuda_nvcc_depend} \"${file}\"\n")
|
||||||
|
endif(NOT IS_DIRECTORY ${file})
|
||||||
foreach(file ${depend_text})
|
|
||||||
|
endforeach(file)
|
||||||
string(REGEX REPLACE "^ +" "" file ${file})
|
|
||||||
|
else()
|
||||||
if(NOT IS_DIRECTORY ${file})
|
# message("FOUND NO DEPENDS")
|
||||||
# If softlinks start to matter, we should change this to REALPATH. For now we need
|
endif()
|
||||||
# to flatten paths, because nvcc can generate stuff like /bin/../include instead of
|
|
||||||
# just /include.
|
|
||||||
get_filename_component(file_absolute "${file}" ABSOLUTE)
|
file(WRITE ${output_file} "# Generated by: make2cmake.cmake\nSET(CUDA_NVCC_DEPEND\n ${cuda_nvcc_depend})\n\n")
|
||||||
list(APPEND dependency_list "${file_absolute}")
|
|
||||||
endif(NOT IS_DIRECTORY ${file})
|
|
||||||
|
|
||||||
endforeach(file)
|
|
||||||
|
|
||||||
else()
|
|
||||||
# message("FOUND NO DEPENDS")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Remove the duplicate entries and sort them.
|
|
||||||
list(REMOVE_DUPLICATES dependency_list)
|
|
||||||
list(SORT dependency_list)
|
|
||||||
|
|
||||||
foreach(file ${dependency_list})
|
|
||||||
set(cuda_nvcc_depend "${cuda_nvcc_depend} \"${file}\"\n")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
file(WRITE ${output_file} "# Generated by: make2cmake.cmake\nSET(CUDA_NVCC_DEPEND\n ${cuda_nvcc_depend})\n\n")
|
|
||||||
|
@ -1,39 +1,32 @@
|
|||||||
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
|
# For more information, please see: http://software.sci.utah.edu
|
||||||
# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
|
# The MIT License
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007-2009
|
# Copyright (c) 2007
|
||||||
# Scientific Computing and Imaging Institute, University of Utah
|
# Scientific Computing and Imaging Institute, University of Utah
|
||||||
#
|
#
|
||||||
# This code is licensed under the MIT License. See the FindCUDA.cmake script
|
# License for the specific language governing rights and limitations under
|
||||||
# for the text of the license.
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
# copy of this software and associated documentation files (the "Software"),
|
||||||
# The MIT License
|
# to deal in the Software without restriction, including without limitation
|
||||||
#
|
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
# License for the specific language governing rights and limitations under
|
# and/or sell copies of the Software, and to permit persons to whom the
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
# Software is furnished to do so, subject to the following conditions:
|
||||||
# copy of this software and associated documentation files (the "Software"),
|
#
|
||||||
# to deal in the Software without restriction, including without limitation
|
# The above copyright notice and this permission notice shall be included
|
||||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
# in all copies or substantial portions of the Software.
|
||||||
# and/or sell copies of the Software, and to permit persons to whom the
|
#
|
||||||
# Software is furnished to do so, subject to the following conditions:
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
#
|
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
# The above copyright notice and this permission notice shall be included
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
# in all copies or substantial portions of the Software.
|
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
#
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
# DEALINGS IN THE SOFTWARE.
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
# DEALINGS IN THE SOFTWARE.
|
|
||||||
#
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
# Parses a .cubin file produced by nvcc and reports statistics about the file.
|
|
||||||
|
|
||||||
|
# .cubin Parsing CMake Script
|
||||||
|
# Abe Stephens
|
||||||
|
# (c) 2007 Scientific Computing and Imaging Institute, University of Utah
|
||||||
|
|
||||||
file(READ ${input_file} file_text)
|
file(READ ${input_file} file_text)
|
||||||
|
|
||||||
@ -75,26 +68,26 @@ if (${file_text} MATCHES ".+")
|
|||||||
if(NOT skip)
|
if(NOT skip)
|
||||||
|
|
||||||
# Registers
|
# Registers
|
||||||
if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)")
|
if (${entry} MATCHES "reg = ([^ ]+)")
|
||||||
string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
|
string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
|
||||||
message("Registers: ${entry}")
|
message("Registers: ${entry}")
|
||||||
endif()
|
endif(${entry} MATCHES "reg = ([^ ]+)")
|
||||||
|
|
||||||
# Local memory
|
# Local memory
|
||||||
if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)")
|
if (${entry} MATCHES "lmem = ([^ ]+)")
|
||||||
string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
|
string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
|
||||||
message("Local: ${entry}")
|
message("Local: ${entry}")
|
||||||
endif()
|
endif(${entry} MATCHES "lmem = ([^ ]+)")
|
||||||
|
|
||||||
# Shared memory
|
# Shared memory
|
||||||
if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)")
|
if (${entry} MATCHES "smem = ([^ ]+)")
|
||||||
string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
|
string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
|
||||||
message("Shared: ${entry}")
|
message("Shared: ${entry}")
|
||||||
endif()
|
endif(${entry} MATCHES "smem = ([^ ]+)")
|
||||||
|
|
||||||
if (${entry} MATCHES "^}")
|
if (${entry} MATCHES "^}")
|
||||||
message("")
|
message("")
|
||||||
endif()
|
endif(${entry} MATCHES "^}")
|
||||||
|
|
||||||
endif(NOT skip)
|
endif(NOT skip)
|
||||||
|
|
||||||
|
@ -1,280 +1,227 @@
|
|||||||
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
|
# This file runs the nvcc commands to produce the desired output file along with
|
||||||
#
|
# the dependency file needed by CMake to compute dependencies. In addition the
|
||||||
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
|
# file checks the output of each command and if the command fails it deletes the
|
||||||
#
|
# output files.
|
||||||
# This code is licensed under the MIT License. See the FindCUDA.cmake script
|
|
||||||
# for the text of the license.
|
# Input variables
|
||||||
|
#
|
||||||
# The MIT License
|
# verbose:BOOL=<> OFF: Be as quiet as possible (default)
|
||||||
#
|
# ON : Describe each step
|
||||||
# License for the specific language governing rights and limitations under
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
# build_configuration:STRING=<> Typically one of Debug, MinSizeRel, Release, or
|
||||||
# copy of this software and associated documentation files (the "Software"),
|
# RelWithDebInfo, but it should match one of the
|
||||||
# to deal in the Software without restriction, including without limitation
|
# entries in CUDA_HOST_FLAGS. This is the build
|
||||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
# configuration used when compiling the code. If
|
||||||
# and/or sell copies of the Software, and to permit persons to whom the
|
# blank or unspecified Debug is assumed as this is
|
||||||
# Software is furnished to do so, subject to the following conditions:
|
# what CMake does.
|
||||||
#
|
#
|
||||||
# The above copyright notice and this permission notice shall be included
|
# generated_file:STRING=<> File to generate. This argument must be passed in.
|
||||||
# in all copies or substantial portions of the Software.
|
#
|
||||||
#
|
# generated_cubin_file:STRING=<> File to generate. This argument must be passed
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
# in if build_cubin is true.
|
||||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
if(NOT generated_file)
|
||||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
message(FATAL_ERROR "You must specify generated_file on the command line")
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
endif()
|
||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
# DEALINGS IN THE SOFTWARE.
|
# Set these up as variables to make reading the generated file easier
|
||||||
|
set(CMAKE_COMMAND "@CMAKE_COMMAND@")
|
||||||
|
set(source_file "@source_file@")
|
||||||
##########################################################################
|
set(NVCC_generated_dependency_file "@NVCC_generated_dependency_file@")
|
||||||
# This file runs the nvcc commands to produce the desired output file along with
|
set(cmake_dependency_file "@cmake_dependency_file@")
|
||||||
# the dependency file needed by CMake to compute dependencies. In addition the
|
set(CUDA_make2cmake "@CUDA_make2cmake@")
|
||||||
# file checks the output of each command and if the command fails it deletes the
|
set(CUDA_parse_cubin "@CUDA_parse_cubin@")
|
||||||
# output files.
|
set(build_cubin @build_cubin@)
|
||||||
|
# We won't actually use these variables for now, but we need to set this, in
|
||||||
# Input variables
|
# order to force this file to be run again if it changes.
|
||||||
#
|
set(generated_file_path "@generated_file_path@")
|
||||||
# verbose:BOOL=<> OFF: Be as quiet as possible (default)
|
set(generated_file_internal "@generated_file@")
|
||||||
# ON : Describe each step
|
set(generated_cubin_file_internal "@generated_cubin_file@")
|
||||||
#
|
|
||||||
# build_configuration:STRING=<> Typically one of Debug, MinSizeRel, Release, or
|
set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@")
|
||||||
# RelWithDebInfo, but it should match one of the
|
set(CUDA_NVCC_FLAGS "@CUDA_NVCC_FLAGS@;@CUDA_WRAP_OPTION_NVCC_FLAGS@")
|
||||||
# entries in CUDA_HOST_FLAGS. This is the build
|
@CUDA_NVCC_FLAGS_CONFIG@
|
||||||
# configuration used when compiling the code. If
|
set(nvcc_flags "@nvcc_flags@")
|
||||||
# blank or unspecified Debug is assumed as this is
|
set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@")
|
||||||
# what CMake does.
|
set(format_flag "@format_flag@")
|
||||||
#
|
|
||||||
# generated_file:STRING=<> File to generate. This argument must be passed in.
|
if(build_cubin AND NOT generated_cubin_file)
|
||||||
#
|
message(FATAL_ERROR "You must specify generated_cubin_file on the command line")
|
||||||
# generated_cubin_file:STRING=<> File to generate. This argument must be passed
|
endif()
|
||||||
# in if build_cubin is true.
|
|
||||||
|
# This is the list of host compilation flags. It C or CXX should already have
|
||||||
if(NOT generated_file)
|
# been chosen by FindCUDA.cmake.
|
||||||
message(FATAL_ERROR "You must specify generated_file on the command line")
|
@CUDA_HOST_FLAGS@
|
||||||
endif()
|
|
||||||
|
# Take the compiler flags and package them up to be sent to the compiler via -Xcompiler
|
||||||
# Set these up as variables to make reading the generated file easier
|
set(nvcc_host_compiler_flags "")
|
||||||
set(CMAKE_COMMAND "@CMAKE_COMMAND@")
|
# If we weren't given a build_configuration, use Debug.
|
||||||
set(source_file "@source_file@")
|
if(NOT build_configuration)
|
||||||
set(NVCC_generated_dependency_file "@NVCC_generated_dependency_file@")
|
set(build_configuration Debug)
|
||||||
set(cmake_dependency_file "@cmake_dependency_file@")
|
endif()
|
||||||
set(CUDA_make2cmake "@CUDA_make2cmake@")
|
string(TOUPPER "${build_configuration}" build_configuration)
|
||||||
set(CUDA_parse_cubin "@CUDA_parse_cubin@")
|
#message("CUDA_NVCC_HOST_COMPILER_FLAGS = ${CUDA_NVCC_HOST_COMPILER_FLAGS}")
|
||||||
set(build_cubin @build_cubin@)
|
foreach(flag ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}})
|
||||||
# We won't actually use these variables for now, but we need to set this, in
|
# Extra quotes are added around each flag to help nvcc parse out flags with spaces.
|
||||||
# order to force this file to be run again if it changes.
|
set(nvcc_host_compiler_flags "${nvcc_host_compiler_flags},\"${flag}\"")
|
||||||
set(generated_file_path "@generated_file_path@")
|
endforeach()
|
||||||
set(generated_file_internal "@generated_file@")
|
if (nvcc_host_compiler_flags)
|
||||||
set(generated_cubin_file_internal "@generated_cubin_file@")
|
set(nvcc_host_compiler_flags "-Xcompiler" ${nvcc_host_compiler_flags})
|
||||||
|
endif()
|
||||||
set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@")
|
#message("nvcc_host_compiler_flags = \"${nvcc_host_compiler_flags}\"")
|
||||||
set(CUDA_NVCC_FLAGS "@CUDA_NVCC_FLAGS@;;@CUDA_WRAP_OPTION_NVCC_FLAGS@")
|
# Add the build specific configuration flags
|
||||||
@CUDA_NVCC_FLAGS_CONFIG@
|
list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
|
||||||
set(nvcc_flags "@nvcc_flags@")
|
|
||||||
set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@")
|
if(DEFINED CCBIN)
|
||||||
set(format_flag "@format_flag@")
|
set(CCBIN -ccbin "${CCBIN}")
|
||||||
|
endif()
|
||||||
if(build_cubin AND NOT generated_cubin_file)
|
|
||||||
message(FATAL_ERROR "You must specify generated_cubin_file on the command line")
|
# cuda_execute_process - Executes a command with optional command echo and status message.
|
||||||
endif()
|
#
|
||||||
|
# status - Status message to print if verbose is true
|
||||||
# This is the list of host compilation flags. It C or CXX should already have
|
# command - COMMAND argument from the usual execute_process argument structure
|
||||||
# been chosen by FindCUDA.cmake.
|
# ARGN - Remaining arguments are the command with arguments
|
||||||
@CUDA_HOST_FLAGS@
|
#
|
||||||
|
# CUDA_result - return value from running the command
|
||||||
# Take the compiler flags and package them up to be sent to the compiler via -Xcompiler
|
#
|
||||||
set(nvcc_host_compiler_flags "")
|
# Make this a macro instead of a function, so that things like RESULT_VARIABLE
|
||||||
# If we weren't given a build_configuration, use Debug.
|
# and other return variables are present after executing the process.
|
||||||
if(NOT build_configuration)
|
macro(cuda_execute_process status command)
|
||||||
set(build_configuration Debug)
|
set(_command ${command})
|
||||||
endif()
|
if(NOT _command STREQUAL "COMMAND")
|
||||||
string(TOUPPER "${build_configuration}" build_configuration)
|
message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})")
|
||||||
#message("CUDA_NVCC_HOST_COMPILER_FLAGS = ${CUDA_NVCC_HOST_COMPILER_FLAGS}")
|
endif()
|
||||||
foreach(flag ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}})
|
if(verbose)
|
||||||
# Extra quotes are added around each flag to help nvcc parse out flags with spaces.
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E echo -- ${status})
|
||||||
set(nvcc_host_compiler_flags "${nvcc_host_compiler_flags},\"${flag}\"")
|
# Now we need to build up our command string. We are accounting for quotes
|
||||||
endforeach()
|
# and spaces, anything else is left up to the user to fix if they want to
|
||||||
if (nvcc_host_compiler_flags)
|
# copy and paste a runnable command line.
|
||||||
set(nvcc_host_compiler_flags "-Xcompiler" ${nvcc_host_compiler_flags})
|
set(cuda_execute_process_string)
|
||||||
endif()
|
foreach(arg ${ARGN})
|
||||||
#message("nvcc_host_compiler_flags = \"${nvcc_host_compiler_flags}\"")
|
# If there are quotes, excape them, so they come through.
|
||||||
# Add the build specific configuration flags
|
string(REPLACE "\"" "\\\"" arg ${arg})
|
||||||
list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
|
# Args with spaces need quotes around them to get them to be parsed as a single argument.
|
||||||
|
if(arg MATCHES " ")
|
||||||
if(DEFINED CCBIN)
|
list(APPEND cuda_execute_process_string "\"${arg}\"")
|
||||||
set(CCBIN -ccbin "${CCBIN}")
|
else()
|
||||||
endif()
|
list(APPEND cuda_execute_process_string ${arg})
|
||||||
|
endif()
|
||||||
# cuda_execute_process - Executes a command with optional command echo and status message.
|
endforeach()
|
||||||
#
|
# Echo the command
|
||||||
# status - Status message to print if verbose is true
|
execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${cuda_execute_process_string})
|
||||||
# command - COMMAND argument from the usual execute_process argument structure
|
endif(verbose)
|
||||||
# ARGN - Remaining arguments are the command with arguments
|
# Run the command
|
||||||
#
|
execute_process(COMMAND ${ARGN} RESULT_VARIABLE CUDA_result )
|
||||||
# CUDA_result - return value from running the command
|
endmacro()
|
||||||
#
|
|
||||||
# Make this a macro instead of a function, so that things like RESULT_VARIABLE
|
# Delete the target file
|
||||||
# and other return variables are present after executing the process.
|
cuda_execute_process(
|
||||||
macro(cuda_execute_process status command)
|
"Removing ${generated_file}"
|
||||||
set(_command ${command})
|
COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
|
||||||
if(NOT _command STREQUAL "COMMAND")
|
)
|
||||||
message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})")
|
|
||||||
endif()
|
# Generate the dependency file
|
||||||
if(verbose)
|
cuda_execute_process(
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E echo -- ${status})
|
"Generating dependency file: ${NVCC_generated_dependency_file}"
|
||||||
# Now we need to build up our command string. We are accounting for quotes
|
COMMAND "${CUDA_NVCC_EXECUTABLE}"
|
||||||
# and spaces, anything else is left up to the user to fix if they want to
|
"${source_file}"
|
||||||
# copy and paste a runnable command line.
|
${CUDA_NVCC_FLAGS}
|
||||||
set(cuda_execute_process_string)
|
${nvcc_flags}
|
||||||
foreach(arg ${ARGN})
|
${CCBIN}
|
||||||
# If there are quotes, excape them, so they come through.
|
${nvcc_host_compiler_flags}
|
||||||
string(REPLACE "\"" "\\\"" arg ${arg})
|
-DNVCC
|
||||||
# Args with spaces need quotes around them to get them to be parsed as a single argument.
|
-M
|
||||||
if(arg MATCHES " ")
|
-o "${NVCC_generated_dependency_file}"
|
||||||
list(APPEND cuda_execute_process_string "\"${arg}\"")
|
${CUDA_NVCC_INCLUDE_ARGS}
|
||||||
else()
|
)
|
||||||
list(APPEND cuda_execute_process_string ${arg})
|
|
||||||
endif()
|
if(CUDA_result)
|
||||||
endforeach()
|
message(FATAL_ERROR "Error generating ${generated_file}")
|
||||||
# Echo the command
|
endif()
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${cuda_execute_process_string})
|
|
||||||
endif(verbose)
|
# Generate the cmake readable dependency file to a temp file. Don't put the
|
||||||
# Run the command
|
# quotes just around the filenames for the input_file and output_file variables.
|
||||||
execute_process(COMMAND ${ARGN} RESULT_VARIABLE CUDA_result )
|
# CMake will pass the quotes through and not be able to find the file.
|
||||||
endmacro()
|
cuda_execute_process(
|
||||||
|
"Generating temporary cmake readable file: ${cmake_dependency_file}.tmp"
|
||||||
# Delete the target file
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
cuda_execute_process(
|
-D "input_file:FILEPATH=${NVCC_generated_dependency_file}"
|
||||||
"Removing ${generated_file}"
|
-D "output_file:FILEPATH=${cmake_dependency_file}.tmp"
|
||||||
COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
|
-P "${CUDA_make2cmake}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# For CUDA 2.3 and below, -G -M doesn't work, so remove the -G flag
|
if(CUDA_result)
|
||||||
# for dependency generation and hope for the best.
|
message(FATAL_ERROR "Error generating ${generated_file}")
|
||||||
set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}")
|
endif()
|
||||||
set(CUDA_VERSION @CUDA_VERSION@)
|
|
||||||
if(CUDA_VERSION VERSION_LESS "3.0")
|
# Copy the file if it is different
|
||||||
cmake_policy(PUSH)
|
cuda_execute_process(
|
||||||
# CMake policy 0007 NEW states that empty list elements are not
|
"Copy if different ${cmake_dependency_file}.tmp to ${cmake_dependency_file}"
|
||||||
# ignored. I'm just setting it to avoid the warning that's printed.
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${cmake_dependency_file}.tmp" "${cmake_dependency_file}"
|
||||||
cmake_policy(SET CMP0007 NEW)
|
)
|
||||||
# Note that this will remove all occurances of -G.
|
|
||||||
list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G")
|
if(CUDA_result)
|
||||||
cmake_policy(POP)
|
message(FATAL_ERROR "Error generating ${generated_file}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This
|
# Delete the temporary file
|
||||||
# can cause incorrect dependencies when #including files based on this macro which is
|
cuda_execute_process(
|
||||||
# defined in the generating passes of nvcc invokation. We will go ahead and manually
|
"Removing ${cmake_dependency_file}.tmp and ${NVCC_generated_dependency_file}"
|
||||||
# define this for now until a future version fixes this bug.
|
COMMAND "${CMAKE_COMMAND}" -E remove "${cmake_dependency_file}.tmp" "${NVCC_generated_dependency_file}"
|
||||||
set(CUDACC_DEFINE -D__CUDACC__)
|
)
|
||||||
|
|
||||||
# Generate the dependency file
|
if(CUDA_result)
|
||||||
cuda_execute_process(
|
message(FATAL_ERROR "Error generating ${generated_file}")
|
||||||
"Generating dependency file: ${NVCC_generated_dependency_file}"
|
endif()
|
||||||
COMMAND "${CUDA_NVCC_EXECUTABLE}"
|
|
||||||
-M
|
# Generate the code
|
||||||
${CUDACC_DEFINE}
|
cuda_execute_process(
|
||||||
"${source_file}"
|
"Generating ${generated_file}"
|
||||||
-o "${NVCC_generated_dependency_file}"
|
COMMAND "${CUDA_NVCC_EXECUTABLE}"
|
||||||
${CCBIN}
|
"${source_file}"
|
||||||
${nvcc_flags}
|
${CUDA_NVCC_FLAGS}
|
||||||
${nvcc_host_compiler_flags}
|
${nvcc_flags}
|
||||||
${depends_CUDA_NVCC_FLAGS}
|
${CCBIN}
|
||||||
-DNVCC
|
${nvcc_host_compiler_flags}
|
||||||
${CUDA_NVCC_INCLUDE_ARGS}
|
-DNVCC
|
||||||
)
|
${format_flag} -o "${generated_file}"
|
||||||
|
${CUDA_NVCC_INCLUDE_ARGS}
|
||||||
if(CUDA_result)
|
)
|
||||||
message(FATAL_ERROR "Error generating ${generated_file}")
|
|
||||||
endif()
|
if(CUDA_result)
|
||||||
|
# Since nvcc can sometimes leave half done files make sure that we delete the output file.
|
||||||
# Generate the cmake readable dependency file to a temp file. Don't put the
|
cuda_execute_process(
|
||||||
# quotes just around the filenames for the input_file and output_file variables.
|
"Removing ${generated_file}"
|
||||||
# CMake will pass the quotes through and not be able to find the file.
|
COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
|
||||||
cuda_execute_process(
|
)
|
||||||
"Generating temporary cmake readable file: ${cmake_dependency_file}.tmp"
|
message(FATAL_ERROR "Error generating file ${generated_file}")
|
||||||
COMMAND "${CMAKE_COMMAND}"
|
else()
|
||||||
-D "input_file:FILEPATH=${NVCC_generated_dependency_file}"
|
message("Generated ${generated_file} successfully.")
|
||||||
-D "output_file:FILEPATH=${cmake_dependency_file}.tmp"
|
endif()
|
||||||
-P "${CUDA_make2cmake}"
|
|
||||||
)
|
# Cubin resource report commands.
|
||||||
|
if( build_cubin )
|
||||||
if(CUDA_result)
|
# Run with -cubin to produce resource usage report.
|
||||||
message(FATAL_ERROR "Error generating ${generated_file}")
|
cuda_execute_process(
|
||||||
endif()
|
"Generating ${generated_cubin_file}"
|
||||||
|
COMMAND "${CUDA_NVCC_EXECUTABLE}"
|
||||||
# Copy the file if it is different
|
"${source_file}"
|
||||||
cuda_execute_process(
|
${CUDA_NVCC_FLAGS}
|
||||||
"Copy if different ${cmake_dependency_file}.tmp to ${cmake_dependency_file}"
|
${nvcc_flags}
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${cmake_dependency_file}.tmp" "${cmake_dependency_file}"
|
${CCBIN}
|
||||||
)
|
${nvcc_host_compiler_flags}
|
||||||
|
-DNVCC
|
||||||
if(CUDA_result)
|
-cubin
|
||||||
message(FATAL_ERROR "Error generating ${generated_file}")
|
-o "${generated_cubin_file}"
|
||||||
endif()
|
${CUDA_NVCC_INCLUDE_ARGS}
|
||||||
|
)
|
||||||
# Delete the temporary file
|
|
||||||
cuda_execute_process(
|
# Execute the parser script.
|
||||||
"Removing ${cmake_dependency_file}.tmp and ${NVCC_generated_dependency_file}"
|
cuda_execute_process(
|
||||||
COMMAND "${CMAKE_COMMAND}" -E remove "${cmake_dependency_file}.tmp" "${NVCC_generated_dependency_file}"
|
"Executing the parser script"
|
||||||
)
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
-D "input_file:STRING=${generated_cubin_file}"
|
||||||
if(CUDA_result)
|
-P "${CUDA_parse_cubin}"
|
||||||
message(FATAL_ERROR "Error generating ${generated_file}")
|
)
|
||||||
endif()
|
|
||||||
|
endif( build_cubin )
|
||||||
# Generate the code
|
|
||||||
cuda_execute_process(
|
|
||||||
"Generating ${generated_file}"
|
|
||||||
COMMAND "${CUDA_NVCC_EXECUTABLE}"
|
|
||||||
"${source_file}"
|
|
||||||
${format_flag} -o "${generated_file}"
|
|
||||||
${CCBIN}
|
|
||||||
${nvcc_flags}
|
|
||||||
${nvcc_host_compiler_flags}
|
|
||||||
${CUDA_NVCC_FLAGS}
|
|
||||||
-DNVCC
|
|
||||||
${CUDA_NVCC_INCLUDE_ARGS}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(CUDA_result)
|
|
||||||
# Since nvcc can sometimes leave half done files make sure that we delete the output file.
|
|
||||||
cuda_execute_process(
|
|
||||||
"Removing ${generated_file}"
|
|
||||||
COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
|
|
||||||
)
|
|
||||||
message(FATAL_ERROR "Error generating file ${generated_file}")
|
|
||||||
else()
|
|
||||||
if(verbose)
|
|
||||||
message("Generated ${generated_file} successfully.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Cubin resource report commands.
|
|
||||||
if( build_cubin )
|
|
||||||
# Run with -cubin to produce resource usage report.
|
|
||||||
cuda_execute_process(
|
|
||||||
"Generating ${generated_cubin_file}"
|
|
||||||
COMMAND "${CUDA_NVCC_EXECUTABLE}"
|
|
||||||
"${source_file}"
|
|
||||||
${CUDA_NVCC_FLAGS}
|
|
||||||
${nvcc_flags}
|
|
||||||
${CCBIN}
|
|
||||||
${nvcc_host_compiler_flags}
|
|
||||||
-DNVCC
|
|
||||||
-cubin
|
|
||||||
-o "${generated_cubin_file}"
|
|
||||||
${CUDA_NVCC_INCLUDE_ARGS}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Execute the parser script.
|
|
||||||
cuda_execute_process(
|
|
||||||
"Executing the parser script"
|
|
||||||
COMMAND "${CMAKE_COMMAND}"
|
|
||||||
-D "input_file:STRING=${generated_cubin_file}"
|
|
||||||
-P "${CUDA_parse_cubin}"
|
|
||||||
)
|
|
||||||
|
|
||||||
endif( build_cubin )
|
|
||||||
|
@ -89,80 +89,6 @@
|
|||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
|
|
||||||
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(SolutionDir)\nvtt.vsprops"
|
|
||||||
CharacterSet="2"
|
|
||||||
WholeProgramOptimization="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
EnableIntrinsicFunctions="true"
|
|
||||||
RuntimeLibrary="2"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib FreeImage.lib"
|
|
||||||
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
|
|
||||||
AdditionalLibraryDirectories="$(GnuWinDir)\lib; $(FreeImageDir)"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
OptimizeReferences="2"
|
|
||||||
EnableCOMDATFolding="2"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|x64"
|
Name="Debug|x64"
|
||||||
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
|
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
|
||||||
@ -234,6 +160,85 @@
|
|||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="$(SolutionDir)\nvtt.vsprops"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="3"
|
||||||
|
InlineFunctionExpansion="0"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
FavorSizeOrSpeed="0"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
StringPooling="true"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
EnableEnhancedInstructionSet="2"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib FreeImage.lib"
|
||||||
|
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
|
||||||
|
AdditionalLibraryDirectories="$(GnuWinDir)\lib; $(FreeImageDir)"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|x64"
|
Name="Release|x64"
|
||||||
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
|
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
|
||||||
@ -261,8 +266,11 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="3"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableFunctionLevelLinking="true"
|
EnableFunctionLevelLinking="true"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
|
@ -192,11 +192,16 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
|
InlineFunctionExpansion="0"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
FavorSizeOrSpeed="0"
|
||||||
|
OmitFramePointers="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableFunctionLevelLinking="true"
|
||||||
|
EnableEnhancedInstructionSet="2"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
@ -266,9 +271,15 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="3"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
||||||
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
@ -202,16 +202,17 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
InlineFunctionExpansion="2"
|
InlineFunctionExpansion="0"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="0"
|
||||||
OmitFramePointers="true"
|
OmitFramePointers="true"
|
||||||
EnableFiberSafeOptimizations="true"
|
EnableFiberSafeOptimizations="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableFunctionLevelLinking="true"
|
||||||
|
EnableEnhancedInstructionSet="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
@ -287,9 +288,15 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="3"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
|
||||||
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
/>
|
/>
|
||||||
|
@ -173,16 +173,17 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
InlineFunctionExpansion="2"
|
InlineFunctionExpansion="0"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="0"
|
||||||
OmitFramePointers="true"
|
OmitFramePointers="true"
|
||||||
EnableFiberSafeOptimizations="true"
|
EnableFiberSafeOptimizations="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableFunctionLevelLinking="true"
|
||||||
|
EnableEnhancedInstructionSet="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
@ -242,9 +243,15 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="3"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
||||||
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
@ -281,106 +288,98 @@
|
|||||||
<References>
|
<References>
|
||||||
</References>
|
</References>
|
||||||
<Files>
|
<Files>
|
||||||
<Filter
|
<File
|
||||||
Name="Source Files"
|
RelativePath="..\..\..\src\nvcore\Algorithms.h"
|
||||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
|
||||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
|
||||||
>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\Debug.cpp"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\Array.h"
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\nvcore\FileSystem.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\nvcore\Library.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\nvcore\Memory.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\nvcore\StrLib.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\nvcore\TextReader.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\nvcore\TextWriter.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Header Files"
|
|
||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
|
||||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
|
||||||
>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\Algorithms.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\Containers.h"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\Containers.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\Debug.cpp"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\Debug.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\Debug.h"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\DefsVcWin32.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\DefsVcWin32.h"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\FileSystem.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\FileSystem.cpp"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\HashMap.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\FileSystem.h"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\Library.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\HashMap.h"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\Memory.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\Library.cpp"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\nvcore.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\Library.h"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\Ptr.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\Memory.cpp"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\RefCounted.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\Memory.h"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\StrLib.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\nvcore.h"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\TextReader.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\Ptr.h"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\TextWriter.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\RefCounted.h"
|
||||||
</File>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\..\src\nvcore\Timer.h"
|
<File
|
||||||
>
|
RelativePath="..\..\..\src\nvcore\StrLib.cpp"
|
||||||
</File>
|
>
|
||||||
</Filter>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\nvcore\StrLib.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\nvcore\TextReader.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\nvcore\TextReader.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\nvcore\TextWriter.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\nvcore\TextWriter.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\nvcore\Timer.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
|
@ -192,11 +192,16 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
|
InlineFunctionExpansion="0"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
FavorSizeOrSpeed="0"
|
||||||
|
OmitFramePointers="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableFunctionLevelLinking="true"
|
||||||
|
EnableEnhancedInstructionSet="2"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
@ -265,9 +270,15 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="3"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
||||||
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
@ -202,11 +202,16 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
|
InlineFunctionExpansion="0"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
FavorSizeOrSpeed="0"
|
||||||
|
OmitFramePointers="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableFunctionLevelLinking="true"
|
||||||
|
EnableEnhancedInstructionSet="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
@ -283,9 +288,15 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="3"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
|
||||||
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
/>
|
/>
|
||||||
|
@ -173,14 +173,16 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
InlineFunctionExpansion="2"
|
InlineFunctionExpansion="0"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
|
FavorSizeOrSpeed="0"
|
||||||
OmitFramePointers="true"
|
OmitFramePointers="true"
|
||||||
AdditionalIncludeDirectories="$(GnuWinDir)/include; $(FreeImageDir)"
|
AdditionalIncludeDirectories="$(GnuWinDir)/include; $(FreeImageDir)"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableFunctionLevelLinking="true"
|
||||||
|
EnableEnhancedInstructionSet="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
@ -240,9 +242,15 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="3"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
||||||
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
|
@ -202,11 +202,16 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
|
InlineFunctionExpansion="0"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
FavorSizeOrSpeed="0"
|
||||||
|
OmitFramePointers="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableFunctionLevelLinking="true"
|
||||||
|
EnableEnhancedInstructionSet="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
@ -283,9 +288,15 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="3"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
|
||||||
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
/>
|
/>
|
||||||
|
@ -173,16 +173,17 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
InlineFunctionExpansion="2"
|
InlineFunctionExpansion="0"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="0"
|
||||||
OmitFramePointers="true"
|
OmitFramePointers="true"
|
||||||
EnableFiberSafeOptimizations="true"
|
EnableFiberSafeOptimizations="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableFunctionLevelLinking="true"
|
||||||
|
EnableEnhancedInstructionSet="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
@ -242,9 +243,15 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="3"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
||||||
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
|
@ -6,7 +6,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvtt", "nvtt\nvtt.vcproj",
|
|||||||
{CE017322-01FC-4851-9C8B-64E9A8E26C38} = {CE017322-01FC-4851-9C8B-64E9A8E26C38}
|
{CE017322-01FC-4851-9C8B-64E9A8E26C38} = {CE017322-01FC-4851-9C8B-64E9A8E26C38}
|
||||||
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
|
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
|
||||||
{4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
|
{4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669} = {C33787E3-5564-4834-9FE3-A9020455A669}
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153} = {4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}
|
||||||
{50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
|
{50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
@ -81,7 +81,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imperativeapi", "imperative
|
|||||||
{1AEB7681-57D8-48EE-813D-5C41CC38B647} = {1AEB7681-57D8-48EE-813D-5C41CC38B647}
|
{1AEB7681-57D8-48EE-813D-5C41CC38B647} = {1AEB7681-57D8-48EE-813D-5C41CC38B647}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bc6h", "bc6h\bc6h.vcproj", "{C33787E3-5564-4834-9FE3-A9020455A669}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bc6h", "bc6h\bc6h.vcproj", "{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -429,30 +429,30 @@ Global
|
|||||||
{7DCF280E-702B-49F3-84A7-AE7E146384D6}.Release|Win32.Build.0 = Release|Win32
|
{7DCF280E-702B-49F3-84A7-AE7E146384D6}.Release|Win32.Build.0 = Release|Win32
|
||||||
{7DCF280E-702B-49F3-84A7-AE7E146384D6}.Release|x64.ActiveCfg = Release|x64
|
{7DCF280E-702B-49F3-84A7-AE7E146384D6}.Release|x64.ActiveCfg = Release|x64
|
||||||
{7DCF280E-702B-49F3-84A7-AE7E146384D6}.Release|x64.Build.0 = Release|x64
|
{7DCF280E-702B-49F3-84A7-AE7E146384D6}.Release|x64.Build.0 = Release|x64
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Debug (no cuda)|x64.Build.0 = Debug|x64
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Debug (no cuda)|x64.Build.0 = Debug|x64
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Debug|Win32.ActiveCfg = Debug|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Debug|Win32.Build.0 = Debug|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Debug|x64.ActiveCfg = Debug|x64
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Debug|x64.Build.0 = Debug|x64
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Debug|x64.Build.0 = Debug|x64
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Release (no cuda)|Mixed Platforms.Build.0 = Release|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Release (no cuda)|Mixed Platforms.Build.0 = Release|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Release (no cuda)|Win32.Build.0 = Release|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Release (no cuda)|Win32.Build.0 = Release|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Release (no cuda)|x64.ActiveCfg = Release|x64
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Release (no cuda)|x64.ActiveCfg = Release|x64
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Release (no cuda)|x64.Build.0 = Release|x64
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Release (no cuda)|x64.Build.0 = Release|x64
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Release|Mixed Platforms.Build.0 = Release|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Release|Win32.ActiveCfg = Release|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Release|Win32.Build.0 = Release|Win32
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Release|Win32.Build.0 = Release|Win32
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Release|x64.ActiveCfg = Release|x64
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Release|x64.ActiveCfg = Release|x64
|
||||||
{C33787E3-5564-4834-9FE3-A9020455A669}.Release|x64.Build.0 = Release|x64
|
{4C16A4CC-8B4E-470C-B9AE-B40AF26C5153}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -12,16 +12,24 @@
|
|||||||
Name="SrcDir"
|
Name="SrcDir"
|
||||||
Value="$(SolutionDir)..\..\src"
|
Value="$(SolutionDir)..\..\src"
|
||||||
/>
|
/>
|
||||||
|
<UserMacro
|
||||||
|
Name="ExternDir"
|
||||||
|
Value="$(SolutionDir)..\..\extern"
|
||||||
|
/>
|
||||||
<UserMacro
|
<UserMacro
|
||||||
Name="PoshDir"
|
Name="PoshDir"
|
||||||
Value="$(SolutionDir)..\..\extern\poshlib"
|
Value="$(ExternDir)\poshlib"
|
||||||
/>
|
/>
|
||||||
<UserMacro
|
<UserMacro
|
||||||
Name="GnuWinDir"
|
Name="GnuWinDir"
|
||||||
Value="$(SolutionDir)..\..\extern\gnuwin32"
|
Value="$(ExternDir)\gnuwin32"
|
||||||
/>
|
/>
|
||||||
<UserMacro
|
<UserMacro
|
||||||
Name="FreeImageDir"
|
Name="FreeImageDir"
|
||||||
Value="$(SolutionDir)..\..\extern\FreeImage"
|
Value="$(ExternDir)\FreeImage"
|
||||||
|
/>
|
||||||
|
<UserMacro
|
||||||
|
Name="GlewDir"
|
||||||
|
Value="$(ExternDir)\glew"
|
||||||
/>
|
/>
|
||||||
</VisualStudioPropertySheet>
|
</VisualStudioPropertySheet>
|
||||||
|
@ -207,16 +207,17 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
InlineFunctionExpansion="2"
|
InlineFunctionExpansion="0"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="0"
|
||||||
OmitFramePointers="true"
|
OmitFramePointers="true"
|
||||||
EnableFiberSafeOptimizations="true"
|
EnableFiberSafeOptimizations="true"
|
||||||
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;$(CUDA_INC_PATH)"
|
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;$(CUDA_INC_PATH)"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableFunctionLevelLinking="true"
|
||||||
|
EnableEnhancedInstructionSet="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="0"
|
DebugInformationFormat="0"
|
||||||
@ -295,11 +296,15 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="3"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
OmitFramePointers="true"
|
OmitFramePointers="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;$(CUDA_INC_PATH)"
|
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;$(CUDA_INC_PATH)"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
|
||||||
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="0"
|
DebugInformationFormat="0"
|
||||||
@ -904,10 +909,6 @@
|
|||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\nvtt\cuda\Bitmaps.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\src\nvtt\CompressionOptions.h"
|
RelativePath="..\..\..\src\nvtt\CompressionOptions.h"
|
||||||
>
|
>
|
||||||
|
@ -173,16 +173,17 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
InlineFunctionExpansion="2"
|
InlineFunctionExpansion="0"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="0"
|
||||||
OmitFramePointers="true"
|
OmitFramePointers="true"
|
||||||
EnableFiberSafeOptimizations="true"
|
EnableFiberSafeOptimizations="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__;SQUISH_USE_SSE = 2"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__;SQUISH_USE_SSE = 2"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableFunctionLevelLinking="true"
|
||||||
|
EnableEnhancedInstructionSet="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
@ -242,9 +243,15 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="3"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
|
||||||
|
StringPooling="true"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
|
@ -235,13 +235,13 @@ namespace nv
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Return true if element found.
|
/// Return true if element found.
|
||||||
bool find(const T & element, uint * index)
|
bool find(const T & element, uint * index) const
|
||||||
{
|
{
|
||||||
return find(element, 0, m_size, index);
|
return find(element, 0, m_size, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return true if element found within the given range.
|
/// Return true if element found within the given range.
|
||||||
bool find(const T & element, uint first, uint count, uint * index)
|
bool find(const T & element, uint first, uint count, uint * index) const
|
||||||
{
|
{
|
||||||
for (uint i = first; i < first+count; i++) {
|
for (uint i = first; i < first+count; i++) {
|
||||||
if (m_buffer[i] == element) {
|
if (m_buffer[i] == element) {
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
# include <dbghelp.h>
|
# include <dbghelp.h>
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
# pragma comment(lib,"dbghelp.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
|
#if !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
|
||||||
@ -76,55 +77,191 @@ namespace
|
|||||||
|
|
||||||
#if NV_OS_WIN32 && NV_CC_MSVC
|
#if NV_OS_WIN32 && NV_CC_MSVC
|
||||||
|
|
||||||
// TODO write minidump
|
static bool writeMiniDump(EXCEPTION_POINTERS * pExceptionInfo)
|
||||||
|
|
||||||
static LONG WINAPI nvTopLevelFilter( struct _EXCEPTION_POINTERS * pExceptionInfo)
|
|
||||||
{
|
{
|
||||||
NV_UNUSED(pExceptionInfo);
|
|
||||||
/* BOOL (WINAPI * Dump) (HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION );
|
|
||||||
|
|
||||||
AutoString dbghelp_path(512);
|
|
||||||
getcwd(dbghelp_path, 512);
|
|
||||||
dbghelp_path.Append("\\DbgHelp.dll");
|
|
||||||
nvTranslatePath(dbghelp_path);
|
|
||||||
|
|
||||||
PiLibrary DbgHelp_lib(dbghelp_path, true);
|
|
||||||
|
|
||||||
if( !DbgHelp_lib.IsValid() ) {
|
|
||||||
nvDebug("*** 'DbgHelp.dll' not found.\n");
|
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !DbgHelp_lib.BindSymbol( (void **)&Dump, "MiniDumpWriteDump" ) ) {
|
|
||||||
nvDebug("*** 'DbgHelp.dll' too old.\n");
|
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create the file
|
// create the file
|
||||||
HANDLE hFile = ::CreateFile( "nv.dmp", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
|
HANDLE hFile = CreateFile("crash.dmp", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if( hFile == INVALID_HANDLE_VALUE ) {
|
if (hFile == INVALID_HANDLE_VALUE) {
|
||||||
nvDebug("*** Failed to create dump file.\n");
|
nvDebug("*** Failed to create dump file.\n");
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MINIDUMP_EXCEPTION_INFORMATION ExInfo;
|
||||||
_MINIDUMP_EXCEPTION_INFORMATION ExInfo;
|
|
||||||
|
|
||||||
ExInfo.ThreadId = ::GetCurrentThreadId();
|
ExInfo.ThreadId = ::GetCurrentThreadId();
|
||||||
ExInfo.ExceptionPointers = pExceptionInfo;
|
ExInfo.ExceptionPointers = pExceptionInfo;
|
||||||
ExInfo.ClientPointers = NULL;
|
ExInfo.ClientPointers = NULL;
|
||||||
|
|
||||||
// write the dump
|
// write the dump
|
||||||
bool ok = Dump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL )!=0;
|
BOOL ok = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL) != 0;
|
||||||
::CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
|
|
||||||
if( !ok ) {
|
if (ok == FALSE) {
|
||||||
nvDebug("*** Failed to save dump file.\n");
|
nvDebug("*** Failed to save dump file.\n");
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nvDebug("--- Dump file saved.\n");
|
nvDebug("\nDump file saved.\n");
|
||||||
*/
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool hasStackTrace() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static NV_NOINLINE int backtrace(void * trace[], int maxcount) {
|
||||||
|
|
||||||
|
// In Windows XP and Windows Server 2003, the sum of the FramesToSkip and FramesToCapture parameters must be less than 63.
|
||||||
|
int xp_maxcount = min(63-1, maxcount);
|
||||||
|
|
||||||
|
int count = RtlCaptureStackBackTrace(1, xp_maxcount, trace, NULL);
|
||||||
|
nvDebugCheck(count <= maxcount);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
static NV_NOINLINE int backtraceWithSymbols(CONTEXT * ctx, void * trace[], int maxcount, int skip = 0) {
|
||||||
|
|
||||||
|
// Init the stack frame for this function
|
||||||
|
STACKFRAME64 stackFrame = { 0 };
|
||||||
|
|
||||||
|
#if NV_CPU_X86_64
|
||||||
|
DWORD dwMachineType = IMAGE_FILE_MACHINE_AMD64;
|
||||||
|
stackFrame.AddrPC.Offset = ctx->Rip;
|
||||||
|
stackFrame.AddrFrame.Offset = ctx->Rbp;
|
||||||
|
stackFrame.AddrStack.Offset = ctx->Rsp;
|
||||||
|
#elif NV_CPU_X86
|
||||||
|
DWORD dwMachineType = IMAGE_FILE_MACHINE_I386;
|
||||||
|
stackFrame.AddrPC.Offset = ctx->Eip;
|
||||||
|
stackFrame.AddrFrame.Offset = ctx->Ebp;
|
||||||
|
stackFrame.AddrStack.Offset = ctx->Esp;
|
||||||
|
#else
|
||||||
|
#error "Platform not supported!"
|
||||||
|
#endif
|
||||||
|
stackFrame.AddrPC.Mode = AddrModeFlat;
|
||||||
|
stackFrame.AddrFrame.Mode = AddrModeFlat;
|
||||||
|
stackFrame.AddrStack.Mode = AddrModeFlat;
|
||||||
|
|
||||||
|
// Walk up the stack
|
||||||
|
const HANDLE hThread = GetCurrentThread();
|
||||||
|
const HANDLE hProcess = GetCurrentProcess();
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < maxcount; i++)
|
||||||
|
{
|
||||||
|
// walking once first makes us skip self
|
||||||
|
if (!StackWalk64(dwMachineType, hProcess, hThread, &stackFrame, ctx, NULL, &SymFunctionTableAccess64, &SymGetModuleBase64, NULL)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if (stackFrame.AddrPC.Offset == stackFrame.AddrReturn.Offset || stackFrame.AddrPC.Offset == 0) {
|
||||||
|
break;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if (i >= skip) {
|
||||||
|
trace[i - skip] = (PVOID)stackFrame.AddrPC.Offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return i - skip;
|
||||||
|
}
|
||||||
|
|
||||||
|
static NV_NOINLINE int backtrace(void * trace[], int maxcount) {
|
||||||
|
CONTEXT ctx = { 0 };
|
||||||
|
#if NV_CPU_X86 && !NV_CPU_X86_64
|
||||||
|
ctx.ContextFlags = CONTEXT_CONTROL;
|
||||||
|
_asm {
|
||||||
|
call x
|
||||||
|
x: pop eax
|
||||||
|
mov ctx.Eip, eax
|
||||||
|
mov ctx.Ebp, ebp
|
||||||
|
mov ctx.Esp, esp
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
RtlCaptureContext(&ctx);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return backtraceWithSymbols(&ctx, trace, maxcount, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NV_NOINLINE void printStackTrace(void * trace[], int size, int start=0)
|
||||||
|
{
|
||||||
|
HANDLE hProcess = GetCurrentProcess();
|
||||||
|
|
||||||
|
nvDebug( "\nDumping stacktrace:\n" );
|
||||||
|
|
||||||
|
// Resolve PC to function names
|
||||||
|
for (int i = start; i < size; i++)
|
||||||
|
{
|
||||||
|
// Check for end of stack walk
|
||||||
|
DWORD64 ip = (DWORD64)trace[i];
|
||||||
|
if (ip == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Get function name
|
||||||
|
#define MAX_STRING_LEN (512)
|
||||||
|
unsigned char byBuffer[sizeof(IMAGEHLP_SYMBOL64) + MAX_STRING_LEN] = { 0 };
|
||||||
|
IMAGEHLP_SYMBOL64 * pSymbol = (IMAGEHLP_SYMBOL64*)byBuffer;
|
||||||
|
pSymbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
|
||||||
|
pSymbol->MaxNameLength = MAX_STRING_LEN;
|
||||||
|
|
||||||
|
DWORD64 dwDisplacement;
|
||||||
|
|
||||||
|
if (SymGetSymFromAddr64(hProcess, ip, &dwDisplacement, pSymbol))
|
||||||
|
{
|
||||||
|
pSymbol->Name[MAX_STRING_LEN-1] = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Make the symbol readable for humans
|
||||||
|
UnDecorateSymbolName( pSym->Name, lpszNonUnicodeUnDSymbol, BUFFERSIZE,
|
||||||
|
UNDNAME_COMPLETE |
|
||||||
|
UNDNAME_NO_THISTYPE |
|
||||||
|
UNDNAME_NO_SPECIAL_SYMS |
|
||||||
|
UNDNAME_NO_MEMBER_TYPE |
|
||||||
|
UNDNAME_NO_MS_KEYWORDS |
|
||||||
|
UNDNAME_NO_ACCESS_SPECIFIERS );
|
||||||
|
*/
|
||||||
|
|
||||||
|
// pSymbol->Name
|
||||||
|
const char * pFunc = pSymbol->Name;
|
||||||
|
|
||||||
|
// Get file/line number
|
||||||
|
IMAGEHLP_LINE64 theLine = { 0 };
|
||||||
|
theLine.SizeOfStruct = sizeof(theLine);
|
||||||
|
|
||||||
|
DWORD dwDisplacement;
|
||||||
|
if (!SymGetLineFromAddr64(hProcess, ip, &dwDisplacement, &theLine))
|
||||||
|
{
|
||||||
|
nvDebug("unknown(%08X) : %s\n", (uint32)ip, pFunc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
const char* pFile = strrchr(theLine.FileName, '\\');
|
||||||
|
if ( pFile == NULL ) pFile = theLine.FileName;
|
||||||
|
else pFile++;
|
||||||
|
*/
|
||||||
|
const char * pFile = theLine.FileName;
|
||||||
|
|
||||||
|
int line = theLine.LineNumber;
|
||||||
|
|
||||||
|
nvDebug("%s(%d) : %s\n", pFile, line, pFunc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Write mini dump and print stack trace.
|
||||||
|
static LONG WINAPI topLevelFilter(EXCEPTION_POINTERS * pExceptionInfo)
|
||||||
|
{
|
||||||
|
void * trace[64];
|
||||||
|
|
||||||
|
int size = backtraceWithSymbols(pExceptionInfo->ContextRecord, trace, 64);
|
||||||
|
printStackTrace(trace, size, 0);
|
||||||
|
|
||||||
|
writeMiniDump(pExceptionInfo);
|
||||||
|
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +269,7 @@ namespace
|
|||||||
|
|
||||||
#if defined(HAVE_EXECINFO_H) // NV_OS_LINUX
|
#if defined(HAVE_EXECINFO_H) // NV_OS_LINUX
|
||||||
|
|
||||||
static bool nvHasStackTrace() {
|
static bool hasStackTrace() {
|
||||||
#if NV_OS_DARWIN
|
#if NV_OS_DARWIN
|
||||||
return backtrace != NULL;
|
return backtrace != NULL;
|
||||||
#else
|
#else
|
||||||
@ -140,7 +277,7 @@ namespace
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvPrintStackTrace(void * trace[], int size, int start=0) {
|
static void printStackTrace(void * trace[], int size, int start=0) {
|
||||||
char ** string_array = backtrace_symbols(trace, size);
|
char ** string_array = backtrace_symbols(trace, size);
|
||||||
|
|
||||||
nvDebug( "\nDumping stacktrace:\n" );
|
nvDebug( "\nDumping stacktrace:\n" );
|
||||||
@ -260,7 +397,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_EXECINFO_H)
|
#if defined(HAVE_EXECINFO_H)
|
||||||
if (nvHasStackTrace()) // in case of weak linking
|
if (hasStackTrace()) // in case of weak linking
|
||||||
{
|
{
|
||||||
void * trace[64];
|
void * trace[64];
|
||||||
int size = backtrace(trace, 64);
|
int size = backtrace(trace, 64);
|
||||||
@ -270,7 +407,7 @@ namespace
|
|||||||
trace[1] = pnt;
|
trace[1] = pnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
nvPrintStackTrace(trace, size, 1);
|
printStackTrace(trace, size, 1);
|
||||||
}
|
}
|
||||||
#endif // defined(HAVE_EXECINFO_H)
|
#endif // defined(HAVE_EXECINFO_H)
|
||||||
|
|
||||||
@ -289,18 +426,14 @@ namespace
|
|||||||
// Code from Daniel Vogel.
|
// Code from Daniel Vogel.
|
||||||
static bool isDebuggerPresent()
|
static bool isDebuggerPresent()
|
||||||
{
|
{
|
||||||
bool result = false;
|
HINSTANCE kernel32 = GetModuleHandle("kernel32.dll");
|
||||||
|
if (kernel32) {
|
||||||
HINSTANCE kern_lib = LoadLibraryExA( "kernel32.dll", NULL, 0 );
|
FARPROC IsDebuggerPresent = GetProcAddress(kernel32, "IsDebuggerPresent");
|
||||||
if( kern_lib ) {
|
if (IsDebuggerPresent != NULL && IsDebuggerPresent()) {
|
||||||
FARPROC lIsDebuggerPresent = GetProcAddress( kern_lib, "IsDebuggerPresent" );
|
return true;
|
||||||
if( lIsDebuggerPresent && lIsDebuggerPresent() ) {
|
|
||||||
result = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeLibrary( kern_lib );
|
|
||||||
}
|
}
|
||||||
return result;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush the message queue. This is necessary for the message box to show up.
|
// Flush the message queue. This is necessary for the message box to show up.
|
||||||
@ -322,11 +455,11 @@ namespace
|
|||||||
StringBuilder error_string;
|
StringBuilder error_string;
|
||||||
if( func != NULL ) {
|
if( func != NULL ) {
|
||||||
error_string.format( "*** Assertion failed: %s\n On file: %s\n On function: %s\n On line: %d\n ", exp, file, func, line );
|
error_string.format( "*** Assertion failed: %s\n On file: %s\n On function: %s\n On line: %d\n ", exp, file, func, line );
|
||||||
nvDebug( error_string );
|
nvDebug( error_string.str() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
error_string.format( "*** Assertion failed: %s\n On file: %s\n On line: %d\n ", exp, file, line );
|
error_string.format( "*** Assertion failed: %s\n On file: %s\n On line: %d\n ", exp, file, line );
|
||||||
nvDebug( error_string );
|
nvDebug( error_string.str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDebuggerPresent()) {
|
if (isDebuggerPresent()) {
|
||||||
@ -334,7 +467,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
flushMessageQueue();
|
flushMessageQueue();
|
||||||
int action = MessageBoxA(NULL, error_string, "Assertion failed", MB_ABORTRETRYIGNORE|MB_ICONERROR);
|
int action = MessageBoxA(NULL, error_string.str(), "Assertion failed", MB_ABORTRETRYIGNORE|MB_ICONERROR);
|
||||||
switch( action ) {
|
switch( action ) {
|
||||||
case IDRETRY:
|
case IDRETRY:
|
||||||
ret = NV_ABORT_DEBUG;
|
ret = NV_ABORT_DEBUG;
|
||||||
@ -352,7 +485,7 @@ namespace
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
if( ret == NV_ABORT_EXIT ) {
|
if( ret == NV_ABORT_EXIT ) {
|
||||||
// Exit cleanly.
|
// Exit cleanly.
|
||||||
throw "Assertion failed";
|
throw "Assertion failed";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,16 +535,16 @@ namespace
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_EXECINFO_H)
|
#if defined(HAVE_EXECINFO_H)
|
||||||
if (nvHasStackTrace())
|
if (hasStackTrace())
|
||||||
{
|
{
|
||||||
void * trace[64];
|
void * trace[64];
|
||||||
int size = backtrace(trace, 64);
|
int size = backtrace(trace, 64);
|
||||||
nvPrintStackTrace(trace, size, 2);
|
printStackTrace(trace, size, 2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Exit cleanly.
|
// Exit cleanly.
|
||||||
throw std::runtime_error("Assertion failed");
|
throw "Assertion failed";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -453,14 +586,12 @@ void NV_CDECL nvDebugPrint(const char *msg, ...)
|
|||||||
/// Dump debug info.
|
/// Dump debug info.
|
||||||
void debug::dumpInfo()
|
void debug::dumpInfo()
|
||||||
{
|
{
|
||||||
#if !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) && defined(HAVE_EXECINFO_H)
|
if (hasStackTrace())
|
||||||
if (nvHasStackTrace())
|
|
||||||
{
|
{
|
||||||
void * trace[64];
|
void * trace[64];
|
||||||
int size = backtrace(trace, 64);
|
int size = backtrace(trace, 64);
|
||||||
nvPrintStackTrace(trace, size, 1);
|
printStackTrace(trace, size, 1);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -497,7 +628,12 @@ void debug::enableSigHandler()
|
|||||||
|
|
||||||
#if NV_OS_WIN32 && NV_CC_MSVC
|
#if NV_OS_WIN32 && NV_CC_MSVC
|
||||||
|
|
||||||
s_old_exception_filter = ::SetUnhandledExceptionFilter( nvTopLevelFilter );
|
s_old_exception_filter = ::SetUnhandledExceptionFilter( topLevelFilter );
|
||||||
|
|
||||||
|
// SYMOPT_DEFERRED_LOADS make us not take a ton of time unless we actual log traces
|
||||||
|
SymSetOptions(SYMOPT_DEFERRED_LOADS|SYMOPT_FAIL_CRITICAL_ERRORS|SYMOPT_LOAD_LINES|SYMOPT_UNDNAME);
|
||||||
|
|
||||||
|
SymInitialize(GetCurrentProcess(), NULL, TRUE);
|
||||||
|
|
||||||
#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
|
#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
|
||||||
|
|
||||||
@ -526,6 +662,8 @@ void debug::disableSigHandler()
|
|||||||
::SetUnhandledExceptionFilter( s_old_exception_filter );
|
::SetUnhandledExceptionFilter( s_old_exception_filter );
|
||||||
s_old_exception_filter = NULL;
|
s_old_exception_filter = NULL;
|
||||||
|
|
||||||
|
SymCleanup(GetCurrentProcess());
|
||||||
|
|
||||||
#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
|
#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
|
||||||
|
|
||||||
sigaction(SIGSEGV, &s_old_sigsegv, NULL);
|
sigaction(SIGSEGV, &s_old_sigsegv, NULL);
|
||||||
|
@ -3,35 +3,54 @@
|
|||||||
#include "Memory.h"
|
#include "Memory.h"
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
|
|
||||||
//#if HAVE_MALLOC_H
|
|
||||||
//#include <malloc.h>
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define USE_EFENCE 0
|
||||||
|
|
||||||
|
#if USE_EFENCE
|
||||||
|
extern "C" void *EF_malloc(size_t size);
|
||||||
|
extern "C" void *EF_realloc(void * oldBuffer, size_t newSize);
|
||||||
|
extern "C" void EF_free(void * address);
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace nv;
|
using namespace nv;
|
||||||
|
|
||||||
void * nv::mem::malloc(size_t size)
|
void * nv::mem::malloc(size_t size)
|
||||||
{
|
{
|
||||||
|
#if USE_EFENCE
|
||||||
|
return EF_malloc(size);
|
||||||
|
#else
|
||||||
return ::malloc(size);
|
return ::malloc(size);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void * nv::mem::malloc(size_t size, const char * file, int line)
|
void * nv::mem::malloc(size_t size, const char * file, int line)
|
||||||
{
|
{
|
||||||
NV_UNUSED(file);
|
NV_UNUSED(file);
|
||||||
NV_UNUSED(line);
|
NV_UNUSED(line);
|
||||||
|
#if USE_EFENCE
|
||||||
|
return EF_malloc(size);
|
||||||
|
#else
|
||||||
return ::malloc(size);
|
return ::malloc(size);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void nv::mem::free(const void * ptr)
|
void nv::mem::free(const void * ptr)
|
||||||
{
|
{
|
||||||
|
#if USE_EFENCE
|
||||||
|
return EF_free(const_cast<void *>(ptr));
|
||||||
|
#else
|
||||||
::free(const_cast<void *>(ptr));
|
::free(const_cast<void *>(ptr));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void * nv::mem::realloc(void * ptr, size_t size)
|
void * nv::mem::realloc(void * ptr, size_t size)
|
||||||
{
|
{
|
||||||
nvDebugCheck(ptr != NULL || size != 0); // undefined realloc behavior.
|
nvDebugCheck(ptr != NULL || size != 0); // undefined realloc behavior.
|
||||||
|
#if USE_EFENCE
|
||||||
|
return EF_realloc(ptr, size);
|
||||||
|
#else
|
||||||
return ::realloc(ptr, size);
|
return ::realloc(ptr, size);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,9 +211,7 @@ StringBuilder::StringBuilder( const char * s, int extra_size_hint/*=0*/ ) : m_si
|
|||||||
/** Delete the string. */
|
/** Delete the string. */
|
||||||
StringBuilder::~StringBuilder()
|
StringBuilder::~StringBuilder()
|
||||||
{
|
{
|
||||||
m_size = 0;
|
|
||||||
strFree(m_str);
|
strFree(m_str);
|
||||||
m_str = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -237,7 +235,7 @@ StringBuilder & StringBuilder::formatList( const char * fmt, va_list arg )
|
|||||||
{
|
{
|
||||||
nvDebugCheck(fmt != NULL);
|
nvDebugCheck(fmt != NULL);
|
||||||
|
|
||||||
if( m_size == 0 ) {
|
if (m_size == 0) {
|
||||||
m_size = 64;
|
m_size = 64;
|
||||||
m_str = strAlloc( m_size );
|
m_str = strAlloc( m_size );
|
||||||
}
|
}
|
||||||
@ -287,21 +285,19 @@ StringBuilder & StringBuilder::append( const char * s )
|
|||||||
|
|
||||||
const uint slen = uint(strlen( s ));
|
const uint slen = uint(strlen( s ));
|
||||||
|
|
||||||
if( m_str == NULL ) {
|
if (m_str == NULL) {
|
||||||
m_size = slen + 1;
|
m_size = slen + 1;
|
||||||
m_str = strAlloc(m_size);
|
m_str = strAlloc(m_size);
|
||||||
strCpy( m_str, m_size, s );
|
memcpy(m_str, s, m_size + 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
const uint len = uint(strlen( m_str ));
|
const uint len = uint(strlen( m_str ));
|
||||||
|
if (m_size < len + slen + 1) {
|
||||||
if( m_size < len + slen + 1 ) {
|
|
||||||
m_size = len + slen + 1;
|
m_size = len + slen + 1;
|
||||||
m_str = strReAlloc(m_str, m_size);
|
m_str = strReAlloc(m_str, m_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
strCat( m_str, m_size, s );
|
memcpy(m_str + len, s, slen + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -338,7 +334,7 @@ StringBuilder & StringBuilder::appendFormatList( const char * fmt, va_list arg )
|
|||||||
else {
|
else {
|
||||||
StringBuilder tmp_str;
|
StringBuilder tmp_str;
|
||||||
tmp_str.formatList( fmt, tmp );
|
tmp_str.formatList( fmt, tmp );
|
||||||
append( tmp_str );
|
append( tmp_str.str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
va_end(tmp);
|
va_end(tmp);
|
||||||
@ -391,7 +387,7 @@ StringBuilder & StringBuilder::number( uint i, int base )
|
|||||||
StringBuilder & StringBuilder::reserve( uint size_hint )
|
StringBuilder & StringBuilder::reserve( uint size_hint )
|
||||||
{
|
{
|
||||||
nvCheck(size_hint != 0);
|
nvCheck(size_hint != 0);
|
||||||
if( size_hint > m_size ) {
|
if (size_hint > m_size) {
|
||||||
m_str = strReAlloc(m_str, size_hint);
|
m_str = strReAlloc(m_str, size_hint);
|
||||||
m_size = size_hint;
|
m_size = size_hint;
|
||||||
}
|
}
|
||||||
@ -403,9 +399,9 @@ StringBuilder & StringBuilder::reserve( uint size_hint )
|
|||||||
StringBuilder & StringBuilder::copy( const char * s, int extra_size/*=0*/ )
|
StringBuilder & StringBuilder::copy( const char * s, int extra_size/*=0*/ )
|
||||||
{
|
{
|
||||||
nvCheck( s != NULL );
|
nvCheck( s != NULL );
|
||||||
uint str_size = uint(strlen( s )) + 1;
|
const uint str_size = uint(strlen( s )) + 1;
|
||||||
reserve(str_size + extra_size);
|
reserve(str_size + extra_size);
|
||||||
strCpy( m_str, str_size, s );
|
memcpy(m_str, s, str_size);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,11 +409,9 @@ StringBuilder & StringBuilder::copy( const char * s, int extra_size/*=0*/ )
|
|||||||
/** Copy an StringBuilder. */
|
/** Copy an StringBuilder. */
|
||||||
StringBuilder & StringBuilder::copy( const StringBuilder & s )
|
StringBuilder & StringBuilder::copy( const StringBuilder & s )
|
||||||
{
|
{
|
||||||
if( s.m_str == NULL ) {
|
if (s.m_str == NULL) {
|
||||||
nvCheck( s.m_size == 0 );
|
nvCheck( s.m_size == 0 );
|
||||||
m_size = 0;
|
reset();
|
||||||
strFree( m_str );
|
|
||||||
m_str = NULL;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
reserve( s.m_size );
|
reserve( s.m_size );
|
||||||
@ -428,8 +422,8 @@ StringBuilder & StringBuilder::copy( const StringBuilder & s )
|
|||||||
|
|
||||||
bool StringBuilder::endsWith(const char * str) const
|
bool StringBuilder::endsWith(const char * str) const
|
||||||
{
|
{
|
||||||
size_t l = strlen(str);
|
uint l = uint(strlen(str));
|
||||||
size_t ml = strlen(m_str);
|
uint ml = uint(strlen(m_str));
|
||||||
if (ml < l) return false;
|
if (ml < l) return false;
|
||||||
return strncmp(m_str + ml - l, str, l) == 0;
|
return strncmp(m_str + ml - l, str, l) == 0;
|
||||||
}
|
}
|
||||||
@ -596,7 +590,7 @@ void String::setString(const StringBuilder & str)
|
|||||||
data = NULL;
|
data = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
allocString(str);
|
allocString(str.str());
|
||||||
addRef();
|
addRef();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,8 @@ namespace nv
|
|||||||
bool isNull() const { return m_size == 0; }
|
bool isNull() const { return m_size == 0; }
|
||||||
|
|
||||||
// const char * accessors
|
// const char * accessors
|
||||||
operator const char * () const { return m_str; }
|
//operator const char * () const { return m_str; }
|
||||||
operator char * () { return m_str; }
|
//operator char * () { return m_str; }
|
||||||
const char * str() const { return m_str; }
|
const char * str() const { return m_str; }
|
||||||
char * str() { return m_str; }
|
char * str() { return m_str; }
|
||||||
|
|
||||||
|
@ -42,6 +42,8 @@ using namespace nv;
|
|||||||
(uint(uint8(ch2)) << 16) | (uint(uint8(ch3)) << 24 ))
|
(uint(uint8(ch2)) << 16) | (uint(uint8(ch3)) << 24 ))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const uint nv::FOURCC_NVTT = MAKEFOURCC('N', 'V', 'T', 'T');
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static const uint FOURCC_DDS = MAKEFOURCC('D', 'D', 'S', ' ');
|
static const uint FOURCC_DDS = MAKEFOURCC('D', 'D', 'S', ' ');
|
||||||
@ -58,6 +60,8 @@ namespace
|
|||||||
|
|
||||||
static const uint FOURCC_DX10 = MAKEFOURCC('D', 'X', '1', '0');
|
static const uint FOURCC_DX10 = MAKEFOURCC('D', 'X', '1', '0');
|
||||||
|
|
||||||
|
static const uint FOURCC_UVER = MAKEFOURCC('U', 'V', 'E', 'R');
|
||||||
|
|
||||||
// 32 bit RGB formats.
|
// 32 bit RGB formats.
|
||||||
static const uint D3DFMT_R8G8B8 = 20;
|
static const uint D3DFMT_R8G8B8 = 20;
|
||||||
static const uint D3DFMT_A8R8G8B8 = 21;
|
static const uint D3DFMT_A8R8G8B8 = 21;
|
||||||
@ -480,63 +484,62 @@ namespace nv
|
|||||||
|
|
||||||
} // nv namespace
|
} // nv namespace
|
||||||
|
|
||||||
/* Not used!
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
struct FormatDescriptor
|
struct FormatDescriptor
|
||||||
{
|
{
|
||||||
uint format;
|
uint format;
|
||||||
uint bitcount;
|
uint bitcount;
|
||||||
uint rmask;
|
uint rmask;
|
||||||
uint gmask;
|
uint gmask;
|
||||||
uint bmask;
|
uint bmask;
|
||||||
uint amask;
|
uint amask;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const FormatDescriptor s_d3dFormats[] =
|
static const FormatDescriptor s_d3dFormats[] =
|
||||||
{
|
{
|
||||||
{ D3DFMT_R8G8B8, 24, 0xFF0000, 0xFF00, 0xFF, 0 },
|
{ D3DFMT_R8G8B8, 24, 0xFF0000, 0xFF00, 0xFF, 0 },
|
||||||
{ D3DFMT_A8R8G8B8, 32, 0xFF0000, 0xFF00, 0xFF, 0xFF000000 }, // DXGI_FORMAT_B8G8R8A8_UNORM
|
{ D3DFMT_A8R8G8B8, 32, 0xFF0000, 0xFF00, 0xFF, 0xFF000000 }, // DXGI_FORMAT_B8G8R8A8_UNORM
|
||||||
{ D3DFMT_X8R8G8B8, 32, 0xFF0000, 0xFF00, 0xFF, 0 }, // DXGI_FORMAT_B8G8R8X8_UNORM
|
{ D3DFMT_X8R8G8B8, 32, 0xFF0000, 0xFF00, 0xFF, 0 }, // DXGI_FORMAT_B8G8R8X8_UNORM
|
||||||
{ D3DFMT_R5G6B5, 16, 0xF800, 0x7E0, 0x1F, 0 }, // DXGI_FORMAT_B5G6R5_UNORM
|
{ D3DFMT_R5G6B5, 16, 0xF800, 0x7E0, 0x1F, 0 }, // DXGI_FORMAT_B5G6R5_UNORM
|
||||||
{ D3DFMT_X1R5G5B5, 16, 0x7C00, 0x3E0, 0x1F, 0 },
|
{ D3DFMT_X1R5G5B5, 16, 0x7C00, 0x3E0, 0x1F, 0 },
|
||||||
{ D3DFMT_A1R5G5B5, 16, 0x7C00, 0x3E0, 0x1F, 0x8000 }, // DXGI_FORMAT_B5G5R5A1_UNORM
|
{ D3DFMT_A1R5G5B5, 16, 0x7C00, 0x3E0, 0x1F, 0x8000 }, // DXGI_FORMAT_B5G5R5A1_UNORM
|
||||||
{ D3DFMT_A4R4G4B4, 16, 0xF00, 0xF0, 0xF, 0xF000 },
|
{ D3DFMT_A4R4G4B4, 16, 0xF00, 0xF0, 0xF, 0xF000 },
|
||||||
{ D3DFMT_R3G3B2, 8, 0xE0, 0x1C, 0x3, 0 },
|
{ D3DFMT_R3G3B2, 8, 0xE0, 0x1C, 0x3, 0 },
|
||||||
{ D3DFMT_A8, 8, 0, 0, 0, 8 }, // DXGI_FORMAT_A8_UNORM
|
{ D3DFMT_A8, 8, 0, 0, 0, 8 }, // DXGI_FORMAT_A8_UNORM
|
||||||
{ D3DFMT_A8R3G3B2, 16, 0xE0, 0x1C, 0x3, 0xFF00 },
|
{ D3DFMT_A8R3G3B2, 16, 0xE0, 0x1C, 0x3, 0xFF00 },
|
||||||
{ D3DFMT_X4R4G4B4, 16, 0xF00, 0xF0, 0xF, 0 },
|
{ D3DFMT_X4R4G4B4, 16, 0xF00, 0xF0, 0xF, 0 },
|
||||||
{ D3DFMT_A2B10G10R10, 32, 0x3FF, 0xFFC00, 0x3FF00000, 0xC0000000 }, // DXGI_FORMAT_R10G10B10A2
|
{ D3DFMT_A2B10G10R10, 32, 0x3FF, 0xFFC00, 0x3FF00000, 0xC0000000 }, // DXGI_FORMAT_R10G10B10A2
|
||||||
{ D3DFMT_A8B8G8R8, 32, 0xFF, 0xFF00, 0xFF0000, 0xFF000000 }, // DXGI_FORMAT_R8G8B8A8_UNORM
|
{ D3DFMT_A8B8G8R8, 32, 0xFF, 0xFF00, 0xFF0000, 0xFF000000 }, // DXGI_FORMAT_R8G8B8A8_UNORM
|
||||||
{ D3DFMT_X8B8G8R8, 32, 0xFF, 0xFF00, 0xFF0000, 0 },
|
{ D3DFMT_X8B8G8R8, 32, 0xFF, 0xFF00, 0xFF0000, 0 },
|
||||||
{ D3DFMT_G16R16, 32, 0xFFFF, 0xFFFF0000, 0, 0 }, // DXGI_FORMAT_R16G16_UNORM
|
{ D3DFMT_G16R16, 32, 0xFFFF, 0xFFFF0000, 0, 0 }, // DXGI_FORMAT_R16G16_UNORM
|
||||||
{ D3DFMT_A2R10G10B10, 32, 0x3FF00000, 0xFFC00, 0x3FF, 0xC0000000 },
|
{ D3DFMT_A2R10G10B10, 32, 0x3FF00000, 0xFFC00, 0x3FF, 0xC0000000 },
|
||||||
|
{ D3DFMT_A2B10G10R10, 32, 0x3FF, 0xFFC00, 0x3FF00000, 0xC0000000 },
|
||||||
|
|
||||||
{ D3DFMT_L8, 8, 8, 0, 0, 0 }, // DXGI_FORMAT_R8_UNORM
|
{ D3DFMT_L8, 8, 8, 0, 0, 0 }, // DXGI_FORMAT_R8_UNORM
|
||||||
{ D3DFMT_L16, 16, 16, 0, 0, 0 }, // DXGI_FORMAT_R16_UNORM
|
{ D3DFMT_L16, 16, 16, 0, 0, 0 }, // DXGI_FORMAT_R16_UNORM
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint s_d3dFormatCount = sizeof(s_d3dFormats) / sizeof(s_d3dFormats[0]);
|
static const uint s_d3dFormatCount = sizeof(s_d3dFormats) / sizeof(s_d3dFormats[0]);
|
||||||
|
|
||||||
static uint findD3D9Format(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
|
static uint findD3D9Format(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < s_d3dFormatCount; i++)
|
for (int i = 0; i < s_d3dFormatCount; i++)
|
||||||
{
|
{
|
||||||
if (s_d3dFormats[i].bitcount == bitcount &&
|
if (s_d3dFormats[i].bitcount == bitcount &&
|
||||||
s_d3dFormats[i].rmask == rmask &&
|
s_d3dFormats[i].rmask == rmask &&
|
||||||
s_d3dFormats[i].gmask == gmask &&
|
s_d3dFormats[i].gmask == gmask &&
|
||||||
s_d3dFormats[i].bmask == bmask &&
|
s_d3dFormats[i].bmask == bmask &&
|
||||||
s_d3dFormats[i].amask == amask)
|
s_d3dFormats[i].amask == amask)
|
||||||
{
|
{
|
||||||
return s_d3dFormats[i].format;
|
return s_d3dFormats[i].format;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // nv namespace
|
} // namespace
|
||||||
*/
|
|
||||||
|
|
||||||
DDSHeader::DDSHeader()
|
DDSHeader::DDSHeader()
|
||||||
{
|
{
|
||||||
@ -551,7 +554,7 @@ DDSHeader::DDSHeader()
|
|||||||
memset(this->reserved, 0, sizeof(this->reserved));
|
memset(this->reserved, 0, sizeof(this->reserved));
|
||||||
|
|
||||||
// Store version information on the reserved header attributes.
|
// Store version information on the reserved header attributes.
|
||||||
this->reserved[9] = MAKEFOURCC('N', 'V', 'T', 'T');
|
this->reserved[9] = FOURCC_NVTT;
|
||||||
this->reserved[10] = (2 << 16) | (1 << 8) | (0); // major.minor.revision
|
this->reserved[10] = (2 << 16) | (1 << 8) | (0); // major.minor.revision
|
||||||
|
|
||||||
this->pf.size = 32;
|
this->pf.size = 32;
|
||||||
@ -598,7 +601,7 @@ void DDSHeader::setMipmapCount(uint count)
|
|||||||
if (count == 0 || count == 1)
|
if (count == 0 || count == 1)
|
||||||
{
|
{
|
||||||
this->flags &= ~DDSD_MIPMAPCOUNT;
|
this->flags &= ~DDSD_MIPMAPCOUNT;
|
||||||
this->mipmapcount = 0;
|
this->mipmapcount = 1;
|
||||||
|
|
||||||
if (this->caps.caps2 == 0) {
|
if (this->caps.caps2 == 0) {
|
||||||
this->caps.caps1 = DDSCAPS_TEXTURE;
|
this->caps.caps1 = DDSCAPS_TEXTURE;
|
||||||
@ -725,15 +728,13 @@ void DDSHeader::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nvCheck(bitcount > 0 && bitcount <= 32);
|
// D3DX functions do not like this:
|
||||||
|
|
||||||
// Align to 8.
|
|
||||||
if (bitcount <= 8) bitcount = 8;
|
|
||||||
else if (bitcount <= 16) bitcount = 16;
|
|
||||||
else if (bitcount <= 24) bitcount = 24;
|
|
||||||
else bitcount = 32;
|
|
||||||
|
|
||||||
this->pf.fourcc = 0; //findD3D9Format(bitcount, rmask, gmask, bmask, amask);
|
this->pf.fourcc = 0; //findD3D9Format(bitcount, rmask, gmask, bmask, amask);
|
||||||
|
/*if (this->pf.fourcc) {
|
||||||
|
this->pf.flags |= DDPF_FOURCC;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
nvCheck(bitcount > 0 && bitcount <= 32);
|
||||||
this->pf.bitcount = bitcount;
|
this->pf.bitcount = bitcount;
|
||||||
this->pf.rmask = rmask;
|
this->pf.rmask = rmask;
|
||||||
this->pf.gmask = gmask;
|
this->pf.gmask = gmask;
|
||||||
@ -760,6 +761,12 @@ void DDSHeader::setHasAlphaFlag(bool b)
|
|||||||
else this->pf.flags &= ~DDPF_ALPHAPIXELS;
|
else this->pf.flags &= ~DDPF_ALPHAPIXELS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DDSHeader::setUserVersion(int version)
|
||||||
|
{
|
||||||
|
this->reserved[7] = FOURCC_UVER;
|
||||||
|
this->reserved[8] = version;
|
||||||
|
}
|
||||||
|
|
||||||
void DDSHeader::swapBytes()
|
void DDSHeader::swapBytes()
|
||||||
{
|
{
|
||||||
this->fourcc = POSH_LittleU32(this->fourcc);
|
this->fourcc = POSH_LittleU32(this->fourcc);
|
||||||
@ -798,10 +805,48 @@ void DDSHeader::swapBytes()
|
|||||||
|
|
||||||
bool DDSHeader::hasDX10Header() const
|
bool DDSHeader::hasDX10Header() const
|
||||||
{
|
{
|
||||||
return this->pf.fourcc == FOURCC_DX10; // @@ This is according to AMD
|
return this->pf.fourcc == FOURCC_DX10;
|
||||||
//return this->pf.flags == 0; // @@ This is according to MS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint DDSHeader::signature() const
|
||||||
|
{
|
||||||
|
return this->reserved[9];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint DDSHeader::toolVersion() const
|
||||||
|
{
|
||||||
|
return this->reserved[10];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint DDSHeader::userVersion() const
|
||||||
|
{
|
||||||
|
if (this->reserved[7] == FOURCC_UVER) {
|
||||||
|
return this->reserved[8];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DDSHeader::isNormalMap() const
|
||||||
|
{
|
||||||
|
return (pf.flags & DDPF_NORMAL) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DDSHeader::hasAlpha() const
|
||||||
|
{
|
||||||
|
return (pf.flags & DDPF_ALPHAPIXELS) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint DDSHeader::d3d9Format() const
|
||||||
|
{
|
||||||
|
if (pf.flags & DDPF_FOURCC) {
|
||||||
|
return pf.fourcc;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return findD3D9Format(pf.bitcount, pf.rmask, pf.gmask, pf.bmask, pf.amask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DirectDrawSurface::DirectDrawSurface() : stream(NULL)
|
DirectDrawSurface::DirectDrawSurface() : stream(NULL)
|
||||||
{
|
{
|
||||||
@ -955,7 +1000,7 @@ bool DirectDrawSurface::hasAlpha() const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// @@ Here we could check the ALPHA_PIXELS flag, but nobody sets it.
|
// @@ Here we could check the ALPHA_PIXELS flag, but nobody sets it. (except us?)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1047,6 +1092,11 @@ void DirectDrawSurface::setHasAlphaFlag(bool b)
|
|||||||
header.setHasAlphaFlag(b);
|
header.setHasAlphaFlag(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DirectDrawSurface::setUserVersion(int version)
|
||||||
|
{
|
||||||
|
nvDebugCheck(isValid());
|
||||||
|
header.setUserVersion(version);
|
||||||
|
}
|
||||||
|
|
||||||
void DirectDrawSurface::mipmap(Image * img, uint face, uint mipmap)
|
void DirectDrawSurface::mipmap(Image * img, uint face, uint mipmap)
|
||||||
{
|
{
|
||||||
@ -1093,6 +1143,28 @@ void DirectDrawSurface::mipmap(Image * img, uint face, uint mipmap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void * DirectDrawSurface::readData(uint * sizePtr)
|
||||||
|
{
|
||||||
|
uint header_size = 128; // sizeof(DDSHeader);
|
||||||
|
|
||||||
|
if (header.hasDX10Header())
|
||||||
|
{
|
||||||
|
header_size += 20; // sizeof(DDSHeader10);
|
||||||
|
}
|
||||||
|
|
||||||
|
stream->seek(header_size);
|
||||||
|
|
||||||
|
int size = stream->size() - header_size;
|
||||||
|
*sizePtr = size;
|
||||||
|
|
||||||
|
void * data = new unsigned char [size];
|
||||||
|
|
||||||
|
size = stream->serialize(data, size);
|
||||||
|
nvDebugCheck(size == *sizePtr);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
void DirectDrawSurface::readLinearImage(Image * img)
|
void DirectDrawSurface::readLinearImage(Image * img)
|
||||||
{
|
{
|
||||||
nvDebugCheck(stream != NULL);
|
nvDebugCheck(stream != NULL);
|
||||||
@ -1411,26 +1483,33 @@ void DirectDrawSurface::printInfo() const
|
|||||||
if (header.pf.flags & DDPF_ALPHAPREMULT) printf("\t\tDDPF_ALPHAPREMULT\n");
|
if (header.pf.flags & DDPF_ALPHAPREMULT) printf("\t\tDDPF_ALPHAPREMULT\n");
|
||||||
if (header.pf.flags & DDPF_NORMAL) printf("\t\tDDPF_NORMAL\n");
|
if (header.pf.flags & DDPF_NORMAL) printf("\t\tDDPF_NORMAL\n");
|
||||||
|
|
||||||
printf("\tFourCC: '%c%c%c%c'\n",
|
if (header.pf.fourcc != 0) {
|
||||||
((header.pf.fourcc >> 0) & 0xFF),
|
// Display fourcc code even when DDPF_FOURCC flag not set.
|
||||||
((header.pf.fourcc >> 8) & 0xFF),
|
printf("\tFourCC: '%c%c%c%c' (0x%.8X)\n",
|
||||||
((header.pf.fourcc >> 16) & 0xFF),
|
((header.pf.fourcc >> 0) & 0xFF),
|
||||||
((header.pf.fourcc >> 24) & 0xFF));
|
((header.pf.fourcc >> 8) & 0xFF),
|
||||||
if ((header.pf.fourcc & DDPF_FOURCC) && (header.pf.bitcount != 0))
|
((header.pf.fourcc >> 16) & 0xFF),
|
||||||
|
((header.pf.fourcc >> 24) & 0xFF),
|
||||||
|
header.pf.fourcc);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((header.pf.flags & DDPF_FOURCC) && (header.pf.bitcount != 0))
|
||||||
{
|
{
|
||||||
printf("\tSwizzle: '%c%c%c%c'\n",
|
printf("\tSwizzle: '%c%c%c%c' (0x%.8X)\n",
|
||||||
(header.pf.bitcount >> 0) & 0xFF,
|
(header.pf.bitcount >> 0) & 0xFF,
|
||||||
(header.pf.bitcount >> 8) & 0xFF,
|
(header.pf.bitcount >> 8) & 0xFF,
|
||||||
(header.pf.bitcount >> 16) & 0xFF,
|
(header.pf.bitcount >> 16) & 0xFF,
|
||||||
(header.pf.bitcount >> 24) & 0xFF);
|
(header.pf.bitcount >> 24) & 0xFF,
|
||||||
|
header.pf.bitcount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("\tBit count: %d\n", header.pf.bitcount);
|
printf("\tBit count: %d\n", header.pf.bitcount);
|
||||||
}
|
}
|
||||||
printf("\tRed mask: 0x%.8X\n", header.pf.rmask);
|
|
||||||
|
printf("\tRed mask: 0x%.8X\n", header.pf.rmask);
|
||||||
printf("\tGreen mask: 0x%.8X\n", header.pf.gmask);
|
printf("\tGreen mask: 0x%.8X\n", header.pf.gmask);
|
||||||
printf("\tBlue mask: 0x%.8X\n", header.pf.bmask);
|
printf("\tBlue mask: 0x%.8X\n", header.pf.bmask);
|
||||||
printf("\tAlpha mask: 0x%.8X\n", header.pf.amask);
|
printf("\tAlpha mask: 0x%.8X\n", header.pf.amask);
|
||||||
|
|
||||||
printf("Caps:\n");
|
printf("Caps:\n");
|
||||||
@ -1467,7 +1546,7 @@ void DirectDrawSurface::printInfo() const
|
|||||||
printf("\tArray size: %u\n", header.header10.arraySize);
|
printf("\tArray size: %u\n", header.header10.arraySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header.reserved[9] == MAKEFOURCC('N', 'V', 'T', 'T'))
|
if (header.reserved[9] == FOURCC_NVTT)
|
||||||
{
|
{
|
||||||
int major = (header.reserved[10] >> 16) & 0xFF;
|
int major = (header.reserved[10] >> 16) & 0xFF;
|
||||||
int minor = (header.reserved[10] >> 8) & 0xFF;
|
int minor = (header.reserved[10] >> 8) & 0xFF;
|
||||||
@ -1476,5 +1555,10 @@ void DirectDrawSurface::printInfo() const
|
|||||||
printf("Version:\n");
|
printf("Version:\n");
|
||||||
printf("\tNVIDIA Texture Tools %d.%d.%d\n", major, minor, revision);
|
printf("\tNVIDIA Texture Tools %d.%d.%d\n", major, minor, revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (header.reserved[7] == FOURCC_UVER)
|
||||||
|
{
|
||||||
|
printf("User Version: %d\n", header.reserved[8]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@ namespace nv
|
|||||||
class Stream;
|
class Stream;
|
||||||
struct ColorBlock;
|
struct ColorBlock;
|
||||||
|
|
||||||
|
extern const uint FOURCC_NVTT;
|
||||||
|
|
||||||
struct NVIMAGE_CLASS DDSPixelFormat
|
struct NVIMAGE_CLASS DDSPixelFormat
|
||||||
{
|
{
|
||||||
uint size;
|
uint size;
|
||||||
@ -100,10 +102,17 @@ namespace nv
|
|||||||
void setDX10Format(uint format);
|
void setDX10Format(uint format);
|
||||||
void setNormalFlag(bool b);
|
void setNormalFlag(bool b);
|
||||||
void setHasAlphaFlag(bool b);
|
void setHasAlphaFlag(bool b);
|
||||||
|
void setUserVersion(int version);
|
||||||
|
|
||||||
void swapBytes();
|
void swapBytes();
|
||||||
|
|
||||||
bool hasDX10Header() const;
|
bool hasDX10Header() const;
|
||||||
|
uint signature() const;
|
||||||
|
uint toolVersion() const;
|
||||||
|
uint userVersion() const;
|
||||||
|
bool isNormalMap() const;
|
||||||
|
bool hasAlpha() const;
|
||||||
|
uint d3d9Format() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
NVIMAGE_API Stream & operator<< (Stream & s, DDSHeader & header);
|
NVIMAGE_API Stream & operator<< (Stream & s, DDSHeader & header);
|
||||||
@ -137,9 +146,11 @@ namespace nv
|
|||||||
|
|
||||||
void setNormalFlag(bool b);
|
void setNormalFlag(bool b);
|
||||||
void setHasAlphaFlag(bool b);
|
void setHasAlphaFlag(bool b);
|
||||||
|
void setUserVersion(int version);
|
||||||
|
|
||||||
void mipmap(Image * img, uint f, uint m);
|
void mipmap(Image * img, uint f, uint m);
|
||||||
// void mipmap(FloatImage * img, uint f, uint m);
|
// void mipmap(FloatImage * img, uint f, uint m);
|
||||||
|
void * readData(uint * sizePtr);
|
||||||
|
|
||||||
void printInfo() const;
|
void printInfo() const;
|
||||||
|
|
||||||
|
@ -199,12 +199,12 @@ void FloatImage::normalize(uint base_component)
|
|||||||
|
|
||||||
void FloatImage::packNormals(uint base_component)
|
void FloatImage::packNormals(uint base_component)
|
||||||
{
|
{
|
||||||
scaleBias(base_component, 3, 0.5f, 1.0f);
|
scaleBias(base_component, 3, 0.5f, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FloatImage::expandNormals(uint base_component)
|
void FloatImage::expandNormals(uint base_component)
|
||||||
{
|
{
|
||||||
scaleBias(base_component, 3, 2, -0.5);
|
scaleBias(base_component, 3, 2, -1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FloatImage::scaleBias(uint base_component, uint num, float scale, float bias)
|
void FloatImage::scaleBias(uint base_component, uint num, float scale, float bias)
|
||||||
@ -215,7 +215,7 @@ void FloatImage::scaleBias(uint base_component, uint num, float scale, float bia
|
|||||||
float * ptr = this->channel(base_component + c);
|
float * ptr = this->channel(base_component + c);
|
||||||
|
|
||||||
for(uint i = 0; i < size; i++) {
|
for(uint i = 0; i < size; i++) {
|
||||||
ptr[i] = scale * (ptr[i] + bias);
|
ptr[i] = scale * ptr[i] + bias;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
#include "FloatImage.h"
|
#include "FloatImage.h"
|
||||||
#include "TgaFile.h"
|
#include "TgaFile.h"
|
||||||
#include "PsdFile.h"
|
#include "PsdFile.h"
|
||||||
|
#include "DirectDrawSurface.h"
|
||||||
|
|
||||||
#include "nvmath/Color.h"
|
#include "nvmath/Color.h"
|
||||||
|
#include "nvmath/Half.h"
|
||||||
|
|
||||||
#include "nvcore/Ptr.h"
|
#include "nvcore/Ptr.h"
|
||||||
#include "nvcore/Utils.h"
|
#include "nvcore/Utils.h"
|
||||||
@ -93,6 +95,8 @@ namespace nv
|
|||||||
|
|
||||||
#endif // defined(HAVE_FREEIMAGE)
|
#endif // defined(HAVE_FREEIMAGE)
|
||||||
|
|
||||||
|
static FloatImage * loadFloatDDS(Stream & s);
|
||||||
|
|
||||||
} // ImageIO namespace
|
} // ImageIO namespace
|
||||||
} // nv namespace
|
} // nv namespace
|
||||||
|
|
||||||
@ -207,12 +211,18 @@ FloatImage * nv::ImageIO::loadFloat(const char * fileName, Stream & s)
|
|||||||
|
|
||||||
const uint spos = s.tell(); // Save stream position.
|
const uint spos = s.tell(); // Save stream position.
|
||||||
|
|
||||||
|
if (strCaseCmp(extension, ".dds") == 0) {
|
||||||
|
floatImage = loadFloatDDS(s);
|
||||||
|
}
|
||||||
|
|
||||||
// Try to load as a floating point image.
|
// Try to load as a floating point image.
|
||||||
#if defined(HAVE_FREEIMAGE)
|
#if defined(HAVE_FREEIMAGE)
|
||||||
FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(fileName);
|
if (floatImage == NULL) {
|
||||||
if (fif != FIF_UNKNOWN && FreeImage_FIFSupportsReading(fif)) {
|
FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(fileName);
|
||||||
floatImage = loadFloatFreeImage(fif, s);
|
if (fif != FIF_UNKNOWN && FreeImage_FIFSupportsReading(fif)) {
|
||||||
}
|
floatImage = loadFloatFreeImage(fif, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
#else // defined(HAVE_FREEIMAGE)
|
#else // defined(HAVE_FREEIMAGE)
|
||||||
#pragma message(NV_FILE_LINE "TODO: Load TIFF and EXR files from stream.")
|
#pragma message(NV_FILE_LINE "TODO: Load TIFF and EXR files from stream.")
|
||||||
#if defined(HAVE_TIFF)
|
#if defined(HAVE_TIFF)
|
||||||
@ -1697,3 +1707,44 @@ bool nv::ImageIO::saveFloatEXR(const char * fileName, const FloatImage * fimage,
|
|||||||
#endif // defined(HAVE_OPENEXR)
|
#endif // defined(HAVE_OPENEXR)
|
||||||
|
|
||||||
#endif // defined(HAVE_FREEIMAGE)
|
#endif // defined(HAVE_FREEIMAGE)
|
||||||
|
|
||||||
|
FloatImage * nv::ImageIO::loadFloatDDS(Stream & s)
|
||||||
|
{
|
||||||
|
nvCheck(s.isLoading());
|
||||||
|
nvCheck(!s.isError());
|
||||||
|
|
||||||
|
DDSHeader header;
|
||||||
|
s << header;
|
||||||
|
|
||||||
|
static const uint D3DFMT_A16B16G16R16F = 113;
|
||||||
|
|
||||||
|
// @@ We only support RGBA16F for now.
|
||||||
|
if (header.pf.fourcc == D3DFMT_A16B16G16R16F) {
|
||||||
|
const int size = header.width * header.height;
|
||||||
|
uint16 * const data = new uint16[size * 4];
|
||||||
|
|
||||||
|
s.serialize(data, size * 4 * sizeof(uint16));
|
||||||
|
|
||||||
|
FloatImage * img = new FloatImage;
|
||||||
|
img->allocate(4, header.width, header.height);
|
||||||
|
|
||||||
|
uint32 * r = (uint32 *)img->channel(0);
|
||||||
|
uint32 * g = (uint32 *)img->channel(1);
|
||||||
|
uint32 * b = (uint32 *)img->channel(2);
|
||||||
|
uint32 * a = (uint32 *)img->channel(3);
|
||||||
|
|
||||||
|
uint16 * ptr = data;
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
*r++ = half_to_float( *ptr++ );
|
||||||
|
*g++ = half_to_float( *ptr++ );
|
||||||
|
*b++ = half_to_float( *ptr++ );
|
||||||
|
*a++ = half_to_float( *ptr++ );
|
||||||
|
}
|
||||||
|
|
||||||
|
delete [] data;
|
||||||
|
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@ -59,7 +59,9 @@ void CompressionOptions::reset()
|
|||||||
m.gsize = 8;
|
m.gsize = 8;
|
||||||
m.bsize = 8;
|
m.bsize = 8;
|
||||||
m.asize = 8;
|
m.asize = 8;
|
||||||
m.pixelType = PixelType_UnsignedNorm;
|
|
||||||
|
m.pixelType = PixelType_UnsignedNorm;
|
||||||
|
m.pitchAlignment = 1;
|
||||||
|
|
||||||
m.enableColorDithering = false;
|
m.enableColorDithering = false;
|
||||||
m.enableAlphaDithering = false;
|
m.enableAlphaDithering = false;
|
||||||
@ -98,10 +100,10 @@ void CompressionOptions::setColorWeights(float red, float green, float blue, flo
|
|||||||
|
|
||||||
|
|
||||||
/// Set color mask to describe the RGB/RGBA format.
|
/// Set color mask to describe the RGB/RGBA format.
|
||||||
void CompressionOptions::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
|
void CompressionOptions::setPixelFormat(uint bitCount, uint rmask, uint gmask, uint bmask, uint amask)
|
||||||
{
|
{
|
||||||
// Validate arguments.
|
// Validate arguments.
|
||||||
nvCheck(bitcount == 8 || bitcount == 16 || bitcount == 24 || bitcount == 32);
|
nvCheck(bitCount <= 32);
|
||||||
nvCheck((rmask & gmask) == 0);
|
nvCheck((rmask & gmask) == 0);
|
||||||
nvCheck((rmask & bmask) == 0);
|
nvCheck((rmask & bmask) == 0);
|
||||||
nvCheck((rmask & amask) == 0);
|
nvCheck((rmask & amask) == 0);
|
||||||
@ -109,16 +111,16 @@ void CompressionOptions::setPixelFormat(uint bitcount, uint rmask, uint gmask, u
|
|||||||
nvCheck((gmask & amask) == 0);
|
nvCheck((gmask & amask) == 0);
|
||||||
nvCheck((bmask & amask) == 0);
|
nvCheck((bmask & amask) == 0);
|
||||||
|
|
||||||
if (bitcount != 32)
|
if (bitCount != 32)
|
||||||
{
|
{
|
||||||
uint maxMask = (1 << bitcount);
|
uint maxMask = (1 << bitCount);
|
||||||
nvCheck(maxMask > rmask);
|
nvCheck(maxMask > rmask);
|
||||||
nvCheck(maxMask > gmask);
|
nvCheck(maxMask > gmask);
|
||||||
nvCheck(maxMask > bmask);
|
nvCheck(maxMask > bmask);
|
||||||
nvCheck(maxMask > amask);
|
nvCheck(maxMask > amask);
|
||||||
}
|
}
|
||||||
|
|
||||||
m.bitcount = bitcount;
|
m.bitcount = bitCount;
|
||||||
m.rmask = rmask;
|
m.rmask = rmask;
|
||||||
m.gmask = gmask;
|
m.gmask = gmask;
|
||||||
m.bmask = bmask;
|
m.bmask = bmask;
|
||||||
@ -153,6 +155,14 @@ void CompressionOptions::setPixelType(PixelType pixelType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Set pitch alignment in bytes.
|
||||||
|
void CompressionOptions::setPitchAlignment(int pitchAlignment)
|
||||||
|
{
|
||||||
|
nvDebugCheck(pitchAlignment > 0 && isPowerOfTwo(pitchAlignment));
|
||||||
|
m.pitchAlignment = pitchAlignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Use external compressor.
|
/// Use external compressor.
|
||||||
void CompressionOptions::setExternalCompressor(const char * name)
|
void CompressionOptions::setExternalCompressor(const char * name)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,8 @@ namespace nvtt
|
|||||||
uint8 asize;
|
uint8 asize;
|
||||||
|
|
||||||
PixelType pixelType;
|
PixelType pixelType;
|
||||||
|
uint pitchAlignment;
|
||||||
|
|
||||||
nv::String externalCompressor;
|
nv::String externalCompressor;
|
||||||
|
|
||||||
// Quantization.
|
// Quantization.
|
||||||
|
@ -40,12 +40,9 @@ using namespace nvtt;
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
inline uint computePitch(uint w, uint bitsize)
|
inline uint computePitch(uint w, uint bitsize, uint alignment)
|
||||||
{
|
{
|
||||||
uint p = w * ((bitsize + 7) / 8);
|
return ((w * bitsize + 8 * alignment - 1) / (8 * alignment)) * alignment;
|
||||||
|
|
||||||
// Align to 32 bits.
|
|
||||||
return ((p + 3) / 4) * 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void convert_to_a8r8g8b8(const void * src, void * dst, uint w)
|
inline void convert_to_a8r8g8b8(const void * src, void * dst, uint w)
|
||||||
@ -65,6 +62,67 @@ namespace
|
|||||||
return half_from_float(c.u);
|
return half_from_float(c.u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct BitStream
|
||||||
|
{
|
||||||
|
BitStream(uint8 * ptr) : ptr(ptr), buffer(0), bits(0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void putBits(uint p, int bitCount)
|
||||||
|
{
|
||||||
|
nvDebugCheck(bits < 8);
|
||||||
|
nvDebugCheck(bitCount <= 32);
|
||||||
|
|
||||||
|
uint64 buffer = (this->buffer << bitCount) | p;
|
||||||
|
uint bits = this->bits + bitCount;
|
||||||
|
|
||||||
|
while (bits >= 8)
|
||||||
|
{
|
||||||
|
*ptr++ = (buffer & 0xFF);
|
||||||
|
|
||||||
|
buffer >>= 8;
|
||||||
|
bits -= 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->buffer = (uint8)buffer;
|
||||||
|
this->bits = bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
void putFloat(float f)
|
||||||
|
{
|
||||||
|
nvDebugCheck(bits == 0);
|
||||||
|
*((float *)ptr) = f;
|
||||||
|
ptr += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
void putHalf(float f)
|
||||||
|
{
|
||||||
|
nvDebugCheck(bits == 0);
|
||||||
|
*((uint16 *)ptr) = to_half(f);
|
||||||
|
ptr += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void flush()
|
||||||
|
{
|
||||||
|
nvDebugCheck(bits < 8);
|
||||||
|
if (bits) {
|
||||||
|
*ptr++ = buffer;
|
||||||
|
buffer = 0;
|
||||||
|
bits = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void align(int alignment)
|
||||||
|
{
|
||||||
|
nvDebugCheck(alignment >= 1);
|
||||||
|
flush();
|
||||||
|
putBits(0, ((size_t)ptr % alignment) * 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8 * ptr;
|
||||||
|
uint8 buffer;
|
||||||
|
uint8 bits;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
@ -96,7 +154,7 @@ void PixelFormatConverter::compress(nvtt::InputFormat inputFormat, nvtt::AlphaMo
|
|||||||
if (compressionOptions.bitcount != 0)
|
if (compressionOptions.bitcount != 0)
|
||||||
{
|
{
|
||||||
bitCount = compressionOptions.bitcount;
|
bitCount = compressionOptions.bitcount;
|
||||||
nvCheck(bitCount == 8 || bitCount == 16 || bitCount == 24 || bitCount == 32);
|
nvCheck(bitCount <= 32);
|
||||||
|
|
||||||
rmask = compressionOptions.rmask;
|
rmask = compressionOptions.rmask;
|
||||||
gmask = compressionOptions.gmask;
|
gmask = compressionOptions.gmask;
|
||||||
@ -130,20 +188,16 @@ void PixelFormatConverter::compress(nvtt::InputFormat inputFormat, nvtt::AlphaMo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint byteCount = (bitCount + 7) / 8;
|
const uint pitch = computePitch(w, bitCount, compressionOptions.pitchAlignment);
|
||||||
uint pitch = computePitch(w, bitCount);
|
const uint wh = w * h;
|
||||||
|
|
||||||
uint srcPitch = w;
|
|
||||||
uint srcPlane = w * h;
|
|
||||||
|
|
||||||
|
|
||||||
// Allocate output scanline.
|
// Allocate output scanline.
|
||||||
uint8 * dst = (uint8 *)mem::malloc(pitch + 4);
|
uint8 * const dst = (uint8 *)mem::malloc(pitch);
|
||||||
|
|
||||||
for (uint y = 0; y < h; y++)
|
for (uint y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
const uint * src = (const uint *)data + y * srcPitch;
|
const uint * src = (const uint *)data + y * w;
|
||||||
const float * fsrc = (const float *)data + y * srcPitch;
|
const float * fsrc = (const float *)data + y * w;
|
||||||
|
|
||||||
if (inputFormat == nvtt::InputFormat_BGRA_8UB && compressionOptions.pixelType == nvtt::PixelType_UnsignedNorm && bitCount == 32 && rmask == 0xFF0000 && gmask == 0xFF00 && bmask == 0xFF && amask == 0xFF000000)
|
if (inputFormat == nvtt::InputFormat_BGRA_8UB && compressionOptions.pixelType == nvtt::PixelType_UnsignedNorm && bitCount == 32 && rmask == 0xFF0000 && gmask == 0xFF00 && bmask == 0xFF && amask == 0xFF000000)
|
||||||
{
|
{
|
||||||
@ -151,7 +205,7 @@ void PixelFormatConverter::compress(nvtt::InputFormat inputFormat, nvtt::AlphaMo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint8 * ptr = dst;
|
BitStream stream(dst);
|
||||||
|
|
||||||
for (uint x = 0; x < w; x++)
|
for (uint x = 0; x < w; x++)
|
||||||
{
|
{
|
||||||
@ -171,29 +225,25 @@ void PixelFormatConverter::compress(nvtt::InputFormat inputFormat, nvtt::AlphaMo
|
|||||||
//g = ((float *)src)[4 * x + 1];
|
//g = ((float *)src)[4 * x + 1];
|
||||||
//b = ((float *)src)[4 * x + 2];
|
//b = ((float *)src)[4 * x + 2];
|
||||||
//a = ((float *)src)[4 * x + 3];
|
//a = ((float *)src)[4 * x + 3];
|
||||||
r = fsrc[x + 0 * srcPlane];
|
r = fsrc[x + 0 * wh];
|
||||||
g = fsrc[x + 1 * srcPlane];
|
g = fsrc[x + 1 * wh];
|
||||||
b = fsrc[x + 2 * srcPlane];
|
b = fsrc[x + 2 * wh];
|
||||||
a = fsrc[x + 3 * srcPlane];
|
a = fsrc[x + 3 * wh];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compressionOptions.pixelType == nvtt::PixelType_Float)
|
if (compressionOptions.pixelType == nvtt::PixelType_Float)
|
||||||
{
|
{
|
||||||
if (rsize == 32) *((float *)ptr) = r;
|
if (rsize == 32) stream.putFloat(r);
|
||||||
else if (rsize == 16) *((uint16 *)ptr) = to_half(r);
|
else if (rsize == 16) stream.putHalf(r);
|
||||||
ptr += rsize / 8;
|
|
||||||
|
|
||||||
if (gsize == 32) *((float *)ptr) = g;
|
if (gsize == 32) stream.putFloat(g);
|
||||||
else if (gsize == 16) *((uint16 *)ptr) = to_half(g);
|
else if (gsize == 16) stream.putHalf(g);
|
||||||
ptr += gsize / 8;
|
|
||||||
|
|
||||||
if (bsize == 32) *((float *)ptr) = b;
|
if (bsize == 32) stream.putFloat(b);
|
||||||
else if (bsize == 16) *((uint16 *)ptr) = to_half(b);
|
else if (bsize == 16) stream.putHalf(b);
|
||||||
ptr += bsize / 8;
|
|
||||||
|
|
||||||
if (asize == 32) *((float *)ptr) = a;
|
if (asize == 32) stream.putFloat(a);
|
||||||
else if (asize == 16) *((uint16 *)ptr) = to_half(a);
|
else if (asize == 16) stream.putHalf(a);
|
||||||
ptr += asize / 8;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -212,25 +262,27 @@ void PixelFormatConverter::compress(nvtt::InputFormat inputFormat, nvtt::AlphaMo
|
|||||||
p |= PixelFormat::convert(c.b, 8, bsize) << bshift;
|
p |= PixelFormat::convert(c.b, 8, bsize) << bshift;
|
||||||
p |= PixelFormat::convert(c.a, 8, asize) << ashift;
|
p |= PixelFormat::convert(c.a, 8, asize) << ashift;
|
||||||
|
|
||||||
|
stream.putBits(p, bitCount);
|
||||||
|
|
||||||
// Output one byte at a time.
|
// Output one byte at a time.
|
||||||
for (uint i = 0; i < byteCount; i++)
|
/*for (uint i = 0; i < byteCount; i++)
|
||||||
{
|
{
|
||||||
*(dst + x * byteCount + i) = (p >> (i * 8)) & 0xFF;
|
*(dst + x * byteCount + i) = (p >> (i * 8)) & 0xFF;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zero padding.
|
// Zero padding.
|
||||||
for (uint x = w * byteCount; x < pitch; x++)
|
stream.align(compressionOptions.pitchAlignment);
|
||||||
|
nvDebugCheck(stream.ptr == dst + pitch);
|
||||||
|
|
||||||
|
/*for (uint x = w * byteCount; x < pitch; x++)
|
||||||
{
|
{
|
||||||
*(dst + x) = 0;
|
*(dst + x) = 0;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outputOptions.outputHandler != NULL)
|
outputOptions.writeData(dst, pitch);
|
||||||
{
|
|
||||||
outputOptions.outputHandler->writeData(dst, pitch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mem::free(dst);
|
mem::free(dst);
|
||||||
|
@ -89,18 +89,15 @@ namespace
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint computePitch(uint w, uint bitsize)
|
inline uint computePitch(uint w, uint bitsize, uint alignment)
|
||||||
{
|
{
|
||||||
uint p = w * ((bitsize + 7) / 8);
|
return ((w * bitsize + 8 * alignment - 1) / (8 * alignment)) * alignment;
|
||||||
|
}
|
||||||
|
|
||||||
// Align to 32 bits.
|
static int computeImageSize(uint w, uint h, uint d, uint bitCount, uint alignment, Format format)
|
||||||
return ((p + 3) / 4) * 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int computeImageSize(uint w, uint h, uint d, uint bitCount, Format format)
|
|
||||||
{
|
{
|
||||||
if (format == Format_RGBA) {
|
if (format == Format_RGBA) {
|
||||||
return d * h * computePitch(w, bitCount);
|
return d * h * computePitch(w, bitCount, alignment);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// @@ Handle 3D textures. DXT and VTC have different behaviors.
|
// @@ Handle 3D textures. DXT and VTC have different behaviors.
|
||||||
@ -324,7 +321,7 @@ int Compressor::estimateSize(int w, int h, int d, const CompressionOptions & com
|
|||||||
|
|
||||||
uint bitCount = co.getBitCount();
|
uint bitCount = co.getBitCount();
|
||||||
|
|
||||||
return computeImageSize(w, h, d, bitCount, format);
|
return computeImageSize(w, h, d, bitCount, co.pitchAlignment, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -413,7 +410,20 @@ bool Compressor::Private::outputHeader(const InputOptions::Private & inputOption
|
|||||||
if (outputOptions.container == Container_DDS || outputOptions.container == Container_DDS10)
|
if (outputOptions.container == Container_DDS || outputOptions.container == Container_DDS10)
|
||||||
{
|
{
|
||||||
DDSHeader header;
|
DDSHeader header;
|
||||||
|
|
||||||
|
header.setUserVersion(outputOptions.version);
|
||||||
|
|
||||||
|
if (inputOptions.textureType == TextureType_2D) {
|
||||||
|
header.setTexture2D();
|
||||||
|
}
|
||||||
|
else if (inputOptions.textureType == TextureType_Cube) {
|
||||||
|
header.setTextureCube();
|
||||||
|
}
|
||||||
|
/*else if (inputOptions.textureType == TextureType_3D) {
|
||||||
|
header.setTexture3D();
|
||||||
|
header.setDepth(inputOptions.targetDepth);
|
||||||
|
}*/
|
||||||
|
|
||||||
header.setWidth(inputOptions.targetWidth);
|
header.setWidth(inputOptions.targetWidth);
|
||||||
header.setHeight(inputOptions.targetHeight);
|
header.setHeight(inputOptions.targetHeight);
|
||||||
|
|
||||||
@ -499,7 +509,7 @@ bool Compressor::Private::outputHeader(const InputOptions::Private & inputOption
|
|||||||
if (compressionOptions.format == Format_RGBA)
|
if (compressionOptions.format == Format_RGBA)
|
||||||
{
|
{
|
||||||
// Get output bit count.
|
// Get output bit count.
|
||||||
header.setPitch(computePitch(inputOptions.targetWidth, compressionOptions.getBitCount()));
|
header.setPitch(computePitch(inputOptions.targetWidth, compressionOptions.getBitCount(), compressionOptions.pitchAlignment));
|
||||||
|
|
||||||
if (compressionOptions.pixelType == PixelType_Float)
|
if (compressionOptions.pixelType == PixelType_Float)
|
||||||
{
|
{
|
||||||
@ -564,7 +574,7 @@ bool Compressor::Private::outputHeader(const InputOptions::Private & inputOption
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
header.setLinearSize(computeImageSize(inputOptions.targetWidth, inputOptions.targetHeight, inputOptions.targetDepth, compressionOptions.bitcount, compressionOptions.format));
|
header.setLinearSize(computeImageSize(inputOptions.targetWidth, inputOptions.targetHeight, inputOptions.targetDepth, compressionOptions.bitcount, compressionOptions.pitchAlignment, compressionOptions.format));
|
||||||
|
|
||||||
if (compressionOptions.format == Format_DXT1 || compressionOptions.format == Format_DXT1a || compressionOptions.format == Format_DXT1n) {
|
if (compressionOptions.format == Format_DXT1 || compressionOptions.format == Format_DXT1a || compressionOptions.format == Format_DXT1n) {
|
||||||
header.setFourCC('D', 'X', 'T', '1');
|
header.setFourCC('D', 'X', 'T', '1');
|
||||||
@ -618,17 +628,6 @@ bool Compressor::Private::outputHeader(const InputOptions::Private & inputOption
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputOptions.textureType == TextureType_2D) {
|
|
||||||
header.setTexture2D();
|
|
||||||
}
|
|
||||||
else if (inputOptions.textureType == TextureType_Cube) {
|
|
||||||
header.setTextureCube();
|
|
||||||
}
|
|
||||||
/*else if (inputOptions.textureType == TextureType_3D) {
|
|
||||||
header.setTexture3D();
|
|
||||||
header.setDepth(inputOptions.targetDepth);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Swap bytes if necessary.
|
// Swap bytes if necessary.
|
||||||
header.swapBytes();
|
header.swapBytes();
|
||||||
|
|
||||||
@ -669,6 +668,19 @@ bool Compressor::Private::outputHeader(const TexImage & tex, int mipmapCount, co
|
|||||||
{
|
{
|
||||||
DDSHeader header;
|
DDSHeader header;
|
||||||
|
|
||||||
|
header.setUserVersion(outputOptions.version);
|
||||||
|
|
||||||
|
if (tex.textureType() == TextureType_2D) {
|
||||||
|
header.setTexture2D();
|
||||||
|
}
|
||||||
|
else if (tex.textureType() == TextureType_Cube) {
|
||||||
|
header.setTextureCube();
|
||||||
|
}
|
||||||
|
/*else if (tex.textureType() == TextureType_3D) {
|
||||||
|
header.setTexture3D();
|
||||||
|
header.setDepth(tex.depth());
|
||||||
|
}*/
|
||||||
|
|
||||||
header.setWidth(tex.width());
|
header.setWidth(tex.width());
|
||||||
header.setHeight(tex.height());
|
header.setHeight(tex.height());
|
||||||
header.setMipmapCount(mipmapCount);
|
header.setMipmapCount(mipmapCount);
|
||||||
@ -750,7 +762,7 @@ bool Compressor::Private::outputHeader(const TexImage & tex, int mipmapCount, co
|
|||||||
if (compressionOptions.format == Format_RGBA)
|
if (compressionOptions.format == Format_RGBA)
|
||||||
{
|
{
|
||||||
// Get output bit count.
|
// Get output bit count.
|
||||||
header.setPitch(computePitch(tex.width(), compressionOptions.getBitCount()));
|
header.setPitch(computePitch(tex.width(), compressionOptions.getBitCount(), compressionOptions.pitchAlignment));
|
||||||
|
|
||||||
if (compressionOptions.pixelType == PixelType_Float)
|
if (compressionOptions.pixelType == PixelType_Float)
|
||||||
{
|
{
|
||||||
@ -815,7 +827,7 @@ bool Compressor::Private::outputHeader(const TexImage & tex, int mipmapCount, co
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
header.setLinearSize(computeImageSize(tex.width(), tex.height(), tex.depth(), compressionOptions.bitcount, compressionOptions.format));
|
header.setLinearSize(computeImageSize(tex.width(), tex.height(), tex.depth(), compressionOptions.bitcount, compressionOptions.pitchAlignment, compressionOptions.format));
|
||||||
|
|
||||||
if (compressionOptions.format == Format_DXT1 || compressionOptions.format == Format_DXT1a || compressionOptions.format == Format_DXT1n) {
|
if (compressionOptions.format == Format_DXT1 || compressionOptions.format == Format_DXT1a || compressionOptions.format == Format_DXT1n) {
|
||||||
header.setFourCC('D', 'X', 'T', '1');
|
header.setFourCC('D', 'X', 'T', '1');
|
||||||
@ -869,17 +881,6 @@ bool Compressor::Private::outputHeader(const TexImage & tex, int mipmapCount, co
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tex.textureType() == TextureType_2D) {
|
|
||||||
header.setTexture2D();
|
|
||||||
}
|
|
||||||
else if (tex.textureType() == TextureType_Cube) {
|
|
||||||
header.setTextureCube();
|
|
||||||
}
|
|
||||||
/*else if (tex.textureType() == TextureType_3D) {
|
|
||||||
header.setTexture3D();
|
|
||||||
header.setDepth(tex.depth());
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Swap bytes if necessary.
|
// Swap bytes if necessary.
|
||||||
header.swapBytes();
|
header.swapBytes();
|
||||||
|
|
||||||
@ -890,7 +891,7 @@ bool Compressor::Private::outputHeader(const TexImage & tex, int mipmapCount, co
|
|||||||
headerSize = 128 + 20;
|
headerSize = 128 + 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool writeSucceed = outputOptions.outputHandler->writeData(&header, headerSize);
|
bool writeSucceed = outputOptions.writeData(&header, headerSize);
|
||||||
if (!writeSucceed)
|
if (!writeSucceed)
|
||||||
{
|
{
|
||||||
outputOptions.error(Error_FileWrite);
|
outputOptions.error(Error_FileWrite);
|
||||||
@ -916,7 +917,7 @@ bool Compressor::Private::compressMipmaps(uint f, const InputOptions::Private &
|
|||||||
|
|
||||||
for (uint m = 0; m < mipmapCount; m++)
|
for (uint m = 0; m < mipmapCount; m++)
|
||||||
{
|
{
|
||||||
int size = computeImageSize(w, h, d, compressionOptions.getBitCount(), compressionOptions.format);
|
int size = computeImageSize(w, h, d, compressionOptions.getBitCount(), compressionOptions.pitchAlignment, compressionOptions.format);
|
||||||
outputOptions.beginImage(size, w, h, d, f, m);
|
outputOptions.beginImage(size, w, h, d, f, m);
|
||||||
|
|
||||||
if (!initMipmap(mipmap, inputOptions, w, h, d, f, m))
|
if (!initMipmap(mipmap, inputOptions, w, h, d, f, m))
|
||||||
@ -1553,12 +1554,12 @@ int Compressor::Private::estimateSize(const InputOptions::Private & inputOptions
|
|||||||
{
|
{
|
||||||
const Format format = compressionOptions.format;
|
const Format format = compressionOptions.format;
|
||||||
|
|
||||||
uint bitCount = compressionOptions.bitcount;
|
const uint bitCount = compressionOptions.getBitCount();
|
||||||
if (format == Format_RGBA && bitCount == 0) bitCount = compressionOptions.rsize + compressionOptions.gsize + compressionOptions.bsize + compressionOptions.asize;
|
const uint pitchAlignment = compressionOptions.pitchAlignment;
|
||||||
|
|
||||||
inputOptions.computeTargetExtents();
|
inputOptions.computeTargetExtents();
|
||||||
|
|
||||||
uint mipmapCount = inputOptions.realMipmapCount();
|
const uint mipmapCount = inputOptions.realMipmapCount();
|
||||||
|
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
@ -1570,7 +1571,7 @@ int Compressor::Private::estimateSize(const InputOptions::Private & inputOptions
|
|||||||
|
|
||||||
for (uint m = 0; m < mipmapCount; m++)
|
for (uint m = 0; m < mipmapCount; m++)
|
||||||
{
|
{
|
||||||
size += computeImageSize(w, h, d, bitCount, format);
|
size += computeImageSize(w, h, d, bitCount, pitchAlignment, format);
|
||||||
|
|
||||||
// Compute extents of next mipmap:
|
// Compute extents of next mipmap:
|
||||||
w = max(1U, w / 2);
|
w = max(1U, w / 2);
|
||||||
|
@ -49,13 +49,20 @@ void OutputOptions::reset()
|
|||||||
|
|
||||||
m.outputHeader = true;
|
m.outputHeader = true;
|
||||||
m.container = Container_DDS;
|
m.container = Container_DDS;
|
||||||
|
m.version = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Set output file name.
|
/// Set output file name.
|
||||||
void OutputOptions::setFileName(const char * fileName)
|
void OutputOptions::setFileName(const char * fileName)
|
||||||
{
|
{
|
||||||
m.fileName = fileName; // @@ Do we need to record filename?
|
if (!m.fileName.isNull())
|
||||||
|
{
|
||||||
|
// To close the file and avoid leak.
|
||||||
|
delete m.outputHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
m.fileName = fileName;
|
||||||
m.outputHandler = NULL;
|
m.outputHandler = NULL;
|
||||||
|
|
||||||
DefaultOutputHandler * oh = new DefaultOutputHandler(fileName);
|
DefaultOutputHandler * oh = new DefaultOutputHandler(fileName);
|
||||||
@ -94,6 +101,11 @@ void OutputOptions::setContainer(Container container)
|
|||||||
m.container = container;
|
m.container = container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Set user version.
|
||||||
|
void OutputOptions::setUserVersion(int version)
|
||||||
|
{
|
||||||
|
m.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
bool OutputOptions::Private::hasValidOutputHandler() const
|
bool OutputOptions::Private::hasValidOutputHandler() const
|
||||||
{
|
{
|
||||||
|
@ -35,9 +35,7 @@ namespace nvtt
|
|||||||
{
|
{
|
||||||
DefaultOutputHandler(const char * fileName) : stream(fileName) {}
|
DefaultOutputHandler(const char * fileName) : stream(fileName) {}
|
||||||
|
|
||||||
virtual ~DefaultOutputHandler()
|
virtual ~DefaultOutputHandler() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel)
|
virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel)
|
||||||
{
|
{
|
||||||
@ -66,6 +64,7 @@ namespace nvtt
|
|||||||
|
|
||||||
bool outputHeader;
|
bool outputHeader;
|
||||||
Container container;
|
Container container;
|
||||||
|
int version;
|
||||||
|
|
||||||
bool hasValidOutputHandler() const;
|
bool hasValidOutputHandler() const;
|
||||||
|
|
||||||
|
@ -271,23 +271,19 @@ float TexImage::alphaTestCoverage(float alphaRef/*= 0.5*/) const
|
|||||||
|
|
||||||
bool TexImage::load(const char * fileName)
|
bool TexImage::load(const char * fileName)
|
||||||
{
|
{
|
||||||
#pragma message(NV_FILE_LINE "TODO: Add support for DDS textures in TexImage::load().")
|
AutoPtr<FloatImage> img(ImageIO::loadFloat(fileName));
|
||||||
|
if (img == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
AutoPtr<FloatImage> img(ImageIO::loadFloat(fileName));
|
detach();
|
||||||
|
|
||||||
if (img == NULL)
|
img->resizeChannelCount(4);
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
detach();
|
m->imageArray.resize(1);
|
||||||
|
m->imageArray[0] = img.release();
|
||||||
|
|
||||||
img->resizeChannelCount(4);
|
return true;
|
||||||
|
|
||||||
m->imageArray.resize(1);
|
|
||||||
m->imageArray[0] = img.release();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TexImage::save(const char * fileName) const
|
bool TexImage::save(const char * fileName) const
|
||||||
@ -560,25 +556,25 @@ void TexImage::resize(int w, int h, ResizeFilter filter)
|
|||||||
if (filter == ResizeFilter_Box)
|
if (filter == ResizeFilter_Box)
|
||||||
{
|
{
|
||||||
BoxFilter filter;
|
BoxFilter filter;
|
||||||
m->imageArray[i]->resize(filter, w, h, wrapMode, 3);
|
img = img->resize(filter, w, h, wrapMode, 3);
|
||||||
}
|
}
|
||||||
else if (filter == ResizeFilter_Triangle)
|
else if (filter == ResizeFilter_Triangle)
|
||||||
{
|
{
|
||||||
TriangleFilter filter;
|
TriangleFilter filter;
|
||||||
m->imageArray[i]->resize(filter, w, h, wrapMode, 3);
|
img = img->resize(filter, w, h, wrapMode, 3);
|
||||||
}
|
}
|
||||||
else if (filter == ResizeFilter_Kaiser)
|
else if (filter == ResizeFilter_Kaiser)
|
||||||
{
|
{
|
||||||
//KaiserFilter filter(inputOptions.kaiserWidth);
|
//KaiserFilter filter(inputOptions.kaiserWidth);
|
||||||
//filter.setParameters(inputOptions.kaiserAlpha, inputOptions.kaiserStretch);
|
//filter.setParameters(inputOptions.kaiserAlpha, inputOptions.kaiserStretch);
|
||||||
KaiserFilter filter(3);
|
KaiserFilter filter(3);
|
||||||
m->imageArray[i]->resize(filter, w, h, wrapMode, 3);
|
img = img->resize(filter, w, h, wrapMode, 3);
|
||||||
}
|
}
|
||||||
else //if (filter == ResizeFilter_Mitchell)
|
else //if (filter == ResizeFilter_Mitchell)
|
||||||
{
|
{
|
||||||
nvDebugCheck(filter == ResizeFilter_Mitchell);
|
nvDebugCheck(filter == ResizeFilter_Mitchell);
|
||||||
MitchellFilter filter;
|
MitchellFilter filter;
|
||||||
m->imageArray[i]->resize(filter, w, h, wrapMode, 3);
|
img = img->resize(filter, w, h, wrapMode, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -586,27 +582,30 @@ void TexImage::resize(int w, int h, ResizeFilter filter)
|
|||||||
if (filter == ResizeFilter_Box)
|
if (filter == ResizeFilter_Box)
|
||||||
{
|
{
|
||||||
BoxFilter filter;
|
BoxFilter filter;
|
||||||
m->imageArray[i]->resize(filter, w, h, wrapMode);
|
img = img->resize(filter, w, h, wrapMode);
|
||||||
}
|
}
|
||||||
else if (filter == ResizeFilter_Triangle)
|
else if (filter == ResizeFilter_Triangle)
|
||||||
{
|
{
|
||||||
TriangleFilter filter;
|
TriangleFilter filter;
|
||||||
m->imageArray[i]->resize(filter, w, h, wrapMode);
|
img = img->resize(filter, w, h, wrapMode);
|
||||||
}
|
}
|
||||||
else if (filter == ResizeFilter_Kaiser)
|
else if (filter == ResizeFilter_Kaiser)
|
||||||
{
|
{
|
||||||
//KaiserFilter filter(inputOptions.kaiserWidth);
|
//KaiserFilter filter(inputOptions.kaiserWidth);
|
||||||
//filter.setParameters(inputOptions.kaiserAlpha, inputOptions.kaiserStretch);
|
//filter.setParameters(inputOptions.kaiserAlpha, inputOptions.kaiserStretch);
|
||||||
KaiserFilter filter(3);
|
KaiserFilter filter(3);
|
||||||
m->imageArray[i]->resize(filter, w, h, wrapMode);
|
img = img->resize(filter, w, h, wrapMode);
|
||||||
}
|
}
|
||||||
else //if (filter == ResizeFilter_Mitchell)
|
else //if (filter == ResizeFilter_Mitchell)
|
||||||
{
|
{
|
||||||
nvDebugCheck(filter == ResizeFilter_Mitchell);
|
nvDebugCheck(filter == ResizeFilter_Mitchell);
|
||||||
MitchellFilter filter;
|
MitchellFilter filter;
|
||||||
m->imageArray[i]->resize(filter, w, h, wrapMode);
|
img = img->resize(filter, w, h, wrapMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete m->imageArray[i];
|
||||||
|
m->imageArray[i] = img;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -813,6 +812,18 @@ void TexImage::scaleBias(int channel, float scale, float bias)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TexImage::clamp(int channel, float low, float high)
|
||||||
|
{
|
||||||
|
detach();
|
||||||
|
|
||||||
|
foreach (i, m->imageArray)
|
||||||
|
{
|
||||||
|
if (m->imageArray[i] == NULL) continue;
|
||||||
|
|
||||||
|
m->imageArray[i]->clamp(channel, 1, low, high);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TexImage::packNormal()
|
void TexImage::packNormal()
|
||||||
{
|
{
|
||||||
scaleBias(0, 0.5f, 0.5f);
|
scaleBias(0, 0.5f, 0.5f);
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
# define NVTT_API
|
# define NVTT_API
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NVTT_VERSION 020100
|
#define NVTT_VERSION 20100
|
||||||
|
|
||||||
#define NVTT_FORBID_COPY(Class) \
|
#define NVTT_FORBID_COPY(Class) \
|
||||||
private: \
|
private: \
|
||||||
@ -144,6 +144,8 @@ namespace nvtt
|
|||||||
|
|
||||||
NVTT_API void setPixelType(PixelType pixelType);
|
NVTT_API void setPixelType(PixelType pixelType);
|
||||||
|
|
||||||
|
NVTT_API void setPitchAlignment(int pitchAlignment);
|
||||||
|
|
||||||
NVTT_API void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold = 127);
|
NVTT_API void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold = 127);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -345,6 +347,7 @@ namespace nvtt
|
|||||||
|
|
||||||
NVTT_API void setOutputHeader(bool outputHeader);
|
NVTT_API void setOutputHeader(bool outputHeader);
|
||||||
NVTT_API void setContainer(Container container);
|
NVTT_API void setContainer(Container container);
|
||||||
|
NVTT_API void setUserVersion(int version);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -432,6 +435,7 @@ namespace nvtt
|
|||||||
NVTT_API void transform(const float w0[4], const float w1[4], const float w2[4], const float w3[4], const float offset[4]);
|
NVTT_API void transform(const float w0[4], const float w1[4], const float w2[4], const float w3[4], const float offset[4]);
|
||||||
NVTT_API void swizzle(int r, int g, int b, int a);
|
NVTT_API void swizzle(int r, int g, int b, int a);
|
||||||
NVTT_API void scaleBias(int channel, float scale, float bias);
|
NVTT_API void scaleBias(int channel, float scale, float bias);
|
||||||
|
NVTT_API void clamp(int channel, float low = 0.0f, float high = 1.0f);
|
||||||
NVTT_API void packNormal();
|
NVTT_API void packNormal();
|
||||||
NVTT_API void expandNormal();
|
NVTT_API void expandNormal();
|
||||||
NVTT_API void blend(float r, float g, float b, float a, float t);
|
NVTT_API void blend(float r, float g, float b, float a, float t);
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
# define NVTT_API
|
# define NVTT_API
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NVTT_VERSION 020100
|
#define NVTT_VERSION 20100
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
typedef struct nvtt::InputOptions NvttInputOptions;
|
typedef struct nvtt::InputOptions NvttInputOptions;
|
||||||
|
@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
|||||||
outputFileName.stripExtension();
|
outputFileName.stripExtension();
|
||||||
outputFileName.append(".dds");
|
outputFileName.append(".dds");
|
||||||
|
|
||||||
outputOptions.setFileName(outputFileName);
|
outputOptions.setFileName(outputFileName.str());
|
||||||
|
|
||||||
// Output compressed image.
|
// Output compressed image.
|
||||||
context.outputHeader(image, image.countMipmaps(), compressionOptions, outputOptions);
|
context.outputHeader(image, image.countMipmaps(), compressionOptions, outputOptions);
|
||||||
|
@ -423,7 +423,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Path csvFileName;
|
Path csvFileName;
|
||||||
csvFileName.format("%s/result.csv", outPath);
|
csvFileName.format("%s/result.csv", outPath);
|
||||||
StdOutputStream csvStream(csvFileName);
|
StdOutputStream csvStream(csvFileName.str());
|
||||||
TextWriter csvWriter(&csvStream);
|
TextWriter csvWriter(&csvStream);
|
||||||
|
|
||||||
float totalTime = 0;
|
float totalTime = 0;
|
||||||
@ -465,7 +465,7 @@ int main(int argc, char *argv[])
|
|||||||
outputFileName.format("%s/%s", outPath, fileNames[i]);
|
outputFileName.format("%s/%s", outPath, fileNames[i]);
|
||||||
outputFileName.stripExtension();
|
outputFileName.stripExtension();
|
||||||
outputFileName.append(".png");
|
outputFileName.append(".png");
|
||||||
if (!ImageIO::save(outputFileName, img_out.ptr()))
|
if (!ImageIO::save(outputFileName.str(), img_out.ptr()))
|
||||||
{
|
{
|
||||||
printf("Error saving file '%s'.\n", outputFileName.str());
|
printf("Error saving file '%s'.\n", outputFileName.str());
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
for (uint i = 0; i < imageCount; i++)
|
for (uint i = 0; i < imageCount; i++)
|
||||||
{
|
{
|
||||||
if (!images[i].load(files[i]))
|
if (!images[i].load(files[i].str()))
|
||||||
{
|
{
|
||||||
printf("*** error loading file\n");
|
printf("*** error loading file\n");
|
||||||
return 1;
|
return 1;
|
||||||
@ -138,7 +138,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nv::StdOutputStream stream(output);
|
nv::StdOutputStream stream(output.str());
|
||||||
if (stream.isError()) {
|
if (stream.isError()) {
|
||||||
printf("Error opening '%s' for writting\n", output.str());
|
printf("Error opening '%s' for writting\n", output.str());
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -295,11 +295,12 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uint version = nvtt::version();
|
const uint version = nvtt::version();
|
||||||
const uint major = version / 100;
|
const uint major = version / 100 / 100;
|
||||||
const uint minor = version % 100;
|
const uint minor = (version / 100) % 100;
|
||||||
|
const uint rev = version % 100;
|
||||||
|
|
||||||
|
|
||||||
printf("NVIDIA Texture Tools %u.%u - Copyright NVIDIA Corporation 2007\n\n", major, minor);
|
printf("NVIDIA Texture Tools %u.%u.%u - Copyright NVIDIA Corporation 2007\n\n", major, minor, rev);
|
||||||
|
|
||||||
if (input.isNull())
|
if (input.isNull())
|
||||||
{
|
{
|
||||||
@ -351,7 +352,7 @@ int main(int argc, char *argv[])
|
|||||||
if (nv::strCaseCmp(input.extension(), ".dds") == 0)
|
if (nv::strCaseCmp(input.extension(), ".dds") == 0)
|
||||||
{
|
{
|
||||||
// Load surface.
|
// Load surface.
|
||||||
nv::DirectDrawSurface dds(input);
|
nv::DirectDrawSurface dds(input.str());
|
||||||
if (!dds.isValid())
|
if (!dds.isValid())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "The file '%s' is not a valid DDS file.\n", input.str());
|
fprintf(stderr, "The file '%s' is not a valid DDS file.\n", input.str());
|
||||||
@ -400,7 +401,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (loadAsFloat)
|
if (loadAsFloat)
|
||||||
{
|
{
|
||||||
nv::AutoPtr<nv::FloatImage> image(nv::ImageIO::loadFloat(input));
|
nv::AutoPtr<nv::FloatImage> image(nv::ImageIO::loadFloat(input.str()));
|
||||||
|
|
||||||
if (image == NULL)
|
if (image == NULL)
|
||||||
{
|
{
|
||||||
@ -420,7 +421,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
// Regular image.
|
// Regular image.
|
||||||
nv::Image image;
|
nv::Image image;
|
||||||
if (!image.load(input))
|
if (!image.load(input.str()))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "The file '%s' is not a supported image type.\n", input.str());
|
fprintf(stderr, "The file '%s' is not a supported image type.\n", input.str());
|
||||||
return 1;
|
return 1;
|
||||||
@ -449,6 +450,9 @@ int main(int argc, char *argv[])
|
|||||||
inputOptions.setAlphaMode(nvtt::AlphaMode_None);
|
inputOptions.setAlphaMode(nvtt::AlphaMode_None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputOptions.setRoundMode(nvtt::RoundMode_ToNearestPowerOfTwo);
|
||||||
|
|
||||||
|
|
||||||
if (normal)
|
if (normal)
|
||||||
{
|
{
|
||||||
setNormalMap(inputOptions);
|
setNormalMap(inputOptions);
|
||||||
@ -524,7 +528,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
MyErrorHandler errorHandler;
|
MyErrorHandler errorHandler;
|
||||||
MyOutputHandler outputHandler(output);
|
MyOutputHandler outputHandler(output.str());
|
||||||
if (outputHandler.stream->isError())
|
if (outputHandler.stream->isError())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error opening '%s' for writting\n", output.str());
|
fprintf(stderr, "Error opening '%s' for writting\n", output.str());
|
||||||
|
@ -112,7 +112,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load surface.
|
// Load surface.
|
||||||
nv::DirectDrawSurface dds(input);
|
nv::DirectDrawSurface dds(input.str());
|
||||||
if (!dds.isValid())
|
if (!dds.isValid())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "The file '%s' is not a valid DDS file.\n", input.str());
|
fprintf(stderr, "The file '%s' is not a valid DDS file.\n", input.str());
|
||||||
@ -179,7 +179,7 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
nv::ImageIO::save(name, stream, &mipmap);
|
nv::ImageIO::save(name.str(), stream, &mipmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,8 +204,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
nv::Image image0, image1;
|
nv::Image image0, image1;
|
||||||
if (!loadImage(image0, input0)) return 0;
|
if (!loadImage(image0, input0.str())) return 0;
|
||||||
if (!loadImage(image1, input1)) return 0;
|
if (!loadImage(image1, input1.str())) return 0;
|
||||||
|
|
||||||
const uint w0 = image0.width();
|
const uint w0 = image0.width();
|
||||||
const uint h0 = image0.height();
|
const uint h0 = image0.height();
|
||||||
|
@ -164,7 +164,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
nv::Image image;
|
nv::Image image;
|
||||||
if (!loadImage(image, input)) return 0;
|
if (!loadImage(image, input.str())) return 0;
|
||||||
|
|
||||||
nv::FloatImage fimage(&image);
|
nv::FloatImage fimage(&image);
|
||||||
fimage.toLinear(0, 3, gamma);
|
fimage.toLinear(0, 3, gamma);
|
||||||
|
Loading…
Reference in New Issue
Block a user