aardappel / lobster

The Lobster Programming Language
http://strlen.com/lobster
2.24k stars 121 forks source link

Support more texture types / GPU queries / SSBO improvements / mipmap features #222

Closed maierfelix closed 1 year ago

maierfelix commented 1 year ago

A rough overview of what this adds:

aardappel commented 1 year ago

Lets give it a better name than "Update" :)

maierfelix commented 1 year ago

Lets give it a better name than "Update" :)

Not sure if I can think of a better name^^

aardappel commented 1 year ago

Not sure if I can think of a better name^^

I can't think of a worse name :) See my changed title

aardappel commented 1 year ago

You have linker errors on some platforms:

Undefined symbols for architecture x86_64:
  "TimeQuery::Stop()", referenced from:
      AddGraphics(lobster::NativeRegistry&)::$_99::__invoke(lobster::Value*&, lobster::VM&, lobster::Value&) in graphics.o
  "TimeQuery::Start()", referenced from:
      AddGraphics(lobster::NativeRegistry&)::$_98::__invoke(lobster::Value*&, lobster::VM&, lobster::Value&) in graphics.o
  "vtable for TimeQuery", referenced from:
      AddGraphics(lobster::NativeRegistry&)::$_97::__invoke(lobster::Value*&, lobster::VM&) in graphics.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
aardappel commented 1 year ago

I guess gltimequery.cpp is not added on the mac.. I can fix that.

aardappel commented 1 year ago

The failures on Android/Wasm is because you use the Query functions that don't exist on those platforms, please surround their use with #ifdef PLATFORM_WINNIX (platforms that have OpenGL 4.x) and in the #else case just return some default value.

aardappel commented 1 year ago

Seems clang is now unhappy about:

/home/runner/work/lobster/lobster/dev/src/gltexture.cpp: In function ‘uint16_t FloatToHalfFloat(float)’:
/home/runner/work/lobster/lobster/dev/src/gltexture.cpp:37:20: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   37 |     uint32_t b = (*(uint32_t*)&x) + 0x00001000;
      |                    ^~~~~~~~~~~~~

Maybe we can replace (*(uint32_t*)&x) by this kind of code:

int2float i2f;
i2f.f = x;
i2f.i
aardappel commented 1 year ago

Ok, lets merge this for now, we will fix issues separately