How does the GPU know which vertex attribute is what?

Discussion in '3DS - Homebrew Development and Emulators' started by cal64, Jan 31, 2017.

  1. cal64
    OP

    cal64 Advanced Member

    Newcomer
    1
    Oct 31, 2016
    France
    Is it setup in the vertex shader? If so, is there any documentation on that? Or is it something different?

    Thanks for reading, any help is very appreciated!!
     
  2. cal64
    OP

    cal64 Advanced Member

    Newcomer
    1
    Oct 31, 2016
    France
    Ok figured id explain a bit:
    When you declare a vertex attribute, you don't explicitly state what it is (pos, normal, texcoord), just what it's made of.
    I can't seem to find how the gpu then figures out what each atttibute is for.

    Any help?
     
  3. bubble2k16

    bubble2k16 GBAtemp Fan

    Member
    9
    Jul 25, 2016
    Senegal
    When you call GPU_SetAttributeBuffers, you set up how many vectors you will send to the vertex shader, and for each vector, how many elements.

    At the vertex shaders, you receive input from your vertex buffers, through the registers v0, v1, ..., after doing the necessary transformations to these vectors, you can then set the final values to the output registers. It is at the point you will decide whether the transformed v0 will be the tex coordinate, position on screen or the colour.
     
  4. cal64
    OP

    cal64 Advanced Member

    Newcomer
    1
    Oct 31, 2016
    France
    Thank you soooooo much!!!
    You can't even imagine how much you helped me there!
     
  5. bubble2k16

    bubble2k16 GBAtemp Fan

    Member
    9
    Jul 25, 2016
    Senegal
    No problem :)
     
  6. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    5
    Jul 28, 2008
    United States
    I just want to mention that if you are doing stuff like this then make sure to test on real hardware - early and often. There are all sorts on sins that emulators will happily work with but will cause the real hardware to lockup immediately or not display correctly. Just my 2 cents.
     
    bubble2k16 and slaphappygamer like this.
  7. cal64
    OP

    cal64 Advanced Member

    Newcomer
    1
    Oct 31, 2016
    France
    Oh wow. Thanks a lot for mentionning that, I wouldn't have expected such a thing :).
    You just saved from potentially a lot of frustration!
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice