Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
vadere
vadere
Commits
9c9677f7
Commit
9c9677f7
authored
Oct 12, 2017
by
Benedikt Zoennchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete duplicated classes
parent
26bd4722
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
126 deletions
+0
-126
VadereUtils/src/org/vadere/util/opencl/examples/CLUtils.java
VadereUtils/src/org/vadere/util/opencl/examples/CLUtils.java
+0
-52
VadereUtils/src/org/vadere/util/opencl/examples/IOUtil.java
VadereUtils/src/org/vadere/util/opencl/examples/IOUtil.java
+0
-74
No files found.
VadereUtils/src/org/vadere/util/opencl/examples/CLUtils.java
deleted
100644 → 0
View file @
26bd4722
package
org.vadere.util.opencl.examples
;
import
org.apache.log4j.LogManager
;
import
org.apache.log4j.Logger
;
import
org.lwjgl.PointerBuffer
;
import
org.lwjgl.opencl.CL
;
import
org.lwjgl.opencl.CLCapabilities
;
import
org.lwjgl.system.MemoryStack
;
import
java.nio.IntBuffer
;
import
java.util.ArrayList
;
import
static
org
.
lwjgl
.
opencl
.
CL10
.
clGetPlatformIDs
;
import
static
org
.
lwjgl
.
system
.
MemoryStack
.
stackPush
;
/**
* Created by bzoennchen on 08.09.17.
*/
public
class
CLUtils
{
public
static
Logger
log
=
LogManager
.
getLogger
(
CLUtils
.
class
);
public
static
ArrayList
<
Long
>
getCLPlatforms
()
{
MemoryStack
stack
=
stackPush
();
IntBuffer
pi
=
stack
.
mallocInt
(
1
);
InfoUtils
.
checkCLError
(
clGetPlatformIDs
(
null
,
pi
));
if
(
pi
.
get
(
0
)
==
0
)
{
log
.
warn
(
"No OpenCL platform found."
);
return
new
ArrayList
<>();
}
PointerBuffer
platformIDs
=
stack
.
mallocPointer
(
pi
.
get
(
0
));
InfoUtils
.
checkCLError
(
clGetPlatformIDs
(
platformIDs
,
(
IntBuffer
)
null
));
ArrayList
<
Long
>
platforms
=
new
ArrayList
<>(
platformIDs
.
capacity
());
for
(
int
i
=
0
;
i
<
platformIDs
.
capacity
();
i
++)
{
long
platform
=
platformIDs
.
get
(
i
);
CLCapabilities
caps
=
CL
.
createPlatformCapabilities
(
platform
);
if
(
caps
.
cl_khr_gl_sharing
||
caps
.
cl_APPLE_gl_sharing
)
{
platforms
.
add
(
platform
);
}
}
return
platforms
;
}
}
VadereUtils/src/org/vadere/util/opencl/examples/IOUtil.java
deleted
100644 → 0
View file @
26bd4722
package
org.vadere.util.opencl.examples
;
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
*/
import
org.lwjgl.*
;
import
java.io.*
;
import
java.nio.*
;
import
java.nio.channels.*
;
import
java.nio.file.*
;
import
static
org
.
lwjgl
.
BufferUtils
.*;
public
final
class
IOUtil
{
private
IOUtil
()
{
}
private
static
ByteBuffer
resizeBuffer
(
ByteBuffer
buffer
,
int
newCapacity
)
{
ByteBuffer
newBuffer
=
BufferUtils
.
createByteBuffer
(
newCapacity
);
buffer
.
flip
();
newBuffer
.
put
(
buffer
);
return
newBuffer
;
}
/**
* Reads the specified resource and returns the raw data as a ByteBuffer.
*
* @param resource the resource to read
* @param bufferSize the initial buffer size
*
* @return the resource data
*
* @throws IOException if an IO error occurs
*/
public
static
ByteBuffer
ioResourceToByteBuffer
(
String
resource
,
int
bufferSize
)
throws
IOException
{
ByteBuffer
buffer
;
Path
path
=
Paths
.
get
(
resource
);
if
(
Files
.
isReadable
(
path
))
{
try
(
SeekableByteChannel
fc
=
Files
.
newByteChannel
(
path
))
{
buffer
=
BufferUtils
.
createByteBuffer
((
int
)
fc
.
size
()
+
1
);
while
(
fc
.
read
(
buffer
)
!=
-
1
)
{
;
}
}
}
else
{
try
(
InputStream
source
=
IOUtil
.
class
.
getClassLoader
().
getResourceAsStream
(
resource
);
ReadableByteChannel
rbc
=
Channels
.
newChannel
(
source
)
)
{
buffer
=
createByteBuffer
(
bufferSize
);
while
(
true
)
{
int
bytes
=
rbc
.
read
(
buffer
);
if
(
bytes
==
-
1
)
{
break
;
}
if
(
buffer
.
remaining
()
==
0
)
{
buffer
=
resizeBuffer
(
buffer
,
buffer
.
capacity
()
*
2
);
}
}
}
}
buffer
.
flip
();
return
buffer
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment