Replace NULL macros with nullptr literals.

Change-Id: I918c40879aa547438f77e7d1a95fa2aa33bec398
diff --git a/driver/rsdAllocation.cpp b/driver/rsdAllocation.cpp
index bbe0d7a..e34d0c3 100644
--- a/driver/rsdAllocation.cpp
+++ b/driver/rsdAllocation.cpp
@@ -193,7 +193,7 @@
     if (!(alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_SCRIPT)) {
         if (alloc->mHal.drvState.lod[0].mallocPtr) {
             free(alloc->mHal.drvState.lod[0].mallocPtr);
-            alloc->mHal.drvState.lod[0].mallocPtr = NULL;
+            alloc->mHal.drvState.lod[0].mallocPtr = nullptr;
         }
     }
     rsdGLCheckError(rsc, "UploadToTexture");
@@ -360,7 +360,7 @@
     // We align all allocations to a 16-byte boundary.
     uint8_t* ptr = (uint8_t *)memalign(16, allocSize);
     if (!ptr) {
-        return NULL;
+        return nullptr;
     }
     if (forceZero) {
         memset(ptr, 0, allocSize);
@@ -376,15 +376,15 @@
     alloc->mHal.drv = drv;
 
     // Calculate the object size.
-    size_t allocSize = AllocationBuildPointerTable(rsc, alloc, alloc->getType(), NULL);
+    size_t allocSize = AllocationBuildPointerTable(rsc, alloc, alloc->getType(), nullptr);
 
-    uint8_t * ptr = NULL;
+    uint8_t * ptr = nullptr;
     if (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_IO_OUTPUT) {
 
     } else if (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_IO_INPUT) {
         // Allocation is allocated when the surface is created
         // in getSurface
-    } else if (alloc->mHal.state.userProvidedPtr != NULL) {
+    } else if (alloc->mHal.state.userProvidedPtr != nullptr) {
         // user-provided allocation
         // limitations: no faces, no LOD, USAGE_SCRIPT or SCRIPT+TEXTURE only
         if (!(alloc->mHal.state.usageFlags == (RS_ALLOCATION_USAGE_SCRIPT | RS_ALLOCATION_USAGE_SHARED) ||
@@ -405,7 +405,7 @@
 
             ptr = allocAlignedMemory(allocSize, forceZero);
             if (!ptr) {
-                alloc->mHal.drv = NULL;
+                alloc->mHal.drv = nullptr;
                 free(drv);
                 return false;
             }
@@ -417,7 +417,7 @@
     } else {
         ptr = allocAlignedMemory(allocSize, forceZero);
         if (!ptr) {
-            alloc->mHal.drv = NULL;
+            alloc->mHal.drv = nullptr;
             free(drv);
             return false;
         }
@@ -456,7 +456,7 @@
     }
 
 
-    drv->readBackFBO = NULL;
+    drv->readBackFBO = nullptr;
 
     // fill out the initial state of the buffer if we couldn't use the user-provided ptr and USAGE_SHARED was accepted
     if ((alloc->mHal.state.userProvidedPtr != 0) && (drv->useUserProvidedPtr == false)) {
@@ -500,13 +500,13 @@
             !(alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_IO_OUTPUT)) {
                 free(alloc->mHal.drvState.lod[0].mallocPtr);
         }
-        alloc->mHal.drvState.lod[0].mallocPtr = NULL;
+        alloc->mHal.drvState.lod[0].mallocPtr = nullptr;
     }
 
 #ifndef RS_COMPATIBILITY_LIB
-    if (drv->readBackFBO != NULL) {
+    if (drv->readBackFBO != nullptr) {
         delete drv->readBackFBO;
-        drv->readBackFBO = NULL;
+        drv->readBackFBO = nullptr;
     }
 
     if ((alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_IO_OUTPUT) &&
@@ -519,15 +519,15 @@
             mapper.unlock(drv->wndBuffer->handle);
             int32_t r = nw->queueBuffer(nw, drv->wndBuffer, -1);
 
-            drv->wndSurface = NULL;
+            drv->wndSurface = nullptr;
             native_window_api_disconnect(nw, NATIVE_WINDOW_API_CPU);
-            nw->decStrong(NULL);
+            nw->decStrong(nullptr);
         }
     }
 #endif
 
     free(drv);
-    alloc->mHal.drv = NULL;
+    alloc->mHal.drv = nullptr;
 }
 
 void rsdAllocationResize(const Context *rsc, const Allocation *alloc,
@@ -542,7 +542,7 @@
     }
     void * oldPtr = alloc->mHal.drvState.lod[0].mallocPtr;
     // Calculate the object size
-    size_t s = AllocationBuildPointerTable(rsc, alloc, newType, NULL);
+    size_t s = AllocationBuildPointerTable(rsc, alloc, newType, nullptr);
     uint8_t *ptr = (uint8_t *)realloc(oldPtr, s);
     // Build the relative pointer tables.
     size_t verifySize = AllocationBuildPointerTable(rsc, alloc, newType, ptr);
@@ -571,7 +571,7 @@
     if (!drv->textureID && !drv->renderTargetID) {
         return; // nothing was rendered here yet, so nothing to sync
     }
-    if (drv->readBackFBO == NULL) {
+    if (drv->readBackFBO == nullptr) {
         drv->readBackFBO = new RsdFrameBufferObj();
         drv->readBackFBO->setColorTarget(drv, 0);
         drv->readBackFBO->setDimensions(alloc->getType()->getDimX(),
@@ -656,7 +656,7 @@
     GraphicBufferMapper &mapper = GraphicBufferMapper::get();
     Rect bounds(drv->wndBuffer->width, drv->wndBuffer->height);
 
-    void *dst = NULL;
+    void *dst = nullptr;
     mapper.lock(drv->wndBuffer->handle,
             GRALLOC_USAGE_SW_READ_NEVER | GRALLOC_USAGE_SW_WRITE_OFTEN,
             bounds, &dst);
@@ -674,7 +674,7 @@
     ANativeWindow *old = drv->wndSurface;
 
     if (nw) {
-        nw->incStrong(NULL);
+        nw->incStrong(nullptr);
     }
 
     if (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET) {
@@ -689,13 +689,13 @@
         GraphicBufferMapper &mapper = GraphicBufferMapper::get();
         mapper.unlock(drv->wndBuffer->handle);
         old->cancelBuffer(old, drv->wndBuffer, -1);
-        drv->wndSurface = NULL;
+        drv->wndSurface = nullptr;
 
         native_window_api_disconnect(old, NATIVE_WINDOW_API_CPU);
-        old->decStrong(NULL);
+        old->decStrong(nullptr);
     }
 
-    if (nw != NULL) {
+    if (nw != nullptr) {
         int32_t r;
         uint32_t flags = 0;
 
@@ -747,7 +747,7 @@
  error:
 
     if (nw) {
-        nw->decStrong(NULL);
+        nw->decStrong(nullptr);
     }
 
 
@@ -1202,14 +1202,14 @@
 {
     obj->p = alloc;
 #ifdef __LP64__
-    if (alloc != NULL) {
+    if (alloc != nullptr) {
         obj->r = alloc->mHal.drvState.lod[0].mallocPtr;
         obj->v1 = alloc->mHal.drv;
         obj->v2 = (void *)alloc->mHal.drvState.lod[0].stride;
     } else {
-        obj->r = NULL;
-        obj->v1 = NULL;
-        obj->v2 = NULL;
+        obj->r = nullptr;
+        obj->v1 = nullptr;
+        obj->v2 = nullptr;
     }
 #endif
 }
diff --git a/driver/rsdBcc.cpp b/driver/rsdBcc.cpp
index 419422a..811fa3e 100644
--- a/driver/rsdBcc.cpp
+++ b/driver/rsdBcc.cpp
@@ -47,7 +47,7 @@
     RsdCpuReference::CpuScript * cs =
         dc->mCpuRef->createScript(script, resName, cacheDir, bitcode,
                                   bitcodeSize, flags);
-    if (cs == NULL) {
+    if (cs == nullptr) {
         return false;
     }
     script->mHal.drv = cs;
@@ -59,7 +59,7 @@
                       Element *e) {
     RsdHal *dc = (RsdHal *)rsc->mHal.drv;
     RsdCpuReference::CpuScript * cs = dc->mCpuRef->createIntrinsic(s, iid, e);
-    if (cs == NULL) {
+    if (cs == nullptr) {
         return false;
     }
     s->mHal.drv = cs;
@@ -76,8 +76,8 @@
                             size_t usrLen,
                             const RsScriptCall *sc) {
 
-    if (ain == NULL) {
-        rsdScriptInvokeForEachMulti(rsc, s, slot, NULL, 0, aout, usr, usrLen,
+    if (ain == nullptr) {
+        rsdScriptInvokeForEachMulti(rsc, s, slot, nullptr, 0, aout, usr, usrLen,
                                     sc);
     } else {
         const Allocation *ains[1] = {ain};
@@ -159,7 +159,7 @@
 void rsdScriptDestroy(const Context *dc, Script *s) {
     RsdCpuReference::CpuScript *cs = (RsdCpuReference::CpuScript *)s->mHal.drv;
     delete cs;
-    s->mHal.drv = NULL;
+    s->mHal.drv = nullptr;
 }
 
 
@@ -176,12 +176,12 @@
 {
     obj->p = script;
 #ifdef __LP64__
-    obj->r = NULL;
-    if (script != NULL) {
+    obj->r = nullptr;
+    if (script != nullptr) {
         obj->v1 = script->mHal.drv;
     } else {
-        obj->v1 = NULL;
+        obj->v1 = nullptr;
     }
-    obj->v2 = NULL;
+    obj->v2 = nullptr;
 #endif
 }
diff --git a/driver/rsdCore.cpp b/driver/rsdCore.cpp
index 37c9755..48959fd 100644
--- a/driver/rsdCore.cpp
+++ b/driver/rsdCore.cpp
@@ -53,7 +53,7 @@
 #ifndef RS_COMPATIBILITY_LIB
     #define NATIVE_FUNC(a) a
 #else
-    #define NATIVE_FUNC(a) NULL
+    #define NATIVE_FUNC(a) nullptr
 #endif
 
 
@@ -64,7 +64,7 @@
     NATIVE_FUNC(rsdGLSwap),
 
     Shutdown,
-    NULL,
+    nullptr,
     SetPriority,
     rsdAllocRuntimeMem,
     rsdFreeRuntimeMem,
@@ -169,7 +169,7 @@
         rsdScriptGroupSetOutput,
         rsdScriptGroupExecute,
         rsdScriptGroupDestroy,
-        NULL
+        nullptr
     },
 
     {
@@ -184,7 +184,7 @@
         rsdElementUpdateCachedObject
     },
 
-    NULL // finish
+    nullptr // finish
 };
 
 extern const RsdCpuReference::CpuSymbol * rsdLookupRuntimeStub(Context * pContext, char const* name);
@@ -209,7 +209,7 @@
                                           &rsdLookupRuntimeStub, &LookupScript);
     if (!dc->mCpuRef) {
         ALOGE("RsdCpuReference::create for driver hal failed.");
-        rsc->mHal.drv = NULL;
+        rsc->mHal.drv = nullptr;
         free(dc);
         return false;
     }
@@ -217,7 +217,7 @@
 #ifndef RS_COMPATIBILITY_LIB
     // Set a callback for compiler setup here.
     if (false) {
-        dc->mCpuRef->setSetupCompilerCallback(NULL);
+        dc->mCpuRef->setSetupCompilerCallback(nullptr);
     }
 
     // Set a callback for switching MemChunk's allocator here.
@@ -251,7 +251,7 @@
     RsdHal *dc = (RsdHal *)rsc->mHal.drv;
     delete dc->mCpuRef;
     free(dc);
-    rsc->mHal.drv = NULL;
+    rsc->mHal.drv = nullptr;
 }
 
 void* rsdAllocRuntimeMem(size_t size, uint32_t flags) {
diff --git a/driver/rsdElement.cpp b/driver/rsdElement.cpp
index c0413e4..06a0790 100644
--- a/driver/rsdElement.cpp
+++ b/driver/rsdElement.cpp
@@ -35,9 +35,9 @@
 {
     obj->p = element;
 #ifdef __LP64__
-    obj->r = NULL;
-    obj->v1 = NULL;
-    obj->v2 = NULL;
+    obj->r = nullptr;
+    obj->v1 = nullptr;
+    obj->v2 = nullptr;
 #endif
 }
 
diff --git a/driver/rsdFrameBuffer.cpp b/driver/rsdFrameBuffer.cpp
index bb07d29..f458bf9 100644
--- a/driver/rsdFrameBuffer.cpp
+++ b/driver/rsdFrameBuffer.cpp
@@ -32,8 +32,8 @@
 void setDepthAttachment(const Context *rsc, const FBOCache *fb) {
     RsdFrameBufferObj *fbo = (RsdFrameBufferObj*)fb->mHal.drv;
 
-    DrvAllocation *depth = NULL;
-    if (fb->mHal.state.depthTarget != NULL) {
+    DrvAllocation *depth = nullptr;
+    if (fb->mHal.state.depthTarget != nullptr) {
         depth = (DrvAllocation *)fb->mHal.state.depthTarget->mHal.drv;
 
         if (depth->uploadDeferred) {
@@ -48,8 +48,8 @@
     RsdFrameBufferObj *fbo = (RsdFrameBufferObj*)fb->mHal.drv;
     // Now attach color targets
     for (uint32_t i = 0; i < fb->mHal.state.colorTargetsCount; i ++) {
-        DrvAllocation *color = NULL;
-        if (fb->mHal.state.colorTargets[i] != NULL) {
+        DrvAllocation *color = nullptr;
+        if (fb->mHal.state.colorTargets[i] != nullptr) {
             color = (DrvAllocation *)fb->mHal.state.colorTargets[i]->mHal.drv;
 
             if (color->uploadDeferred) {
@@ -63,7 +63,7 @@
 
 bool rsdFrameBufferInit(const Context *rsc, const FBOCache *fb) {
     RsdFrameBufferObj *fbo = new RsdFrameBufferObj();
-    if (fbo == NULL) {
+    if (fbo == nullptr) {
         return false;
     }
     fb->mHal.drv = fbo;
@@ -93,7 +93,7 @@
 void rsdFrameBufferDestroy(const Context *rsc, const FBOCache *fb) {
     RsdFrameBufferObj *fbo = (RsdFrameBufferObj *)fb->mHal.drv;
     delete fbo;
-    fb->mHal.drv = NULL;
+    fb->mHal.drv = nullptr;
 }
 
 
diff --git a/driver/rsdFrameBufferObj.cpp b/driver/rsdFrameBufferObj.cpp
index 7731aff..1e91c98 100644
--- a/driver/rsdFrameBufferObj.cpp
+++ b/driver/rsdFrameBufferObj.cpp
@@ -35,7 +35,7 @@
     for (uint32_t i = 0; i < mColorTargetsCount; i ++) {
         mColorTargets[i] = 0;
     }
-    mDepthTarget = NULL;
+    mDepthTarget = nullptr;
     mDirty = true;
 }
 
@@ -73,7 +73,7 @@
 
 
 void RsdFrameBufferObj::setDepthAttachment() {
-    if (mDepthTarget != NULL) {
+    if (mDepthTarget != nullptr) {
         if (mDepthTarget->textureID) {
             glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
                                    GL_TEXTURE_2D, mDepthTarget->textureID, 0);
@@ -91,7 +91,7 @@
 void RsdFrameBufferObj::setColorAttachment() {
     // Now attach color targets
     for (uint32_t i = 0; i < mColorTargetsCount; i ++) {
-        if (mColorTargets[i] != NULL) {
+        if (mColorTargets[i] != nullptr) {
             if (mColorTargets[i]->textureID) {
                 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i,
                                        GL_TEXTURE_2D, mColorTargets[i]->textureID, 0);
@@ -110,12 +110,12 @@
 }
 
 bool RsdFrameBufferObj::renderToFramebuffer() {
-    if (mDepthTarget != NULL) {
+    if (mDepthTarget != nullptr) {
         return false;
     }
 
     for (uint32_t i = 0; i < mColorTargetsCount; i ++) {
-        if (mColorTargets[i] != NULL) {
+        if (mColorTargets[i] != nullptr) {
             return false;
         }
     }
diff --git a/driver/rsdGL.cpp b/driver/rsdGL.cpp
index ff0c9a6..e803487 100644
--- a/driver/rsdGL.cpp
+++ b/driver/rsdGL.cpp
@@ -153,7 +153,7 @@
 void rsdGLShutdown(const Context *rsc) {
     RsdHal *dc = (RsdHal *)rsc->mHal.drv;
 
-    rsdGLSetSurface(rsc, 0, 0, NULL);
+    rsdGLSetSurface(rsc, 0, 0, nullptr);
     dc->gl.shaderCache->cleanupAll();
     delete dc->gl.shaderCache;
     delete dc->gl.vertexArrayState;
@@ -320,7 +320,7 @@
     checkEglError("eglCreateContext");
     if (dc->gl.egl.context == EGL_NO_CONTEXT) {
         ALOGE("%p, eglCreateContext returned EGL_NO_CONTEXT", rsc);
-        rsc->setWatchdogGL(NULL, 0, NULL);
+        rsc->setWatchdogGL(nullptr, 0, nullptr);
         return false;
     }
     gGLContextCount++;
@@ -333,7 +333,7 @@
     if (dc->gl.egl.surfaceDefault == EGL_NO_SURFACE) {
         ALOGE("eglCreatePbufferSurface returned EGL_NO_SURFACE");
         rsdGLShutdown(rsc);
-        rsc->setWatchdogGL(NULL, 0, NULL);
+        rsc->setWatchdogGL(nullptr, 0, nullptr);
         return false;
     }
 
@@ -344,7 +344,7 @@
         ALOGE("eglMakeCurrent returned EGL_FALSE");
         checkEglError("eglMakeCurrent", ret);
         rsdGLShutdown(rsc);
-        rsc->setWatchdogGL(NULL, 0, NULL);
+        rsc->setWatchdogGL(nullptr, 0, nullptr);
         return false;
     }
 
@@ -359,7 +359,7 @@
     //ALOGV("GL Renderer %s", mGL.mRenderer);
     //ALOGV("GL Extensions %s", mGL.mExtensions);
 
-    const char *verptr = NULL;
+    const char *verptr = nullptr;
     if (strlen((const char *)dc->gl.gl.version) > 9) {
         if (!memcmp(dc->gl.gl.version, "OpenGL ES-CM", 12)) {
             verptr = (const char *)dc->gl.gl.version + 12;
@@ -372,7 +372,7 @@
     if (!verptr) {
         ALOGE("Error, OpenGL ES Lite not supported");
         rsdGLShutdown(rsc);
-        rsc->setWatchdogGL(NULL, 0, NULL);
+        rsc->setWatchdogGL(nullptr, 0, nullptr);
         return false;
     } else {
         sscanf(verptr, " %i.%i", &dc->gl.gl.majorVersion, &dc->gl.gl.minorVersion);
@@ -388,14 +388,14 @@
     glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &dc->gl.gl.maxFragmentTextureImageUnits);
     glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &dc->gl.gl.maxFragmentUniformVectors);
 
-    dc->gl.gl.OES_texture_npot = NULL != strstr((const char *)dc->gl.gl.extensions,
+    dc->gl.gl.OES_texture_npot = nullptr != strstr((const char *)dc->gl.gl.extensions,
                                                 "GL_OES_texture_npot");
-    dc->gl.gl.IMG_texture_npot = NULL != strstr((const char *)dc->gl.gl.extensions,
+    dc->gl.gl.IMG_texture_npot = nullptr != strstr((const char *)dc->gl.gl.extensions,
                                                    "GL_IMG_texture_npot");
-    dc->gl.gl.NV_texture_npot_2D_mipmap = NULL != strstr((const char *)dc->gl.gl.extensions,
+    dc->gl.gl.NV_texture_npot_2D_mipmap = nullptr != strstr((const char *)dc->gl.gl.extensions,
                                                             "GL_NV_texture_npot_2D_mipmap");
     dc->gl.gl.EXT_texture_max_aniso = 1.0f;
-    bool hasAniso = NULL != strstr((const char *)dc->gl.gl.extensions,
+    bool hasAniso = nullptr != strstr((const char *)dc->gl.gl.extensions,
                                    "GL_EXT_texture_filter_anisotropic");
     if (hasAniso) {
         glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &dc->gl.gl.EXT_texture_max_aniso);
@@ -408,11 +408,11 @@
     dc->gl.shaderCache = new RsdShaderCache();
     dc->gl.vertexArrayState = new RsdVertexArrayState();
     dc->gl.vertexArrayState->init(dc->gl.gl.maxVertexAttribs);
-    dc->gl.currentFrameBuffer = NULL;
+    dc->gl.currentFrameBuffer = nullptr;
     dc->mHasGraphics = true;
 
     ALOGV("%p initGLThread end", rsc);
-    rsc->setWatchdogGL(NULL, 0, NULL);
+    rsc->setWatchdogGL(nullptr, 0, nullptr);
     return true;
 }
 
@@ -421,7 +421,7 @@
     RsdHal *dc = (RsdHal *)rsc->mHal.drv;
 
     EGLBoolean ret;
-    if (dc->gl.egl.surface != NULL) {
+    if (dc->gl.egl.surface != nullptr) {
         rsc->setWatchdogGL("eglMakeCurrent", __LINE__, __FILE__);
         ret = eglMakeCurrent(dc->gl.egl.display, dc->gl.egl.surfaceDefault,
                              dc->gl.egl.surfaceDefault, dc->gl.egl.context);
@@ -431,20 +431,20 @@
         ret = eglDestroySurface(dc->gl.egl.display, dc->gl.egl.surface);
         checkEglError("eglDestroySurface", ret);
 
-        dc->gl.egl.surface = NULL;
+        dc->gl.egl.surface = nullptr;
     }
 
-    if (dc->gl.currentWndSurface != NULL) {
-        dc->gl.currentWndSurface->decStrong(NULL);
+    if (dc->gl.currentWndSurface != nullptr) {
+        dc->gl.currentWndSurface->decStrong(nullptr);
     }
 
     dc->gl.currentWndSurface = (ANativeWindow *)sur;
-    if (dc->gl.currentWndSurface != NULL) {
-        dc->gl.currentWndSurface->incStrong(NULL);
+    if (dc->gl.currentWndSurface != nullptr) {
+        dc->gl.currentWndSurface->incStrong(nullptr);
 
         rsc->setWatchdogGL("eglCreateWindowSurface", __LINE__, __FILE__);
         dc->gl.egl.surface = eglCreateWindowSurface(dc->gl.egl.display, dc->gl.egl.config,
-                                                    dc->gl.currentWndSurface, NULL);
+                                                    dc->gl.currentWndSurface, nullptr);
         checkEglError("eglCreateWindowSurface");
         if (dc->gl.egl.surface == EGL_NO_SURFACE) {
             ALOGE("eglCreateWindowSurface returned EGL_NO_SURFACE");
@@ -455,23 +455,23 @@
                              dc->gl.egl.surface, dc->gl.egl.context);
         checkEglError("eglMakeCurrent", ret);
     }
-    rsc->setWatchdogGL(NULL, 0, NULL);
+    rsc->setWatchdogGL(nullptr, 0, nullptr);
     return true;
 }
 
 bool rsdGLSetSurface(const Context *rsc, uint32_t w, uint32_t h, RsNativeWindow sur) {
     RsdHal *dc = (RsdHal *)rsc->mHal.drv;
 
-    if (dc->gl.wndSurface != NULL) {
-        dc->gl.wndSurface->decStrong(NULL);
-        dc->gl.wndSurface = NULL;
+    if (dc->gl.wndSurface != nullptr) {
+        dc->gl.wndSurface->decStrong(nullptr);
+        dc->gl.wndSurface = nullptr;
     }
     if(w && h) {
         // WAR: Some drivers fail to handle 0 size surfaces correctly. Use the
         // pbuffer to avoid this pitfall.
         dc->gl.wndSurface = (ANativeWindow *)sur;
-        if (dc->gl.wndSurface != NULL) {
-            dc->gl.wndSurface->incStrong(NULL);
+        if (dc->gl.wndSurface != nullptr) {
+            dc->gl.wndSurface->incStrong(nullptr);
         }
     }
 
diff --git a/driver/rsdGL.h b/driver/rsdGL.h
index 419c317..48c4c4e 100644
--- a/driver/rsdGL.h
+++ b/driver/rsdGL.h
@@ -20,7 +20,7 @@
 #include <rs_hal.h>
 #include <EGL/egl.h>
 
-#define RSD_CALL_GL(x, ...) rsc->setWatchdogGL(#x, __LINE__, __FILE__); x(__VA_ARGS__); rsc->setWatchdogGL(NULL, 0, NULL)
+#define RSD_CALL_GL(x, ...) rsc->setWatchdogGL(#x, __LINE__, __FILE__); x(__VA_ARGS__); rsc->setWatchdogGL(nullptr, 0, nullptr)
 
 class RsdShaderCache;
 class RsdVertexArrayState;
diff --git a/driver/rsdMesh.cpp b/driver/rsdMesh.cpp
index 50daf3e..01d2140 100644
--- a/driver/rsdMesh.cpp
+++ b/driver/rsdMesh.cpp
@@ -28,7 +28,7 @@
 using namespace android::renderscript;
 
 bool rsdMeshInit(const Context *rsc, const Mesh *m) {
-    RsdMeshObj *drv = NULL;
+    RsdMeshObj *drv = nullptr;
     if(m->mHal.drv) {
         drv = (RsdMeshObj*)m->mHal.drv;
         delete drv;
diff --git a/driver/rsdMeshObj.cpp b/driver/rsdMeshObj.cpp
index 8f072a5..ac1780c 100644
--- a/driver/rsdMeshObj.cpp
+++ b/driver/rsdMeshObj.cpp
@@ -32,9 +32,9 @@
 RsdMeshObj::RsdMeshObj(const Context *rsc, const Mesh *rsMesh) {
     mRSMesh = rsMesh;
 
-    mAttribs = NULL;
-    mAttribAllocationIndex = NULL;
-    mGLPrimitives = NULL;
+    mAttribs = nullptr;
+    mAttribAllocationIndex = nullptr;
+    mGLPrimitives = nullptr;
 
     mAttribCount = 0;
 }
@@ -86,8 +86,8 @@
     if (mAttribs) {
         delete [] mAttribs;
         delete [] mAttribAllocationIndex;
-        mAttribs = NULL;
-        mAttribAllocationIndex = NULL;
+        mAttribs = nullptr;
+        mAttribAllocationIndex = nullptr;
     }
     if (!mAttribCount) {
         return false;
@@ -148,7 +148,7 @@
 
         if (drvAlloc->bufferID) {
             mAttribs[ct].buffer = drvAlloc->bufferID;
-            mAttribs[ct].ptr = NULL;
+            mAttribs[ct].ptr = nullptr;
         } else {
             mAttribs[ct].buffer = 0;
             mAttribs[ct].ptr = (const uint8_t*)alloc->mHal.drvState.lod[0].mallocPtr;
diff --git a/driver/rsdPath.cpp b/driver/rsdPath.cpp
index ee5e3ad..1a9fa21 100644
--- a/driver/rsdPath.cpp
+++ b/driver/rsdPath.cpp
@@ -71,13 +71,13 @@
 
 bool rsdPathInitStatic(const Context *rsc, const Path *m,
                        const Allocation *vtx, const Allocation *loops) {
-    DrvPathStatic *drv = NULL;
+    DrvPathStatic *drv = nullptr;
     cleanup(rsc, m);
 
     DrvPathStatic *dps = new DrvPathStatic(vtx, loops);
     //LOGE("init path m %p,  %p", m, dps);
     m->mHal.drv = dps;
-    return dps != NULL;
+    return dps != nullptr;
 }
 
 bool rsdPathInitDynamic(const Context *rsc, const Path *m) {
@@ -97,7 +97,7 @@
 
 void rsdPathDestroy(const Context *rsc, const Path *m) {
     cleanup(rsc, m);
-    m->mHal.drv = NULL;
+    m->mHal.drv = nullptr;
 }
 
 
diff --git a/driver/rsdProgram.cpp b/driver/rsdProgram.cpp
index 132f7be..f2b5452 100644
--- a/driver/rsdProgram.cpp
+++ b/driver/rsdProgram.cpp
@@ -67,7 +67,7 @@
 void rsdProgramVertexDestroy(const Context *rsc, const ProgramVertex *pv) {
     RsdHal *dc = (RsdHal *)rsc->mHal.drv;
 
-    RsdShader *drv = NULL;
+    RsdShader *drv = nullptr;
     if(pv->mHal.drv) {
         drv = (RsdShader*)pv->mHal.drv;
         if (rsc->props.mLogShaders) {
@@ -101,7 +101,7 @@
 void rsdProgramFragmentDestroy(const Context *rsc, const ProgramFragment *pf) {
     RsdHal *dc = (RsdHal *)rsc->mHal.drv;
 
-    RsdShader *drv = NULL;
+    RsdShader *drv = nullptr;
     if(pf->mHal.drv) {
         drv = (RsdShader*)pf->mHal.drv;
         if (rsc->props.mLogShaders) {
diff --git a/driver/rsdProgramStore.cpp b/driver/rsdProgramStore.cpp
index c1295e8..79d2fdd 100644
--- a/driver/rsdProgramStore.cpp
+++ b/driver/rsdProgramStore.cpp
@@ -39,7 +39,7 @@
 
 bool rsdProgramStoreInit(const Context *rsc, const ProgramStore *ps) {
     DrvProgramStore *drv = (DrvProgramStore *)calloc(1, sizeof(DrvProgramStore));
-    if (drv == NULL) {
+    if (drv == nullptr) {
         return false;
     }
 
@@ -149,7 +149,7 @@
 
 error:
     free(drv);
-    ps->mHal.drv = NULL;
+    ps->mHal.drv = nullptr;
     return false;
 }
 
@@ -198,7 +198,7 @@
 
 void rsdProgramStoreDestroy(const Context *rsc, const ProgramStore *ps) {
     free(ps->mHal.drv);
-    ps->mHal.drv = NULL;
+    ps->mHal.drv = nullptr;
 }
 
 
diff --git a/driver/rsdRuntimeStubs.cpp b/driver/rsdRuntimeStubs.cpp
index 2fd7ff8..8f5dbbe 100644
--- a/driver/rsdRuntimeStubs.cpp
+++ b/driver/rsdRuntimeStubs.cpp
@@ -532,7 +532,8 @@
                             android::renderscript::rs_allocation in,
                             android::renderscript::rs_allocation out) {
     Context *rsc = RsdCpuReference::getTlsContext();
-    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p, NULL, 0, NULL);
+    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p,
+               nullptr, 0, nullptr);
 }
 #else
 static void SC_ForEach_SAA(android::renderscript::rs_script *target,
@@ -549,7 +550,8 @@
                             android::renderscript::rs_allocation out,
                             const void *usr) {
     Context *rsc = RsdCpuReference::getTlsContext();
-    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p, usr, 0, NULL);
+    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p,
+               usr, 0, nullptr);
 }
 #else
 static void SC_ForEach_SAAU(android::renderscript::rs_script *target,
@@ -588,7 +590,8 @@
                              const void *usr,
                              uint32_t usrLen) {
     Context *rsc = RsdCpuReference::getTlsContext();
-    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p, usr, usrLen, NULL);
+    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p,
+               usr, usrLen, nullptr);
 }
 #else
 static void SC_ForEach_SAAUL(android::renderscript::rs_script *target,
@@ -673,7 +676,7 @@
 
 static uint32_t SC_ToClient(int cmdID) {
     Context *rsc = RsdCpuReference::getTlsContext();
-    return rsrToClient(rsc, cmdID, (const void *)NULL, 0);
+    return rsrToClient(rsc, cmdID, (const void *)nullptr, 0);
 }
 
 static uint32_t SC_ToClientBlocking2(int cmdID, const void *data, uint32_t len) {
@@ -683,7 +686,7 @@
 
 static uint32_t SC_ToClientBlocking(int cmdID) {
     Context *rsc = RsdCpuReference::getTlsContext();
-    return rsrToClientBlocking(rsc, cmdID, (const void *)NULL, 0);
+    return rsrToClientBlocking(rsc, cmdID, (const void *)nullptr, 0);
 }
 
 
@@ -696,20 +699,20 @@
     if (x >= t->getLODDimX(0)) {
         sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
         rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
-        return NULL;
+        return nullptr;
     }
 
     if (vecSize > 0) {
         if (vecSize != e->getVectorSize()) {
             sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
             rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
-            return NULL;
+            return nullptr;
         }
 
         if (dt != e->getType()) {
             sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
             rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
-            return NULL;
+            return nullptr;
         }
     }
 
@@ -727,26 +730,26 @@
     if (x >= t->getLODDimX(0)) {
         sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
         rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
-        return NULL;
+        return nullptr;
     }
 
     if (y >= t->getLODDimY(0)) {
         sprintf(buf, "Out range ElementAt Y %i of %i", y, t->getLODDimY(0));
         rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
-        return NULL;
+        return nullptr;
     }
 
     if (vecSize > 0) {
         if (vecSize != e->getVectorSize()) {
             sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
             rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
-            return NULL;
+            return nullptr;
         }
 
         if (dt != e->getType()) {
             sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
             rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
-            return NULL;
+            return nullptr;
         }
     }
 
@@ -765,32 +768,32 @@
     if (x >= t->getLODDimX(0)) {
         sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
         rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
-        return NULL;
+        return nullptr;
     }
 
     if (y >= t->getLODDimY(0)) {
         sprintf(buf, "Out range ElementAt Y %i of %i", y, t->getLODDimY(0));
         rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
-        return NULL;
+        return nullptr;
     }
 
     if (z >= t->getLODDimZ(0)) {
         sprintf(buf, "Out range ElementAt Z %i of %i", z, t->getLODDimZ(0));
         rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
-        return NULL;
+        return nullptr;
     }
 
     if (vecSize > 0) {
         if (vecSize != e->getVectorSize()) {
             sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
             rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
-            return NULL;
+            return nullptr;
         }
 
         if (dt != e->getType()) {
             sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
             rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
-            return NULL;
+            return nullptr;
         }
     }
 
@@ -814,7 +817,7 @@
     const Type *t = ((Allocation*)a.p)->getType();
     const Element *e = t->getElement();
     void *tmp = ElementAt1D((Allocation*)a.p, RS_TYPE_UNSIGNED_8, 0, x);
-    if (tmp != NULL) {
+    if (tmp != nullptr) {
         memcpy(tmp, ptr, e->getSizeBytes());
     }
 }
@@ -822,7 +825,7 @@
     const Type *t = ((Allocation*)a.p)->getType();
     const Element *e = t->getElement();
     void *tmp = ElementAt2D((Allocation*)a.p, RS_TYPE_UNSIGNED_8, 0, x, y);
-    if (tmp != NULL) {
+    if (tmp != nullptr) {
         memcpy(tmp, ptr, e->getSizeBytes());
     }
 }
@@ -830,41 +833,41 @@
     const Type *t = ((Allocation*)a.p)->getType();
     const Element *e = t->getElement();
     void *tmp = ElementAt3D((Allocation*)a.p, RS_TYPE_UNSIGNED_8, 0, x, y, z);
-    if (tmp != NULL) {
+    if (tmp != nullptr) {
         memcpy(tmp, ptr, e->getSizeBytes());
     }
 }
 
 #define ELEMENT_AT(T, DT, VS)                                               \
     static void SC_SetElementAt1_##T(android::renderscript::rs_allocation a, const T *val, uint32_t x) { \
-        void *r = ElementAt1D((Allocation*)a.p, DT, VS, x);               \
-        if (r != NULL) ((T *)r)[0] = *val;                               \
+        void *r = ElementAt1D((Allocation*)a.p, DT, VS, x);             \
+        if (r != nullptr) ((T *)r)[0] = *val;                           \
         else ALOGE("Error from %s", __PRETTY_FUNCTION__);               \
     }                                                                   \
     static void SC_SetElementAt2_##T(android::renderscript::rs_allocation a, const T * val, uint32_t x, uint32_t y) { \
-        void *r = ElementAt2D((Allocation*)a.p, DT, VS, x, y);            \
-        if (r != NULL) ((T *)r)[0] = *val;                               \
+        void *r = ElementAt2D((Allocation*)a.p, DT, VS, x, y);          \
+        if (r != nullptr) ((T *)r)[0] = *val;                           \
         else ALOGE("Error from %s", __PRETTY_FUNCTION__);               \
     }                                                                   \
     static void SC_SetElementAt3_##T(android::renderscript::rs_allocation a, const T * val, uint32_t x, uint32_t y, uint32_t z) { \
-        void *r = ElementAt3D((Allocation*)a.p, DT, VS, x, y, z);         \
-        if (r != NULL) ((T *)r)[0] = *val;                               \
+        void *r = ElementAt3D((Allocation*)a.p, DT, VS, x, y, z);       \
+        if (r != nullptr) ((T *)r)[0] = *val;                           \
         else ALOGE("Error from %s", __PRETTY_FUNCTION__);               \
     }                                                                   \
     static void SC_GetElementAt1_##T(android::renderscript::rs_allocation a, T *val, uint32_t x) {                  \
-        void *r = ElementAt1D((Allocation*)a.p, DT, VS, x);               \
-        if (r != NULL) *val = ((T *)r)[0];                              \
-        else ALOGE("Error from %s", __PRETTY_FUNCTION__);                    \
+        void *r = ElementAt1D((Allocation*)a.p, DT, VS, x);             \
+        if (r != nullptr) *val = ((T *)r)[0];                           \
+        else ALOGE("Error from %s", __PRETTY_FUNCTION__);               \
     }                                                                   \
     static void SC_GetElementAt2_##T(android::renderscript::rs_allocation a, T *val, uint32_t x, uint32_t y) {      \
-        void *r = ElementAt2D((Allocation*)a.p, DT, VS, x, y);            \
-        if (r != NULL) *val = ((T *)r)[0];                              \
-        else ALOGE("Error from %s", __PRETTY_FUNCTION__);                    \
-    }                                                                   \
+        void *r = ElementAt2D((Allocation*)a.p, DT, VS, x, y);           \
+        if (r != nullptr) *val = ((T *)r)[0];                            \
+        else ALOGE("Error from %s", __PRETTY_FUNCTION__);                \
+    }                                                                    \
     static void SC_GetElementAt3_##T(android::renderscript::rs_allocation a, T *val, uint32_t x, uint32_t y, uint32_t z) { \
-        void *r = ElementAt3D((Allocation*)a.p, DT, VS, x, y, z);         \
-        if (r != NULL) *val = ((T *)r)[0];                              \
-        else ALOGE("Error from %s", __PRETTY_FUNCTION__);                    \
+        void *r = ElementAt3D((Allocation*)a.p, DT, VS, x, y, z);        \
+        if (r != nullptr) *val = ((T *)r)[0];                            \
+        else ALOGE("Error from %s", __PRETTY_FUNCTION__);                \
     }
 
 ELEMENT_AT(char, RS_TYPE_SIGNED_8, 1)
@@ -1367,7 +1370,7 @@
     { "_Z9rsgFinishv", (void *)&SC_Finish, false },
 #endif
 
-    { NULL, NULL, false }
+    { nullptr, nullptr, false }
 };
 
 #ifdef RS_COMPATIBILITY_LIB
@@ -1378,7 +1381,7 @@
 
 #define IS_CLEAR_SET_OBJ(t) \
     bool rsIsObject(t src) { \
-        return src.p != NULL; \
+        return src.p != nullptr; \
     } \
     void __attribute__((overloadable)) rsClearObject(t *dst) { \
         return SC_ClearObject(reinterpret_cast<rs_object_base *>(dst)); \
@@ -1398,7 +1401,8 @@
                            ::rs_allocation in,
                            ::rs_allocation out) {
     Context *rsc = RsdCpuReference::getTlsContext();
-    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p, NULL, 0, NULL);
+    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p,
+               nullptr, 0, nullptr);
 }
 
 static void SC_ForEach_SAAUS(::rs_script target,
@@ -1407,7 +1411,8 @@
                              const void *usr,
                              const RsScriptCall *call) {
     Context *rsc = RsdCpuReference::getTlsContext();
-    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p, usr, 0, call);
+    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p,
+               usr, 0, call);
 }
 
 static void SC_ForEach_SAAUL(::rs_script target,
@@ -1416,7 +1421,8 @@
                              const void *usr,
                              uint32_t usrLen) {
     Context *rsc = RsdCpuReference::getTlsContext();
-    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p, usr, usrLen, NULL);
+    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p,
+               usr, usrLen, nullptr);
 }
 
 static void SC_ForEach_SAAULS(::rs_script target,
@@ -1426,7 +1432,8 @@
                               uint32_t usrLen,
                               const RsScriptCall *call) {
     Context *rsc = RsdCpuReference::getTlsContext();
-    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p, usr, usrLen, call);
+    rsrForEach(rsc, (Script*)target.p, (Allocation*)in.p, (Allocation*)out.p,
+               usr, usrLen, call);
 }
 
 const Allocation * rsGetAllocation(const void *ptr) {
@@ -1897,7 +1904,7 @@
 extern const RsdCpuReference::CpuSymbol * rsdLookupRuntimeStub(Context * pContext, char const* name) {
     ScriptC *s = (ScriptC *)pContext;
     const RsdCpuReference::CpuSymbol *syms = gSyms;
-    const RsdCpuReference::CpuSymbol *sym = NULL;
+    const RsdCpuReference::CpuSymbol *sym = nullptr;
 
     if (!sym) {
         while (syms->fnPtr) {
@@ -1908,5 +1915,5 @@
         }
     }
 
-    return NULL;
+    return nullptr;
 }
diff --git a/driver/rsdSampler.cpp b/driver/rsdSampler.cpp
index 1a72fd4..28b594f 100644
--- a/driver/rsdSampler.cpp
+++ b/driver/rsdSampler.cpp
@@ -47,13 +47,13 @@
 {
     obj->p = alloc;
 #ifdef __LP64__
-    obj->r = NULL;
-    if (alloc != NULL) {
+    obj->r = nullptr;
+    if (alloc != nullptr) {
         obj->v1 = alloc->mHal.drv;
     } else {
-        obj->v1 = NULL;
+        obj->v1 = nullptr;
     }
-    obj->v2 = NULL;
+    obj->v2 = nullptr;
 #endif
 }
 
diff --git a/driver/rsdScriptGroup.cpp b/driver/rsdScriptGroup.cpp
index 6162c11..a7b2e77 100644
--- a/driver/rsdScriptGroup.cpp
+++ b/driver/rsdScriptGroup.cpp
@@ -32,7 +32,7 @@
     RsdHal *dc = (RsdHal *)rsc->mHal.drv;
 
     sg->mHal.drv = dc->mCpuRef->createScriptGroup(sg);
-    return sg->mHal.drv != NULL;
+    return sg->mHal.drv != nullptr;
 }
 
 void rsdScriptGroupSetInput(const Context *rsc, const ScriptGroup *sg,
@@ -59,13 +59,13 @@
 {
     obj->p = sg;
 #ifdef __LP64__
-    obj->r = NULL;
-    if (sg != NULL) {
+    obj->r = nullptr;
+    if (sg != nullptr) {
         obj->v1 = sg->mHal.drv;
     } else {
-        obj->v1 = NULL;
+        obj->v1 = nullptr;
     }
-    obj->v2 = NULL;
+    obj->v2 = nullptr;
 #endif
 }
 
diff --git a/driver/rsdShader.cpp b/driver/rsdShader.cpp
index d1a486b..7511883 100644
--- a/driver/rsdShader.cpp
+++ b/driver/rsdShader.cpp
@@ -65,16 +65,16 @@
     mAttribCount = 0;
     mUniformCount = 0;
 
-    mAttribNames = NULL;
-    mUniformNames = NULL;
-    mUniformArraySizes = NULL;
-    mCurrentState = NULL;
+    mAttribNames = nullptr;
+    mUniformNames = nullptr;
+    mUniformArraySizes = nullptr;
+    mCurrentState = nullptr;
 
     mIsValid = false;
 }
 
 RsdShader::StateBasedKey *RsdShader::getExistingState() {
-    RsdShader::StateBasedKey *returnKey = NULL;
+    RsdShader::StateBasedKey *returnKey = nullptr;
 
     for (uint32_t i = 0; i < mStateBasedShaders.size(); i ++) {
         returnKey = mStateBasedShaders[i];
@@ -92,7 +92,7 @@
                 texType = GL_TEXTURE_CUBE_MAP;
             }
             if (texType != returnKey->mTextureTargets[ct]) {
-                returnKey = NULL;
+                returnKey = nullptr;
                 break;
             }
         }
@@ -102,7 +102,7 @@
 
 uint32_t RsdShader::getStateBasedShaderID(const Context *rsc) {
     StateBasedKey *state = getExistingState();
-    if (state != NULL) {
+    if (state != nullptr) {
         mCurrentState = state;
         return mCurrentState->mShaderID;
     }
@@ -121,7 +121,7 @@
     uint32_t uniformCount = 0;
     for (uint32_t ct=0; ct < mRSProgram->mHal.state.inputElementsCount; ct++) {
         initAddUserElement(mRSProgram->mHal.state.inputElements[ct], mAttribNames,
-                           NULL, &attribCount, RS_SHADER_ATTR);
+                           nullptr, &attribCount, RS_SHADER_ATTR);
     }
     for (uint32_t ct=0; ct < mRSProgram->mHal.state.constantsCount; ct++) {
         initAddUserElement(mRSProgram->mHal.state.constantTypes[ct]->getElement(),
@@ -243,7 +243,7 @@
 
     if (mCurrentState->mShaderID) {
         const char * ss = mShader.c_str();
-        RSD_CALL_GL(glShaderSource, mCurrentState->mShaderID, 1, &ss, NULL);
+        RSD_CALL_GL(glShaderSource, mCurrentState->mShaderID, 1, &ss, nullptr);
         RSD_CALL_GL(glCompileShader, mCurrentState->mShaderID);
 
         GLint compiled = 0;
@@ -254,7 +254,7 @@
             if (infoLen) {
                 char* buf = (char*) malloc(infoLen);
                 if (buf) {
-                    RSD_CALL_GL(glGetShaderInfoLog, mCurrentState->mShaderID, infoLen, NULL, buf);
+                    RSD_CALL_GL(glGetShaderInfoLog, mCurrentState->mShaderID, infoLen, nullptr, buf);
                     rsc->setError(RS_ERROR_FATAL_PROGRAM_LINK, buf);
                     free(buf);
                 }
diff --git a/driver/rsdShaderCache.cpp b/driver/rsdShaderCache.cpp
index 0e36b49..608922c 100644
--- a/driver/rsdShaderCache.cpp
+++ b/driver/rsdShaderCache.cpp
@@ -166,7 +166,7 @@
             if (bufLength) {
                 char* buf = (char*) malloc(bufLength);
                 if (buf) {
-                    glGetProgramInfoLog(pgm, bufLength, NULL, buf);
+                    glGetProgramInfoLog(pgm, bufLength, nullptr, buf);
                     rsc->setError(RS_ERROR_FATAL_PROGRAM_LINK, buf);
                     free(buf);
                 }
@@ -189,7 +189,7 @@
         populateUniformData(frag, pgm, e->fragUniforms);
 
         // Only populate this list if we have arrays in our uniforms
-        UniformQueryData **uniformList = NULL;
+        UniformQueryData **uniformList = nullptr;
         GLint numUniforms = 0;
         bool hasArrays = hasArrayUniforms(vtx, frag);
         if (hasArrays) {
@@ -221,12 +221,12 @@
                                uniformList, (uint32_t)numUniforms);
 
         // Clean up the uniform data from GL
-        if (uniformList != NULL) {
+        if (uniformList != nullptr) {
             for (uint32_t ct = 0; ct < (uint32_t)numUniforms; ct++) {
                 delete uniformList[ct];
             }
             delete[] uniformList;
-            uniformList = NULL;
+            uniformList = nullptr;
         }
     }
 
diff --git a/driver/rsdShaderCache.h b/driver/rsdShaderCache.h
index 9b45092..de195e6 100644
--- a/driver/rsdShaderCache.h
+++ b/driver/rsdShaderCache.h
@@ -78,16 +78,16 @@
         int32_t arraySize;
         uint32_t type;
         UniformQueryData(uint32_t maxName) {
-            name = NULL;
+            name = nullptr;
             nameLength = maxName;
             if (nameLength > 0 ) {
                 name = new char[nameLength];
             }
         }
         ~UniformQueryData() {
-            if (name != NULL) {
+            if (name != nullptr) {
                 delete[] name;
-                name = NULL;
+                name = nullptr;
             }
         }
     };
@@ -119,19 +119,19 @@
         ~ProgramEntry() {
             if (vtxAttrs) {
                 delete[] vtxAttrs;
-                vtxAttrs = NULL;
+                vtxAttrs = nullptr;
             }
             if (vtxUniforms) {
                 delete[] vtxUniforms;
-                vtxUniforms = NULL;
+                vtxUniforms = nullptr;
             }
             if (fragUniforms) {
                 delete[] fragUniforms;
-                fragUniforms = NULL;
+                fragUniforms = nullptr;
             }
             if (fragUniformIsSTO) {
                 delete[] fragUniformIsSTO;
-                fragUniformIsSTO = NULL;
+                fragUniformIsSTO = nullptr;
             }
         }
         uint32_t vtx;
diff --git a/driver/rsdType.cpp b/driver/rsdType.cpp
index fa7b46c..869a86d 100644
--- a/driver/rsdType.cpp
+++ b/driver/rsdType.cpp
@@ -46,9 +46,9 @@
 {
     obj->p = t;
 #ifdef __LP64__
-    obj->r = NULL;
-    obj->v1 = NULL;
-    obj->v2 = NULL;
+    obj->r = nullptr;
+    obj->v1 = nullptr;
+    obj->v2 = nullptr;
 #endif
 }
 
diff --git a/driver/rsdVertexArray.cpp b/driver/rsdVertexArray.cpp
index d0a9b3e..c18a062 100644
--- a/driver/rsdVertexArray.cpp
+++ b/driver/rsdVertexArray.cpp
@@ -46,7 +46,7 @@
     type = 0;
     size = 0;
     stride = 0;
-    ptr = NULL;
+    ptr = nullptr;
     normalized = false;
     name = "";
 }
@@ -118,14 +118,14 @@
 }
 ////////////////////////////////////////////
 RsdVertexArrayState::RsdVertexArrayState() {
-    mAttrsEnabled = NULL;
+    mAttrsEnabled = nullptr;
     mAttrsEnabledSize = 0;
 }
 
 RsdVertexArrayState::~RsdVertexArrayState() {
     if (mAttrsEnabled) {
         delete[] mAttrsEnabled;
-        mAttrsEnabled = NULL;
+        mAttrsEnabled = nullptr;
     }
 }
 void RsdVertexArrayState::init(uint32_t maxAttrs) {
diff --git a/driver/runtime/rs_structs.h b/driver/runtime/rs_structs.h
index e35cd54..40f740a 100644
--- a/driver/runtime/rs_structs.h
+++ b/driver/runtime/rs_structs.h
@@ -275,7 +275,7 @@
             void **vertexBuffers;
             uint32_t vertexBuffersCount;
 
-            // indexBuffers[i] could be NULL, in which case only primitives[i] is used
+            // indexBuffers[i] could be nullptr, in which case only primitives[i] is used
             void **indexBuffers;
             uint32_t indexBuffersCount;
             rs_primitive *primitives;