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

Strange autoconversion of integers to floats #234

Open
metayan opened this issue Oct 6, 2019 · 3 comments
Open

Strange autoconversion of integers to floats #234

metayan opened this issue Oct 6, 2019 · 3 comments

Comments

@metayan
Copy link

metayan commented Oct 6, 2019

Something seems to have been changed recently, because

(defun-g cube-frag ((tc :vec3) &uniform (tex :sampler-cube))
  (texture tex (* (v! -1 1 1) tc)))

suddenly gives:

Error compiling fragment-shader: 
ERROR: 0:15: 'f' : syntax error: syntax error

// fragment-stage
#version 410

in _FROM_VERTEX_STAGE_
{
     in vec3 _VERTEX_STAGE_OUT_1;
} v_in;

layout(location = 0)  out vec4 _FRAGMENT_STAGE_OUT_0;

uniform samplerCube TEX;

void main()
{
    _FRAGMENT_STAGE_OUT_0 = texture(TEX,(vec3(-1f,1f,1f) * v_in._VERTEX_STAGE_OUT_1));
    return;
}
@metayan
Copy link
Author

metayan commented Oct 6, 2019

Until 24da4ae this was emitted:

void main()
{
    _FRAGMENT_STAGE_OUT_0 = texture(TEX,(vec3(float(-1),float(1),float(1)) * v_in._VERTEX_STAGE_OUT_1));
    return;
}

@metayan
Copy link
Author

metayan commented Oct 6, 2019

By the way, how cool is it that we can checkout a different version of a package and just ql:quickload it into a running program?
Discovering more and more Lisp awesomeness. ;)
(And most likely there is a SLIME shortcut – or some day will be – to do this automagically. load-previous/next-version-of-package :) )

@cbaggers
Copy link
Owner

cbaggers commented Oct 10, 2019

@metayan yeah it's rad!

The change was that, in cases where we used to use scalar constructors on literal integers, we now just emit the correct literal. For example rather than (float 2) we emit 2f.

However, some drivers don't seem to like 2f and instead require 2.0f so I've fixed that. Should be good now on master

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

2 participants