mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-27 07:26:48 +01:00
Like a game of telephone
- Fix overlay via casting - Saw cortex doing this in nvidium, and it seems obvious in hindsight
This commit is contained in:
parent
e7a112d773
commit
cfe6f3901b
2 changed files with 5 additions and 7 deletions
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||
|
||||
import com.jozufozu.flywheel.Flywheel;
|
||||
import com.jozufozu.flywheel.api.layout.FloatRepr;
|
||||
import com.jozufozu.flywheel.api.layout.IntegerRepr;
|
||||
import com.jozufozu.flywheel.api.layout.Layout;
|
||||
import com.jozufozu.flywheel.api.layout.LayoutBuilder;
|
||||
import com.jozufozu.flywheel.api.vertex.VertexView;
|
||||
|
@ -19,7 +18,7 @@ public final class InternalVertex {
|
|||
.vector("position", FloatRepr.FLOAT, 3)
|
||||
.vector("color", FloatRepr.NORMALIZED_UNSIGNED_BYTE, 4)
|
||||
.vector("tex", FloatRepr.FLOAT, 2)
|
||||
.vector("overlay", IntegerRepr.SHORT, 2)
|
||||
.vector("overlay", FloatRepr.SHORT, 2)
|
||||
.vector("light", FloatRepr.UNSIGNED_SHORT, 2)
|
||||
.vector("normal", FloatRepr.NORMALIZED_BYTE, 3)
|
||||
.build();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
in vec3 _flw_a_pos;
|
||||
in vec4 _flw_a_color;
|
||||
in vec2 _flw_a_texCoord;
|
||||
in ivec2 _flw_a_overlay;
|
||||
in vec2 _flw_a_overlay;
|
||||
in vec2 _flw_a_light;
|
||||
in vec3 _flw_a_normal;
|
||||
|
||||
|
@ -9,10 +9,9 @@ void _flw_layoutVertex() {
|
|||
flw_vertexPos = vec4(_flw_a_pos, 1.0);
|
||||
flw_vertexColor = _flw_a_color;
|
||||
flw_vertexTexCoord = _flw_a_texCoord;
|
||||
// Need to clamp the overlay texture coords to sane coordinates because integer vertex attributes explode on
|
||||
// some drivers for some draw calls. This should only effect instances that don't write to overlay, but
|
||||
// the internal vertex format is unfortunately subject to these issues.
|
||||
flw_vertexOverlay = clamp(_flw_a_overlay, 0, 15);
|
||||
// Integer vertex attributes explode on some drivers for some draw calls, so get the driver
|
||||
// to cast the int to a float so we can cast it back to an int and reliably get a sane value.
|
||||
flw_vertexOverlay = ivec2(_flw_a_overlay);
|
||||
flw_vertexLight = _flw_a_light / 256.0;
|
||||
flw_vertexNormal = _flw_a_normal;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue