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
d4bd167d
Commit
d4bd167d
authored
Nov 30, 2018
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
don't use fences for now, too slow
parent
bc81523e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-gl/webgl/context.ts
+8
-1
8 additions, 1 deletion
src/mol-gl/webgl/context.ts
src/mol-math/geometry/gaussian-density/gpu.ts
+2
-2
2 additions, 2 deletions
src/mol-math/geometry/gaussian-density/gpu.ts
with
10 additions
and
3 deletions
src/mol-gl/webgl/context.ts
+
8
−
1
View file @
d4bd167d
...
@@ -79,18 +79,23 @@ let SentWebglSyncObjectNotSupportedInWebglMessage = false
...
@@ -79,18 +79,23 @@ let SentWebglSyncObjectNotSupportedInWebglMessage = false
function
waitForGpuCommandsComplete
(
gl
:
GLRenderingContext
):
Promise
<
void
>
{
function
waitForGpuCommandsComplete
(
gl
:
GLRenderingContext
):
Promise
<
void
>
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
if
(
isWebGL2
(
gl
))
{
if
(
isWebGL2
(
gl
))
{
// TODO seems quite slow
fence
(
gl
,
resolve
)
fence
(
gl
,
resolve
)
}
else
{
}
else
{
if
(
!
SentWebglSyncObjectNotSupportedInWebglMessage
)
{
if
(
!
SentWebglSyncObjectNotSupportedInWebglMessage
)
{
console
.
info
(
'
Sync object not supported in WebGL
'
)
console
.
info
(
'
Sync object not supported in WebGL
'
)
SentWebglSyncObjectNotSupportedInWebglMessage
=
true
SentWebglSyncObjectNotSupportedInWebglMessage
=
true
}
}
gl
.
readPixels
(
0
,
0
,
1
,
1
,
gl
.
RGBA
,
gl
.
UNSIGNED_BYTE
,
tmpPixe
l
)
waitForGpuCommandsCompleteSync
(
g
l
)
resolve
()
resolve
()
}
}
})
})
}
}
function
waitForGpuCommandsCompleteSync
(
gl
:
GLRenderingContext
):
void
{
gl
.
readPixels
(
0
,
0
,
1
,
1
,
gl
.
RGBA
,
gl
.
UNSIGNED_BYTE
,
tmpPixel
)
}
export
function
createImageData
(
buffer
:
ArrayLike
<
number
>
,
width
:
number
,
height
:
number
)
{
export
function
createImageData
(
buffer
:
ArrayLike
<
number
>
,
width
:
number
,
height
:
number
)
{
const
w
=
width
*
4
const
w
=
width
*
4
const
h
=
height
const
h
=
height
...
@@ -147,6 +152,7 @@ export interface WebGLContext {
...
@@ -147,6 +152,7 @@ export interface WebGLContext {
readPixels
:
(
x
:
number
,
y
:
number
,
width
:
number
,
height
:
number
,
buffer
:
Uint8Array
)
=>
void
readPixels
:
(
x
:
number
,
y
:
number
,
width
:
number
,
height
:
number
,
buffer
:
Uint8Array
)
=>
void
readPixelsAsync
:
(
x
:
number
,
y
:
number
,
width
:
number
,
height
:
number
,
buffer
:
Uint8Array
)
=>
Promise
<
void
>
readPixelsAsync
:
(
x
:
number
,
y
:
number
,
width
:
number
,
height
:
number
,
buffer
:
Uint8Array
)
=>
Promise
<
void
>
waitForGpuCommandsComplete
:
()
=>
Promise
<
void
>
waitForGpuCommandsComplete
:
()
=>
Promise
<
void
>
waitForGpuCommandsCompleteSync
:
()
=>
void
destroy
:
()
=>
void
destroy
:
()
=>
void
}
}
...
@@ -279,6 +285,7 @@ export function createContext(gl: GLRenderingContext): WebGLContext {
...
@@ -279,6 +285,7 @@ export function createContext(gl: GLRenderingContext): WebGLContext {
},
},
readPixelsAsync
,
readPixelsAsync
,
waitForGpuCommandsComplete
:
()
=>
waitForGpuCommandsComplete
(
gl
),
waitForGpuCommandsComplete
:
()
=>
waitForGpuCommandsComplete
(
gl
),
waitForGpuCommandsCompleteSync
:
()
=>
waitForGpuCommandsCompleteSync
(
gl
),
destroy
:
()
=>
{
destroy
:
()
=>
{
unbindResources
(
gl
)
unbindResources
(
gl
)
...
...
This diff is collapsed.
Click to expand it.
src/mol-math/geometry/gaussian-density/gpu.ts
+
2
−
2
View file @
d4bd167d
...
@@ -110,7 +110,7 @@ async function GaussianDensityTexture2d(ctx: RuntimeContext, webgl: WebGLContext
...
@@ -110,7 +110,7 @@ async function GaussianDensityTexture2d(ctx: RuntimeContext, webgl: WebGLContext
render
(
texture
)
render
(
texture
)
if
(
ctx
.
shouldUpdate
)
await
ctx
.
update
({
message
:
'
gpu gaussian density calculation
'
})
if
(
ctx
.
shouldUpdate
)
await
ctx
.
update
({
message
:
'
gpu gaussian density calculation
'
})
await
webgl
.
waitForGpuCommandsComplete
()
await
webgl
.
waitForGpuCommandsComplete
Sync
()
return
{
texture
,
scale
:
Vec3
.
inverse
(
Vec3
.
zero
(),
delta
),
bbox
:
expandedBox
,
dim
}
return
{
texture
,
scale
:
Vec3
.
inverse
(
Vec3
.
zero
(),
delta
),
bbox
:
expandedBox
,
dim
}
}
}
...
@@ -157,7 +157,7 @@ async function GaussianDensityTexture3d(ctx: RuntimeContext, webgl: WebGLContext
...
@@ -157,7 +157,7 @@ async function GaussianDensityTexture3d(ctx: RuntimeContext, webgl: WebGLContext
render
(
texture
)
render
(
texture
)
await
ctx
.
update
({
message
:
'
gpu gaussian density calculation
'
});
await
ctx
.
update
({
message
:
'
gpu gaussian density calculation
'
});
await
webgl
.
waitForGpuCommandsComplete
()
await
webgl
.
waitForGpuCommandsComplete
Sync
()
return
{
texture
,
scale
:
Vec3
.
inverse
(
Vec3
.
zero
(),
delta
),
bbox
:
expandedBox
,
dim
}
return
{
texture
,
scale
:
Vec3
.
inverse
(
Vec3
.
zero
(),
delta
),
bbox
:
expandedBox
,
dim
}
}
}
...
...
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