#programming
1 messages · Page 168 of 1
it also astounded me how many people said that quicksort had a worse space complexity than merge sort, considering quicksort can be done in-place and merge sort cant

but merge is the only operation that would require a separate buffer and merge is easy to do in place
(i am trustworthy and never make things up based on gut feeling)
okay maybe not
hmm
to do it efficiently you typically need an auxillary array thats the same size as the input array
you can it without it if you want to sacrifice some hidden constants
i think typically rotation
but im not super versed in merge sort
The space overhead can be reduced to O(√n) by using binary searches and rotations
no algorithms
i dont want to think about them because i'll soon have to implement so many incremental data structures

its O(n) by default so sqrt is a good improvement
n/2 is even easier
if you consider stack frames its worse though
since merge sort is a recursive algorithm
you dont have to do that
you can just for (int i = 1; i < n; i *= 2) (roughly)
do i just study java instead of python for my python passage exam cuz i am stupid at python
though actually, i think tail call is applicable
god damn back rooms of the sea
just start from chunks of size 1 and go up instead of starting top down
merge each 2 consecutive chunks using the same merge function
i dont think its possible to do quicksort without stack frames
or at least the standard algorithm
and i think its the same with merge sort using its conventional algorithm
probably true


rep stosberf

neurm
just because you can doesn't mean you should 
i guess if you can't afford that little bit of temporary storage 
parallel quicksort is better than normal quicksort
if you do it in multiple processes you get more stack from the OS 
I still don't know who made this gif and why

Part of that could have been how neuro always used to say that she is insanely tall
rotate rotate
and tall people usually play basketball
so that might have lead to that train of thought
thats the only idea i have
i have finite free will in accordance with the laws of physics
its me on the gif
i only just noticed

my hdr sdr toggle switch now works 
it puts the dispalys in the wrong order tho, but i cant be bothered to fix that
ill just reorder my dp inputs
I was asking because I was curious if it was possible to make a audio file small enough to fit into the 4KB storage of this Nokia-esque phone (G8). I trimmed and re-encoded an existing audio file to 48kb/s CBR using a simple audio trimmer app but those files were still too big. What could I use instead to make a specialized mp3 audio file that could be stored and played on something like this?
does the phone have an sd card slot
the audio data is the big part. lower your bitrate.
It does but I wanted to see if it's possible to fit it onto the phones internal memory instead and also because I don't have a sd card on hand right now
just use an sd card
the internal storage on phones like that is not made for storing video/audio/images
my screenshots have proper colour now 
Guess that's the only reasonable way since even if I somehow get a audio file that small, it would just sound like noise when played. I was thinking about it theoretically but that's still kindof pointless anyway
only took a small amount of vibe-coding 
i dont know bash, and i wasnt interested in learning it
huh
disabling hdr makes my youtube need to reload the page
anyways, look at my red circle
"circle"
circle's in computer graphics are a social construct
nothing is round
the cake is a lie
Since you're a Linux user it would be very useful to know
based

