Category Archives: Metal

Code of Conduct

So today there has been some controversy on Twitter about 360|iDev’s Code of Conduct.

I honestly do not understand what the controversy is here. They are clearly stating that they want a diverse conference where everyone will be respected.

Here is my perspective on things.

I am a female programmer. I got into programming later in life. I originally studied video and audio production. I was young and foolish and thought I could succeed purely through sheer force of will. I would say I was about 30 when I really began to learn enough programming to make a go of it. At the last job I had I was not only the only woman, I was also the oldest person by a decade. I also have some health issues that make it impossible to work more than 40 hours a week.

Between being a woman, being older, not having a dozen years of experience, and having health issues, I feel very vulnerable in a community that fetishized boys barely old enough to drink who have been coding for fun since they were ten.

I have been extraordinarily privileged to be given the opportunity to speak at conferences on something that isn’t feminism. 360|iDev will be the fifth conference I have spoken at this year. I am speaking about Apple’s new 3D graphics programming framework.

People like Jim Remsik, Dave Klein, and John Wilker are all throwing me a lifeline to give me the chance to establish myself as a professional and maybe have a career.

I worry sometimes that I only get these opportunities because of “male guilt”. I am very concerned with being seen as someone who only gets to speak because they want more women. I have worked tirelessly to try to prove my cred by tackling difficult programming topics that frighten most people away. I am worried sick about not having a great talk to present at 360|iDev because my reach exceeds my grasp.

Even if I make an idiot of myself, at least I was given the chance. That’s all I ask for. I am being given a time and a place and what I do with it is up to me. A lot of people won’t even do that and I am eternally grateful for being given the chance to do what I can and make what I can of it. I am also grateful for the chance to meet the other people who are speaking and attending. In a world where connections are everything, the connections I have made at my conferences have been absolutely invaluable.

I have absolutely no idea what in the Code of Conduct created this fuss. I do know that I submitted a talk to a conference I could not afford to attend and that the organizers are not only giving me a chance to speak about a topic that is near and dear to my heart, they are also financially making it possible for me to go.

Talk is cheap. If you care so much about getting more women in technology, hire more women. Be willing to train them when they don’t have 5-10 years of experience. Mentor someone. Do something that actually costs you time or money. 360|iDev did. Don’t just go on Twitter and be a douche.

Lexical or Preprocessor Issue

So, today was the day I decided to bite the bullet and start working on my Metal demo for CocoaConf Columbus and 360|iDev.

Since a large focus of my talk is on GPUImage, I am hoping to put together a light Metal version of GPUImage that processes an image using a series of filters. I want to write between three and five filters that are easily stacked on one another that have a GPUImage counterpart in order to test how fast Metal processes images compared to GPUImage.

I went to look at what sample code is available from Apple for Metal. To my delight, I saw that there was an image processing base project. It includes one filter to change an image to black and white and that is hardcoded. I should be able to go into this project, add my filters, and add some UI elements allowing me to add the filter shaders I write.

Today I opened the sample code. Immediately, there was an error.

“Lexical or Preprocessor Issue: QuartzCore/CAMetalLayer.h not found.”

This is why we can't have nice things!!

This is why we can’t have nice things!!

Huh. That is inconvenient.

Did some digging. Refrained from asking this question on Stack Overflow because the last time I asked a question about the betas I got a snide person telling me to go somewhere else. Headed to the Dev Forums and found this thread.

Apparently, for the time being, there is no support for Metal in the simulator. There should be support for Metal if you have an A7 device like the iPhone 5S (which I have) that is running the iOS 8 beta.

I have not yet updated my phone to the beta. I know we are getting close to the point where it will be released, so it isn’t a huge thing to update to the beta, I just feel like I have no guarantee that stuff will work on there properly even after I update to the beta.

I must say that this latest wrinkle is not doing anything to sell me on Metal.

Metal only works on iOS A7 chips and now further won’t even work in the simulator. I usually use the simulator in my talks to demonstrate things I am doing, but now I have to get it on my device. I think I can use Airplay to show what the screen looks like, but that is one more step that can go wrong in my process.

The other things I am noticing in the sample applications is that most of the class implementation files end in “.mm”, which means that they are explicitly telling the compiler that there is going to be C++ code in them.

I have not worked with Swift as much as I should have, but I am wondering if this is going to be a problem with trying to write an app in Swift. I know that theoretically Swift is supposed to behave like Objective-C in that you can include C and C++ code, but I have not tried to write straight C code in a Swift class yet. Can you write C code in a Swift class, or is the support just that I can import a C class into a Swift-based project? How is this going to work with Metal?

