108 reputation
3
bio website
location
age
visits member for 2 years, 7 months
seen Apr 2 '12 at 22:45

Mar
29
awarded  Scholar
Mar
29
accepted Why can't a blendShader sample anything but the current coordinate of the background image?
Mar
29
comment Why can't a blendShader sample anything but the current coordinate of the background image?
Ok, so the real "reason" for the restriction is firstly that Flash is performing an actual blend onto a hardware framebuffer upon which parallel drawing operations may be occurring. Since various regions of that framebuffer may be updated simultaneously during parallel processing of the blend, sampling anything other than the current pixel is unreliable because it could non-deterministically result in the original or new color, depending on whether or not a parallel calculation has updated the sampling region already or not.
Mar
29
comment Why can't a blendShader sample anything but the current coordinate of the background image?
So "the hardware doesn't support it" doesn't answer the question of why the same exact Shader in Flash CAN sample two images anywhere in one context, but CAN'T sample two images anywhere in another context. Both contexts ARE hardware accelerated, but I'm trying to differentiate the two contexts. I think what's happening is that in "blendShader" mode the Shader is processed by a different hardware feature, so the background image isn't just a bitmap or texture source, but rather it's a back buffer that can't be sampled arbitrarily, because of concurrent processing in other regions.
Mar
29
comment Why can't a blendShader sample anything but the current coordinate of the background image?
They don't exist; hence, I thought a "blend shader" is just a regular Shader, which happens to blend two input images. Flash handles that well; just wrap the Shader in a ShaderFilter instance and add it to the DisplayObject's (DO's) "filters" array. It can sample the two images anywhere. On the other hand, that same Shader instance, when set as a DO's "blendShader" property, suddenly loses the ability to sample anywhere. I though by setting a Shader instance to the "blendShader" property, Flash was just automatically providing the two input images. Apparently, it's processing it differently.
Mar
29
awarded  Student
Mar
28
awarded  Editor
Mar
28
revised Why can't a blendShader sample anything but the current coordinate of the background image?
added 885 characters in body
Mar
28
asked Why can't a blendShader sample anything but the current coordinate of the background image?