hi shadow
i bought my audio equipment
well, part of it
i got a Denon AVR-X6200W for 450 bucks
do you aprove as my local audio guy?
shadow came by to comment "based" and then died 
what is wrong in my godot script"func _unhandled_input(event: InputEvent) -> void:
if event is InputEventMouseButton:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
elif event.is_action_pressed("ui_cancel"):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
if Input.get_mouse_mode() = Input.MOUSE_MODE_CAPTURED:
if event is InputEventMouseMotion:
neck.rotate_y(-event.relative.x*0.01)
camera.rotate_x(-event.relative.y*0.01)
camera.rotation.x=clamp(camera.rotation.x,deg2rad(-30),deg2rad(60))" give me idias why it 's not working
the error message probably knows more than we do
and use proper code boxes please
type 3 of these ` before and after the code block
it sais it's in "input.get_mouse_mode()=input.MOUSE_MODE_captured:
uh
lemme just
func _unhandled_input(event: InputEvent) -> void:
if event is InputEventMouseButton:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
elif event.is_action_pressed("ui_cancel"):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
if Input.get_mouse_mode() = Input.MOUSE_MODE_CAPTURED:
if event is InputEventMouseMotion:
neck.rotate_y(-event.relative.x*0.01)
camera.rotate_x(-event.relative.y*0.01)
camera.rotation.x=clamp(camera.rotation.x,deg2rad(-30),deg2rad(60))
does this look right?
please use proper formating or nobody is able to read it
okay
= is an assignment operator, for comparison you would use ==
if Input.get_mouse_mode() = Input.MOUSE_MODE_CAPTURED:
needs to be
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
i think thats the issue at least
also, you set Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) meaning the Input.get_mouse_mode() will no longer be MOUSE_MODE_CAPTURED, so the inner if will never run im pretty sure
thanks man
unless i did the indentation wrong
it worked in the engine

@tender river managed to the vm up to 4gb/s throughput
so on the cheating test now 80% of c throughput
on single char it's 230 MiB/s
which is a lot worse than c 
yuh i made it use fuel a while ago
awawa
can you test it ples 
aaa i forgot to clang-format
$str := "a"
main := fn(): never loop @ecall(0, str.ptr, str.len)
all you need to do is
nix-shell
# make main.hb
hbc --optimizations release>bin.axe
result/bin/hbvm_c | pv>/dev/null
slowge
interesting performance regression
why so many stalled cycles
erf its faster on stdout but slower on fib

probably google's benchmark library
Maybe there's better ones now idk it's been a while since I've had to do this 
I end up just compiling multiple versions and using hyperfine or poop (yes I know
)
Out of interest, what's your perf record call?
Been benchmarking stuff recently and there's so much stuff to configure
Oh nevermind that's stat, didn't notice haha
Can recommend using record, followed by samply import 
The Firefox profiler is perfect for comparing the results
wahoo
the fluctuations are too high to say anything conclusive
and this doesnt help 
is it showing the total speed
or just the recent speed
wait i know
last time it was 8.77
now its 9.36
both were in a minute
so its faster
its funny because this change made the fib slower again
bwabwabwa
only by a tiny amount but i sad
experience this beautiful code
while (fuel--)
Does anyone know what kind of Neural Network Evil and Neuro-Sama were based off of?
it was slower

oh it makes sense that writing 0 would be faster since its branchless
i think
i was already writing zero to reg 0 but
in the last commit i stopped being lazy and put it in only some of the instructions
distracted 
awawa
awawa
its a shame gcc's lto sucks so much
What language are you using?
c
ah
I don't work with c much
I was told its a little harder than C#
the only challenge of using c over c# is manual memory control
the only difference between most languages is typesystem and memory model
true
aside from that its just stdlib
You know Neuro and Evil are written on C# right?
they arent.
At the very least their APIs are
the frontend is, the backend isnt
Really? On Vedal's Github he only writes in C# Javascript and Typescript
the neuro sdk is a reference implementation
I know
the live2D models are rendered in unity with C# programming, the llm models are runnign in python
neuro sdk is for integrating games, its not part of neuro's code
I know.
we're 99.99% sure at least
if you know then you know what you have said is wrong
no need to be patronising
I'm not trying to be
Apologize
I am just saying, since he seems to have an affinity for C# he might have written her in C#
I havent had the privledge of watching his Coding streams though
neuro's code doesnt get worked on in coding streams
he doesnt actually code in the dev streams
and even if he did he wouldnt show the ai code
in a long time in the past there was some of neuro's code on stream iirc
@tender river python right?
I meant I havent seen his coding streams meaning I dont KNOW if he works in python more than C#
its a fair question i guess, but llm's in C# are basicly unheard of
Thats not true
Its uncommon but I've seen plenty
She likely is python since its easier to code in
I dont code in Python much since my college classes are required to be in C#
To be fair she's Python but at this point Python is Python + a bunch of C libraries
i mean what else would it be 
its python regardless
I know. I'm just joking
always has been. you cant do much in python without libraries
You can, it will just take 100× so nobody does, obviously
its not really a matter of being easier, its that there's no reason to not use python when all development in this space happens in python. 
if you want to, you can use torch in c# just fine. there's just no reason to.
its not faster.
Hm
Very true. And if the program is gonna be read by others you should do it in a language other comprehend. Because of that Python has turned into the language fo LLMs.
sure some stuff is possible in python without libraries, like you could skip out on numpy at do the math manually. but for stuff like graphics, audio, or numerous other things you will need at least 1 library
well, the same is true of any language
yep
if you do graphics or audio you will need to access system apis
How long have you all been programming?
more than 10 years
2-3 years if scratch doesnt ocunt
LMAO
if it does count like 12 years
scratch imo doesnt count
I'm glad we all went through Scratch...
hey my scratch programs were top tier.
the best damn code ive seen a 6 y/o make
I was recently tested on Programming knowledge and they asked questions about scratch
I havent used it since I was like 10
more than 10 years
you guys are old huh
im 18
I figured
since when is 18 old?
No not you
these damn kids
im joking
I've been programming for around 6 years
if you count scratch make it 9
I'd say 10 years, same for scratch in particular. Block programming in general it has been 12ish years. Hard to remember considering I'm 21.
common gcc L 
clang doesnt support -mstringop-strategy=rep_byte
wth is that 
i was using tail recursion
functional programmer by nature
i first started programming by copy-pasting batch scripts from youtube into notepad on windows 8 
this is the best way to write a parser though 
I started with Java making Minecraft modpacks on Notepad
i started with a terrible c graphing calculator
Lol
technically i wrote some code before 2015 when my dad showed me turbo pascal
but i didnt find it interesting at the time
turbo pascal
i was like 6yo
om
Oh that's fantastic haha
Going into middle school I started reading about scratch. But I've already used hopscotch for awhile before.
Do you all thing Neuro was built off a Recurrent Neural Network or Generative Adversarial Network
i cant find my code from 10 years ago, but i found untitled-6 from 2017 so 8 years ago.
that'd be uhhh 2015
hbvm
If we're counting childhood coding I actually don't know when it was the first time I coded... My dad is a programmer so my younger brother and I did a lot of stuff when we were younger
.c
I got an clicker game somewhere on scratch. Takes about 30 minutes before it breaks into infinity, which is honestly impressive considering my age when making it.
by da way, if you want to play with writing hbvm programs in machine code, i have a freestanding vm implementation here
most of my scratch stuff is deleted cuz it wasnt up to my high standarts, but i know it did indeed suck
it doesnt implement any of the ableos ecalls though, so you would have to write those yourself i guess
copy(vec.rbegin(), vec.rend(), ostream_iterator<int>(cout, ""));
wow
i might be stupid for asking this but what does hbvm mean..?
Sometimes I played it in HS because scratch was unblocked, maybe I also did it after graduating.
my monitors arent in the correct order
thats interesting
ill need tto debug my hdr toggle script bwaa
that is not a stupid question 
What is the script 
#!/bin/bash
MONITORS=("DP-3" "DP-2" "DP-1")
HDR_ON=false
for m in "${MONITORS[@]}"; do
FORMAT=$(hyprctl monitors | awk -v mon="$m" '$0 ~ mon {in_mon=1} in_mon && $1=="currentFormat:" {print $2; exit}')
if [[ "$FORMAT" == *1010 ]]; then
HDR_ON=true
break
fi
done
for m in "${MONITORS[@]}"; do
hyprctl keyword monitor "$m, 2560x1440@180, auto, 1, bitdepth, $([[ "$HDR_ON" == true ]] && echo 8 || echo 10), cm, $([[ "$HDR_ON" == true ]] && echo sdr || echo hdr), sdrbrightness, 1.4, vrr, 2" >/dev/null 2>&1
done
notify-send "HDR toggled" "HDR is now $([[ "$HDR_ON" == true ]] && echo "off" || echo "on")"
iuts probably that auto being a bitch
ill need to give it actuall numbers i guess
hbvm is the vm that runs hb code
@tender river
void hbvm_ecall_handler(HBVm *vm) {
auto args = vm->regs;
vm->regs[1] = syscall(args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
}
hbvm-linux
it forwards the ecalls to syscalls
that sounds like a good idea for testing hbvm codegen
aight fixed. if only everything was this easy
probably
@desert plaza this is an hbvm binary that uses the linux write syscall
0000000 15 91 d2 00 00 00 00 3c 00 00 00 00 00 00 00 02
0000010 00 00 00 00 00 00 00 3c 00 00 00 00 00 00 00 02
0000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000030 00 00 00 00 00 00 00 4e 1f fe f8 ff ff ff ff ff
0000040 ff ff 08 00 30 fe fe f8 ff ff ff ff ff ff ff 46
0000050 02 00 4b 01 01 00 00 00 00 00 00 00 4b 04 02 00
0000060 00 00 00 00 00 00 4c 03 00 0d 00 00 00 5c 53 e1
0000070 ff ff ff 61 0a 0a 00 00 00 01 00 00 00 73 00 00
0000080 00 00 00 00 00 17 00 00 00 00 00 00 00 37 00 00
0000090 00 00 00 00 00 00 6d 61 69 6e 2e 73 74 72 00 61
00000a0 0a 00 6d 61 69 6e 2e 6d 61 69 6e 00 6d 61 69 6e
00000b0 00
00000b1
erm why is pv not working
ok, pv is working but piping to devnull isnt
erm
im writing to the wrong fd
genius
blazing speed
unsurprising though
this one is c native though
so its basically equivalent
which i find interesting
95% of performance
definitely being capped by syscall here
my approach would have been:
hyprland.conf
source = monitor_a.conf
source = monitor_b.conf
source = monitor_c.conf
...
monitor_{a,b,c}_{HDR,NON_HDR}.conf
# HDR on and HDR off
monitor = ...
bash script
-# I forgor how to bash
if [[ "$HDR_ON" == true ]] then;
ln monitor_{a,b,c}.conf monitor_{a,b,c}_HDR.conf
fi
i just cant be bothered to have seperate configs per monitor
its either all on or all off hdr
I was actually thinking as I was writing this that I shouldn't even be using hyprland for this
wdym?
Probably a dumb question... But why
screenshots look like garbage with hdr on, bt i like how hdr looks.
hdr doesnt look too diffrent but the colours look nicer in my experience.
this is what happens when i try to take a screenshot
hdr on vs off
off is left btw
Thats not my question tho. Just... Why does one need a script to control monitors
I personally use a program called kanshi as hyprland struggles with hotpluging monitors, you can also CLI to switch configs as long as all of the requirements for it exist.
i need to be able to turn the hdr off for when i want to take a screenshot
I just exec-once the program in my config
im fine with hyprland for now
It's not a new window manager
Sorry am I having a stroke? Maybe I don't follow. I'm just using KDE with whatever is default on arch. And everything just works 
it doesnt work here
Oh
grim doesnt do proper hdr screenshots because of the hyprland compositor or something
so everything looks like shit
and i have mapped the pause button on my heyboard to a hdr toggle now
I don't mean to sound mean, but why use that then
hdr just looks nicer imo
Nono, the hyprland thing
https://sr.ht/~emersion/kanshi/ @olive sable
sunk cost fallacy
Oh, respectable. Have a nice day.
While hyprland is bound to the config at all times, this can switch between all defined modes
kanshi allows you to define output profiles that are automatically enabled and disabled on hotplug. ye i dont really need that on my desktop. this would be nice for my laptop tho
pushed, maybe go wild or something idunoo


You can manually call profiles from the command line as long as it matches
so one HDR profile one non HDR one and just call them
hmmm
i mean what i have now works and i dont have any dependancies
ill keep it like this for now
Understandable have a nice day
fucking around with hyprland hdr has drained me to the point where i just dont want to risk breakign it again
i have succesfully moved the vertexbuffer into vram 
this is all a bunch of small things that dont make a visual diffrence rn cuz ram was fast enough for 12 vertices, but it does need to happen
Got a question for anyone here who might be more knowledgeable about batteries than yours truly
Is the 20-80% rule actually worth bothering to stick to?
i think so.
like it doesnt make that much of a diffrence, but over thousands of charges it adds up
At that point, aren't you just pretending your battery is degraded from the start to stop it degrading though?
I mean you're running at 60% capacity when a thousand cycles only brings you down to 80
In my case anyway
not really, since it isnt degraded that 60% lasts a decent while
Surely it only lasts as long as a degraded 60% though?
and ill still charge it to 100% if i have a long day ahead of me
but for casual use i dont need the full 100
That was a voice typing fail if you were wondering
i dont have a side-by-side comaprison
Well wouldn't 60% degraded capacity 0 to 100 more or less be 60% 20 to 80 on a full capacity battery?
from my perspective, noboy is forcing you to keep adhering to the 20-80 thing all the time. if you really need the 100% then the battery will be less degraded and the 100% will last longer than if you let it degrade beforehand
I guess so yeah
all in all it probably doesnt make that much of a diffrence unless the phone is 6 years old
there is llm ||wrapping|| stuff in like every language
the oldest file I can think to look for is dated last modified jan 2017, but I'm pretty sure thats the date I copied it over to my new windows laptop from my old iMac
i see
pretty sure I was writing shit back in 2015, but it was script-based 3D modeling rather than programming apps
god knows when I took that java course, but it was probably sometime around 2016
it's always either py/libtorch, tensorflow, llama-cpp or any of the countless onnx runtimes
I bet M$ is mad af about it too because they sunk so much time into ML.NET
and they were super ahead of the curve too
odds are python won over something better like C++ or C# because data engineers don't want to spend time learning a proper language

I think the creator of mojo said that he started off by trying to create a better AI framework in rust but nobody would fucking use it, so he conceeded and made mojo which borrows python syntax
python isnt a bad language for something that isnt cpu bound. but think about the hours of wasted compute time all toghether
yeah
its better now with pypy JIT too
but its just crazy to me that people defended python as AI glue back then before we had pypy JIT
i made an index buffer 
it turns out that if you have the code to make one buffer you dont need to change much to make a couple diffrent ones

I want to make my rendering code use the GPU instead of the CPU but I despise doing all the verbose setup bullshit
I'm pretty sure my entire architecture is incompatible with it and I have to rewrite basically everything from scratch

i think it's just that python happened to be the best combo of a good scripting lang, mature ecosystem, high-levelness and general disregard to perf because 99% of the spent compute you're wrapping native code anyway. lua was another good fit (as we can confirm by torch originally being a lua lib) but i suppose the ecosystem was meh, besides, python already was basically the most popular out of this category of langs
if verbose is an issue then vulkan isnt an option ye, but i doubt you would have gone the vulkn route anyways
opengl isnt too bad imo
im using opengl through skiasharp
and even that is super verbose and virtually undocumented
i see skia 
opengl through skiasharp
what does this even mean, why do you need opengl when you have skia already
skia itself is CPU only
that's just not true and can't be
GPU support is kindof built on top of skia
you need to create a GPU surface specific to whatever API you want (opengl, vulkan, metal) and then it overrides certain draw calls
I mean, flutter is kinda like a game engine under the hood
its a lot closer to a game engine than traditional UI frameworks
it is in big part because it uses skia
instead of wrapping native ui
sam typing up a storm
opengl isnt too bad imo. id consider it pretty light actually.
you just gotta do some
SDL_Init(SDL_INIT_VIDEO)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
glewInit()
SDL_GL_SetSwapInterval(swapInterval)
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glFrontFace(GL_CCW);
glViewport(0, 0, screenWidth, screenHeight);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
and boom you have your context.
then to get objects on screen you jsut do some
//init:
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, bufferView.byteLength, buffer.data() + bufferView.byteOffset, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, vecSize, type, GL_FALSE, vecSize*4, (void*)0);
//drawing
glDrawArray(mesh.count, mesh.indexType, (void*)0)
like it looks complicated. and i left out some details. but it really isnt
see, I lose half of those APIs through skia
which is nice that I don't have to setup the viewport and whatnot, but its annoying because I have to create, manually bind, and maintain each individual buffer as an individual IDisposable
i mean, settignup the viewport is literally 1 command here
and ussualy you can leave it out
also my code is for rendering text and 2D textures
its jsut better to make sure it gets done since i dev for multiple platforms
you'l need to do TTF_Init() too then i guess and do some of that stuff
i haven tried that myself tho, i just include it already
also I would rather not raw dog opengl because I don't want to write my own font handling and text drawing
thats fair
I'm just complaining instead of actually doing it
here lemme show you what Im working with
the rendering code takes so many shortcuts because it was originally written for CPU
opengl is like
-init the window
-set versions
-init opengl
-set some settings
-make your buffers
-bind your buffers
-draw
its essentiely jsut those things you need to do
you have like 30 diffrent "draw xyz functions" 
The age old question of MBR or GPT I'd have to see what the pros and cons are
ik
but most of them boil down to DrawText
the main issue is how frame disposal is handled and how AddImageSection is handled
i still don't understand what for exactly you need raw opengl...
we create and throw away so many buffers
when you're in skia
omg
since its 2D i was expecting just a function with a text input and positiondata that would have jsut been reussed
is it not the exact same api regardless if you use gpu or cpu
using the GPU adds a ton of stuff you need to do before you draw and after you draw
also you can't just create and throw away buffers the way we do atm on GPU
if it were me i would have just done raw opengl, but i guess thatds unfair of me to say since im used to doing that
I promise I've spent several hours looking into this already
at least that's just code you add
using var bm = new SKBitmap(width, height, pixformat); creates a CPU buffer, and theres no way around that
and we use that everywhere
really? ive never done that 
all i do is just set a uniform buffer or 2. there is no aftercare needed
to create a GPU buffer I need to pass the GPU context around, then using that I need to create a GPU surface with a specific opengl index, and some other stuff
keeping track of indices is kind of my main issue, as well as the fact that the rendering is as forward as you could possible make it
ive never used "gpu surfaces" 
GPU surfaces are the only thing exposed in skia
huh
I don't perform any text measuring at all before allocating; I alloc a new row of pixels when I run out of room
which isn't compatible with GPU because that needs to know the size of the buffer
ussualy for 2D. i would just set the position with a uniform buffer, and then bind a texture, and then draw
you can even reusee the same shaders
its annoying, but its also the right way to do it and will also increase performance by reducing the amount of data copies
what are you doing where you need to grow your buffers?
.
are your buffers not the size of the window?
im not rendering to a window
huh
well, i guess if it works it works
its horrible
its jsut far from what i would do
its slow
but it works
its far from what I would do too
I didn't write the original rendering code, I've just been fixing it up slowly over the last 3 years
but now its at the point where I need to rewrite it for GPU support
3 years
Here's what it looked like before I first touched it https://github.com/lay295/TwitchDownloader/blob/20b38b350760f267547179f084832dba94181428/TwitchDownloaderCore/ChatRenderer.cs

its a little not amazing
well, goodluck
i woudnt be able to do it, the skia gpu stuff sounds like actual garbage
so you say
also I would rather not raw dog opengl because I don't want to write my own font handling and text drawing
you can just use a library for that im pretty sure
altho i havent used ones for C#
Learn OpenGL . com provides good and clear modern 3.3+ OpenGL tutorials with clear examples. A great resource to learn modern OpenGL aimed at beginners.
you need to bundle the fonts you want?
depends on the library ye
yeah people would be super mad if I removed system font support
and my ass is not doing it myself
my NIHS stops at implementing low level rendering functions
good lord, I am not loading each glyph individually
ye the sdl one is better impretty sure
//this opens a font style and sets a size
TTF_Font* Sans = TTF_OpenFont("Sans.ttf", 24);
// this is the color in rgb format,
// maxing out all would give you the color white,
// and it will be your text's color
SDL_Color White = {255, 255, 255};
// as TTF_RenderText_Solid could only be used on
// SDL_Surface then you have to create the surface first
SDL_Surface* surfaceMessage =
TTF_RenderText_Solid(Sans, "put your text here", White);
// now you can convert it into a texture
SDL_Texture* Message = SDL_CreateTextureFromSurface(renderer, surfaceMessage);
SDL_Rect Message_rect; //create a rect
Message_rect.x = 0; //controls the rect's x coordinate
Message_rect.y = 0; // controls the rect's y coordinte
Message_rect.w = 100; // controls the width of the rect
Message_rect.h = 100; // controls the height of the rect
// (0,0) is on the top left of the window/screen,
// think a rect as the text's box,
// that way it would be very simple to understand
// Now since it's a texture, you have to put RenderCopy
// in your game loop area, the area where the whole code executes
// you put the renderer's name first, the Message,
// the crop size (you can ignore this if you don't want
// to dabble with cropping), and the rect which is the size
// and coordinate of your texture
SDL_RenderCopy(renderer, Message, NULL, &Message_rect);
// Don't forget to free your surface and texture
SDL_FreeSurface(surfaceMessage);
SDL_DestroyTexture(Message);
it does mean you need to convert an sdl surface into a opengl texture
idk, sdl2 is being phased out i guess
honestly, this API looks harder to work with than skiasharp
especially considering that I need to keep harfbuzzsharp around
which means I would need to render each individiual glyph to an sdl surface
they have a function for that apprently
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, surf);
and then you can directly binf the output
void SDL_BindTexture(SDL_Texture *t)
{
glBindTexture(GL_TEXTURE_2D, t->id);
}
I think they expect you to use the glyph APIs the same way the opengl tutorial wanted you to use freetype fonts
fair. sdl can be a but annoying at times. its jsut cuz i know how it works that it looks easier to me
nah sdl can do a full block of text at the same time
I'm 95% sure it doesn't do shaping though
no shaping = no arabic, hebrew, hindi, etc.
So much lingo I'm never gonna understand
I hate it here
I miss when I didn't know about text shaping
however, text shaping is also really nice because it lets me break the text at individual glyphs instead of just guessing where to break
sometyhing like this should work
//this opens a font style and sets a size
TTF_Font* Sans = TTF_OpenFont("Sans.ttf", 24);
SDL_Color White = {255, 255, 255};
SDL_Surface* surfaceMessage = TTF_RenderText_Solid(Sans, "put your text here", White);
SDL_Texture* Message = SDL_CreateTextureFromSurface(renderer, surfaceMessage);
glBindTexture(GL_TEXTURE_2D, Message->id)
SDL_DestroyTexture(Message);
havent done any testing tho so idk
it'll work for any non-shaped text
its a really annoying problem
you need a shaping library like harfbuzz or whatever the windows kernel provides
It can draw Unicode characters just fine (so Arabic, Hebrew, Hindi codepoints will render if the font supports them), but it will not do the script-specific shaping, ligatures, or bidirectional reordering you need for those writing systems.
and I'm pretty pretty sure SDL3_ttf doesn't use harfbuzz under the hood
yeah
no shaping is basically unreadable to them
I appreciate you looking into this for me though
hey wait what
i forgor to commit
sounds like you have to opt into harfbuzz
god, you have to init harfbuzz properties for each individual font you load
here's an example i generated. it probably works maybe
119 lines. not the absolute worst but not great
that might work idk
ye idk either, i dont have these libraries installed
this function is getting insanely long 
commandManager.init(deviceManager.device, deviceManager.indices, frameManager.swapChainImages.size(), frameManager.swapChainFramebuffers, frameManager.swapChainExtent, frameManager.graphicsPipeline, frameManager.renderPass, vertexBuffer, indexBuffer, indices.size());
i should put this in a struct and just pass that
i have a couple diffrent managers, and i guess the main.cpp would count as the manager manager then 
seems fine
there are 10
hmmm
I just realized the folder for Visual Studio Code is "Microsoft VS Code"
i cant tell if that is a good or a bad idea
that is the top 10 programming joke in my life

make it an extra constructor that takes the managers and calls this function
isnt that just moving the problem around?
it seems that valorant isnt gifting bonus subs this subtember? lucky me, I don't have to implement that in my renderer
he wants to improve readability

you think this is because of vedal breaking the hype train record lol
struct would not work well as it would require code reader referencing
this is c++ with vulkan, that ship has long sailed 
just be like the ML libraries for some reason and take like 30 params
bruh
i have renamed the repo to just "vulkan" because i have published a branch that dosnt have terrible code
i hope this doesnt break quacks bot tho

templates 
c++
make it as ambiguous as possible


this i swhat i have rn
https://github.com/samvanmaele/vulkan/tree/useful_stuff
This branch is 2 commits ahead of, 63 commits behind main. 
damn he really just nuked the whole history
the triangle is so fast because it completely ignores every single rule of race conditions and good code practices
thats why i cant use any of it besides the early improvements
i mean, it still does 13K fps, just not 47K like the triangle
🔺 
Microsoft is losing against the code

gnome 3 stability is much better than it used to be 
it doesnt randomly crash every 2 seconds anymore

vvvvvvvvvvvvv


hi chat, which do you prefer
the indentation is identical between the two
not the relevant part of the code
fair
I coded a macro in python to automatically screenshot my pc when it detects brainrot words on the screen, so it can start shaming how much braincells i lost
first but remove the first if and replace the end with FromResult(IsConnected)
I can do something like this to remedy that part
a switch on a boolean is just an if
thats what an if is

but i suppose c# ifs arent expressions
I didnt even notice that
aside from that, simplicity is the most important factor when you are working in such a high level language
no matter what you write its going to perform the same
so just write the simplest version
it can be argued that pattern match is as simple as the direct version
the person arguing that would be wrong
I was just entertaining the switch expression that my IDE really wanted me to use
reading program downwards is the correct way to read a program
reading to the side is mental overhead
I preferred 1 as well, but I was curious if anyone here thought different
especially the rust devs
pattern matches are also read downwards 
disagree i like using less lines of code
[C89 devs didn't like that]
lmao
fuck arrows
wrong, pattern match is read downwards and then in the => direction
arrows
not one but three
Too simple for a switch imo. ifs work just fine

⬆️
wrong reply
a pattern match is only useful when there is a pattern to match
I think there's some truth to this, but I don't agree that you should always prefer down instead of right
personally prefer chain of ifs
well, i disagree with your disagreeing
use a function
arrows just makes shit confusing
I have a few functions
i blame c# for not having ifs be expressions
unless super super needed
wdym by that
an expression is something that evaluates to a value
whats an "expression" to you
a ? b : c is an expression
C# has that
if (a) { b } else { c } is a statement
mhm but its not as nice to read
ternaries have their place
only way you arent gonna read to the side is assembly code
expression trees are normal

this is like saying its not possible to completely remove the cancer so we shouldnt even try 
no, i dont think you need statements at all 
there's a reason most style guides specify a maximum line length
its because long lines are unreadable
line length is a separate concern
there's a reason most style guides specify a maximum line length
thats what I was talking about btw
I mean, I could write C# with 1 indentation max if I use goto

because I needed the goto
hang on
and I didn't want to use a label
and now that I'm looking at it again, I think this code might actually throw an exception because the content might only be valid for a single read?
I don't actually know

shorter vertical space gives you better overview of what your code does as long as you're able to mentally parse it
turns out it literally is not valid with a traditional goto
I don't see a better way
of course if you collapse to much into a single line it wont be easy to read (except for some cases where there isnt too much nesting)
yuri posting on main, we dont see that here very often
you could just make a boolean shouldThrottle and do a second if 
its not like its gonna be slower
Hay there, just wondering dose anybody know of a good way to learn code, I know theory of code but never picked up on it (originally VB) i don't really care what language just not MF
boolean control flow 
still better than using a switch for its default label so you can goto it
shouldBreak = true;
if shouldBreak { break; }
Type thing
I hate that
readable and understandable
no
there are no problems with the above control flow
labels are better than booleans because they are harder to get wrong
when you're trying to achieve the same goal, anyway
booleans are better than labels because they are more explicit with intention and easier to read 
in this case, I disagree with both points
they are an adhoc solution
in this case its a very clear improvement over having a whole switch 
not really?
its just an if
semantically
ifs are easier than mangling control flow to conformance with booleans
I don't think its worth adding the mental complexity of a boolean just to reduce the indentation by 1 and change the keyword
^
I used to have more gotos in this project but I've since replaced them with saner alternatives
but this is a case where I think goto reduces complexity significantly
the best solution isnt one that uses the simplest concepts but one thats the hardest to get wrong as long as you perfectly know the concepts involved
and if that isn't the case, use go

I assume this is what konii was saying was her preferred alternative?
yuh something like this
in the context of the screenshot its not that much harder to read
but when you add the extra code around it, the context melds into the other surrounding statements
i dislike this version since it's easier to scan code for gotos and labels than for boolean reads/writes
it just obscures the control flow
even with double-spacing between each statement, its still harder to parse imo
but I think I've also lost konii on the fact that I have some lines longer than 80 cols
my router code 
yeah thats fine to me
exactly, long lines can be fine or not fine, it depends on the context
reading long lines is something you can better at, anyway
aight imma try to make uniform buffers. this should make it possible to do animated shaders 
The only case I'll disagree with is when it wraps on an ultrawide monitor
disable soft wrap and you won't have that issue anymore 
like this is horrible
yup
but I'm not touching it because I'm in the process of rewriting this file on another branch
i have ones 300 long 

this sucks too and its also punched down in the rewrite branch
you dont want to know how long this line is
4pt font
what in the fuck are you doing that needs sucha long line of code?
Emojis
regex

emojis were invented by the devil 
checks out
also I wish C# had an stdlib function for detecting emojis that didnt need a regex
I dont wannt do the research to figure it out myself
does c# not have a unicode char class database somewhere
it does for some categories, but emojis is not one of them
also I wish C# had a no-alloc unicode enumerator
we have TextElementEnumerator but it allocates a new string on the heap every time it advances with no option to reuse a buffer
i was satisfied in a similar way pulling a large repo i had but havent touched in liek 2 months
it's so broken from dependencies that i didn't include because previously me went surely i'll just be working on this continuously forever, no need for a container or anything, and surely ill be on windows forever (i am no longer on windows)
i am no longer satisfied
exiv2 patch broke KDE's wallpaper picker nice
glad i ran pacman -Syu out of habit and now cannot open wallpapers
ayy running sudo downgrade exiv2 and then picking version 0.28.5 1 then rebooting did fix it
so if any of y'all are using KDE and suddenly can't open the wallpaper picker and updating today, do that and it'll fix it
It's a meme, make of it what you will
hm
Torvalds in 2k25
never heard of this windows version
Strong words, but that's not new
At times it's rather refreshing to read something so candid

alright i killed it
supposedly le smart bulb
literally wh omegalul
hi! im trying to learn C so i wanna ask questions
is this how typedef struct works?
Also i mistook %d for double/float so pls ignore that
you dont need the first Point
its needed because it uses struct Point* in its own body
but also please use virtual functions for something like that 
that typedef struct example is generated by GPT so that i get the general idea of it
you just need to define struct Point; above and then you dont need struct Point* at all, just Point*
but is typedef struct like
typedef struct Name {
// <assign data types and vars here>
}```
?
not true
or do i not need typedef
better example
you do need typedef, but only if you want to use A instead of struct A
before you have defined the typedef, you will have to use struct A regardless
well... i do want multiple variables in a
X.Y kinda way
this is valid C
its global right?
(you dont even need the last line)
it worked for me
also i thought of something silly
either that or im forgetting a detail
nop, typedef <type> name
what does typedef do again?
defines a type
soo typedef double is valid?
if so, what for other than struct?
struct name {}
is a type
struct {}
is also a type
typedef uint8_t u8
typedef struct <name1> { ... } <name2>
name 1 - the name when used like struct <name1> *ptr = NULL;
name 2 - the name when used like <name2> *ptr = NULL;
name 1 can be omitted
i honestly dont know but this looks like java
c23 errors on that too 
no
what languages do you know
sorry, didnt include #include <stdio.h> on the screenshot 🥀
okay maybe not much
it has curly brackets
its C
oh yes
similarity end there
its fine dw
javascript, some python, c#, java, windows batch script file
typedef is like using in C#
ew python
wait does C# have that kind of using
i dont want to be forced to learn python anymore
buuut i have a py passage exam on semptember 15
it does
typedef PC.MyCompany.Project Project; in C syntax
by the way <type> (*name)(<args>) is a function pointer type
its not advised to put this inside of your structs
if you are using c++ use virtual functions or something
if you're using C++ don't use typedefs at all
aight lemme go thru w3schools for a bit
use using and plain struct definitions without typedef
using i64 = int64_t;
struct A { int a; int b; };
C++
I have done a stupid.
The needed materials for my college course said a drawing tablet, but they meant one without the android to use on a pc 
I bought the pen for my tablet with android without the pc
if you are just using c, make it a plain function outside the struct:
typedef struct Point {
double x;
double y;
} Point;
void point_display(Point *point) {}
double point_distance_from_origin(Point *point) {}
im good with c++
im aiming for lightweight and more control i think
alr
the reason you have to name it as point_display and not just display is that there are no modules in c
if you #include "point.h" its going to add display as a function, not point.display or something, if you name the function display
i dont recommend using c unless you have a particular reason to 
c++ is probably a better choice if you want to stick closer to typical object oriented programming
but C is quite faster no? 
no
no

