2019-08-21 17:58 CEST

View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0006022Spring engineLuapublic2018-07-30 23:36
Reporterlhog 
Assigned ToKloot 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version104.0 +git 
Target VersionFixed in Version 
Summary0006022: uniformArray definition in gl.CreateShader doesn't seem to initialize array uniforms
DescriptionI use something like the following snippet:
shObj = gl.CreateShader({
  fragment = fragCode,
  uniform = {
    something = 0.5,
  },
  uniformInt = {
    somethingElse = 1,
  },
  uniformArray = {
    someArray = {0.1, 0.2, 0.3, 0.4, 0.5},
  },
})

Every other uniform, except someArray gets initialized.

If the same initialization is done somewhere in the drawing code like this, then everything works as expected:
  local UNIFORM_TYPE_FLOAT = 2
  tbl = {0.1, 0.2, 0.3, 0.4, 0.5}
  gl.UniformArray(someArrayLoc, UNIFORM_TYPE_FLOAT, tbl)

I think something might be wrong with uniformArray parsing in gl.CreateShader or am I missing some special syntax?
Additional Informationhttps://github.com/lhog/spring-luashader-goodies/blob/master/GaussBlur.lua#L150-L156
https://github.com/lhog/spring-luashader-goodies/blob/master/GaussBlur.lua#L181-L182
https://github.com/lhog/spring-luashader-goodies/blob/master/LuaShader.lua#L209-L236
TagsNo tags attached.
Checked infolog.txt for lua Errors
Attached Files

-Relationships
+Relationships

-Notes

~0019267

Kloot (developer)

arrays are automatically handled by CreateShader, just write this:

  uniformFloat = {
    something = 0.5,
    someArray = {0.1, 0.2, 0.3, 0.4, 0.5},
  },

"uniformArray" is not a recognized key.

~0019268

lhog (reporter)

I've just tried two variants:

uniform = {
  weights = {0.1, 0.2, 0.3},
  offsets = {0.0, 1.0, 2.0},
}

and

uniformFloat = {
  weights = {0.1, 0.2, 0.3},
  offsets = {0.0, 1.0, 2.0},
}

Both cause the following warnings in the infolog.txt:
[f=0003874] Warning: [ParseUniformsTable] uniform "weights" from table "uniform" not active in shader
[f=0003874] Warning: [ParseUniformsTable] uniform "offsets" from table "uniform" not active in shader

As in the previous case gl.UniformArray(someArrayLoc, UNIFORM_TYPE_FLOAT, tbl) works just fine on the same uniforms.

As far as uniformArray key, it's suggested on the GLSL wiki: https://springrts.com/wiki/Lua_GLSL_Api
I would change this myself, but my IP-address is blocked (apparently collateral damage from some other guy's ban).

~0019270

Kloot (developer)

Fix cd9b5e3c2c59554e7fc6ec7fca45fa9db5a216b2 committed to develop branch: fix 0006022, repo: spring changeset id: 10413
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2018-07-30 02:50 lhog New Issue
2018-07-30 09:49 Kloot Note Added: 0019267
2018-07-30 09:49 Kloot Status new => closed
2018-07-30 09:49 Kloot Resolution open => no change required
2018-07-30 14:43 lhog Status closed => feedback
2018-07-30 14:43 lhog Resolution no change required => reopened
2018-07-30 14:43 lhog Note Added: 0019268
2018-07-30 16:36 Kloot Assigned To => Kloot
2018-07-30 16:36 Kloot Status feedback => assigned
2018-07-30 23:36 Kloot Changeset attached => spring develop cd9b5e3c
2018-07-30 23:36 Kloot Note Added: 0019270
2018-07-30 23:36 Kloot Status assigned => resolved
2018-07-30 23:36 Kloot Resolution reopened => fixed
+Issue History