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

Parsing problem when file doesn't end in EOL #126

Closed
dekimir opened this issue Feb 19, 2016 · 5 comments
Closed

Parsing problem when file doesn't end in EOL #126

dekimir opened this issue Feb 19, 2016 · 5 comments
Assignees

Comments

@dekimir
Copy link

dekimir commented Feb 19, 2016

Running spirv-as on the attached file yields:

error: 21: 1: Invalid Opcode name 'OpCapability Shader
OpMemoryModel Logical GLSL450

%i32 = OpTypeInt 32 1
%f32 = OpTypeFloat 32
%v4i32 = OpTypeVector %i32 4
%timg = OpTypeImage %i32 2D 0 0 0 0 Unknown
%pimg = OpTypePointer Input %timg
%tfun = OpTypeFunction %i32

%vimg = OpVariable %pimg Input
%coord = OpConstant %i32 0
%bias = OpConstant %f32 0.

%main = OpFunction %i32 None %tfun
%lbl = OpLabel
%img = OpLoad %timg %vimg
%r1 = OpImageFetch %v4i32 %img %coord Offset|Bias %bias %bias
;%r2 = OpImageSampleExplicitLod %v4i32 %sample %coord Bias 0.2
OpReturnValue %coord
OpFunctionEndѷ'

IOW, it thinks the whole program is an opcode name. 🙀

shader.txt

@dneto0
Copy link
Collaborator

dneto0 commented Feb 19, 2016

I'm surprised it doesn't stop at the first space after OpCapbility. ?! Hmm.

@dekimir
Copy link
Author

dekimir commented Feb 19, 2016

Forgot to add: if I add a newline at the end of the file, it assembles just fine.

antiagainst added a commit to antiagainst/SPIRV-Tools that referenced this issue Feb 22, 2016
This addresses Bug KhronosGroup#126 where EOL is missing at the end of
source file.
antiagainst added a commit to antiagainst/SPIRV-Tools that referenced this issue Feb 22, 2016
This addresses Bug KhronosGroup#126 where EOL is missing at the end of
source file.
antiagainst added a commit to antiagainst/SPIRV-Tools that referenced this issue Feb 22, 2016
This addresses Bug KhronosGroup#126 where EOL is missing at the end of
source file.
@antiagainst
Copy link
Contributor

Done via #131.

@dneto0
Copy link
Collaborator

dneto0 commented Feb 22, 2016

I verified it against the shader.txt file originally submitted, but with the trailing newline removed. (Somehow it crept in?)

@antiagainst
Copy link
Contributor

@dneto0 Yeah, the attached file has EOL before EOF.

@dekimir kindly shows me how to use the power of echo -n.

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

3 participants