Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
21 user(s) are online (13 user(s) are browsing Forums)

Members: 0
Guests: 21

more...
Support us!
Recent OS4 Files
OS4Depot.net
Report message:*
 

Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress

Subject: Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
by kas1e on 2019/9/20 20:23:22

@All
While porting supertuxkart, found another simple shader which fail on our side. Daniel's glslangvalidator_redux compile them fine (so probabaly olges2 also fine there, because code from daniel's last glslangvalidator_reduce are inside of ogles2 if i correctly remember), but then, compiled .spv version from that shader fail on Nova with reference to problems with shared_ptr

There is shader in question:

#version 120

// motion_blur.vert

void main()
{
    
gl_TexCoord[0].st vec2(gl_MultiTexCoord0.sgl_MultiTexCoord0.t);
    
gl_Position gl_Vertex;
}


glslangvalidator compile it fine:

Quote:

8/0.Work:Warp3DNova/my_tests> glslangvalidator_redux -G -o motion_blur.vert.spv motion_blur.vert

Success.


Then nova fail to compile it:

8/0.Work:Warp3DNova/my_testsW3DNShaderInfo motion_blur.vert.spv 
W3DNShaderInfo 
Get shader information

Shader
motion_blur.vert.spv
Compiling motion_blur
.vert.spv failed (12with errorunknown error
Log
:
ERRORAn exception occurred during compilation
ERRORAssertion failedpx != 0in Tboost::shared_ptr<T>::operator->() const [with T GPUProg::CGRegisterAlloc], defined in /SDK/local/common/include/boost/shared_ptr.hpp in line 253
ERROR
An exception occurred during compilation
ERRORAssertion failedpx != 0in Tboost::shared_ptr<T>::operator->() const [with T GPUProg::CGRegisterAlloc], defined in /SDK/local/common/include/boost/shared_ptr.hpp in line 253
ERROR
Code generation failed for an unknown reason.



Done.


And there is verbose output from nova:

8/0.Work:Warp3DNova/my_testsW3DNShaderInfo -v motion_blur.vert.spv 
W3DNShaderInfo 
Get shader information

Verbose mode
Shader
motion_blur.vert.spv
Compiling motion_blur
.vert.spv failed (12with errorunknown error
Log
:
Shader size760 bytes
Parsing SPIR
-V code

Module Version
1.2.0
Generator Magic Number
0x80003
Upper bound on ids
32

Parsed instructions
:
            
OpCapability: : Shader
         1
OpExtInstImport: : GLSL.std.450
            OpMemoryModel
: : addressingLogicalmemoryGLSL450
         4
OpEntryPoint: : mainexecution modelVertex
            OpSource
: : GLSL ver 120
         4
OpName: : main
        12
OpName: : gl_TexCoord
        16
OpName: : gl_MultiTexCoord0
        29
OpName: : gl_Position
        30
OpName: : gl_Vertex
        29
OpDecorate: : BuiltIn(Position)
         
2OpTypeVoidVoid
         3
OpTypeFunction<< func()
         
6OpTypeFloatFloat32 bits
         7
OpTypeVector: ???Vector4num-elements4element type id6
         8
OpTypeIntUInt32 bitsunsigned
         9
OpConstant8 const9 0x1
        10
OpTypeArray: ???[]: length id9element type id7
        11
OpTypePointer: ???Ptrstorage class: Output
        12
OpVariable11var12storage class: Output
        13
OpTypeIntInt32 bitssigned
        14
OpConstant13 const14 0x0
        15
OpTypePointer: ???Ptrstorage class: Input
        16
OpVariable15var16storage class: Input
        17
OpConstant8 const17 0x0
        18
OpTypePointer: ???Ptrstorage class: Input
        23
OpTypeVector: ???Vector2num-elements2element type id6
        25
OpTypePointer: ???Ptrstorage class: Output
        29
OpVariable25var29storage class: Output
        30
OpVariable15var30storage class: Input
         4
OpFunctionfunc4(type3)

         
5OpLabel
        
19OpAccessChain1816[17]
        
20OpLoad6tmp20 << 19
        21
OpAccessChain1816[9]
        
22OpLoad6tmp22 << 21
        24
OpCompositeConstruct23tmp24 << 2022
        26
OpAccessChain2512[14]
        
27OpLoad7tmp27 << 26
        28
OpVectorShuffle7tmp28 << 27244523
            OpStore
: : 28 >> 26
        31
OpLoad7tmp31 << 30
            OpStore
: : 31 >> 29
            OpReturn

            
OpFunctionEnd

Linking the instructions
Initial Disassembly
:
Module Info:
            
OpSource: : GLSL ver 120
         1
OpExtInstImport: : GLSL.std.450
            OpMemoryModel
: : addressingLogicalmemoryGLSL450

Capabilities
:
            
OpCapability: : Shader

Inputs
:
        
16OpVariableFloatVector4*: gl_MultiTexCoord0storage class: Input
        30
OpVariableFloatVector4*: gl_Vertexstorage class: Input

Outputs
:
        
12OpVariableFloatVector4[1]*: gl_TexCoordstorage class: Output
        29
OpVariableFloatVector4*: gl_Positionstorage class: Output DecoratorsBuiltIn(Position)

Entry Points
         
4OpEntryPoint: : mainexecution modelVertex, Function: Void main()

Constants:
         
9OpConstantUInt const9 1
        14
OpConstantInt const14 0
        17
OpConstantUInt const17 0

Disassembled Code
:
         
4OpFunctionVoid main()
                 
5lb5:
                        
19OpAccessChainFloat*: gl_MultiTexCoord0[0]
                        
20OpLoadFloattmp20 << gl_MultiTexCoord0[0]
                        
21OpAccessChainFloat*: gl_MultiTexCoord0[1]
                        
22OpLoadFloattmp22 << gl_MultiTexCoord0[1]
                        
24OpCompositeConstructFloatVector2tmp24 << tmp20tmp22
                        26
OpAccessChainFloatVector4*: gl_TexCoord[0]
                        
27OpLoadFloatVector4tmp27 << gl_TexCoord[0]
                        
28OpVectorShuffleFloatVector4tmp28 << tmp27tmp244523
                            OpStore
: : tmp28 >> gl_TexCoord[0]
                        
31OpLoadFloatVector4tmp31 << gl_Vertex
                            OpStore
: : tmp31 >> gl_Position
                            OpReturn




Performing hardware-independent optimization...
Can't merge stores to array variable: gl_TexCoord
Optimization done.

Optimized Disassembly:
Module Info:
            OpSource: : GLSL ver 120
         1: OpExtInstImport: : GLSL.std.450
            OpMemoryModel: : addressing: Logical, memory: GLSL450

Capabilities:
            OpCapability: : Shader

Inputs:
        16: OpVariable: FloatVector4*: gl_MultiTexCoord0: storage class: Input
        30: OpVariable: FloatVector4*: gl_Vertex: storage class: Input

Outputs:
        12: OpVariable: FloatVector4[1]*: gl_TexCoord: storage class: Output
        29: OpVariable: FloatVector4*: gl_Position: storage class: Output Decorators: BuiltIn(Position)

Entry Points: 
         4: OpEntryPoint: : main, execution model: Vertex, Function: Void main()

Constants:
         9: OpConstant: UInt const9 = 1
        14: OpConstant: Int const14 = 0
        17: OpConstant: UInt const17 = 0

Disassembled Code:
         4: OpFunction: Void main()
                 5: lb5:
                        19: OpAccessChain: Float*: gl_MultiTexCoord0[0]
                        20: OpLoad: Float: tmp20 << gl_MultiTexCoord0[0]
                        21: OpAccessChain: Float*: gl_MultiTexCoord0[1]
                        22: OpLoad: Float: tmp22 << gl_MultiTexCoord0[1]
                        24: OpCompositeConstruct: FloatVector2: tmp24 << tmp20, tmp22
                        26: OpAccessChain: FloatVector4*: gl_TexCoord[0]
                        27: OpLoad: FloatVector4: tmp27 << gl_TexCoord[0]
                        28: OpVectorShuffle: FloatVector4: tmp28 << tmp27, tmp24, 4, 5, 2, 3
                            OpStore: : tmp28 >> gl_TexCoord[0]
                        31: OpLoad: FloatVector4: tmp31 << gl_Vertex
                            OpStore: : tmp31 >> gl_Position
                            OpReturn: 



Generating the compiled code...
ERROR: An exception occurred during compilation: 
ERROR: Assertion failed: px != 0, in T* boost::shared_ptr<T>::operator->() const [with T = GPUProg::CGRegisterAlloc], defined in /SDK/local/common/include/boost/shared_ptr.hpp in line 253
Intermediate disassembly (pre optimization):
Program Type: Vertex
Input Variables:
offset: 0, size: 16, FloatVector4 gl_Vertex
offset: 1, size: 16, FloatVector4 gl_MultiTexCoord0

Output Variables:
offset: 32, size: 16, FloatVector4 gl_TexCoord[1]

Special Output Variables:
offset: 12, size: 16, FloatVector4 gl_Position BuiltIn(Position)

Constants:
UInt32 const9: 1
Int32 const14: 0
UInt32 const17: 0

Instructions:
V_ADD_I32 vDst(VGPR0) src0(SGPR2) src1(VGPR0) // VOP2
# Void main()
Function: Void main()
# lb5
Label: lb5
#         19: OpAccessChain: Float*: gl_MultiTexCoord0[0]
#         20: OpLoad: Float: tmp20 << gl_MultiTexCoord0[0]
S_LOAD_DWORDX4_IMM offset(4) sBase(SGPR[6:7]) sDst(SGPR[8:11])
S_WAITCNT 0 
BUFFER_LOAD_FORMAT_X offset(0) offEn(0) idxEn(1) glc(0) addr64(0) lds(0) vAddr(VGPR[0:1]) vData(VGPR2) srSrc(SGPR[8:11]) slc(0) tfe(0) sOffset(0)
S_WAITCNT 0 
#         21: OpAccessChain: Float*: gl_MultiTexCoord0[1]
#         22: OpLoad: Float: tmp22 << gl_MultiTexCoord0[1]
S_LOAD_DWORDX4_IMM offset(4) sBase(SGPR[6:7]) sDst(SGPR[12:15])
S_WAITCNT 0 
BUFFER_LOAD_FORMAT_XYZW offset(0) offEn(0) idxEn(1) glc(0) addr64(0) lds(0) vAddr(VGPR[0:1]) vData(VGPR4) srSrc(SGPR[12:15]) slc(0) tfe(0) sOffset(0)
S_WAITCNT 0 
V_MOV_B32 vDst(VGPR3) src0(VGPR5)
#         24: OpCompositeConstruct: FloatVector2: tmp24 << tmp20, tmp22
V_MOV_B32 vDst(VGPR8) src0(VGPR2)
V_MOV_B32 vDst(VGPR9) src0(VGPR3)
#         26: OpAccessChain: FloatVector4*: gl_TexCoord[0]
#         27: OpLoad: FloatVector4: tmp27 << gl_TexCoord[0]

Performing GPU-specific optimization...
Pre register allocation control-flow processing...
Intermediate disassembly (pre register allocation):
Program Type: Vertex
Input Variables:
offset: 0, size: 16, FloatVector4 gl_Vertex
offset: 1, size: 16, FloatVector4 gl_MultiTexCoord0

Output Variables:
offset: 32, size: 16, FloatVector4 gl_TexCoord[1]

Special Output Variables:
offset: 12, size: 16, FloatVector4 gl_Position BuiltIn(Position)

Constants:
UInt32 const9: 1
Int32 const14: 0
UInt32 const17: 0

Instructions:
V_ADD_I32 vDst(VGPR0) src0(SGPR2) src1(VGPR0) // VOP2
# Void main()
Function: Void main()
# lb5
Label: lb5
#         19: OpAccessChain: Float*: gl_MultiTexCoord0[0]
#         20: OpLoad: Float: tmp20 << gl_MultiTexCoord0[0]
S_LOAD_DWORDX4_IMM offset(4) sBase(SGPR[6:7]) sDst(SGPR[8:11])
S_WAITCNT 0 
BUFFER_LOAD_FORMAT_X offset(0) offEn(0) idxEn(1) glc(0) addr64(0) lds(0) vAddr(VGPR[0:1]) vData(VGPR2) srSrc(SGPR[8:11]) slc(0) tfe(0) sOffset(0)
S_WAITCNT 0 
#         21: OpAccessChain: Float*: gl_MultiTexCoord0[1]
#         22: OpLoad: Float: tmp22 << gl_MultiTexCoord0[1]
S_LOAD_DWORDX4_IMM offset(4) sBase(SGPR[6:7]) sDst(SGPR[12:15])
S_WAITCNT 0 
BUFFER_LOAD_FORMAT_XYZW offset(0) offEn(0) idxEn(1) glc(0) addr64(0) lds(0) vAddr(VGPR[0:1]) vData(VGPR4) srSrc(SGPR[12:15]) slc(0) tfe(0) sOffset(0)
S_WAITCNT 0 
V_MOV_B32 vDst(VGPR3) src0(VGPR5)
#         24: OpCompositeConstruct: FloatVector2: tmp24 << tmp20, tmp22
V_MOV_B32 vDst(VGPR8) src0(VGPR2)
V_MOV_B32 vDst(VGPR9) src0(VGPR3)
#         26: OpAccessChain: FloatVector4*: gl_TexCoord[0]
#         27: OpLoad: FloatVector4: tmp27 << gl_TexCoord[0]
ERROR: An exception occurred during compilation: 
ERROR: Assertion failed: px != 0, in T* boost::shared_ptr<T>::operator->() const [with T = GPUProg::CGRegisterAlloc], defined in /SDK/local/common/include/boost/shared_ptr.hpp in line 253



Done.

8/0.Work:Warp3DNova/my_tests>



I do some google, and found that this variable used pretty offten in all tutorials and even in book “OpenGL Shading language".

Then i find that it all described in section 5.5 of GLSL spec, and in end i find in google some explain , that this “st” part is part of swizzle mask which let you recombine your vector. The texture coordinates are four-component vectors, but st mask selects the first two (you can use “xy”, it would be the same).

So i tried also with "xy", but it also fail.

Any ideas if it expected to work (so its a bug), or some non-implemented feature ?
Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project