Skip to content

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Apr 11, 2016

This PR fixes an error in webgl_interactive_cubes_gpu logged by Firefox 45.0.1.

Error: WebGL: readPixels: Out-of-bounds reads with readPixels are deprecated, and may be slow.

The problem is that the example can generate read requests with readRenderTargetPixels that contain out-of-bounds pixels (see FF source code for more information). To avoid this problem, an additional if statement prevents read request with mouse coordinates less or equal zero.

A more strict implementation could be done in readRenderTargetPixels. The method could only allow read request with x and y values within the range of [1, renderTarget.width] and [1, renderTarget.height].

@Mugen87 Mugen87 changed the title Examples: Fix Firefox error in "webgl_interactive_cubes_gpu" Examples: Fix Firefox Error in "webgl_interactive_cubes_gpu" Apr 11, 2016
@mrdoob
Copy link
Owner

mrdoob commented Apr 11, 2016

A more strict implementation could be done in readRenderTargetPixels. The method could only allow read request with x and y values within the range of [1, width] and [1, height].

That sounds like a better fix!

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Apr 11, 2016

Done!

@mrdoob mrdoob merged commit c7f5019 into mrdoob:dev Apr 11, 2016
@mrdoob
Copy link
Owner

mrdoob commented Apr 11, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants