|
112 | 112 |
|
113 | 113 | function Base.copyto!(dst::CuTextureArray{T,1}, src::CuArray{T,1,M}) where {T, M} |
114 | 114 | size(dst) == size(src) || throw(DimensionMismatch("source and destination sizes must match")) |
115 | | - Base.unsafe_copyto!(pointer(dst), pointer(src; type=M), length(dst)) |
| 115 | + if M <: Union{HostMemory, DeviceMemory} |
| 116 | + Base.unsafe_copyto!(pointer(dst), pointer(src; type=M), length(dst)) |
| 117 | + else |
| 118 | + Base.unsafe_copyto!(pointer(dst), pointer(src), length(dst)) |
| 119 | + end |
116 | 120 | return dst |
117 | 121 | end |
118 | 122 |
|
|
124 | 128 |
|
125 | 129 | function Base.copyto!(dst::CuTextureArray{T,2}, src::CuArray{T,2,M}) where {T, M} |
126 | 130 | size(dst) == size(src) || throw(DimensionMismatch("source and destination sizes must match")) |
127 | | - unsafe_copy2d!(pointer(dst), ArrayMemory, pointer(src; type=M), M, size(dst)...) |
| 131 | + if M <: Union{HostMemory, DeviceMemory} |
| 132 | + unsafe_copy2d!(pointer(dst), ArrayMemory, pointer(src; type=M), M, size(dst)...) |
| 133 | + else |
| 134 | + unsafe_copy2d!(pointer(dst), ArrayMemory, pointer(src), M, size(dst)...) |
| 135 | + end |
128 | 136 | return dst |
129 | 137 | end |
130 | 138 |
|
|
142 | 150 |
|
143 | 151 | function Base.copyto!(dst::CuTextureArray{T,3}, src::CuArray{T,3,M}) where {T, M} |
144 | 152 | size(dst) == size(src) || throw(DimensionMismatch("source and destination sizes must match")) |
145 | | - unsafe_copy3d!(pointer(dst), ArrayMemory, pointer(src; type=M), M, size(dst)...) |
| 153 | + if M <: Union{HostMemory, DeviceMemory} |
| 154 | + unsafe_copy3d!(pointer(dst), ArrayMemory, pointer(src; type=M), M, size(dst)...) |
| 155 | + else |
| 156 | + unsafe_copy3d!(pointer(dst), ArrayMemory, pointer(src), M, size(dst)...) |
| 157 | + end |
146 | 158 | return dst |
147 | 159 | end |
148 | 160 |
|
|
0 commit comments