Skip to content

Commit 617b91e

Browse files
committed
UnifiedMemory isn't a valid type
1 parent 867dfe4 commit 617b91e

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/texture.jl

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ end
112112

113113
function Base.copyto!(dst::CuTextureArray{T,1}, src::CuArray{T,1,M}) where {T, M}
114114
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
116120
return dst
117121
end
118122

@@ -124,7 +128,11 @@ end
124128

125129
function Base.copyto!(dst::CuTextureArray{T,2}, src::CuArray{T,2,M}) where {T, M}
126130
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
128136
return dst
129137
end
130138

@@ -142,7 +150,11 @@ end
142150

143151
function Base.copyto!(dst::CuTextureArray{T,3}, src::CuArray{T,3,M}) where {T, M}
144152
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
146158
return dst
147159
end
148160

0 commit comments

Comments
 (0)