mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2025-07-02 13:20:30 +08:00
Update DirectX samples
This commit is contained in:
parent
25b33d2d04
commit
01b7ee41f6
@ -26,11 +26,9 @@ add_subdirectory(postProcessGL)
|
|||||||
add_subdirectory(quasirandomGenerator)
|
add_subdirectory(quasirandomGenerator)
|
||||||
add_subdirectory(quasirandomGenerator_nvrtc)
|
add_subdirectory(quasirandomGenerator_nvrtc)
|
||||||
add_subdirectory(recursiveGaussian)
|
add_subdirectory(recursiveGaussian)
|
||||||
if (WIN32)
|
add_subdirectory(simpleD3D11)
|
||||||
#add_subdirectory(simpleD3D11)
|
add_subdirectory(simpleD3D11Texture)
|
||||||
#add_subdirectory(simpleD3D11Texture)
|
add_subdirectory(simpleD3D12)
|
||||||
#add_subdirectory(simpleD3D12)
|
|
||||||
endif()
|
|
||||||
add_subdirectory(simpleGL)
|
add_subdirectory(simpleGL)
|
||||||
#add_subdirectory(simpleGLES)
|
#add_subdirectory(simpleGLES)
|
||||||
#add_subdirectory(simpleGLES_EGLOutput)
|
#add_subdirectory(simpleGLES_EGLOutput)
|
||||||
|
@ -14,12 +14,31 @@ endif()
|
|||||||
# Include directories and libraries
|
# Include directories and libraries
|
||||||
include_directories(../../../Common)
|
include_directories(../../../Common)
|
||||||
|
|
||||||
# Source file
|
if(WIN32)
|
||||||
# Add target for simpleD3D11
|
find_package(DirectX)
|
||||||
add_executable(simpleD3D11 simpleD3D11.cu)
|
|
||||||
|
|
||||||
target_compile_options(simpleD3D11 PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
|
if(${DirectX_FOUND})
|
||||||
|
|
||||||
target_compile_features(simpleD3D11 PRIVATE cxx_std_17 cuda_std_17)
|
# Source file
|
||||||
|
# Add target for simpleD3D11
|
||||||
|
add_executable(simpleD3D11 simpleD3D11.cpp sinewave_cuda.cu)
|
||||||
|
|
||||||
set_target_properties(simpleD3D11 PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
target_compile_options(simpleD3D11 PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
|
||||||
|
|
||||||
|
target_compile_features(simpleD3D11 PRIVATE cxx_std_17 cuda_std_17)
|
||||||
|
|
||||||
|
set_target_properties(simpleD3D11 PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
||||||
|
|
||||||
|
target_link_libraries(simpleD3D11 PRIVATE
|
||||||
|
DirectX::D3D11
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(TARGET simpleD3D11 POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/data
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/data
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
message(STATUS "DirectX not found - will not build sample 'simpleD3D11'")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
################################################################################
|
|
||||||
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
# * Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# * Neither the name of NVIDIA CORPORATION nor the names of its
|
|
||||||
# contributors may be used to endorse or promote products derived
|
|
||||||
# from this software without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
|
||||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
#
|
|
||||||
# Makefile project only supported on Mac OS X and Linux Platforms)
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
# Target rules
|
|
||||||
all: build
|
|
||||||
|
|
||||||
build:
|
|
||||||
$(info >>> WARNING - simpleD3D11 is not supported on Linux - waiving sample <<<)
|
|
||||||
|
|
||||||
run: build
|
|
||||||
|
|
||||||
testrun: build
|
|
||||||
|
|
||||||
clean:
|
|
||||||
|
|
||||||
clobber: clean
|
|
@ -14,12 +14,36 @@ endif()
|
|||||||
# Include directories and libraries
|
# Include directories and libraries
|
||||||
include_directories(../../../Common)
|
include_directories(../../../Common)
|
||||||
|
|
||||||
# Source file
|
if(WIN32)
|
||||||
# Add target for simpleD3D11Texture
|
find_package(DirectX)
|
||||||
add_executable(simpleD3D11Texture simpleD3D11Texture.cu)
|
|
||||||
|
|
||||||
target_compile_options(simpleD3D11Texture PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
|
if(${DirectX_FOUND})
|
||||||
|
|
||||||
target_compile_features(simpleD3D11Texture PRIVATE cxx_std_17 cuda_std_17)
|
# Source file
|
||||||
|
# Add target for simpleD3D11Texture
|
||||||
|
add_executable(simpleD3D11Texture
|
||||||
|
simpleD3D11Texture.cpp
|
||||||
|
texture_2d.cu
|
||||||
|
texture_3d.cu
|
||||||
|
texture_cube.cu
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(simpleD3D11Texture PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
target_compile_options(simpleD3D11Texture PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
|
||||||
|
|
||||||
|
target_compile_features(simpleD3D11Texture PRIVATE cxx_std_17 cuda_std_17)
|
||||||
|
|
||||||
|
set_target_properties(simpleD3D11Texture PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
||||||
|
|
||||||
|
target_link_libraries(simpleD3D11Texture PRIVATE
|
||||||
|
DirectX::D3D11
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(TARGET simpleD3D11Texture POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/data
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/data
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
message(STATUS "DirectX not found - will not build sample 'simpleD3D11Texture'")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
################################################################################
|
|
||||||
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
# * Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# * Neither the name of NVIDIA CORPORATION nor the names of its
|
|
||||||
# contributors may be used to endorse or promote products derived
|
|
||||||
# from this software without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
|
||||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
#
|
|
||||||
# Makefile project only supported on Mac OS X and Linux Platforms)
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
# Target rules
|
|
||||||
all: build
|
|
||||||
|
|
||||||
build:
|
|
||||||
$(info >>> WARNING - simpleD3D11Texture is not supported on Linux - waiving sample <<<)
|
|
||||||
|
|
||||||
run: build
|
|
||||||
|
|
||||||
testrun: build
|
|
||||||
|
|
||||||
clean:
|
|
||||||
|
|
||||||
clobber: clean
|
|
@ -14,12 +14,39 @@ endif()
|
|||||||
# Include directories and libraries
|
# Include directories and libraries
|
||||||
include_directories(../../../Common)
|
include_directories(../../../Common)
|
||||||
|
|
||||||
# Source file
|
if(WIN32)
|
||||||
# Add target for simpleD3D12
|
find_package(DirectX)
|
||||||
add_executable(simpleD3D12 simpleD3D12.cu)
|
|
||||||
|
|
||||||
target_compile_options(simpleD3D12 PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
|
if(${DirectX_FOUND})
|
||||||
|
|
||||||
target_compile_features(simpleD3D12 PRIVATE cxx_std_17 cuda_std_17)
|
# Source file
|
||||||
|
# Add target for simpleD3D12
|
||||||
|
add_executable(simpleD3D12
|
||||||
|
DX12CudaSample.cpp
|
||||||
|
Main.cpp
|
||||||
|
Win32Application.cpp
|
||||||
|
simpleD3D12.cpp
|
||||||
|
stdafx.cpp
|
||||||
|
sinewave_cuda.cu
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(simpleD3D12 PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
target_compile_options(simpleD3D12 PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
|
||||||
|
|
||||||
|
target_compile_features(simpleD3D12 PRIVATE cxx_std_17 cuda_std_17)
|
||||||
|
|
||||||
|
set_target_properties(simpleD3D12 PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
||||||
|
|
||||||
|
target_link_libraries(simpleD3D12 PRIVATE
|
||||||
|
DirectX::D3D12
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(TARGET simpleD3D11 POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_file
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/shaders.hlsl
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/shaders.hlsl
|
||||||
|
)
|
||||||
|
|
||||||
|
else()
|
||||||
|
message(STATUS "DirectX not found - will not build sample 'simpleD3D12'")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
################################################################################
|
|
||||||
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
# * Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# * Neither the name of NVIDIA CORPORATION nor the names of its
|
|
||||||
# contributors may be used to endorse or promote products derived
|
|
||||||
# from this software without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
|
||||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
#
|
|
||||||
# Makefile project only supported on Mac OS X and Linux Platforms)
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
# Target rules
|
|
||||||
all: build
|
|
||||||
|
|
||||||
build:
|
|
||||||
$(info >>> WARNING - simpleD3D12 is not supported on Linux - waiving sample <<<)
|
|
||||||
|
|
||||||
run: build
|
|
||||||
|
|
||||||
testrun: build
|
|
||||||
|
|
||||||
clean:
|
|
||||||
|
|
||||||
clobber: clean
|
|
@ -1,72 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE entry SYSTEM "SamplesInfo.dtd">
|
|
||||||
<entry>
|
|
||||||
<name>simpleD3D12</name>
|
|
||||||
<cuda_api_list>
|
|
||||||
<toolkit>cudaWaitExternalSemaphoresAsync</toolkit>
|
|
||||||
<toolkit>cudaExternalMemoryGetMappedBuffer</toolkit>
|
|
||||||
<toolkit>cudaImportExternalSemaphore</toolkit>
|
|
||||||
<toolkit>cudaFree</toolkit>
|
|
||||||
<toolkit>cudaSetDevice</toolkit>
|
|
||||||
<toolkit>cudaSignalExternalSemaphoresAsync</toolkit>
|
|
||||||
<toolkit>cudaGetDeviceProperties</toolkit>
|
|
||||||
<toolkit>cudaStreamSynchronize</toolkit>
|
|
||||||
<toolkit>cudaDestroyExternalMemory</toolkit>
|
|
||||||
<toolkit>cudaStreamCreate</toolkit>
|
|
||||||
<toolkit>cudaImportExternalMemory</toolkit>
|
|
||||||
<toolkit>cudaGetDeviceCount</toolkit>
|
|
||||||
<toolkit>cudaDestroyExternalSemaphore</toolkit>
|
|
||||||
</cuda_api_list>
|
|
||||||
<description><![CDATA[A program which demonstrates Direct3D12 interoperability with CUDA. The program creates a sinewave in DX12 vertex buffer which is created using CUDA kernels. DX12 and CUDA synchronizes using DirectX12 Fences. Direct3D then renders the results on the screen. A DirectX12 Capable NVIDIA GPU is required on Windows10 or higher OS.]]></description>
|
|
||||||
<devicecompilation>whole</devicecompilation>
|
|
||||||
<includepaths>
|
|
||||||
<path>./</path>
|
|
||||||
<path>../</path>
|
|
||||||
<path>../../../Common</path>
|
|
||||||
</includepaths>
|
|
||||||
<keyconcepts>
|
|
||||||
<concept level="basic">Graphics Interop</concept>
|
|
||||||
<concept level="advanced">CUDA DX12 Interop</concept>
|
|
||||||
<concept level="basic">Image Processing</concept>
|
|
||||||
</keyconcepts>
|
|
||||||
<keywords>
|
|
||||||
<keyword>D3D</keyword>
|
|
||||||
<keyword>d3d12</keyword>
|
|
||||||
</keywords>
|
|
||||||
<libraries>
|
|
||||||
</libraries>
|
|
||||||
<librarypaths>
|
|
||||||
</librarypaths>
|
|
||||||
<nsight_eclipse>true</nsight_eclipse>
|
|
||||||
<primary_file>simpleD3D12.cpp</primary_file>
|
|
||||||
<required_dependencies>
|
|
||||||
<dependency>DirectX12</dependency>
|
|
||||||
</required_dependencies>
|
|
||||||
<scopes>
|
|
||||||
<scope>1:CUDA Basic Topics</scope>
|
|
||||||
<scope>2:Graphics Interop</scope>
|
|
||||||
</scopes>
|
|
||||||
<sm-arch>sm50</sm-arch>
|
|
||||||
<sm-arch>sm52</sm-arch>
|
|
||||||
<sm-arch>sm53</sm-arch>
|
|
||||||
<sm-arch>sm60</sm-arch>
|
|
||||||
<sm-arch>sm61</sm-arch>
|
|
||||||
<sm-arch>sm70</sm-arch>
|
|
||||||
<sm-arch>sm72</sm-arch>
|
|
||||||
<sm-arch>sm75</sm-arch>
|
|
||||||
<sm-arch>sm80</sm-arch>
|
|
||||||
<sm-arch>sm86</sm-arch>
|
|
||||||
<sm-arch>sm87</sm-arch>
|
|
||||||
<sm-arch>sm89</sm-arch>
|
|
||||||
<sm-arch>sm90</sm-arch>
|
|
||||||
<supported_envs>
|
|
||||||
<env>
|
|
||||||
<platform>windows10</platform>
|
|
||||||
</env>
|
|
||||||
</supported_envs>
|
|
||||||
<supported_sm_architectures>
|
|
||||||
<include>all</include>
|
|
||||||
</supported_sm_architectures>
|
|
||||||
<title>Simple D3D12 CUDA Interop</title>
|
|
||||||
<type>exe</type>
|
|
||||||
</entry>
|
|
Loading…
x
Reference in New Issue
Block a user