At least with OpenGL ES you have the GLKit framework with should work with Swift. I am interested to know more about this, but sadly I don’t believe I will be able to explore these issues before I give my talk in Columbus.

I am also trying to figure out just how much C++ I need to know to fully work with Metal. I thought that I needed to know about the same amount of C++ as you need to know of C to work with GLSL, but after seeing the number of classes that are implementing C++, I am slightly worried that I am going to be out of my depth for a while.

These are things I am going to have to take into consideration and disclose during my talk. I know most of these issues will resolve themselves in the next few years, it is just slightly frustrating to sit on the sidelines trying to figure out how to make it work here and now.

Fortune favors the brave.

Heavy Metal

Hair Force One announcing Metal

Hair Force One announcing Metal

I know that the big new hotness from WWDC 2014 for most people is the Swift programming language. Swift has a large impact on me and on the project I am working on that I can’t publicly announce yet, but that was not the most intriguing thing announced to me. The most interesting thing that captured my attention was Metal.

I have been interested in learning OpenGL ever since I heard about it. I had to make the terrible choice last year of choosing whether to learn OpenGL or Core Audio because it would be complete idiocy to try to learn both at the same time. Since Chris Adamson didn’t write a book on OpenGL, I made the choice last year to learn Core Audio. It was the first programming book I read cover to cover and I got to spend a day with him in Boston at CocoaConf doing Core Audio. That was an amazing experience, but it’s time to move on to the next thing.

I started to learn OpenGL ES in earnest back in March. I had a few books and I have primarily been reading the same materials over and over again hoping that my brain translates them.

GPUImage

GPUImage

One accepted way learn OpenGL ES is to work on the GPUImage framework. There is a great blog post about how to write a custom shader here.

I decided a good way to learn OpenGL ES was to do a talk on GPUImage. Many of the tutorials I have seen on the framework basically just tell you how to plug it into your project and use the built-in filters. I wanted to do a talk about how the framework actually works and how to write your own filters. The creator of the framework, Brad Larson, lives in town. He has been extraordinarily generous with his time and knowledge about OpenGL ES. I pitched this talk and got it accepted at two different conference: CocoaConf Columbus and 360|iDev in Denver. Both of these conferences are in August. I pitched these talks around May. I figured that would be a decent amount of time to figure all this stuff out.

Then, like everyone else, I got slammed by WWDC.

I know that I don’t have to talk about Metal. It’s only been publicly announced for a few months and it only works on a handful of devices. There was no reason I couldn’t just keep my original talk topic. No reason except I had some existential questions I wanted answered.

Every time I heard about GPUImage I heard it was faster than Core Image because it was programmed on the GPU. What does that mean? All of my research on OpenGL ES says to push as much work off the GPU as possible, but they never specify what work the GPU is doing. I read a whole book on OpenGL ES without having any real clue what work is being done on the GPU.

The Defending Champion, OpenGL ES!

The Defending Champion, OpenGL ES!


I really wanted to do a talk on how to optimize OpenGL ES. I also wanted to explore what exactly it was that Metal was doing that was so much better than OpenGL ES. I heard a lot of bemoaning about how slow and inefficient OpenGL ES was, but after talking to Brad about it for a little while, I wondered if the mob was wrong.

I am doing my first talk on Metal three weeks from today. I have exactly one slide from my talk done as of 1:00 this afternoon, but I am in the process of gathering the answers to my questions.

One resource I can’t recommend more highly is the video tutorial series done by Ray Wenderlich. I had a list of questions in my head that I now have answers to because of his series on OpenGL ES. I am a quarter of the way through it and subscribing to his video tutorials is the best money I have spent on tech resources this year. It is my hope that one day he will produce a 3D graphics programming, hopefully after I know it well enough to be able to contribute to it!

So, I am going to take some time, but not too much, cataloging my work on this talk. I also have a debugging talk to complete in three weeks along with some obligations for my unnamed project. I think this is doable if I don’t have a panic attack or get distracted by squirrels.

The Famous Utah Teapot

The Famous Utah Teapot

I am planning to include links in my blog to any resource I have found to be particularly useful.

My goal before going to CocoaConf is to have a working Metal application with a few of the GPUImage filters translated from the OpenGL Shading Language to the Metal Shading Language. I would like to show the performance differences between GPUImage and Metal using the same project. I would also like to be able to intelligently explain GPU programming to people who are coming into this without knowing anything about OpenGL.

Three weeks. Two talks. Git ‘er done!