Skip to content

Commit

Permalink
Cleanup Texture and WebglTexture to remove WebGL1 functionality (#6300)
Browse files Browse the repository at this point in the history
* Cleanup Texture and WebglTexture to remove WebGL1 functionality

* updated docs

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
  • Loading branch information
mvaligursky and Martin Valigursky committed Apr 26, 2024
1 parent 314cbbd commit 930d69d
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 131 deletions.
54 changes: 27 additions & 27 deletions src/platform/graphics/constants.js
Expand Up @@ -278,7 +278,7 @@ export const BUFFER_STREAM = 2;

/**
* The data store contents will be modified repeatedly on the GPU and used many times. Optimal for
* transform feedback usage (WebGL2 only).
* transform feedback usage.
*
* @type {number}
* @category Graphics
Expand Down Expand Up @@ -653,7 +653,7 @@ export const PIXELFORMAT_RGB32F = 13;
export const PIXELFORMAT_RGBA32F = 14;

/**
* 32-bit floating point single channel format (WebGL2 only).
* 32-bit floating point single channel format.
*
* @type {number}
* @category Graphics
Expand All @@ -669,7 +669,7 @@ export const PIXELFORMAT_R32F = 15;
export const PIXELFORMAT_DEPTH = 16;

/**
* A readable depth/stencil buffer format (WebGL2 only).
* A readable depth/stencil buffer format.
*
* @type {number}
* @category Graphics
Expand All @@ -678,23 +678,23 @@ export const PIXELFORMAT_DEPTHSTENCIL = 17;

/**
* A floating-point color-only format with 11 bits for red and green channels and 10 bits for the
* blue channel (WebGL2 only).
* blue channel.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_111110F = 18;

/**
* Color-only sRGB format (WebGL2 only).
* Color-only sRGB format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_SRGB = 19;

/**
* Color sRGB format with additional alpha channel (WebGL2 only).
* Color sRGB format with additional alpha channel.
*
* @type {number}
* @category Graphics
Expand Down Expand Up @@ -791,143 +791,143 @@ export const PIXELFORMAT_ATC_RGBA = 30;
export const PIXELFORMAT_BGRA8 = 31;

/**
* 8-bit signed integer single-channel (R) format (Not supported by WebGL1).
* 8-bit signed integer single-channel (R) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_R8I = 32;

/**
* 8-bit unsigned integer single-channel (R) format (Not supported by WebGL1).
* 8-bit unsigned integer single-channel (R) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_R8U = 33;

/**
* 16-bit signed integer single-channel (R) format (Not supported by WebGL1).
* 16-bit signed integer single-channel (R) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_R16I = 34;

/**
* 16-bit unsigned integer single-channel (R) format (Not supported by WebGL1).
* 16-bit unsigned integer single-channel (R) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_R16U = 35;

/**
* 32-bit signed integer single-channel (R) format (Not supported by WebGL1).
* 32-bit signed integer single-channel (R) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_R32I = 36;

/**
* 32-bit unsigned integer single-channel (R) format (Not supported by WebGL1).
* 32-bit unsigned integer single-channel (R) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_R32U = 37;

/**
* 8-bit per-channel signed integer (RG) format (Not supported by WebGL1).
* 8-bit per-channel signed integer (RG) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_RG8I = 38;

/**
* 8-bit per-channel unsigned integer (RG) format (Not supported by WebGL1).
* 8-bit per-channel unsigned integer (RG) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_RG8U = 39;

/**
* 16-bit per-channel signed integer (RG) format (Not supported by WebGL1).
* 16-bit per-channel signed integer (RG) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_RG16I = 40;

/**
* 16-bit per-channel unsigned integer (RG) format (Not supported by WebGL1).
* 16-bit per-channel unsigned integer (RG) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_RG16U = 41;

/**
* 32-bit per-channel signed integer (RG) format (Not supported by WebGL1).
* 32-bit per-channel signed integer (RG) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_RG32I = 42;

/**
* 32-bit per-channel unsigned integer (RG) format (Not supported by WebGL1).
* 32-bit per-channel unsigned integer (RG) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_RG32U = 43;

/**
* 8-bit per-channel signed integer (RGBA) format (Not supported by WebGL1).
* 8-bit per-channel signed integer (RGBA) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_RGBA8I = 44;

/**
* 8-bit per-channel unsigned integer (RGBA) format (Not supported by WebGL1).
* 8-bit per-channel unsigned integer (RGBA) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_RGBA8U = 45;

/**
* 16-bit per-channel signed integer (RGBA) format (Not supported by WebGL1).
* 16-bit per-channel signed integer (RGBA) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_RGBA16I = 46;

/**
* 16-bit per-channel unsigned integer (RGBA) format (Not supported by WebGL1).
* 16-bit per-channel unsigned integer (RGBA) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_RGBA16U = 47;

/**
* 32-bit per-channel signed integer (RGBA) format (Not supported by WebGL1).
* 32-bit per-channel signed integer (RGBA) format.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_RGBA32I = 48;

/**
* 32-bit per-channel unsigned integer (RGBA) format (Not supported by WebGL1).
* 32-bit per-channel unsigned integer (RGBA) format.
*
* @type {number}
* @category Graphics
Expand All @@ -953,7 +953,7 @@ export const PIXELFORMAT_RG16F = 51;
// map of engine PIXELFORMAT_*** enums to information about the format
export const pixelFormatInfo = new Map([

// uncompressed formats
// float formats
[PIXELFORMAT_A8, { name: 'A8', size: 1 }],
[PIXELFORMAT_L8, { name: 'L8', size: 1 }],
[PIXELFORMAT_LA8, { name: 'LA8', size: 2 }],
Expand Down Expand Up @@ -991,7 +991,7 @@ export const pixelFormatInfo = new Map([
[PIXELFORMAT_ATC_RGB, { name: 'ATC_RGB', blockSize: 8 }],
[PIXELFORMAT_ATC_RGBA, { name: 'ATC_RGBA', blockSize: 16 }],

// uncompressed integer formats (Not supported on WebGL1)
// integer formats
[PIXELFORMAT_R8I, { name: 'R8I', size: 1, isInt: true }],
[PIXELFORMAT_R8U, { name: 'R8U', size: 1, isInt: true }],
[PIXELFORMAT_R16I, { name: 'R16I', size: 2, isInt: true }],
Expand Down Expand Up @@ -1694,7 +1694,7 @@ export const TYPE_UINT32 = 5;
export const TYPE_FLOAT32 = 6;

/**
* 16-bit floating point vertex element type (not supported by WebGL1).
* 16-bit floating point vertex element type.
*
* @type {number}
* @category Graphics
Expand Down
22 changes: 11 additions & 11 deletions src/platform/graphics/texture.js
Expand Up @@ -71,7 +71,7 @@ class Texture {
* @param {string} [options.name] - The name of the texture. Defaults to null.
* @param {number} [options.width] - The width of the texture in pixels. Defaults to 4.
* @param {number} [options.height] - The height of the texture in pixels. Defaults to 4.
* @param {number} [options.depth] - The number of depth slices in a 3D texture (not supported by WebGl1).
* @param {number} [options.depth] - The number of depth slices in a 3D texture.
* @param {number} [options.format] - The pixel format of the texture. Can be:
*
* - {@link PIXELFORMAT_A8}
Expand Down Expand Up @@ -128,9 +128,9 @@ class Texture {
* Defaults to false.
* @param {number} [options.arrayLength] - Specifies whether the texture is to be a 2D texture array.
* When passed in as undefined or < 1, this is not an array texture. If >= 1, this is an array texture.
* (not supported by WebGL1). Defaults to undefined.
* @param {boolean} [options.volume] - Specifies whether the texture is to be a 3D volume
* (not supported by WebGL1). Defaults to false.
* Defaults to undefined.
* @param {boolean} [options.volume] - Specifies whether the texture is to be a 3D volume.
* Defaults to false.
* @param {string} [options.type] - Specifies the texture type. Can be:
*
* - {@link TEXTURETYPE_DEFAULT}
Expand All @@ -150,10 +150,10 @@ class Texture {
* present) is multiplied into the color channels. Defaults to false.
* @param {boolean} [options.compareOnRead] - When enabled, and if texture format is
* {@link PIXELFORMAT_DEPTH} or {@link PIXELFORMAT_DEPTHSTENCIL}, hardware PCF is enabled for
* this texture, and you can get filtered results of comparison using texture() in your shader
* (not supported by WebGL1). Defaults to false.
* @param {number} [options.compareFunc] - Comparison function when compareOnRead is enabled
* (not supported by WebGL1). Can be:
* this texture, and you can get filtered results of comparison using texture() in your shader.
* Defaults to false.
* @param {number} [options.compareFunc] - Comparison function when compareOnRead is enabled.
* Can be:
*
* - {@link FUNC_LESS}
* - {@link FUNC_LESSEQUAL}
Expand Down Expand Up @@ -485,7 +485,7 @@ class Texture {
}

/**
* The addressing mode to be applied to the 3D texture depth (not supported on WebGL1). Can be:
* The addressing mode to be applied to the 3D texture depth. Can be:
*
* - {@link ADDRESS_REPEAT}
* - {@link ADDRESS_CLAMP_TO_EDGE}
Expand All @@ -512,7 +512,7 @@ class Texture {
/**
* When enabled, and if texture format is {@link PIXELFORMAT_DEPTH} or
* {@link PIXELFORMAT_DEPTHSTENCIL}, hardware PCF is enabled for this texture, and you can get
* filtered results of comparison using texture() in your shader (not supported on WebGL1).
* filtered results of comparison using texture() in your shader.
*
* @type {boolean}
*/
Expand All @@ -528,7 +528,7 @@ class Texture {
}

/**
* Comparison function when compareOnRead is enabled (not supported on WebGL1). Possible values:
* Comparison function when compareOnRead is enabled. Possible values:
*
* - {@link FUNC_LESS}
* - {@link FUNC_LESSEQUAL}
Expand Down

0 comments on commit 930d69d

Please sign in to comment.