Homebrew How does stride work in GPU_SetAttributeBuffers?

cal64

Well-Known Member
OP
Newcomer
Joined
Oct 31, 2016
Messages
65
Trophies
0
Age
30
XP
436
Country
France
Alright, I'm sorry, last technical question:
How does one adjust the "Stride" setting in the above-mentionned function from ctrulib? It's not a direct argument that one can feed to the function, and it seems to rely on the values of the attributeFormats and the bufferPermutations arguments.

Thanks for reading, any help is very appreciated! (Sorry for my potentially broken english!)
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,033
Country
United States
Alright, I'm sorry, last technical question:
How does one adjust the "Stride" setting in the above-mentionned function from ctrulib? It's not a direct argument that one can feed to the function, and it seems to rely on the values of the attributeFormats and the bufferPermutations arguments.

Thanks for reading, any help is very appreciated! (Sorry for my potentially broken english!)
Its complicated - beyond the scope of a forum reply. The simplest answer is that data elements must be tightly packed. There are padding elements that you can use but it is probably best to avoid them given the limited amount of memory. Most libraries like citro take care of the stride for you - take a look at the source.
 

cal64

Well-Known Member
OP
Newcomer
Joined
Oct 31, 2016
Messages
65
Trophies
0
Age
30
XP
436
Country
France
Isn't there any documentation on how it's implemented in the GPU?
Thanks for helping by the way!
 

cal64

Well-Known Member
OP
Newcomer
Joined
Oct 31, 2016
Messages
65
Trophies
0
Age
30
XP
436
Country
France
Alright, @elhobbs , really sorry to bother you again, but I promise this should be the last time. So, from my understanding by looking at the citro3d source, there is only one stride setting per buffer. Is that correct? Also could you maybe (if thats not too annoying) explain what permutations are? And finally, by looking at the portal3ds source, I got that when drawing from md2 files, smea would use 3 buffers because of the layout of the models in memory? Is that it too?

Oh also once it is processed by ctrulib in which register is stride set? Is it in GPU_ATTRIBBUFFERi_CONFIG1/2?

