Jump to content
  • Advertisement


GDNet+ Basic
  • Content count

  • Joined

  • Last visited

Community Reputation

256 Neutral

About zealouselixir

  • Rank

Personal Information


  • Twitter
  • Github
  • Steam
  1. [[stage_in]] doesn't support packed types, but you can get the same effect using the properties of your vertex descriptor's attributes. For example, if you wanted [[attribute(0)]] (which might represent position) to be laid out as three packed floats followed immediately by [[attribute(1)]] (which might represent a surface normal), also consisting of three packed floats, you'd just set the formats and offsets correspondingly, ensuring that your buffer data is packed as described: vertexDesc.attributes[0].format = MTLVertexFormatFloat3; vertexDesc.attributes[0].offset = 0; vertexDesc.attributes[0].bufferIndex = 0; vertexDesc.attributes[1].format = MTLVertexFormatFloat3; vertexDesc.attributes[1].offset = sizeof(float) * 3; vertexDesc.attributes[1].bufferIndex = 0; The struct that you use as the type of your stage_in vertex function parameter will still have each of these members aligned to 4 bytes, as you observe, but the properties will be fetched from the buffer according to the specified vertex descriptor, allowing you to store your data tightly packed.   HTH, ZE  
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!