PlatformInfo

Description

Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts

The PlatformInfo API provides information about the hardware platform being used.

Methods

Name Return Value Summary
getCPU string

Gets the platform description of a CPU.

getCPUBrand string

Gets information on the CPU model.

Deprecated: This function is deprecated and will be removed. Use JSON.parse(PlatformInfo.getCPU(0)).model instead.

getComputer string

Gets the platform description of the computer.

getDisplay string

Gets the platform description of a display.

getGPU string

Gets the platform description of a GPU.

getGraphicsCardType string

Gets the model of the graphics card currently being used.

Deprecated: This function is deprecated and will be removed. Use JSON.parse(PlatformInfo.getGPU( PlatformInfo.getPrimaryGPU() )).model instead.

getMemory string

Gets the platform description of computer memory.

getNumCPUs number

Gets the number of CPUs.

getNumDisplays number

Gets the number of displays.

getNumGPUs number

Gets the number of GPUs.

getNumLogicalCores number

Gets the number of logical CPU cores.

Deprecated: This function is deprecated and will be removed. Use JSON.parse(PlatformInfo.getCPU(0)).numCores instead.

getOperatingSystemType string

Gets the operating system type.

Deprecated: This function is deprecated and will be removed. Use JSON.parse(PlatformInfo.getComputer()).OS instead.

getPlatform string

Gets the complete description of the computer as a whole.

getPlatformTierNames Array.<string>

Gets the names of the possible platform tiers, per PlatformInfo.PlatformTier.

getPrimaryCPU number

Gets the index number of the primary CPU.

getPrimaryDisplay number

Gets the index number of the primary display.

getPrimaryGPU number

Gets the index number of the primary GPU.

getTierProfiled PlatformInfo.PlatformTier

Gets the platform tier of the computer, profiled at Interface start-up.

getTotalSystemMemoryMB number

Gets the total amount of usable physical memory, in MB.

Deprecated: This function is deprecated and will be removed. Use JSON.parse(PlatformInfo.getMemory()).memTotal instead.

has3DHTML boolean

Checks whether HTML on 3D surfaces (e.g., Web entities) is supported.

hasRiftControllers boolean

Checks whether Oculus Touch controllers are connected.

hasViveControllers boolean

Checks whether Vive controllers are connected.

isRenderMethodDeferredCapable boolean

Gets whether the current hardware can use deferred rendering.

isStandalone boolean

Checks whether Interface is running on a stand-alone HMD device (CPU incorporated into the HMD display).

Type Definitions

CPUDescription
Type: object

Information on a CPU.

Properties

Name Type Summary
vendor string

The CPU vendor (e.g., "Intel" or "AMD").

model string

The CPU model.

numCores number

The number of logical cores.

isPrimary boolean

true if the CPU is the primary CPU, false or undefined if it isn't.

ComputerDescription
Type: object

Information on the computer.

Properties

Name Type Summary
OS PlatformInfo.ComputerOS

The operating system.

OSversion string

The operating system version.

vendor string

The computer vendor.

model string

The computer model.

profileTier PlatformInfo.PlatformTier

The platform tier of the computer, profiled at Interface start-up.

ComputerOS
Type: string

The computer operating system.

ValueDescription
"WINDOWS"Windows.
"MACOS"Mac OS.
"LINUX"Linux.
"ANDROID"Android.
DisplayDescription
Type: object

Information on a display.

Properties

Name Type Summary
description string

The display's description.

deviceName string

The display's device name.

boundsLeft number

The pixel coordinate of the left edge of the display (e.g., 0).

boundsRight number

The pixel coordinate of the right edge of the display (e.g., 1920).

boundsTop number

The pixel coordinate of the top edge of the display (e.g., 0).

boundsBottom number

The pixel coordinate of the bottom edge of the display (e.g., 1080).

gpu number

The index number of the GPU that's driving the display.

ppi number

The physical dots per inch of the display.

ppiDesktop number

The logical dots per inch of the desktop as used by the operating system.

physicalWidth number

The physical width of the display, in inches.

physicalHeight number

The physical height of the display, in inches.

modeRefreshrate number

The refresh rate of the current display mode, in Hz.

modeWidth number

The width of the current display mode, in pixels.

modeHeight number

The height of the current display mode, in pixels.

isPrimary boolean

true if the GPU is the primary display, false or undefined if it isn't.

GPUDescription
Type: object

Information on a GPU.

Properties

Name Type Summary
vendor string

