Proposal for the devs: PIXEL and VERTEX
Posted: Tue Oct 03, 2017 5:11 pm
I recently tried to declare a constant named PIXEL in a fragment shader, and it failed with a syntax error. It took me a while to figure out what was the problem: in wrap_Graphics.lua, there's
I understand its purpose, but I'd like to propose that you change it to
When defined this way, it still serves its purpose, but it can also still be used as an identfier in shader code without getting syntax errors. Same for VERTEX.
Reasoning is, it is convention to write constants in UPPER CASE, and PIXEL and VERTEX are somewhat likely candidates to be used in shaders. The syntax error is confusing at first. This minor redefinition would solve this, and it doesn't seem to have any downsides.
Code: Select all
#define PIXEL
Code: Select all
#define PIXEL PIXEL
Reasoning is, it is convention to write constants in UPPER CASE, and PIXEL and VERTEX are somewhat likely candidates to be used in shaders. The syntax error is confusing at first. This minor redefinition would solve this, and it doesn't seem to have any downsides.