[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] OUT_OF_MEMORY error in 1.0.1/conformance/reading/read-pixels-test



On 2013/04/04 10:09, Jeff Gilbert wrote:
I suppose I was unclear:

Good:
gl.activeTexture(gl.TEXTURE0);
gl.uniform1i(loc_uTexUnit, 0);
for (var j = 0; j < 3; j++) {
  for (var i = 0; i < 1000; i++) {
    gl.bindTexture(gl.TEXTURE_2D, (i % 2) ? texA : texB);
    gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
  }
  gl.readPixels(gl.drawingBufferWidth / 2, gl.drawingBufferHeight / 2, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));
}

Bad:
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_2D, texA);
gl.activeTexture(gl.TEXTURE1);
gl.bindTexture(gl.TEXTURE_2D, texB);
for (var j = 0; j < 3; j++) {
  for (var i = 0; i < 1000; i++) {
    gl.uniform1i(loc_uTexUnit, i % 2);
    gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
  }
  gl.readPixels(gl.drawingBufferWidth / 2, gl.drawingBufferHeight / 2, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));
}
It still looks like a poor implementation to me so I agree with Gregg's and Ken's comments.
This is the sort of pipeline filling that would generally warrant a glFlush anyways.
Why? Implementations should do implicit flushes, as Maurice describes.

Leaving it to the application to decide when the GPU command buffers are almost full and a flush is needed is a recipe for problems.

Regards

    -Mark

--
注意:この電子メールには、株式会社エイチアイの機密情報が含まれている場合が有ります。正式なメール受信者では無い場合はメール複製、 再配信または情報の使用を固く禁じております。エラー、手違いでこのメールを受け取られましたら削除を行い配信者にご連絡をお願いいたし ます.

NOTE: This electronic mail message may contain confidential and privileged information from HI Corporation. If you are not the intended recipient, any disclosure, photocopying, distribution or use of the contents of the received information is prohibited. If you have received this e-mail in error, please notify the sender immediately and permanently delete this message and all related copies.