[Mesa-users] Mesa: llvmpipe: issues with using packDouble2x32

Matwey V. Kornilov matwey.kornilov at gmail.com
Tue Aug 7 19:29:26 UTC 2018


Hi Brain,

Can DADD correctly interpret things like .yx (in TEMP[1].yxyx)? It has
to swap fours of bytes before.

2018-08-07 21:08 GMT+03:00 Matwey V. Kornilov <matwey.kornilov at gmail.com>:
> Hi Brain,
>
> Thank you for useful advice. I've found the following.
>
> The shader when black screen is the following:
>
> llvmpipe: Create fragment shader #261 0x275fd10:
> FRAG
> PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1
> DCL IN[0], GENERIC[0], CONSTANT
> DCL OUT[0], COLOR
>   0: MOV OUT[0], IN[0]
>   1: END
> usage masks:
>   IN[0].xyzw
>
> FRAG
> DCL IN[0].xy, GENERIC[9], PERSPECTIVE
> DCL OUT[0], COLOR
> DCL SAMP[0]
> DCL SAMP[1]
> DCL SVIEW[0], 2D, UINT
> DCL SVIEW[1], 1D, FLOAT
> DCL CONST[0][0..1]
> DCL TEMP[0..2], LOCAL
> IMM[0] FLT64 {0,00000000, 1,00000000}
>   0: F2D TEMP[0].xy, CONST[0][0].xxxx
>   1: MOV TEMP[1].xy, IN[0].xyyy
>   2: TEX TEMP[1].xy, TEMP[1], SAMP[0], 2D
>   3: F2D TEMP[2].xy, CONST[0][1].xxxx
>   4: DNEG TEMP[2].xy, TEMP[2].xyxy
>   5: DADD TEMP[1].xy, TEMP[1].yxyx, TEMP[2].xyxy
>   6: DMUL TEMP[0].xy, TEMP[0].xyxy, TEMP[1].xyxy
>   7: DMAX TEMP[0].xy, TEMP[0].xyxy, IMM[0].xyxy
>   8: DMIN TEMP[0].xy, TEMP[0].xyxy, IMM[0].zwzw
>   9: D2F TEMP[0].x, TEMP[0].xyxy
>  10: MOV TEMP[0].x, TEMP[0].xxxx
>  11: TEX TEMP[0], TEMP[0], SAMP[1], 1D
>  12: MOV OUT[0], TEMP[0]
>  13: END
>
> llvmpipe: Create fragment shader #262 0x2916910:
> FRAG
> DCL IN[0].xy, GENERIC[9], PERSPECTIVE
> DCL OUT[0], COLOR
> DCL SAMP[0]
> DCL SAMP[1]
> DCL SVIEW[0], 2D, UINT
> DCL SVIEW[1], 1D, FLOAT
> DCL CONST[0][0..1]
> DCL TEMP[0..2], LOCAL
> IMM[0] FLT64 {0,00000000, 1,00000000}
>   0: F2D TEMP[0].xy, CONST[0][0].xxxx
>   1: MOV TEMP[1].xy, IN[0].xyyy
>   2: TEX TEMP[1].xy, TEMP[1], SAMP[0], 2D
>   3: F2D TEMP[2].xy, CONST[0][1].xxxx
>   4: DNEG TEMP[2].xy, TEMP[2].xyxy
>   5: DADD TEMP[1].xy, TEMP[1].yxyx, TEMP[2].xyxy
>   6: DMUL TEMP[0].xy, TEMP[0].xyxy, TEMP[1].xyxy
>   7: DMAX TEMP[0].xy, TEMP[0].xyxy, IMM[0].xyxy
>   8: DMIN TEMP[0].xy, TEMP[0].xyxy, IMM[0].zwzw
>   9: D2F TEMP[0].x, TEMP[0].xyxy
>  10: MOV TEMP[0].x, TEMP[0].xxxx
>  11: TEX TEMP[0], TEMP[0], SAMP[1], 1D
>  12: MOV OUT[0], TEMP[0]
>  13: END
> usage masks:
>   IN[0].xy
>
>
> For good shader version:
>
> llvmpipe: Create fragment shader #261 0x236ad50:
> FRAG
> PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1
> DCL IN[0], GENERIC[0], CONSTANT
> DCL OUT[0], COLOR
>   0: MOV OUT[0], IN[0]
>   1: END
> usage masks:
>   IN[0].xyzw
>
> FRAG
> DCL IN[0].xy, GENERIC[9], PERSPECTIVE
> DCL OUT[0], COLOR
> DCL SAMP[0]
> DCL SAMP[1]
> DCL SVIEW[0], 2D, UINT
> DCL SVIEW[1], 1D, FLOAT
> DCL CONST[0][0..1]
> DCL TEMP[0..2], LOCAL
> IMM[0] FLT64 {0,00000000, 1,00000000}
>   0: MOV TEMP[0].xy, IN[0].xyyy
>   1: TEX TEMP[0].y, TEMP[0], SAMP[0], 2D
>   2: MOV TEMP[0].x, TEMP[0].yyyy
>   3: MOV TEMP[1].xy, IN[0].xyyy
>   4: TEX TEMP[1].x, TEMP[1], SAMP[0], 2D
>   5: MOV TEMP[0].y, TEMP[1].xxxx
>   6: F2D TEMP[1].xy, CONST[0][0].xxxx
>   7: F2D TEMP[2].xy, CONST[0][1].xxxx
>   8: DNEG TEMP[2].xy, TEMP[2].xyxy
>   9: DADD TEMP[0].xy, TEMP[0].xyxy, TEMP[2].xyxy
>  10: DMUL TEMP[0].xy, TEMP[1].xyxy, TEMP[0].xyxy
>  11: DMAX TEMP[0].xy, TEMP[0].xyxy, IMM[0].xyxy
>  12: DMIN TEMP[0].xy, TEMP[0].xyxy, IMM[0].zwzw
>  13: D2F TEMP[0].x, TEMP[0].xyxy
>  14: MOV TEMP[0].x, TEMP[0].xxxx
>  15: TEX TEMP[0], TEMP[0], SAMP[1], 1D
>  16: MOV OUT[0], TEMP[0]
>  17: END
>
> llvmpipe: Create fragment shader #262 0x2525fd0:
> FRAG
> DCL IN[0].xy, GENERIC[9], PERSPECTIVE
> DCL OUT[0], COLOR
> DCL SAMP[0]
> DCL SAMP[1]
> DCL SVIEW[0], 2D, UINT
> DCL SVIEW[1], 1D, FLOAT
> DCL CONST[0][0..1]
> DCL TEMP[0..2], LOCAL
> IMM[0] FLT64 {0,00000000, 1,00000000}
>   0: MOV TEMP[0].xy, IN[0].xyyy
>   1: TEX TEMP[0].y, TEMP[0], SAMP[0], 2D
>   2: MOV TEMP[0].x, TEMP[0].yyyy
>   3: MOV TEMP[1].xy, IN[0].xyyy
>   4: TEX TEMP[1].x, TEMP[1], SAMP[0], 2D
>   5: MOV TEMP[0].y, TEMP[1].xxxx
>   6: F2D TEMP[1].xy, CONST[0][0].xxxx
>   7: F2D TEMP[2].xy, CONST[0][1].xxxx
>   8: DNEG TEMP[2].xy, TEMP[2].xyxy
>   9: DADD TEMP[0].xy, TEMP[0].xyxy, TEMP[2].xyxy
>  10: DMUL TEMP[0].xy, TEMP[1].xyxy, TEMP[0].xyxy
>  11: DMAX TEMP[0].xy, TEMP[0].xyxy, IMM[0].xyxy
>  12: DMIN TEMP[0].xy, TEMP[0].xyxy, IMM[0].zwzw
>  13: D2F TEMP[0].x, TEMP[0].xyxy
>  14: MOV TEMP[0].x, TEMP[0].xxxx
>  15: TEX TEMP[0], TEMP[0], SAMP[1], 1D
>  16: MOV OUT[0], TEMP[0]
>  17: END
> usage masks:
>   IN[0].xy
>
>
>
> 2018-08-07 17:29 GMT+03:00 Brian Paul <brianp at vmware.com>:
>> On 08/07/2018 03:16 AM, Matwey V. Kornilov wrote:
>>>
>>> Hi all,
>>>
>>> I am running Mesa-18.0.2 with Intel HD Graphics 620 (Kaby Lake GT2) on
>>> Linux 4.12.14. I am trying to use GLSL packDouble2x32() function from
>>> GL_ARB_gpu_shader_fp64 extension in my application.
>>>
>>> The following fragment shader works as expected:
>>>
>>>    #version 330
>>>    #extension GL_ARB_gpu_shader_fp64 : require
>>>    in vec2 UV;
>>>    out vec4 color;
>>>    uniform usampler2D image_texture;
>>>
>>>    void main() {
>>>        double value = packDouble2x32(texture(image_texture, UV).gr);
>>>        color = vec4(float(value), 0.0, 0.0, 1.0);
>>>    }
>>>
>>> `image_texture` parameters are the following. Texture type is
>>> GL_UNSIGNED_INT, pixel format is GL_RG_INTEGER and texture format is
>>> GL_RG32UI.
>>>
>>> However, when I force usage of llvmpipe with the same Mesa installation:
>>>
>>>    OpenGL vendor string: VMware, Inc.
>>>    OpenGL renderer string: llvmpipe (LLVM 5.0, 256 bits)
>>>
>>> The same shader compiles successfully, but renders empty black screen.
>>> I am not sure that this is how it should to be.
>>>
>>> It is interesting that the following shader modification works fine on
>>> llvmpipe:
>>>
>>>    #version 330
>>>    #extension GL_ARB_gpu_shader_fp64 : require
>>>    in vec2 UV;
>>>    out vec4 color;
>>>    uniform usampler2D image_texture;
>>>
>>>    void main() {
>>>        double value = packDouble2x32(uvec2(texture(image_texture,
>>> UV).g, texture(image_texture, UV).r));
>>>        color = vec4(float(value), 0.0, 0.0, 1.0);
>>>    }
>>>
>>> The question is how could I debug further what is going wrong here?
>>>
>>
>> Maybe try setting ST_DEBUG=tgsi and run both versions and compare the TGSI
>> code printed to your terminal.  Any difference would be a clue.
>>
>> -Brian
>>
>
>
>
> --
> With best regards,
> Matwey V. Kornilov



-- 
With best regards,
Matwey V. Kornilov


More information about the mesa-users mailing list