The GPU vendor (e.g., "NVIDIA", "AMD", or "Intel").

model string

The GPU model.

driver string

The GPU driver version.

videoMemory number

The size of the GPU's video memory, in MB.

displays Array.<number>

The index numbers of the displays currently being driven by the GPU. An empty array if the GPU is currently not driving any displays.

isPrimary boolean

true if the GPU is the primary GPU, false or undefined if it isn't.

GraphicsAPIDescription
Type: object

Information on a graphics API.

Properties

Name Type Attributes Summary
name string

The name of the graphics API.

version string

The version of the graphics API.

renderer string <optional>

If an OpenGL API, then the graphics card that performs the rendering.

vendor string <optional>

If an OpenGL API, then the OpenGL vendor.

shadingLanguageVersion string <optional>

If an OpenGL API, then the shading language version.

extensions Array.<string> <optional>

If an OpenGL API, then the list of OpenGL extensions supported.

devices Array.<PlatformInfo.VulkanAPIDescription> <optional>

If a Vulkan API, then the devices provided in the API.

MemoryDescription
Type: object

Information on the computer's memory.

Properties

Name Type Summary
memTotal number

The total amount of usable physical memory, in MB.

NICDescription
Type: object

Information on a network card.

Properties

Name Type Summary
name string

The name of the network card.

mac string

The MAC address of the network card.

PlatformDescription
Type: object

Information on the computer platform as a whole.

Properties

Name Type Summary
computer PlatformInfo.ComputerDescription

Information on the computer.

cpus Array.<PlatformInfo.CPUDescription>

Information on the computer's CPUs.

displays Array.<PlatformInfo.DisplayDescription>

Information on the computer's displays.

gpus Array.<PlatformInfo.GPUDescription>

Information on the computer's GPUs.

graphicsAPIs Array.<PlatformInfo.GraphicsAPIDescription>

Information on the computer's graphics APIs.

memory PlatformInfo.MemoryDescription

Information on the computer's memory.

nics PlatformInfo.NICDescription

Information on the computer's network cards.

PlatformTier
Type: number

The platform tier of a computer is an indication of its rendering capability.

ValueNameDescription
0UNKNOWNUnknown rendering capability.
1LOWLow-end PC, capable of rendering low-quality graphics.
2MIDBusiness-class PC, capable of rendering medium-quality graphics.
3HIGHHigh-end PC, capable of rendering high-quality graphics.
VulkanAPIDescription
Type: object

Information on a Vulkan graphics API.

Properties

Name Type Summary
string
driverVersion string

The driver version.

apiVersion string

The API version.

deviceType string

The device type.

vendor string

The device vendor.

name string

The device name.

extensions Array.<string>

The list of Vulkan extensions supported.

queues Array.<PlatformInfo.VulkanQueueDescription>

The Vulkan queues available.

heaps Array.<PlatformInfo.VulkanHeapDescription>

The Vulkan heaps available.

VulkanHeapDescription
Type: object

Information on a Vulkan heap.

Properties

Name Type Summary
flags string

The Vulkan heap flags.

size number

The heap size.

VulkanQueueDescription
Type: object

Information on a Vulkan queue.

Properties

Name Type Summary
flags string

The Vulkan queue flags.

count number

The queue count.

Method Details

(static) getCPU( index ) → {string}
Returns: The CPU's CPUDescription information as a JSON string.

Gets the platform description of a CPU.

Parameters

Name Type Description
index number

The index number of the CPU.

Example

Report details of the computer's CPUs.

var numCPUs = PlatformInfo.getNumCPUs();
print("Number of CPUs: " + numCPUs);
for (var i = 0; i < numCPUs; i++) {
    var cpuDescription = PlatformInfo.getCPU(i);
    print("CPU " + i + ": " + cpuDescription);
}
(static) getCPUBrand( ) → {string}
Returns: Information on the CPU.

Gets information on the CPU model.

Deprecated: This function is deprecated and will be removed. Use JSON.parse(PlatformInfo.getCPU(0)).model instead.

(static) getComputer( ) → {string}
Returns: The ComputerDescription information as a JSON string.

Gets the platform description of the computer.

(static) getDisplay( index ) → {string}
Returns: The display's DisplayDescription information as a JSON string.

Gets the platform description of a display.

Parameters

Name Type Description
index number

The index number of the display.

Example

Report details of the systems's displays.