welp
From what I know C and C++ and Rust are all equal in speed
no, speed depends on the code you write not on the language (as long as you're using a systems' language)
in 90% of cases the language you use doesnt matter
anyways my other usage? it does a screenshot and i can overlay the screenshot and do whatever the fuck i want from there
as long as it compiles to machine code it will be approximately the same speed
you know c++ is fast but absolute shit syntax
At least in languages that are compiled to native, sure
its a visual thing so i can learn C / C++ more
if its for learning probably use c
just because its further from c#
om
Konii you're an osu player, what drawing tablets (for pc) are good for drawing?
idk ab c# atp
umm
osu! tablets are usually not as good for drawing
c# made me rely on a dll 🥀
wacom ctl 472 is cheap
you'll have to do your own research
i use it for drawing too
use language the best for your job market
xp pen deco 01 is also good for drawing and quite a bit larger
cheaper as well
my college is making me learn Java, C#, and MySQL
i can only really recommend those two since ive only used those ones

i have an xp-pen g640 and i can confirm it's a tablet
I mean, java/c# maybe not cool kids things, but being corpo coder is a comfy life, maybe boring(Java coder here)
i heard its competitive in the CS space
java enterprise devs are the most common devs
my technical school making me learn react php java python
react and MySQL
its competitive everywhere but in CS its worse

