[Mesa-dev] [PATCH 4/5] i965/fs: Return result of image atomic in a register of the expected type.

Francisco Jerez currojerez at riseup.net
Tue Feb 23 03:09:51 UTC 2016


Ilia Mirkin <imirkin at alum.mit.edu> writes:

> On Mon, Feb 22, 2016 at 9:40 PM, Francisco Jerez <currojerez at riseup.net> wrote:
>> So the result is of float type if we're implementing the float
>> overload of imageAtomicExchange.  This is the only back-end change
>> required to support OES_shader_image_atomic AFAICT.
>> ---
>>  src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
>> index 081dbad..75734d2 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
>> @@ -1125,7 +1125,7 @@ namespace brw {
>>           if (rsize && pred)
>>              set_predicate(pred, bld.SEL(tmp, tmp, brw_imm_d(0)));
>>
>> -         return tmp;
>> +         return retype(tmp, src0.type);
>
> I had chosen to stick this into emit_typed_atomic -- the typed-ness
> seemed to fit better there. Your call though, this is just a thought.
>
Yeah, I had noticed this difference.  The reason for doing it here is
that all surface_access::emit_(un)typed_something() calls take a raw UD
payload as argument and return a raw UD result.  They're just thin
wrappers around the logical send opcode and they don't necessarily give
you a return value represented in any of the native types supported by
the EU, not even for the typed messages which usually still need some
sort of unpacking, format conversion and bitcast to the correct type.
The brw::surface_access functions really just deal with binary blobs of
data represented as vectors of UDs and have no idea what format the data
is stored in.  emit_image_* OTOH are expected to honour input types and
preserve type consistency so this really seemed like a bug in there to
me.

>>        }
>>     }
>>  }
>> --
>> 2.7.0
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160222/99f7a62d/attachment-0001.sig>


More information about the mesa-dev mailing list