From 4121bfb46897f3e6f3895f907225dedd50743adf Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 11 Nov 2025 21:12:50 +0000 Subject: [PATCH] Reduce shape vertex size to 8 floats It is not at all clear whether this is an improvement or not --- shader/lighting/cap.vert | 2 +- shader/lighting/lineShadow.vert | 2 +- shader/shape/basic.vert | 2 +- src/Shader/Poke.hs | 4 +- src/Shape/Parameters.hs | 2 +- tags | 96 ++++++++++++++++----------------- 6 files changed, 53 insertions(+), 55 deletions(-) diff --git a/shader/lighting/cap.vert b/shader/lighting/cap.vert index 823f16601..8b25370a1 100644 --- a/shader/lighting/cap.vert +++ b/shader/lighting/cap.vert @@ -1,5 +1,5 @@ #version 450 core -struct PosColNorm { vec4 pos; vec4 col; vec4 norm; }; +struct PosColNorm { vec4 pos; vec4 dummy; }; layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; layout (std430, binding = 3) readonly buffer Data { PosColNorm data[]; }; layout (std430, binding = 4) readonly buffer Indices { uint indices[]; }; diff --git a/shader/lighting/lineShadow.vert b/shader/lighting/lineShadow.vert index 9d9f78535..b41bf9019 100644 --- a/shader/lighting/lineShadow.vert +++ b/shader/lighting/lineShadow.vert @@ -1,5 +1,5 @@ #version 450 core -struct PosColNorm { vec4 pos; vec4 col; vec4 norm; }; +struct PosColNorm { vec4 pos; vec4 dummy; }; layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; layout (std430, binding = 3) readonly buffer Data { PosColNorm data[]; }; layout (std430, binding = 5) readonly buffer Indices { uint indices[]; }; diff --git a/shader/shape/basic.vert b/shader/shape/basic.vert index 79e6fa1e8..ba22315a8 100644 --- a/shader/shape/basic.vert +++ b/shader/shape/basic.vert @@ -1,6 +1,6 @@ #version 450 core //struct PosColNorm { vec4 pos; vec4 norm;uint col; uint dummy; }; -struct PosColNorm { vec4 pos; uint norm;uint d1;uint d2; uint d3;uint col; uint dummy; }; +struct PosColNorm { vec4 pos; uint norm;uint col; }; // I don't know if the dummy is necessary layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; layout (std430, binding = 3) readonly buffer Data { PosColNorm data[]; }; diff --git a/src/Shader/Poke.hs b/src/Shader/Poke.hs index 4abfadb48..b373faace 100644 --- a/src/Shader/Poke.hs +++ b/src/Shader/Poke.hs @@ -440,7 +440,7 @@ pokeJustV :: Float -> Point3 -> Point4 -> Ptr Float -> Int -> Point3 -> IO Int pokeJustV xdata cp col ptr nv sh = do pokeByteOff ptr (nv * shapeVerxSize) (V4 x y z xdata) pokeByteOff ptr (nv *shapeVerxSize + 4 * floatSize) (normalToColor8 $ V4 nx ny nz 1) - pokeByteOff ptr (nv *shapeVerxSize + 8 * floatSize) (toColor8 col) + pokeByteOff ptr (nv *shapeVerxSize + 5 * floatSize) (toColor8 col) return (nv + 1) where V3 x y z = sh @@ -458,7 +458,7 @@ pokeFlatV :: pokeFlatV xdata pnorm col ptr nv sh = do pokeByteOff ptr (nv * shapeVerxSize) (V4 x y z xdata) pokeByteOff ptr (nv *shapeVerxSize + 4 * floatSize) (normalToColor8 $ V4 nx ny nz 1) - pokeByteOff ptr (nv *shapeVerxSize + 8 * floatSize) (toColor8 col) + pokeByteOff ptr (nv *shapeVerxSize + 5 * floatSize) (toColor8 col) return (nv + 1) where V3 x y z = sh diff --git a/src/Shape/Parameters.hs b/src/Shape/Parameters.hs index 94ce4e659..404220530 100644 --- a/src/Shape/Parameters.hs +++ b/src/Shape/Parameters.hs @@ -5,7 +5,7 @@ import Foreign.Storable shapeVerxSize :: Int {-# INLINE shapeVerxSize #-} -shapeVerxSize = sizeOf (0 :: Float) * 12 +shapeVerxSize = sizeOf (0 :: Float) * 8 --shapeVerxAttributes :: [VertexAttribute] --shapeVerxAttributes = diff --git a/tags b/tags index a95fc4f41..15f2217e1 100644 --- a/tags +++ b/tags @@ -1868,7 +1868,6 @@ _incNode src/Dodge/Data/CWorld.hs 30;" f _incNodeZoning src/Dodge/Data/World.hs 52;" f _input src/Dodge/Data/World.hs 41;" f _isWarming src/Dodge/Data/Item/Params.hs 21;" f -_ishapeSSBO src/Data/Preload/Render.hs 48;" f _ispCloseButton src/Dodge/Data/Item/Use/Consumption/LoadAction.hs 31;" f _ispCloseItem src/Dodge/Data/Item/Use/Consumption/LoadAction.hs 29;" f _itConsumables src/Dodge/Data/Item.hs 28;" f @@ -2225,7 +2224,6 @@ _shaderUINT src/Shader/Data.hs 52;" f _shaderVAO src/Shader/Data.hs 54;" f _shapeEBO src/Data/Preload/Render.hs 30;" f _shapeHalfSize src/Shape/Data.hs 13;" f -_shapeSSBO src/Data/Preload/Render.hs 47;" f _shapeShader src/Data/Preload/Render.hs 29;" f _shellPayload src/Dodge/Data/Item/Combine.hs 101;" f _shockwaves src/Dodge/Data/LWorld.hs 112;" f @@ -2688,9 +2686,9 @@ bounceSound src/Dodge/Projectile/Update.hs 74;" f boundPoints src/Bound.hs 10;" f boundedGrid src/Grid.hs 17;" f boxABC src/Polyhedra.hs 108;" f -boxEdgeIndices src/Shader/Poke.hs 358;" f -boxSurfaces src/Shader/Poke.hs 277;" f -boxSurfacesIndices src/Shader/Poke.hs 290;" f +boxEdgeIndices src/Shader/Poke.hs 359;" f +boxSurfaces src/Shader/Poke.hs 278;" f +boxSurfacesIndices src/Shader/Poke.hs 291;" f boxXYZ src/Polyhedra.hs 94;" f boxXYZnobase src/Polyhedra.hs 80;" f brainHat src/Dodge/Item/Equipment.hs 73;" f @@ -2701,7 +2699,7 @@ brightX src/Color.hs 116;" f btSPic src/Dodge/Render/ShapePicture.hs 129;" f btText src/Dodge/Inventory/SelectionList.hs 237;" f bufferEBO src/Shader/Bind.hs 28;" f -bufferPerspectiveMatrixUBO src/Dodge/Render.hs 471;" f +bufferPerspectiveMatrixUBO src/Dodge/Render.hs 472;" f bufferPokedVBO src/Shader/Bind.hs 19;" f bufferShaderLayers src/Shader/Bind.hs 32;" f bulletBeltBracer src/Dodge/Item/Equipment.hs 67;" f @@ -2879,7 +2877,7 @@ copier src/Dodge/Item/Scope.hs 88;" f copierItemUpdate src/Dodge/Creature/State.hs 131;" f copyItemToFloor src/Dodge/FloorItem.hs 14;" f corDoor src/Dodge/Room/Room.hs 385;" f -cornerList src/Preload/Render.hs 245;" f +cornerList src/Preload/Render.hs 249;" f corpseOrGib src/Dodge/Creature/Update.hs 111;" f corridor src/Dodge/Room/Corridor.hs 17;" f corridorBoss src/Dodge/LockAndKey.hs 133;" f @@ -2984,10 +2982,10 @@ cycleL src/DoubleStack.hs 28;" f cycleLT src/IntMapHelp.hs 97;" f cycleOptions src/Dodge/Menu/Option.hs 75;" f cycleR src/DoubleStack.hs 32;" f -cylinderIndices src/Shader/Poke.hs 382;" f +cylinderIndices src/Shader/Poke.hs 383;" f cylinderOnSeg src/Geometry.hs 122;" f cylinderPoly src/Shape.hs 87;" f -cylinderRoundIndices src/Shader/Poke.hs 389;" f +cylinderRoundIndices src/Shader/Poke.hs 390;" f dShadCol src/Dodge/Render/List.hs 222;" f damMatSideEffect src/Dodge/Material/Damage.hs 20;" f damThingHitWith src/Dodge/Damage.hs 72;" f @@ -3172,8 +3170,8 @@ doDebugTestF8 src/Dodge/Update/Input/DebugTest.hs 59;" f doDoorLerp src/Dodge/Door/DoorLerp.hs 8;" f doDoorMount src/Dodge/Door.hs 30;" f doDrag src/Dodge/Update/Input/InGame.hs 127;" f -doDrawing src/Dodge/Render.hs 34;" f -doDrawing' src/Dodge/Render.hs 45;" f +doDrawing src/Dodge/Render.hs 35;" f +doDrawing' src/Dodge/Render.hs 46;" f doFloatFloat src/Dodge/FloatFunction.hs 5;" f doGenFloat src/Dodge/HeldUse.hs 1158;" f doGravityPU src/Dodge/Projectile/Update.hs 35;" f @@ -3196,7 +3194,7 @@ doScopeZoom src/Dodge/Update/Scroll.hs 91;" f doSectionSize src/Dodge/DisplayInventory.hs 211;" f doSideEffects appDodge/Main.hs 125;" f doStrategyActions src/Dodge/Creature/ReaderUpdate.hs 172;" f -doTestDrawing src/Dodge/Render.hs 41;" f +doTestDrawing src/Dodge/Render.hs 42;" f doTextInputOver src/Dodge/Update/Input/Text.hs 15;" f doTextInputOverUniverse src/Dodge/Update/Input/Text.hs 12;" f doThrust src/Dodge/Projectile/Update.hs 129;" f @@ -3555,7 +3553,7 @@ getCrMoveSpeed src/Dodge/Creature/Statistics.hs 50;" f getCrsFromRooms src/Dodge/Room/Tutorial.hs 357;" f getCrsFromRooms' src/Dodge/Room/Tutorial.hs 344;" f getDebugMouseOver src/Dodge/Update.hs 374;" f -getDistortions src/Dodge/Render.hs 477;" f +getDistortions src/Dodge/Render.hs 478;" f getEdgesCrossing src/Dodge/Path.hs 37;" f getGrenadeHitEffect src/Dodge/HeldUse.hs 1264;" f getInventoryPath src/Dodge/Inventory/Path.hs 9;" f @@ -3706,7 +3704,7 @@ initWallZoning src/Dodge/Wall/Zone.hs 12;" f initialRoomTree src/Dodge/Floor.hs 24;" f initialWorld src/Dodge/Initialisation.hs 15;" f initialisePlaying src/Sound.hs 77;" f -initializeGLState src/Preload/Render.hs 263;" f +initializeGLState src/Preload/Render.hs 267;" f initializeOptionMenu src/Dodge/Menu/Option.hs 17;" f initializeOptionMenuBO src/Dodge/Menu/Option.hs 30;" f initializeTexture2D src/Framebuffer/Update.hs 205;" f @@ -4106,12 +4104,12 @@ megaBattery src/Dodge/Item/Ammo.hs 55;" f megaShellMag src/Dodge/Item/Ammo.hs 44;" f megaTinMag src/Dodge/Item/Ammo.hs 23;" f meleeHeadingMove src/Dodge/Creature/Boid.hs 295;" f -memoBoxEdgeIndices src/Shader/Poke.hs 352;" f -memoBoxSurfaces src/Shader/Poke.hs 286;" f -memoCylinderIndices src/Shader/Poke.hs 323;" f -memoFlatIndices src/Shader/Poke.hs 311;" f -memoTopPrismEdgeIndices src/Shader/Poke.hs 329;" f -memoTopPrismIndices src/Shader/Poke.hs 317;" f +memoBoxEdgeIndices src/Shader/Poke.hs 353;" f +memoBoxSurfaces src/Shader/Poke.hs 287;" f +memoCylinderIndices src/Shader/Poke.hs 324;" f +memoFlatIndices src/Shader/Poke.hs 312;" f +memoTopPrismEdgeIndices src/Shader/Poke.hs 330;" f +memoTopPrismIndices src/Shader/Poke.hs 318;" f menuLDP src/Dodge/ListDisplayParams.hs 52;" f menuOptionToSelectionItem src/Dodge/Menu/Option.hs 91;" f merge src/ListHelp.hs 83;" f @@ -4228,6 +4226,7 @@ noclipCheck src/Dodge/WallCreatureCollisions.hs 23;" f nodeFormatting src/Dodge/Combine/Graph.hs 145;" f nodesNear src/Dodge/Path.hs 75;" f normalGait src/Dodge/Creature/State/WalkCycle.hs 30;" f +normalToColor8 src/Shader/Poke.hs 467;" f normalizeAngle src/Geometry/Vector.hs 128;" f normalizeAnglePi src/Dodge/Base.hs 154;" f normalizeColor src/Color.hs 76;" f @@ -4385,10 +4384,10 @@ pointerYourSelectedItem src/Dodge/Item/Location.hs 26;" f pointsToPoly src/Geometry/ConvexPoly.hs 35;" f poisonSPic src/Dodge/Creature/Update.hs 125;" f poisonSprayer src/Dodge/Item/Held/SprayGuns.hs 17;" f -poke34 src/Shader/Poke.hs 506;" f -pokeArrayOff src/Shader/Poke.hs 517;" f -pokeBox src/Shader/Poke.hs 227;" f -pokeBoxSurface src/Shader/Poke.hs 262;" f +poke34 src/Shader/Poke.hs 505;" f +pokeArrayOff src/Shader/Poke.hs 516;" f +pokeBox src/Shader/Poke.hs 228;" f +pokeBoxSurface src/Shader/Poke.hs 263;" f pokeChasm src/Shader/Poke/Floor.hs 24;" f pokeChasmVerx src/Shader/Poke/Floor.hs 28;" f pokeCloud src/Shader/Poke/Cloud.hs 15;" f @@ -4396,28 +4395,28 @@ pokeCloudFloat src/Shader/Poke/Cloud.hs 56;" f pokeCloudIndex src/Shader/Poke/Cloud.hs 60;" f pokeCloudLike src/Shader/Poke/Cloud.hs 33;" f pokeCloudLikeVerx src/Shader/Poke/Cloud.hs 41;" f -pokeCylinder src/Shader/Poke.hs 172;" f -pokeCylinderCaps src/Shader/Poke.hs 215;" f +pokeCylinder src/Shader/Poke.hs 173;" f +pokeCylinderCaps src/Shader/Poke.hs 216;" f pokeDust src/Shader/Poke/Cloud.hs 18;" f -pokeF src/Shader/Poke.hs 67;" f -pokeFlatV src/Shader/Poke.hs 455;" f -pokeFloors src/Shader/Poke.hs 61;" f -pokeIndex src/Shader/Poke.hs 297;" f -pokeJustV src/Shader/Poke.hs 437;" f -pokeLayVerx src/Shader/Poke.hs 480;" f -pokeLayVerxs src/Shader/Poke.hs 473;" f -pokeRoundedCurve src/Shader/Poke.hs 204;" f -pokeRoundedFaces src/Shader/Poke.hs 140;" f -pokeShape src/Shader/Poke.hs 111;" f -pokeShapeObj src/Shader/Poke.hs 124;" f -pokeStride src/Shader/Poke.hs 499;" f +pokeF src/Shader/Poke.hs 68;" f +pokeFlatV src/Shader/Poke.hs 449;" f +pokeFloors src/Shader/Poke.hs 62;" f +pokeIndex src/Shader/Poke.hs 298;" f +pokeJustV src/Shader/Poke.hs 438;" f +pokeLayVerx src/Shader/Poke.hs 479;" f +pokeLayVerxs src/Shader/Poke.hs 472;" f +pokeRoundedCurve src/Shader/Poke.hs 205;" f +pokeRoundedFaces src/Shader/Poke.hs 141;" f +pokeShape src/Shader/Poke.hs 112;" f +pokeShapeObj src/Shader/Poke.hs 125;" f +pokeStride src/Shader/Poke.hs 498;" f pokeTile src/Shader/Poke/Floor.hs 12;" f pokeTileVerx src/Shader/Poke/Floor.hs 18;" f -pokeVerx src/Shader/Poke.hs 38;" f -pokeVerxs src/Shader/Poke.hs 31;" f -pokeW src/Shader/Poke.hs 89;" f -pokeWall src/Shader/Poke.hs 78;" f -pokeWallsWindows src/Shader/Poke.hs 50;" f +pokeVerx src/Shader/Poke.hs 39;" f +pokeVerxs src/Shader/Poke.hs 32;" f +pokeW src/Shader/Poke.hs 90;" f +pokeWall src/Shader/Poke.hs 79;" f +pokeWallsWindows src/Shader/Poke.hs 51;" f poly3 src/Picture/Base.hs 84;" f poly3Col src/Picture/Base.hs 88;" f polyChasm src/Dodge/Room/Tutorial.hs 192;" f @@ -4454,7 +4453,7 @@ powlistUpToN' src/Multiset.hs 12;" f powlistUpToN'' src/Multiset.hs 31;" f preCritStart src/Dodge/Room/Start.hs 83;" f prePos src/Quaternion.hs 64;" f -preloadRender src/Preload/Render.hs 30;" f +preloadRender src/Preload/Render.hs 31;" f premapMaybe src/FoldlHelp.hs 26;" f prependTwo src/Geometry.hs 177;" f prettyDT src/Dodge/DoubleTree.hs 258;" f @@ -4821,7 +4820,7 @@ setTiles src/Dodge/Layout.hs 67;" f setTreeInts src/Dodge/Room/Tutorial.hs 98;" f setViewDistance src/Dodge/Update/Camera.hs 239;" f setViewPos src/Dodge/Creature/ReaderUpdate.hs 69;" f -setViewport src/Dodge/Render.hs 482;" f +setViewport src/Dodge/Render.hs 483;" f setVol src/Dodge/Config.hs 47;" f setWristShieldPos src/Dodge/Equipment.hs 49;" f setWristShieldPos src/Dodge/Euse.hs 38;" f @@ -4846,8 +4845,7 @@ shadVBOptr src/Shader.hs 40;" f shaderTypeExt src/Shader/Compile.hs 176;" f shapeBounds src/Dodge/Room/Foreground.hs 147;" f shapePoints src/Dodge/Room/Foreground.hs 144;" f -shapeVerxAttributes src/Shape/Parameters.hs 14;" f -shapeVerxSize src/Shape/Parameters.hs 11;" f +shapeVerxSize src/Shape/Parameters.hs 6;" f shatterGun src/Dodge/Item/Held/Weapons.hs 8;" f shatterGunSPic src/Dodge/Item/Draw/SPic.hs 312;" f shellExplosionCheck src/Dodge/Projectile/Update.hs 50;" f @@ -5174,8 +5172,8 @@ tone440raiseS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 664;" f tone440sawtoothS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 606;" f tone440sawtoothquietS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 448;" f topInvW src/Dodge/ListDisplayParams.hs 49;" f -topPrismEdgeIndices src/Shader/Poke.hs 335;" f -topPrismIndices src/Shader/Poke.hs 410;" f +topPrismEdgeIndices src/Shader/Poke.hs 336;" f +topPrismIndices src/Shader/Poke.hs 411;" f topTestPart src/Dodge/TestString.hs 44;" f torchShape src/Dodge/Item/Draw/SPic.hs 276;" f torqueAmount src/Dodge/HeldUse.hs 581;" f