Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/modules/player/webgl2/webgl2-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { compressCodeFile } from "@macros/build" with { type: "macro" };

import { StreamPref } from "@/enums/pref-keys";
import { getStreamPref } from "@/utils/pref-utils";
import { BX_FLAGS } from "@/utils/bx-flags";
import { BaseCanvasPlayer } from "../base-canvas-player";
import { StreamPlayerType, StreamVideoProcessingMode } from "@/enums/pref-values";

Expand Down Expand Up @@ -50,7 +51,12 @@ export class WebGL2Player extends BaseCanvasPlayer {
} as WebGLContextAttributes) as WebGL2RenderingContext;
this.gl = gl;

gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferWidth);
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);

// Skip the browser color management on video uploads. Slight color shift possible.
if (BX_FLAGS.WebGL2NoColorConversion) {
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);
}

// Vertex shader: Identity map
const vShader = gl.createShader(gl.VERTEX_SHADER)!;
Expand Down
1 change: 1 addition & 0 deletions src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ type BxFlags = {
SafariWorkaround: boolean;

EnableWebGPURenderer: boolean;
WebGL2NoColorConversion: boolean;

ForceNativeMkbTitles: string[];
FeatureGates: { [key: string]: boolean } | null,
Expand Down
1 change: 1 addition & 0 deletions src/utils/bx-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const DEFAULT_FLAGS: BxFlags = {
SafariWorkaround: true,

EnableWebGPURenderer: false,
WebGL2NoColorConversion: false,

ForceNativeMkbTitles: [],
FeatureGates: null,
Expand Down