var numDisplays = PlatformInfo.getNumDisplays();
print("Number of displays: " + numDisplays);
for (var i = 0; i < numDisplays; i++) {
    var displayDescription = PlatformInfo.getDisplay(i);
    print("Display " + i + ": " + displayDescription);
}
(static) getGPU( index ) → {string}
Returns: The GPU's GPUDescription information as a JSON string.

Gets the platform description of a GPU.

Parameters

Name Type Description
index number

The index number of the GPU.

Example

Report details of the computer's GPUs.

var numGPUs = PlatformInfo.getNumGPUs();
print("Number of GPUs: " + numGPUs);
for (var i = 0; i < numGPUs; i++) {
    var gpuDescription = PlatformInfo.getGPU(i);
    print("GPU " + i + ": " + gpuDescription);
}
(static) getGraphicsCardType( ) → {string}
Returns: The model of the graphics card currently being used.

Gets the model of the graphics card currently being used.

Deprecated: This function is deprecated and will be removed. Use JSON.parse(PlatformInfo.getGPU( PlatformInfo.getPrimaryGPU() )).model instead.

(static) getMemory( ) → {string}
Returns: The computer's MemoryDescription information as a JSON string.

Gets the platform description of computer memory.

Example

Report details of the computer's memory.

print("Memory: " + PlatformInfo.getMemory());
(static) getNumCPUs( ) → {number}
Returns: The number of CPUs.

Gets the number of CPUs.

(static) getNumDisplays( ) → {number}
Returns: The number of displays.

Gets the number of displays.

(static) getNumGPUs( ) → {number}
Returns: The number of GPUs.

Gets the number of GPUs.

(static) getNumLogicalCores( ) → {number}
Returns: The number of logical CPU cores.

Gets the number of logical CPU cores.

Deprecated: This function is deprecated and will be removed. Use JSON.parse(PlatformInfo.getCPU(0)).numCores instead.

(static) getOperatingSystemType( ) → {string}
Returns: The operating system type: "WINDOWS", "MACOS", or "UNKNOWN".

Gets the operating system type.

Deprecated: This function is deprecated and will be removed. Use JSON.parse(PlatformInfo.getComputer()).OS instead.

(static) getPlatform( ) → {string}
Returns: The PlatformDescription information as a JSON string.

Gets the complete description of the computer as a whole.

(static) getPlatformTierNames( ) → {Array.<string>}
Returns: The names of the possible platform tiers.

Gets the names of the possible platform tiers, per PlatformInfo.PlatformTier.

(static) getPrimaryCPU( ) → {number}
Returns: The index of the primary CPU.

Gets the index number of the primary CPU.

(static) getPrimaryDisplay( ) → {number}
Returns: The index of the primary display.

Gets the index number of the primary display.

(static) getPrimaryGPU( ) → {number}
Returns: The index of the primary GPU.

Gets the index number of the primary GPU.

(static) getTierProfiled( ) → {PlatformInfo.PlatformTier}
Returns: The platform tier of the computer.

Gets the platform tier of the computer, profiled at Interface start-up.

Example

Report the platform tier of the computer.

var platformTier = PlatformInfo.getTierProfiled();
var platformTierName = PlatformInfo.getPlatformTierNames()[platformTier];
print("Platform tier: " + platformTier + ", " + platformTierName);
(static) getTotalSystemMemoryMB( ) → {number}
Returns: The total system memory in megabytes.

Gets the total amount of usable physical memory, in MB.

Deprecated: This function is deprecated and will be removed. Use JSON.parse(PlatformInfo.getMemory()).memTotal instead.

(static) has3DHTML( ) → {boolean}
Returns: true if the current display supports HTML on 3D surfaces, false if it doesn't.

Checks whether HTML on 3D surfaces (e.g., Web entities) is supported.

(static) hasRiftControllers( ) → {boolean}
Returns: true if Oculus Touch controllers are connected, false if they aren't.

Checks whether Oculus Touch controllers are connected.

(static) hasViveControllers( ) → {boolean}
Returns: true if Vive controllers are connected, false if they aren't.

Checks whether Vive controllers are connected.

(static) isRenderMethodDeferredCapable( ) → {boolean}
Returns: true if the current hardware can use deferred rendering, false if it can't.

Gets whether the current hardware can use deferred rendering.

(static) isStandalone( ) → {boolean}
Returns: true if Interface is running on a stand-alone HMD device, false if it isn't.

Checks whether Interface is running on a stand-alone HMD device (CPU incorporated into the HMD display).