Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uchar4 component extraction is broken: Not seeing the effect of the mask with 255 #55

Closed
dneto0 opened this issue Sep 6, 2017 · 1 comment
Assignees

Comments

@dneto0
Copy link
Collaborator

dneto0 commented Sep 6, 2017

Example input:

kernel void foo(const global float4* IN, global float4* OUT) {
  uchar4 in4 = *((global const uchar4*)IN);
  float4 result;
  result.x = in4.x;
  result.y = in4.y;
  result.z = in4.z;
  result.w = in4.w;
  *OUT = result;
}
@dneto0
Copy link
Collaborator Author

dneto0 commented Sep 6, 2017

Produces:

         %35 = OpLoad %v4float %34
         %36 = OpCompositeExtract %float %35 0
         %37 = OpBitcast %uint %36
         %38 = OpShiftRightLogical %uint %37 %uint_0
         %39 = OpBitwiseAnd %uint %38 %uint_255
         %40 = OpConvertUToF %float %38 ;  This is wrong. Should use %39 not %38
         %41 = OpCompositeInsert %v4float %40 %16 0
         %42 = OpShiftRightLogical %uint %37 %uint_8
         %43 = OpBitwiseAnd %uint %42 %uint_255
         %44 = OpConvertUToF %float %42
         %45 = OpCompositeInsert %v4float %44 %41 1
         %46 = OpShiftRightLogical %uint %37 %uint_16
         %47 = OpBitwiseAnd %uint %46 %uint_255
         %48 = OpConvertUToF %float %46
         %49 = OpCompositeInsert %v4float %48 %45 2
         %50 = OpShiftRightLogical %uint %37 %uint_24
         %51 = OpBitwiseAnd %uint %50 %uint_255
         %52 = OpConvertUToF %float %50
         %53 = OpCompositeInsert %v4float %52 %49 3
               OpStore %33 %53
               OpReturn
               OpFunctionEnd

@dneto0 dneto0 self-assigned this Sep 6, 2017
dneto0 added a commit to dneto0/clspv that referenced this issue Sep 6, 2017
@dneto0 dneto0 closed this as completed in #56 Sep 6, 2017
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

No branches or pull requests

1 participant