<commit_before>// This file is distributed under the MIT license.
// See the LICENSE file for details.

#pragma once

#ifndef VSNRAY_CUDA_UTIL_H
#define VSNRAY_CUDA_UTIL_H 1

#include <cuda_runtime_api.h>

#include <visionaray/detail/macros.h>
#include <visionaray/math/math.h>
#include <visionaray/texture/forward.h>

namespace visionaray
{
namespace cuda
{

//-------------------------------------------------------------------------------------------------
// cuda texel type <-> visionaray texel type
//

template <typename Type, tex_read_mode ReadMode>
struct map_texel_type
{
    using cuda_type             = Type;
    using vsnray_type           = Type;

    using cuda_return_type      = Type;
    using vsnray_return_type    = Type;

    VSNRAY_FUNC static Type convert_return_type(Type const& value)
    {
        return value;
    }
};


//-------------------------------------------------------------------------------------------------
// cuda -> visionaray
//

template <>
struct map_texel_type<uchar4, ElementType>
{
    using cuda_type             = uchar4;
    using vsnray_type           = vector<4, unorm<8>>;

    using cuda_return_type      = uchar4;
    using vsnray_return_type    = vector<4, unorm<8>>;

    VSNRAY_FUNC static vector<4, unorm<8>> convert_return_type(uchar4 const& value)
    {
        return vector<4, unorm<8>>( value.x, value.y, value.z, value.w );<commit_msg>Fix cuda to visionaray type mapping<commit_after>// This file is distributed under the MIT license.
// See the LICENSE file for details.

#pragma once

#ifndef VSNRAY_CUDA_UTIL_H
#define VSNRAY_CUDA_UTIL_H 1

#include <cuda_runtime_api.h>

#include <visionaray/detail/macros.h>
#include <visionaray/math/math.h>
#include <visionaray/texture/forward.h>

namespace visionaray
{
namespace cuda
{

//-------------------------------------------------------------------------------------------------
// cuda texel type <-> visionaray texel type
//

template <typename Type, tex_read_mode ReadMode>
struct map_texel_type
{
    using cuda_type             = Type;
    using vsnray_type           = Type;

    using cuda_return_type      = Type;
    using vsnray_return_type    = Type;

    VSNRAY_FUNC static Type convert_return_type(Type const& value)
    {
        return value;
    }
};


//-------------------------------------------------------------------------------------------------
// cuda -> visionaray
//

template <>
struct map_texel_type<uchar4, ElementType>
{
    using cuda_type             = uchar4;
    using vsnray_type           = vector<4, unsigned char>;

    using cuda_return_type      = uchar4;
    using vsnray_return_type    = vector<4, unsigned char>;

    VSNRAY_FUNC static vector<4, unsigned char> convert_return_type(uchar4 const& value)
    {
        return vector<4, unsigned char>( value.x, value.y, value.z, value.w );
{'fraction_non_alphanumeric': 0.21824561403508771, 'fraction_numerical': 0.0077192982456140355, 'mean_word_length': 1.8396414342629481, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7462112', 'n_tokens_mistral': 870, 'n_tokens_neox': 855, 'n_words': 211}