Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
a4ab117d
Commit
a4ab117d
authored
Feb 1, 2023
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
support WEBGL_provoking_vertex
parent
8e1876fc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mol-gl/webgl/compat.ts
+26
-1
26 additions, 1 deletion
src/mol-gl/webgl/compat.ts
src/mol-gl/webgl/context.ts
+5
-0
5 additions, 0 deletions
src/mol-gl/webgl/context.ts
src/mol-gl/webgl/extensions.ts
+8
-2
8 additions, 2 deletions
src/mol-gl/webgl/extensions.ts
with
39 additions
and
3 deletions
src/mol-gl/webgl/compat.ts
+
26
−
1
View file @
a4ab117d
/**
/**
* Copyright (c) 2018-202
2
mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2018-202
3
mol* contributors, licensed under MIT, See LICENSE file for more info.
*
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
*/
...
@@ -523,6 +523,31 @@ export function getFboRenderMipmap(gl: GLRenderingContext): COMPAT_fboRenderMipm
...
@@ -523,6 +523,31 @@ export function getFboRenderMipmap(gl: GLRenderingContext): COMPAT_fboRenderMipm
return
isWebGL2
(
gl
)
?
{}
:
gl
.
getExtension
(
'
OES_fbo_render_mipmap
'
);
return
isWebGL2
(
gl
)
?
{}
:
gl
.
getExtension
(
'
OES_fbo_render_mipmap
'
);
}
}
/**
* See https://registry.khronos.org/webgl/extensions/WEBGL_provoking_vertex/
*/
export
interface
COMPAT_provoking_vertex
{
readonly
FIRST_VERTEX_CONVENTION
:
number
;
readonly
LAST_VERTEX_CONVENTION
:
number
;
readonly
PROVOKING_VERTEX
:
number
;
provokingVertex
(
provokeMode
:
number
):
void
;
}
export
function
getProvokingVertex
(
gl
:
GLRenderingContext
):
COMPAT_provoking_vertex
|
null
{
if
(
isWebGL2
(
gl
))
{
const
ext
=
gl
.
getExtension
(
'
WEBGL_provoking_vertex
'
);
if
(
ext
)
{
return
{
FIRST_VERTEX_CONVENTION
:
ext
.
FIRST_VERTEX_CONVENTION_WEBGL
,
LAST_VERTEX_CONVENTION
:
ext
.
LAST_VERTEX_CONVENTION_WEBGL
,
PROVOKING_VERTEX
:
ext
.
PROVOKING_VERTEX_WEBGL
,
provokingVertex
:
ext
.
provokingVertexWEBGL
.
bind
(
gl
)
};
}
}
return
null
;
}
export
function
getNoNonInstancedActiveAttribs
(
gl
:
GLRenderingContext
):
boolean
{
export
function
getNoNonInstancedActiveAttribs
(
gl
:
GLRenderingContext
):
boolean
{
if
(
!
isWebGL2
(
gl
))
return
false
;
if
(
!
isWebGL2
(
gl
))
return
false
;
...
...
This diff is collapsed.
Click to expand it.
src/mol-gl/webgl/context.ts
+
5
−
0
View file @
a4ab117d
...
@@ -239,6 +239,11 @@ export function createContext(gl: GLRenderingContext, props: Partial<{ pixelScal
...
@@ -239,6 +239,11 @@ export function createContext(gl: GLRenderingContext, props: Partial<{ pixelScal
throw
new
Error
(
'
Need "MAX_VERTEX_TEXTURE_IMAGE_UNITS" >= 8
'
);
throw
new
Error
(
'
Need "MAX_VERTEX_TEXTURE_IMAGE_UNITS" >= 8
'
);
}
}
// optimize assuming flats first and last data are same or differences don't matter
// extension is only available when `FIRST_VERTEX_CONVENTION` is more efficient
const
epv
=
extensions
.
provokingVertex
;
epv
?.
provokingVertex
(
epv
.
FIRST_VERTEX_CONVENTION
);
let
isContextLost
=
false
;
let
isContextLost
=
false
;
const
contextRestored
=
new
BehaviorSubject
<
now
.
Timestamp
>
(
0
as
now
.
Timestamp
);
const
contextRestored
=
new
BehaviorSubject
<
now
.
Timestamp
>
(
0
as
now
.
Timestamp
);
...
...
This diff is collapsed.
Click to expand it.
src/mol-gl/webgl/extensions.ts
+
8
−
2
View file @
a4ab117d
/**
/**
* Copyright (c) 2018-202
2
mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2018-202
3
mol* contributors, licensed under MIT, See LICENSE file for more info.
*
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
*/
import
{
GLRenderingContext
,
COMPAT_instanced_arrays
,
COMPAT_standard_derivatives
,
COMPAT_vertex_array_object
,
getInstancedArrays
,
getStandardDerivatives
,
COMPAT_element_index_uint
,
getElementIndexUint
,
COMPAT_texture_float
,
getTextureFloat
,
COMPAT_texture_float_linear
,
getTextureFloatLinear
,
COMPAT_blend_minmax
,
getBlendMinMax
,
getFragDepth
,
COMPAT_frag_depth
,
COMPAT_color_buffer_float
,
getColorBufferFloat
,
COMPAT_draw_buffers
,
getDrawBuffers
,
getShaderTextureLod
,
COMPAT_shader_texture_lod
,
getDepthTexture
,
COMPAT_depth_texture
,
COMPAT_sRGB
,
getSRGB
,
getTextureHalfFloat
,
getTextureHalfFloatLinear
,
COMPAT_texture_half_float
,
COMPAT_texture_half_float_linear
,
COMPAT_color_buffer_half_float
,
getColorBufferHalfFloat
,
getVertexArrayObject
,
getDisjointTimerQuery
,
COMPAT_disjoint_timer_query
,
getNoNonInstancedActiveAttribs
,
getDrawBuffersIndexed
,
COMPAT_draw_buffers_indexed
,
getParallelShaderCompile
,
COMPAT_parallel_shader_compile
,
getFboRenderMipmap
,
COMPAT_fboRenderMipmap
}
from
'
./compat
'
;
import
{
GLRenderingContext
,
COMPAT_instanced_arrays
,
COMPAT_standard_derivatives
,
COMPAT_vertex_array_object
,
getInstancedArrays
,
getStandardDerivatives
,
COMPAT_element_index_uint
,
getElementIndexUint
,
COMPAT_texture_float
,
getTextureFloat
,
COMPAT_texture_float_linear
,
getTextureFloatLinear
,
COMPAT_blend_minmax
,
getBlendMinMax
,
getFragDepth
,
COMPAT_frag_depth
,
COMPAT_color_buffer_float
,
getColorBufferFloat
,
COMPAT_draw_buffers
,
getDrawBuffers
,
getShaderTextureLod
,
COMPAT_shader_texture_lod
,
getDepthTexture
,
COMPAT_depth_texture
,
COMPAT_sRGB
,
getSRGB
,
getTextureHalfFloat
,
getTextureHalfFloatLinear
,
COMPAT_texture_half_float
,
COMPAT_texture_half_float_linear
,
COMPAT_color_buffer_half_float
,
getColorBufferHalfFloat
,
getVertexArrayObject
,
getDisjointTimerQuery
,
COMPAT_disjoint_timer_query
,
getNoNonInstancedActiveAttribs
,
getDrawBuffersIndexed
,
COMPAT_draw_buffers_indexed
,
getParallelShaderCompile
,
COMPAT_parallel_shader_compile
,
getFboRenderMipmap
,
COMPAT_fboRenderMipmap
,
COMPAT_provoking_vertex
,
getProvokingVertex
}
from
'
./compat
'
;
import
{
isDebugMode
}
from
'
../../mol-util/debug
'
;
import
{
isDebugMode
}
from
'
../../mol-util/debug
'
;
export
type
WebGLExtensions
=
{
export
type
WebGLExtensions
=
{
...
@@ -29,6 +29,7 @@ export type WebGLExtensions = {
...
@@ -29,6 +29,7 @@ export type WebGLExtensions = {
disjointTimerQuery
:
COMPAT_disjoint_timer_query
|
null
disjointTimerQuery
:
COMPAT_disjoint_timer_query
|
null
parallelShaderCompile
:
COMPAT_parallel_shader_compile
|
null
parallelShaderCompile
:
COMPAT_parallel_shader_compile
|
null
fboRenderMipmap
:
COMPAT_fboRenderMipmap
|
null
fboRenderMipmap
:
COMPAT_fboRenderMipmap
|
null
provokingVertex
:
COMPAT_provoking_vertex
|
null
noNonInstancedActiveAttribs
:
boolean
noNonInstancedActiveAttribs
:
boolean
}
}
...
@@ -121,6 +122,10 @@ export function createExtensions(gl: GLRenderingContext): WebGLExtensions {
...
@@ -121,6 +122,10 @@ export function createExtensions(gl: GLRenderingContext): WebGLExtensions {
if
(
isDebugMode
&&
fboRenderMipmap
===
null
)
{
if
(
isDebugMode
&&
fboRenderMipmap
===
null
)
{
console
.
log
(
'
Could not find support for "fbo_render_mipmap"
'
);
console
.
log
(
'
Could not find support for "fbo_render_mipmap"
'
);
}
}
const
provokingVertex
=
getProvokingVertex
(
gl
);
if
(
isDebugMode
&&
provokingVertex
===
null
)
{
console
.
log
(
'
Could not find support for "provoking_vertex"
'
);
}
const
noNonInstancedActiveAttribs
=
getNoNonInstancedActiveAttribs
(
gl
);
const
noNonInstancedActiveAttribs
=
getNoNonInstancedActiveAttribs
(
gl
);
...
@@ -146,6 +151,7 @@ export function createExtensions(gl: GLRenderingContext): WebGLExtensions {
...
@@ -146,6 +151,7 @@ export function createExtensions(gl: GLRenderingContext): WebGLExtensions {
disjointTimerQuery
,
disjointTimerQuery
,
parallelShaderCompile
,
parallelShaderCompile
,
fboRenderMipmap
,
fboRenderMipmap
,
provokingVertex
,
noNonInstancedActiveAttribs
,
noNonInstancedActiveAttribs
,
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment