@@ -73,27 +73,27 @@ GLenum rsdKindToGLFormat(RsDataKind k) {
7373}
7474
7575
76- static void Update2DTexture (const Allocation *alloc , const void *ptr, uint32_t xoff, uint32_t yoff ,
77- uint32_t lod, RsAllocationCubemapFace face ,
78- uint32_t w, uint32_t h) {
76+ static void Update2DTexture (const Context *rsc , const Allocation *alloc, const void *ptr ,
77+ uint32_t xoff, uint32_t yoff, uint32_t lod ,
78+ RsAllocationCubemapFace face, uint32_t w, uint32_t h) {
7979 DrvAllocation *drv = (DrvAllocation *)alloc->mHal .drv ;
8080
8181 rsAssert (drv->textureID );
82- glBindTexture ( drv->glTarget , drv->textureID );
83- glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 );
82+ RSD_CALL_GL (glBindTexture, drv->glTarget , drv->textureID );
83+ RSD_CALL_GL (glPixelStorei, GL_UNPACK_ALIGNMENT, 1 );
8484 GLenum t = GL_TEXTURE_2D;
8585 if (alloc->mHal .state .hasFaces ) {
8686 t = gFaceOrder [face];
8787 }
88- glTexSubImage2D ( t, lod, xoff, yoff, w, h, drv->glFormat , drv->glType , ptr);
88+ RSD_CALL_GL (glTexSubImage2D, t, lod, xoff, yoff, w, h, drv->glFormat , drv->glType , ptr);
8989}
9090
9191
9292static void Upload2DTexture (const Context *rsc, const Allocation *alloc, bool isFirstUpload) {
9393 DrvAllocation *drv = (DrvAllocation *)alloc->mHal .drv ;
9494
95- glBindTexture ( drv->glTarget , drv->textureID );
96- glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 );
95+ RSD_CALL_GL (glBindTexture, drv->glTarget , drv->textureID );
96+ RSD_CALL_GL (glPixelStorei, GL_UNPACK_ALIGNMENT, 1 );
9797
9898 uint32_t faceCount = 1 ;
9999 if (alloc->mHal .state .hasFaces ) {
@@ -112,12 +112,12 @@ static void Upload2DTexture(const Context *rsc, const Allocation *alloc, bool is
112112 }
113113
114114 if (isFirstUpload) {
115- glTexImage2D ( t, lod, drv->glFormat ,
115+ RSD_CALL_GL (glTexImage2D, t, lod, drv->glFormat ,
116116 alloc->mHal .state .type ->getLODDimX (lod),
117117 alloc->mHal .state .type ->getLODDimY (lod),
118118 0 , drv->glFormat , drv->glType , p);
119119 } else {
120- glTexSubImage2D ( t, lod, 0 , 0 ,
120+ RSD_CALL_GL (glTexSubImage2D, t, lod, 0 , 0 ,
121121 alloc->mHal .state .type ->getLODDimX (lod),
122122 alloc->mHal .state .type ->getLODDimY (lod),
123123 drv->glFormat , drv->glType , p);
@@ -126,7 +126,7 @@ static void Upload2DTexture(const Context *rsc, const Allocation *alloc, bool is
126126 }
127127
128128 if (alloc->mHal .state .mipmapControl == RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE) {
129- glGenerateMipmap ( drv->glTarget );
129+ RSD_CALL_GL (glGenerateMipmap, drv->glTarget );
130130 }
131131 rsdGLCheckError (rsc, " Upload2DTexture" );
132132}
@@ -145,7 +145,7 @@ static void UploadToTexture(const Context *rsc, const Allocation *alloc) {
145145 bool isFirstUpload = false ;
146146
147147 if (!drv->textureID ) {
148- glGenTextures ( 1 , &drv->textureID );
148+ RSD_CALL_GL (glGenTextures, 1 , &drv->textureID );
149149 isFirstUpload = true ;
150150 }
151151
@@ -168,16 +168,16 @@ static void AllocateRenderTarget(const Context *rsc, const Allocation *alloc) {
168168 }
169169
170170 if (!drv->renderTargetID ) {
171- glGenRenderbuffers ( 1 , &drv->renderTargetID );
171+ RSD_CALL_GL (glGenRenderbuffers, 1 , &drv->renderTargetID );
172172
173173 if (!drv->renderTargetID ) {
174174 // This should generally not happen
175175 LOGE (" allocateRenderTarget failed to gen mRenderTargetID" );
176176 rsc->dumpDebug ();
177177 return ;
178178 }
179- glBindRenderbuffer ( GL_RENDERBUFFER, drv->renderTargetID );
180- glRenderbufferStorage ( GL_RENDERBUFFER, drv->glFormat ,
179+ RSD_CALL_GL (glBindRenderbuffer, GL_RENDERBUFFER, drv->renderTargetID );
180+ RSD_CALL_GL (glRenderbufferStorage, GL_RENDERBUFFER, drv->glFormat ,
181181 alloc->mHal .state .dimensionX , alloc->mHal .state .dimensionY );
182182 }
183183 rsdGLCheckError (rsc, " AllocateRenderTarget" );
@@ -192,17 +192,17 @@ static void UploadToBufferObject(const Context *rsc, const Allocation *alloc) {
192192 // alloc->mHal.state.usageFlags |= RS_ALLOCATION_USAGE_GRAPHICS_VERTEX;
193193
194194 if (!drv->bufferID ) {
195- glGenBuffers ( 1 , &drv->bufferID );
195+ RSD_CALL_GL (glGenBuffers, 1 , &drv->bufferID );
196196 }
197197 if (!drv->bufferID ) {
198198 LOGE (" Upload to buffer object failed" );
199199 drv->uploadDeferred = true ;
200200 return ;
201201 }
202- glBindBuffer ( drv->glTarget , drv->bufferID );
203- glBufferData ( drv->glTarget , alloc->mHal .state .type ->getSizeBytes (),
202+ RSD_CALL_GL (glBindBuffer, drv->glTarget , drv->bufferID );
203+ RSD_CALL_GL (glBufferData, drv->glTarget , alloc->mHal .state .type ->getSizeBytes (),
204204 drv->mallocPtr , GL_DYNAMIC_DRAW);
205- glBindBuffer ( drv->glTarget , 0 );
205+ RSD_CALL_GL (glBindBuffer, drv->glTarget , 0 );
206206 rsdGLCheckError (rsc, " UploadToBufferObject" );
207207}
208208
@@ -261,11 +261,11 @@ void rsdAllocationDestroy(const Context *rsc, Allocation *alloc) {
261261 // mBufferID = 0;
262262 }
263263 if (drv->textureID ) {
264- glDeleteTextures ( 1 , &drv->textureID );
264+ RSD_CALL_GL (glDeleteTextures, 1 , &drv->textureID );
265265 drv->textureID = 0 ;
266266 }
267267 if (drv->renderTargetID ) {
268- glDeleteRenderbuffers ( 1 , &drv->renderTargetID );
268+ RSD_CALL_GL (glDeleteRenderbuffers, 1 , &drv->renderTargetID );
269269 drv->renderTargetID = 0 ;
270270 }
271271
@@ -323,7 +323,7 @@ static void rsdAllocationSyncFromFBO(const Context *rsc, const Allocation *alloc
323323 drv->readBackFBO ->setActive (rsc);
324324
325325 // Do the readback
326- glReadPixels ( 0 , 0 , alloc->getType ()->getDimX (), alloc->getType ()->getDimY (),
326+ RSD_CALL_GL (glReadPixels, 0 , 0 , alloc->getType ()->getDimX (), alloc->getType ()->getDimY (),
327327 drv->glFormat , drv->glType , alloc->getPtr ());
328328
329329 // Revert framebuffer to its original
@@ -414,7 +414,7 @@ void rsdAllocationData2D(const Context *rsc, const Allocation *alloc,
414414 }
415415 drv->uploadDeferred = true ;
416416 } else {
417- Update2DTexture (alloc, data, xoff, yoff, lod, face, w, h);
417+ Update2DTexture (rsc, alloc, data, xoff, yoff, lod, face, w, h);
418418 }
419419}
420420
0 commit comments