This should be it (sorry that's like 4 questions in one post), thanks for your help so far, I understand I must sound quite annoying with this, but really you've been extremely helpful so far, I can't thank you enough!
 
Last edited by cal64,

Hayleia

Well-Known Member
Member
Joined
Feb 26, 2015
Messages
1,485
Trophies
0
XP
1,294
Country
France
Last time I had to deal with strides (that was not with citro3d but I expect it works the same here), here is what it meant.

You want to render shit. Your stuff is described with attributes. You know, a triangle is 3 points, 1 point is 3 coordinates and maybe a color or texture coordinates or both.
See that "maybe"? Here's the problem.

The rasterizer knows the buffer describing your triangles will be in the form "triangle;triangle;triangle;...", so "point;point;point;point;point;point;point;point;point;...".
But it doesn't know if it will be in the form "X,Y,Z,color;X,Y,Z,color;X,Y,Z,color;..." or "X,Y,Z,texX,texY;X,Y,Z,texX,texY;X,Y,Z,texX,texY;..." or whatever.
Well the stride specifies the size of a "X,Y,Z,color" or "X,Y,Z,texX,texY;" group, so that the rasterizer knows where the next element is.
 

cal64

Well-Known Member
OP
Newcomer
Joined
Oct 31, 2016
Messages
65
Trophies
0
Age
30
XP
436
Country
France
Last time I had to deal with strides (that was not with citro3d but I expect it works the same here), here is what it meant.

You want to render shit. Your stuff is described with attributes. You know, a triangle is 3 points, 1 point is 3 coordinates and maybe a color or texture coordinates or both.
See that "maybe"? Here's the problem.

The rasterizer knows the buffer describing your triangles will be in the form "triangle;triangle;triangle;...", so "point;point;point;point;point;point;point;point;point;...".
But it doesn't know if it will be in the form "X,Y,Z,color;X,Y,Z,color;X,Y,Z,color;..." or "X,Y,Z,texX,texY;X,Y,Z,texX,texY;X,Y,Z,texX,texY;..." or whatever.
Well the stride specifies the size of a "X,Y,Z,color" or "X,Y,Z,texX,texY;" group, so that the rasterizer knows where the next element is.
Well, that I already got, what I meant is do strides work per-buffer?

--------------------- MERGED ---------------------------

Actually it's really just the way it's all setup in the GPU that confuses me...
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,033
Country
United States
Alright, @elhobbs , really sorry to bother you again, but I promise this should be the last time. So, from my understanding by looking at the citro3d source, there is only one stride setting per buffer. Is that correct? Also could you maybe (if thats not too annoying) explain what permutations are? And finally, by looking at the portal3ds source, I got that when drawing from md2 files, smea would use 3 buffers because of the layout of the models in memory? Is that it too?

Oh also once it is processed by ctrulib in which register is stride set? Is it in GPU_ATTRIBBUFFERi_CONFIG1/2?

This should be it (sorry that's like 4 questions in one post), thanks for your help so far, I understand I must sound quite annoying with this, but really you've been extremely helpful so far, I can't thank you enough!
That is a lot of questions - that are not easily answered. Your best bet is to read this - https://www.3dbrew.org/wiki/GPU/Internal_Registers#Geometry_pipeline_registers and then compare it to citro3d. To specifically answer one of your questions - the stride is per buffer in config2 bits 16 to 23.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BakerMan
    I rather enjoy a life of taking it easy. I haven't reached that life yet though.
  • BigOnYa @ BigOnYa:
    I don't trust the free ones, but ipvanish I've used for couple years now, n like
  • Psionic Roshambo @ Psionic Roshambo:
    I wonder if they could get CPUs to run that hot then use the heat to power a steam turbine to power the CPUs....
  • BigOnYa @ BigOnYa:
    Good idea, or at least power the GPU
  • Psionic Roshambo @ Psionic Roshambo:
    It's not the movies or games downloads that I would worry about, like breaking into networks, downloading encrypted things, spying on network traffic. I have seen so many "Top Secret" seals on files when I was a kid
  • Psionic Roshambo @ Psionic Roshambo:
    I was obsessed with finding UFOs, a surprising amount of US files where stashed on computers in other countries, China back in the early 90s omg sooo much
  • BigOnYa @ BigOnYa:
    Yea that crazy, I've never tried hack into anything, I just pirate, and my ISP have send me 3-4 letters, so had to VPN it
  • Psionic Roshambo @ Psionic Roshambo:
    Ship to ship communication software for the Navy although without access to the encrypting chips it was mostly useless
  • Psionic Roshambo @ Psionic Roshambo:
    I bet now a 4090 could probably crack it? Hmmm maybe not even back then I'm pretty sure they where using like 1024 bit encryption
  • Psionic Roshambo @ Psionic Roshambo:
    Yayyy the one set finished 324GBs lol
  • Psionic Roshambo @ Psionic Roshambo:
    Compressed....
  • Psionic Roshambo @ Psionic Roshambo:
    I wonder how many years that would have taken on a 56K modem lol
  • Psionic Roshambo @ Psionic Roshambo:
    18000 hours lol
  • Psionic Roshambo @ Psionic Roshambo:
    750 days lol
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    So Internet is very much faster now lol
  • BigOnYa @ BigOnYa:
    "Time Remaining- 2 years, 9 girlfriends, 6 hairstyles, please standby..."
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    I remember one time I downloaded like a 500MB ISO file on 56K and that literally took like 2 days
  • Psionic Roshambo @ Psionic Roshambo:
    I had some sort of resume thing, I remember the software had chains
  • Psionic Roshambo @ Psionic Roshambo:
    Damned if I can't remember.the name though
  • Psionic Roshambo @ Psionic Roshambo:
    Some sort of download management app
  • BigOnYa @ BigOnYa:
    Ok good chatting, I'm off to the bar, to shoot some pool, nighty night.
    +1
  • BakerMan @ BakerMan:
    hey psi
  • BakerMan @ BakerMan:
    i call your girl lyndon the way she b on my johnson
    BakerMan @ BakerMan: i call your girl lyndon the way she b on my johnson