Skip to content
This repository has been archived by the owner on Jul 19, 2018. It is now read-only.

SPIR-V : Add Validation for Interface of Entry Point #2676

Open
metora opened this issue Jun 23, 2018 · 3 comments
Open

SPIR-V : Add Validation for Interface of Entry Point #2676

metora opened this issue Jun 23, 2018 · 3 comments

Comments

@metora
Copy link

metora commented Jun 23, 2018

Hi

I write a Mesa-IR to SPIR-V Translator, and it's fine on NVIDIA and Adreno driver.
But It's crash on MALI driver, so I found the problem is I lost add gl_Position..

OpEntryPoint Vertex %6 "main" %13
I lost the %13.

It's crash on MALI Offline Shader Compiler also.

Thanks

; SPIR-V
; Version: 1.0
; Generator: X-LEGEND Mesa-IR/SPIR-V Translator; 0
; Bound: 17
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %6 "main" %13
OpSource ESSL 310
OpName %6 "main"
OpName %10 "gl_PerVertex"
OpMemberName %10 0 "gl_Position"
OpDecorate %10 Block
OpMemberDecorate %10 0 BuiltIn Position
%2 = OpTypeFloat 32
%3 = OpTypeVector %2 4
%4 = OpTypeVoid
%5 = OpTypeFunction %4
%8 = OpConstant %2 1
%9 = OpConstantComposite %3 %8 %8 %8 %8
%12 = OpTypePointer Output %3
%14 = OpTypeInt 32 1
%10 = OpTypeStruct %3
%11 = OpTypePointer Output %10
%13 = OpVariable %11 Output
%15 = OpConstant %14 0
%6 = OpFunction %4 None %5
%7 = OpLabel
%16 = OpAccessChain %12 %13 %15
OpStore %16 %9
OpReturn
OpFunctionEnd

@chrisforbes
Copy link
Collaborator

We should probably enforce this in SPIRV-Tools rather than here.

@chrisforbes
Copy link
Collaborator

That is, SPIRV-Tools should enforce, for every entrypoint:

  • Every id listed in the entrypoint is for an OpVariable in the Input or Output storage class.
  • The static call graph rooted at that entrypoint does not reference any /other/ OpVariables in the Input or Output storage class which are not listed in the entrypoint. (your case)

@chrisforbes
Copy link
Collaborator

I'm going to move this to the new repo: KhronosGroup/Vulkan-ValidationLayers

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants