Class Overview
The RenderBuffer class is a simplified, high-performance, Unsafe wrapper
used for buffering rendering operations in a single-threaded rendering
environment. It's functionality is similar to the ByteBuffer and related
NIO classes. However, the methods in this class perform little to no
alignment or bounds checks for performance reasons. Therefore, it is
the caller's responsibility to ensure that all put() calls are properly
aligned and within bounds:
- int and float values must be aligned on 4-byte boundaries
- long and double values must be aligned on 8-byte boundaries
This class only includes the bare minimum of methods to support
single-threaded rendering. For example, there is no put(double[]) method
because we currently have no need for such a method in the STR classes.
Summary
Public Methods |
static
RenderBuffer
|
allocate(int numBytes)
Allocates a fresh buffer using the machine endianness.
|
final
int
|
capacity()
The behavior (and names) of the following methods are nearly
identical to their counterparts in the various NIO Buffer classes.
|
final
void
|
clear()
|
final
long
|
getAddress()
Returns the base address of the underlying memory buffer.
|
final
int
|
position()
|
final
void
|
position(long numBytes)
|
RenderBuffer
|
put(long[] x, int offset, int length)
|
RenderBuffer
|
put(int[] x, int offset, int length)
|
RenderBuffer
|
put(float[] x, int offset, int length)
|
RenderBuffer
|
put(long[] x)
|
RenderBuffer
|
put(int[] x)
|
RenderBuffer
|
put(short[] x, int offset, int length)
|
RenderBuffer
|
put(byte[] x, int offset, int length)
|
RenderBuffer
|
put(short[] x)
|
RenderBuffer
|
put(float[] x)
|
RenderBuffer
|
put(byte[] x)
|
final
RenderBuffer
|
putByte(byte x)
putByte() methods...
|
final
RenderBuffer
|
putDouble(double x)
putDouble() method(s)...
|
final
RenderBuffer
|
putFloat(float x)
putFloat() methods...
|
final
RenderBuffer
|
putInt(int x)
|
final
RenderBuffer
|
putInt(int pos, int x)
putInt() methods...
|
final
RenderBuffer
|
putLong(long x)
putLong() methods...
|
final
RenderBuffer
|
putShort(short x)
putShort() methods...
|
final
int
|
remaining()
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
Constants
protected
static
final
long
SIZEOF_BYTE
These constants represent the size of various data types (in bytes).
Constant Value:
1
(0x0000000000000001)
protected
static
final
long
SIZEOF_DOUBLE
Constant Value:
8
(0x0000000000000008)
protected
static
final
long
SIZEOF_FLOAT
Constant Value:
4
(0x0000000000000004)
protected
static
final
long
SIZEOF_INT
Constant Value:
4
(0x0000000000000004)
protected
static
final
long
SIZEOF_LONG
Constant Value:
8
(0x0000000000000008)
protected
static
final
long
SIZEOF_SHORT
Constant Value:
2
(0x0000000000000002)
Fields
protected
final
long
baseAddress
protected
final
int
capacity
protected
long
curAddress
protected
final
long
endAddress
Protected Constructors
protected
RenderBuffer
(int numBytes)
Public Methods
public
static
RenderBuffer
allocate
(int numBytes)
Allocates a fresh buffer using the machine endianness.
public
final
int
capacity
()
The behavior (and names) of the following methods are nearly
identical to their counterparts in the various NIO Buffer classes.
public
final
void
clear
()
public
final
long
getAddress
()
Returns the base address of the underlying memory buffer.
public
final
int
position
()
public
final
void
position
(long numBytes)
public
final
int
remaining
()