Jump to content

  • Log In with Google      Sign In   
  • Create Account

zealouselixir

Member Since 20 Jun 2001
Offline Last Active Aug 31 2016 02:34 PM

Posts I've Made

In Topic: Porting Direct3D 11 to Metal : How to handle Input Layouts?

11 July 2016 - 05:04 PM

[[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

 


In Topic: Error in Creating a Window

26 October 2006 - 03:47 AM

Try defining _UNICODE in your project settings. And UNICODE just to be safe, since the Win32 headers are inconsistent in which they use.

In Topic: [SOLVED] Driving Relays with CMOS signals

03 October 2006 - 03:41 PM

The project isn't done yet - I've just been prototyping the timer circuit. Once the timer is done, I'll wire it into the traffic light, mount it in my living room, and post some pictures. Link coming soon (read: eventually).

-ZE

In Topic: [SOLVED] Driving Relays with CMOS signals

03 October 2006 - 09:47 AM

Thanks guys, that worked brilliantly!

-ZE

In Topic: Non halting Input/Keyscan function

26 July 2006 - 02:37 PM

I think I did this ages ago by first calling kbhit, then calling getch/getchar if the return value was true. Not sure if that'll do the job for you, though.

Regards,
ZE

PARTNERS