mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Correct ConstExpression2DArrayCopy
+ introduce new test ArrayCopy
This commit is contained in:
parent
8dda61900d
commit
241e70e9cd
@ -5457,16 +5457,10 @@ static const std::string constExpressionArrayCopy = R"(
|
||||
class PrivateConstExpression2DArrayCopy
|
||||
{
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T dst[N], const T src[N] ) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T * dst, T const* src ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, I, J - 1>::copy( dst, src );
|
||||
dst[I - 1][J - 1] = src[I - 1][J - 1];
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T dst[N], std::array<T, N> const& src ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, I, J - 1>::copy( dst, src );
|
||||
dst[I - 1][J - 1] = src[I - 1][J - 1];
|
||||
dst[(I - 1) * M + J - 1] = src[(I - 1) * M + J - 1];
|
||||
}
|
||||
};
|
||||
|
||||
@ -5474,25 +5468,17 @@ static const std::string constExpressionArrayCopy = R"(
|
||||
class PrivateConstExpression2DArrayCopy<T, N, M, I,0>
|
||||
{
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T dst[N], const T src[N] ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, I - 1, M>::copy( dst, src );
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T dst[N], std::array<T, N> const& src ) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T * dst, T const* src ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, I - 1, M>::copy( dst, src );
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, size_t N, size_t M>
|
||||
class PrivateConstExpression2DArrayCopy<T, N, M, 0, 0>
|
||||
template<typename T, size_t N, size_t M, size_t J>
|
||||
class PrivateConstExpression2DArrayCopy<T, N, M, 0, J>
|
||||
{
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T /*dst*/[N], const T /*src*/[N] ) VULKAN_HPP_NOEXCEPT
|
||||
{}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T /*dst*/[N], std::array<T, N> const& /*src*/ ) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T * /*dst*/, T const* /*src*/ ) VULKAN_HPP_NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
@ -5502,12 +5488,12 @@ static const std::string constExpressionArrayCopy = R"(
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T dst[N][M], const T src[N][M] ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, N, M>::copy( dst, src );
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, N, M>::copy( &dst[0][0], &src[0][0] );
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T dst[N][M], std::array<std::array<T, M>, N> const& src ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, N, M>::copy( dst, src );
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, N, M>::copy( &dst[0][0], src.data()->data() );
|
||||
}
|
||||
};
|
||||
)";
|
||||
|
99
tests/ArrayCopy/ArrayCopy.cpp
Normal file
99
tests/ArrayCopy/ArrayCopy.cpp
Normal file
@ -0,0 +1,99 @@
|
||||
// Copyright(c) 2018, NVIDIA CORPORATION. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// VulkanHpp Samples : ArrayCopy
|
||||
// Compile test on array copy functions
|
||||
|
||||
#include "vulkan/vulkan.hpp"
|
||||
|
||||
int main(int /*argc*/, char ** /*argv*/)
|
||||
{
|
||||
struct wrap1D
|
||||
{
|
||||
wrap1D(const float src[3])
|
||||
{
|
||||
vk::ConstExpression1DArrayCopy<float, 3>::copy(dst, src);
|
||||
}
|
||||
|
||||
wrap1D(std::array<float,3> const& src)
|
||||
{
|
||||
vk::ConstExpression1DArrayCopy<float, 3>::copy(dst, src);
|
||||
}
|
||||
|
||||
float dst[3];
|
||||
};
|
||||
|
||||
float src1D[3];
|
||||
src1D[0] = 1.0f;
|
||||
src1D[1] = 2.0f;
|
||||
src1D[2] = 3.0f;
|
||||
|
||||
wrap1D w11(src1D);
|
||||
|
||||
std::array<float, 3> asrc1D;
|
||||
asrc1D[0] = 1.0f;
|
||||
asrc1D[1] = 2.0f;
|
||||
asrc1D[2] = 3.0f;
|
||||
|
||||
wrap1D w12(asrc1D);
|
||||
|
||||
struct wrap2D
|
||||
{
|
||||
wrap2D(const float src2D[3][4])
|
||||
{
|
||||
vk::ConstExpression2DArrayCopy<float, 3, 4>::copy(dst, src2D);
|
||||
}
|
||||
|
||||
wrap2D(std::array<std::array<float,4>, 3> const& src2D)
|
||||
{
|
||||
vk::ConstExpression2DArrayCopy<float, 3, 4>::copy(dst, src2D);
|
||||
}
|
||||
|
||||
float dst[3][4];
|
||||
};
|
||||
|
||||
float src2D[3][4];
|
||||
src2D[0][0] = 1.0f;
|
||||
src2D[0][1] = 2.0f;
|
||||
src2D[0][2] = 3.0f;
|
||||
src2D[0][3] = 4.0f;
|
||||
src2D[1][0] = 5.0f;
|
||||
src2D[1][1] = 6.0f;
|
||||
src2D[1][2] = 7.0f;
|
||||
src2D[1][3] = 8.0f;
|
||||
src2D[2][0] = 9.0f;
|
||||
src2D[2][1] = 10.0f;
|
||||
src2D[2][2] = 11.0f;
|
||||
src2D[2][3] = 12.0f;
|
||||
|
||||
wrap2D w21(src2D);
|
||||
|
||||
std::array<std::array<float,4>,3> asrc;
|
||||
asrc[0][0] = 1.0f;
|
||||
asrc[0][1] = 2.0f;
|
||||
asrc[0][2] = 3.0f;
|
||||
asrc[0][3] = 4.0f;
|
||||
asrc[1][0] = 5.0f;
|
||||
asrc[1][1] = 6.0f;
|
||||
asrc[1][2] = 7.0f;
|
||||
asrc[1][3] = 8.0f;
|
||||
asrc[2][0] = 9.0f;
|
||||
asrc[2][1] = 10.0f;
|
||||
asrc[2][2] = 11.0f;
|
||||
asrc[2][3] = 12.0f;
|
||||
|
||||
wrap2D aw22(asrc);
|
||||
|
||||
return 0;
|
||||
}
|
34
tests/ArrayCopy/CMakeLists.txt
Normal file
34
tests/ArrayCopy/CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
||||
# Copyright(c) 2018, NVIDIA CORPORATION. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(ArrayCopy)
|
||||
|
||||
set(HEADERS
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
ArrayCopy.cpp
|
||||
)
|
||||
|
||||
source_group(headers FILES ${HEADERS})
|
||||
source_group(sources FILES ${SOURCES})
|
||||
|
||||
add_executable(ArrayCopy
|
||||
${HEADERS}
|
||||
${SOURCES}
|
||||
)
|
||||
|
||||
set_target_properties(ArrayCopy PROPERTIES FOLDER "Tests")
|
@ -2901,16 +2901,10 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
class PrivateConstExpression2DArrayCopy
|
||||
{
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T dst[N], const T src[N] ) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T * dst, T const* src ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, I, J - 1>::copy( dst, src );
|
||||
dst[I - 1][J - 1] = src[I - 1][J - 1];
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T dst[N], std::array<T, N> const& src ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, I, J - 1>::copy( dst, src );
|
||||
dst[I - 1][J - 1] = src[I - 1][J - 1];
|
||||
dst[(I - 1) * M + J - 1] = src[(I - 1) * M + J - 1];
|
||||
}
|
||||
};
|
||||
|
||||
@ -2918,25 +2912,17 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
class PrivateConstExpression2DArrayCopy<T, N, M, I,0>
|
||||
{
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T dst[N], const T src[N] ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, I - 1, M>::copy( dst, src );
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T dst[N], std::array<T, N> const& src ) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T * dst, T const* src ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, I - 1, M>::copy( dst, src );
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, size_t N, size_t M>
|
||||
class PrivateConstExpression2DArrayCopy<T, N, M, 0, 0>
|
||||
template<typename T, size_t N, size_t M, size_t J>
|
||||
class PrivateConstExpression2DArrayCopy<T, N, M, 0, J>
|
||||
{
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T /*dst*/[N], const T /*src*/[N] ) VULKAN_HPP_NOEXCEPT
|
||||
{}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T /*dst*/[N], std::array<T, N> const& /*src*/ ) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T * /*dst*/, T const* /*src*/ ) VULKAN_HPP_NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
@ -2946,12 +2932,12 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T dst[N][M], const T src[N][M] ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, N, M>::copy( dst, src );
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, N, M>::copy( &dst[0][0], &src[0][0] );
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 static void copy( T dst[N][M], std::array<std::array<T, M>, N> const& src ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, N, M>::copy( dst, src );
|
||||
PrivateConstExpression2DArrayCopy<T, N, M, N, M>::copy( &dst[0][0], src.data()->data() );
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user