1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-05 13:53:38 +00:00

Add uniform tests;

This commit is contained in:
bjorn 2024-06-15 12:08:54 -07:00
parent 0e3b45c5e5
commit df3cd06091

View file

@ -322,10 +322,49 @@ group('graphics', function()
expect({ pass:getDimensions() }).to.equal({ 0, 0 })
end)
test('depth-only canvas', function()
t = lovr.graphics.newTexture(100, 100, { format = 'd32f' })
p = lovr.graphics.newPass({ depth = t })
lovr.graphics.submit(p)
test(':setCanvas', function()
-- depth only
texture = lovr.graphics.newTexture(100, 100, { format = 'd32f' })
pass = lovr.graphics.newPass({ depth = texture })
lovr.graphics.submit(pass)
end)
test(':send', function()
-- First draw has uniforms, second draw does not, and first draw is culled
shader1 = lovr.graphics.newShader('unlit', [[
Constants { vec4 color; };
vec4 lovrmain() { return color; }
]])
shader2 = lovr.graphics.newShader('unlit', [[
vec4 lovrmain() { return vec4(1.); }
]])
texture = lovr.graphics.newTexture(1, 1)
pass = lovr.graphics.newPass(texture)
pass:setViewCull(true)
pass:setShader(shader1)
pass:sphere(0, 0, 10)
pass:setShader(shader2)
pass:sphere(0, 0, -10)
lovr.graphics.submit(pass)
-- First dispatch has uniforms, second dispatch does not
shader1 = lovr.graphics.newShader([[
Constants { vec4 color; };
void lovrmain() { }
]])
shader2 = lovr.graphics.newShader([[
void lovrmain() { }
]])
pass = lovr.graphics.newPass()
pass:setShader(shader1)
pass:compute()
pass:setShader(shader2)
pass:compute()
lovr.graphics.submit(pass)
end)
end)
end)