REACT LMAOOOOOOO 😭
react is common
and its not college
im going for Bachelor in Information Technology
idk if that changes anything
AND PHP
php still has uses
FUCKING PHP
XD
theres a lot of php jobs
too many
can i be honest with you?
ye
most code is legacy code
if i tell you about technical schools you would cry

go ahead
react is good
web technologies 
so you see i didnt go to high school
yeah but i heard its laggy when not used correctly
mhm
so is any language
that's like saying you die when you are killed
and thats why you learn using it


i went to a school that replaced history physics chemistry with programming
so bassicly
they taught me the same thing you learned at early age
https://www.youtube.com/watch?v=wOHqwYtZ_90&pp=ygUKcmVhY3QgdGhlbw%3D%3D
https://www.youtube.com/watch?v=HBpOzj-iBUg&pp=ygUKcmVhY3QgdGhlbw%3D%3D
I always love breaking down these "react sucks" articles. There is some genuine good in here, but oh boy is it also so so wrong...
Thank you Augment Code for sponsoring! Check them out at: https://soydev.link/augment
"CTOs are secretly moving away from React". I knew I had to talk about this one. There's a lot of good info here, but also a ton of nuance missing and frankly a lot of these company's moves seem misinformed.
Thank you Infinite Red for sponsoring! Check them out at: https://soydev.link/infinitered
SOURCE
https://javascript.plainenglish.io/why-...
this guy



