DXGL r474 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r473‎ | r474 | r475 >
Date:23:18, 30 July 2014
Author:admin
Status:new
Tags:
Comment:
Add error checking when creating new textures, and re-enable RGB565 internal format.
Modified paths:
  • /ddraw/TextureManager.c (modified) (history)
  • /ddraw/TextureManager.h (modified) (history)
  • /ddraw/glRenderer.cpp (modified) (history)

Diff [purge]

Index: ddraw/TextureManager.c
@@ -46,6 +46,14 @@
4747 static const int END_TEXFORMATS = __LINE__ - 4;
4848 int numtexformats;
4949
 50+void ClearError()
 51+{
 52+ do
 53+ {
 54+ if (glGetError() == GL_NO_ERROR) break;
 55+ } while (1);
 56+}
 57+
5058 TextureManager *TextureManager_Create(glExtensions *glext)
5159 {
5260 TextureManager *newtex;
@@ -67,9 +75,9 @@
6876 {
6977 TextureManager_DeleteTexture(This, texture);
7078 }
71 -void TextureManager__UploadTexture(TextureManager *This, TEXTURE *texture, int level, const void *data, int width, int height)
 79+void TextureManager__UploadTexture(TextureManager *This, TEXTURE *texture, int level, const void *data, int width, int height, BOOL checkerror)
7280 {
73 - TextureManager_UploadTextureClassic(This, texture, level, data, width, height);
 81+ TextureManager_UploadTextureClassic(This, texture, level, data, width, height, checkerror);
7482 }
7583 void TextureManager__DownloadTexture(TextureManager *This, TEXTURE *texture, int level, void *data)
7684 {
@@ -111,6 +119,7 @@
112120 {
113121 int texformat = -1;
114122 int i;
 123+ GLenum error;
115124 texture->pixelformat.dwSize = sizeof(DDPIXELFORMAT);
116125 for(i = 0; i < numtexformats; i++)
117126 {
@@ -120,6 +129,7 @@
121130 break;
122131 }
123132 }
 133+ ZeroMemory(texture->internalformats, 8 * sizeof(GLint));
124134 switch(texformat)
125135 {
126136 case -1:
@@ -126,44 +136,50 @@
127137 case 0: // 8-bit palette
128138 if(This->ext->glver_major >= 3)
129139 {
130 - texture->internalformat = GL_R8;
 140+ texture->internalformats[0] = GL_R8;
131141 texture->format = GL_RED;
132142 }
133143 else
134144 {
135 - texture->internalformat = GL_RGBA8;
 145+ texture->internalformats[0] = GL_RGBA8;
136146 texture->format = GL_LUMINANCE;
137147 }
138148 texture->type = GL_UNSIGNED_BYTE;
139149 break;
140150 case 1: // 8-bit RGB332
141 - texture->internalformat = GL_R3_G3_B2;
 151+ texture->internalformats[0] = GL_R3_G3_B2;
 152+ texture->internalformats[1] = GL_RGB8;
 153+ texture->internalformats[2] = GL_RGBA8;
142154 texture->format = GL_RGB;
143155 texture->type = GL_UNSIGNED_BYTE_3_3_2;
144156 break;
145157 case 2: // 16-bit RGB555
146 - texture->internalformat = GL_RGB5_A1;
 158+ texture->internalformats[0] = GL_RGB5_A1;
 159+ texture->internalformats[1] = GL_RGB8;
 160+ texture->internalformats[2] = GL_RGBA8;
147161 texture->format = GL_BGRA;
148162 texture->type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
149163 break;
150164 case 3: // 16-bit RGB565
151 - /*if(GLEXT_ARB_ES2_compatibility) texture->internalformat = GL_RGB565;
152 - else */texture->internalformat = GL_RGBA8;
 165+ texture->internalformats[0] = GL_RGB565;
 166+ texture->internalformats[1] = GL_RGB8;
 167+ texture->internalformats[2] = GL_RGBA8;
153168 texture->format = GL_RGB;
154169 texture->type = GL_UNSIGNED_SHORT_5_6_5;
155170 break;
156171 case 4: // 24-bit RGB888
157 - texture->internalformat = GL_RGB8;
 172+ texture->internalformats[0] = GL_RGB8;
 173+ texture->internalformats[1] = GL_RGBA8;
158174 texture->format = GL_BGR;
159175 texture->type = GL_UNSIGNED_BYTE;
160176 break;
161177 case 5: // 32-bit RGB888
162 - texture->internalformat = GL_RGBA8;
 178+ texture->internalformats[0] = GL_RGBA8;
163179 texture->format = GL_BGRA;
164180 texture->type = GL_UNSIGNED_INT_8_8_8_8_REV;
165181 break;
166182 case 6: // 32-bit BGR888
167 - texture->internalformat = GL_RGBA8;
 183+ texture->internalformats[0] = GL_RGBA8;
168184 texture->format = GL_RGBA;
169185 texture->type = GL_UNSIGNED_INT_8_8_8_8_REV;
170186 break;
@@ -171,62 +187,66 @@
172188 FIXME("Unusual texture format RGBA8332 not supported");
173189 break;
174190 case 8: // 16-bit RGBA4444
175 - texture->internalformat = GL_RGBA4;
 191+ texture->internalformats[0] = GL_RGBA4;
 192+ texture->internalformats[1] = GL_RGBA8;
176193 texture->format = GL_BGRA;
177194 texture->type = GL_UNSIGNED_SHORT_4_4_4_4_REV;
178195 break;
179196 case 9: // 16-bit RGBA1555
180 - texture->internalformat = GL_RGB5_A1;
 197+ texture->internalformats[0] = GL_RGB5_A1;
181198 texture->format = GL_BGRA;
182199 texture->type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
183200 break;
184201 case 10: // 32-bit RGBA8888
185 - texture->internalformat = GL_RGBA8;
 202+ texture->internalformats[0] = GL_RGBA8;
186203 texture->format = GL_BGRA;
187204 texture->type = GL_UNSIGNED_INT_8_8_8_8_REV;
188205 break;
189206 case 11: // 8-bit Luminance
190 - texture->internalformat = GL_LUMINANCE8;
 207+ texture->internalformats[0] = GL_LUMINANCE8;
 208+ texture->internalformats[1] = GL_RGB8;
 209+ texture->internalformats[2] = GL_RGBA8;
191210 texture->format = GL_LUMINANCE;
192211 texture->type = GL_UNSIGNED_BYTE;
193212 break;
194213 case 12: // 8-bit Alpha
195 - texture->internalformat = GL_ALPHA8;
 214+ texture->internalformats[0] = GL_ALPHA8;
196215 texture->format = GL_ALPHA;
197216 texture->type = GL_UNSIGNED_BYTE;
198217 break;
199218 case 13: // 16-bit Luminance Alpha
200 - texture->internalformat = GL_LUMINANCE8_ALPHA8;
 219+ texture->internalformats[0] = GL_LUMINANCE8_ALPHA8;
 220+ texture->internalformats[1] = GL_RGBA8;
201221 texture->format = GL_LUMINANCE_ALPHA;
202222 texture->type = GL_UNSIGNED_BYTE;
203223 break;
204224 case 14: // 16-bit Z buffer
205 - texture->internalformat = GL_DEPTH_COMPONENT16;
 225+ texture->internalformats[0] = GL_DEPTH_COMPONENT16;
206226 texture->format = GL_DEPTH_COMPONENT;
207227 texture->type = GL_UNSIGNED_SHORT;
208228 break;
209229 case 15: // 24-bit Z buffer
210 - texture->internalformat = GL_DEPTH_COMPONENT24;
 230+ texture->internalformats[0] = GL_DEPTH_COMPONENT24;
211231 texture->format = GL_DEPTH_COMPONENT;
212232 texture->type = GL_UNSIGNED_INT;
213233 break;
214234 case 16: // 32/24 bit Z buffer
215 - texture->internalformat = GL_DEPTH_COMPONENT24;
 235+ texture->internalformats[0] = GL_DEPTH_COMPONENT24;
216236 texture->format = GL_DEPTH_COMPONENT;
217237 texture->type = GL_UNSIGNED_INT;
218238 break;
219239 case 17: // 32-bit Z buffer
220 - texture->internalformat = GL_DEPTH_COMPONENT32;
 240+ texture->internalformats[0] = GL_DEPTH_COMPONENT32;
221241 texture->format = GL_DEPTH_COMPONENT;
222242 texture->type = GL_UNSIGNED_INT;
223243 break;
224244 case 18: // 32-bit Z/Stencil buffer, depth LSB
225 - texture->internalformat = GL_DEPTH24_STENCIL8;
 245+ texture->internalformats[0] = GL_DEPTH24_STENCIL8;
226246 texture->format = GL_DEPTH_STENCIL;
227247 texture->type = GL_UNSIGNED_INT_24_8;
228248 break;
229249 case 19: // 32-bit Z/Stencil buffer, depth MSB
230 - texture->internalformat = GL_DEPTH24_STENCIL8;
 250+ texture->internalformats[0] = GL_DEPTH24_STENCIL8;
231251 texture->format = GL_DEPTH_STENCIL;
232252 texture->type = GL_UNSIGNED_INT_24_8;
233253 break;
@@ -235,7 +255,23 @@
236256 texture->height = height;
237257 glGenTextures(1,&texture->id);
238258 TextureManager_SetTexture(This,0,texture);
239 - glTexImage2D(GL_TEXTURE_2D,0,texture->internalformat,texture->width,texture->height,0,texture->format,texture->type,NULL);
 259+ do
 260+ {
 261+ ClearError();
 262+ glTexImage2D(GL_TEXTURE_2D, 0, texture->internalformats[0], texture->width, texture->height, 0, texture->format, texture->type, NULL);
 263+ error = glGetError();
 264+ if (error != GL_NO_ERROR)
 265+ {
 266+ if (texture->internalformats[1] == 0)
 267+ {
 268+ FIXME("Failed to create texture, cannot find internal format");
 269+ break;
 270+ }
 271+ memmove(&texture->internalformats[0], &texture->internalformats[1], 7 * sizeof(GLint));
 272+ texture->internalformats[7] = 0;
 273+ }
 274+ else break;
 275+ } while (1);
240276 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,texture->minfilter);
241277 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,texture->magfilter);
242278 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,texture->wraps);
@@ -245,23 +281,55 @@
246282 void TextureManager_DeleteTexture(TextureManager *This, TEXTURE *texture)
247283 {
248284 glDeleteTextures(1,&texture->id);
249 - texture->bordercolor = texture->format = texture->internalformat =
250 - texture->type = texture->width = texture->height = texture->magfilter =
251 - texture->minfilter = texture->miplevel = texture->wraps = texture->wrapt =
 285+ texture->bordercolor = texture->format = texture->type = texture->width =
 286+ texture->height = texture->magfilter = texture->minfilter =
 287+ texture->miplevel = texture->wraps = texture->wrapt =
252288 texture->pbo = texture->id = 0;
 289+ ZeroMemory(texture->internalformats, 8 * sizeof(GLint));
253290 }
254291
255 -void TextureManager_UploadTextureClassic(TextureManager *This, TEXTURE *texture, int level, const void *data, int width, int height)
 292+void TextureManager_UploadTextureClassic(TextureManager *This, TEXTURE *texture, int level, const void *data, int width, int height, BOOL checkerror)
256293 {
 294+ GLenum error;
257295 texture->width = width;
258296 texture->height = height;
259 - if(This->ext->GLEXT_EXT_direct_state_access) This->ext->glTextureImage2DEXT(texture->id,GL_TEXTURE_2D,level,texture->internalformat,
260 - width,height,0,texture->format,texture->type,data);
 297+ if (checkerror)
 298+ {
 299+ do
 300+ {
 301+ ClearError();
 302+ if (This->ext->GLEXT_EXT_direct_state_access) This->ext->glTextureImage2DEXT(texture->id, GL_TEXTURE_2D, level, texture->internalformats[0],
 303+ width, height, 0, texture->format, texture->type, data);
 304+ else
 305+ {
 306+ TextureManager_SetActiveTexture(This, 0);
 307+ TextureManager_SetTexture(This, 0, texture);
 308+ glTexImage2D(GL_TEXTURE_2D, level, texture->internalformats[0], width, height, 0, texture->format, texture->type, data);
 309+ }
 310+ error = glGetError();
 311+ if (error != GL_NO_ERROR)
 312+ {
 313+ if (texture->internalformats[1] == 0)
 314+ {
 315+ FIXME("Failed to update texture, cannot find internal format");
 316+ break;
 317+ }
 318+ memmove(&texture->internalformats[0], &texture->internalformats[1], 7 * sizeof(GLint));
 319+ texture->internalformats[7] = 0;
 320+ }
 321+ else break;
 322+ } while (1);
 323+ }
261324 else
262325 {
263 - TextureManager_SetActiveTexture(This, 0);
264 - TextureManager_SetTexture(This, 0,texture);
265 - glTexImage2D(GL_TEXTURE_2D,level,texture->internalformat,width,height,0,texture->format,texture->type,data);
 326+ if (This->ext->GLEXT_EXT_direct_state_access) This->ext->glTextureImage2DEXT(texture->id, GL_TEXTURE_2D, level, texture->internalformats[0],
 327+ width, height, 0, texture->format, texture->type, data);
 328+ else
 329+ {
 330+ TextureManager_SetActiveTexture(This, 0);
 331+ TextureManager_SetTexture(This, 0, texture);
 332+ glTexImage2D(GL_TEXTURE_2D, level, texture->internalformats[0], width, height, 0, texture->format, texture->type, data);
 333+ }
266334 }
267335 }
268336
@@ -298,200 +366,3 @@
299367 glBindTexture(GL_TEXTURE_2D,texname);
300368 }
301369 }
302 -
303 -
304 -
305 -/* old code
306 - if(ddsd.ddpfPixelFormat.dwFlags & DDPF_RGB)
307 - {
308 - switch(ddsd.ddpfPixelFormat.dwRGBBitCount)
309 - {
310 - case 8:
311 - if(ddsd.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)
312 - {
313 - texformat = GL_LUMINANCE;
314 - texformat2 = GL_UNSIGNED_BYTE;
315 - if(dxglcfg.texformat) texformat3 = GL_LUMINANCE8;
316 - else texformat3 = GL_RGBA8;
317 - if(!palettein) palette = new glDirectDrawPalette(DDPCAPS_8BIT|DDPCAPS_ALLOW256|DDPCAPS_PRIMARYSURFACE,NULL,NULL);
318 - bitmapinfo->bmiHeader.biBitCount = 8;
319 - }
320 - else
321 - {
322 - texformat = GL_RGB;
323 - texformat2 = GL_UNSIGNED_BYTE_3_3_2;
324 - if(dxglcfg.texformat) texformat3 = GL_R3_G3_B2;
325 - else texformat3 = GL_RGBA8;
326 - }
327 - ddsd.ddpfPixelFormat.dwRBitMask = 0;
328 - ddsd.ddpfPixelFormat.dwGBitMask = 0;
329 - ddsd.ddpfPixelFormat.dwBBitMask = 0;
330 - ddsd.lPitch = NextMultipleOfWord(ddsd.dwWidth);
331 - break;
332 - case 16:
333 - if((ddsd.ddpfPixelFormat.dwRBitMask == 0x7C00) && (ddsd.ddpfPixelFormat.dwGBitMask == 0x3E0)
334 - && (ddsd.ddpfPixelFormat.dwBBitMask == 0x1F))
335 - {
336 - texformat = GL_BGRA;
337 - texformat2 = GL_UNSIGNED_SHORT_1_5_5_5_REV;
338 - if(dxglcfg.texformat) texformat3 = GL_RGB5_A1;
339 - else texformat3 = GL_RGBA8;
340 - }
341 - else // fixme: support more formats
342 - {
343 - texformat = GL_RGB;
344 - texformat2 = GL_UNSIGNED_SHORT_5_6_5;
345 - if(dxglcfg.texformat) texformat3 = GL_RGB;
346 - else texformat3 = GL_RGBA8;
347 - }
348 - ddsd.lPitch = NextMultipleOfWord(ddsd.dwWidth*2);
349 - break;
350 - case 24:
351 - if((ddsd.ddpfPixelFormat.dwRBitMask == 0xFF0000) && (ddsd.ddpfPixelFormat.dwGBitMask == 0xFF00)
352 - && (ddsd.ddpfPixelFormat.dwBBitMask == 0xFF))
353 - {
354 - texformat = GL_BGR;
355 - texformat2 = GL_UNSIGNED_BYTE;
356 - if(dxglcfg.texformat) texformat3 = GL_RGB8;
357 - else texformat3 = GL_RGBA8;
358 - }
359 - else // fixme: support more formats
360 - {
361 - texformat = GL_RGB;
362 - texformat2 = GL_UNSIGNED_BYTE;
363 - if(dxglcfg.texformat) texformat3 = GL_RGB8;
364 - else texformat3 = GL_RGBA8;
365 - }
366 - ddsd.lPitch = NextMultipleOfWord(ddsd.dwWidth*3);
367 - break;
368 - case 32:
369 - default:
370 - if((ddsd.ddpfPixelFormat.dwRBitMask == 0xFF0000) && (ddsd.ddpfPixelFormat.dwGBitMask == 0xFF00)
371 - && (ddsd.ddpfPixelFormat.dwBBitMask == 0xFF))
372 - {
373 - texformat = GL_BGRA;
374 - texformat2 = GL_UNSIGNED_INT_8_8_8_8_REV;
375 - texformat3 = GL_RGBA8;
376 - }
377 - else // fixme: support more formats
378 - {
379 - texformat = GL_RGBA;
380 - texformat2 = GL_UNSIGNED_BYTE;
381 - texformat3 = GL_RGBA8;
382 - }
383 - ddsd.lPitch = NextMultipleOfWord(ddsd.dwWidth*4);
384 - }
385 - }
386 - else if(ddsd.ddpfPixelFormat.dwFlags & DDPF_ZBUFFER)
387 - {
388 - switch(ddsd.ddpfPixelFormat.dwZBufferBitDepth)
389 - {
390 - case 16:
391 - default:
392 - texformat = GL_DEPTH_COMPONENT;
393 - texformat2 = GL_UNSIGNED_BYTE;
394 - texformat3 = GL_DEPTH_COMPONENT16;
395 - break;
396 - case 24:
397 - texformat = GL_DEPTH_COMPONENT;
398 - texformat2 = GL_UNSIGNED_BYTE;
399 - texformat3 = GL_DEPTH_COMPONENT24;
400 - break;
401 - case 32:
402 - if((ddsd.ddpfPixelFormat.dwRGBZBitMask == 0x00ffffff) &&
403 - !(ddsd.ddpfPixelFormat.dwFlags & DDPF_STENCILBUFFER))
404 - {
405 - texformat = GL_DEPTH_COMPONENT;
406 - texformat2 = GL_UNSIGNED_INT;
407 - texformat3 = GL_DEPTH_COMPONENT24;
408 - break;
409 - }
410 - else if(ddsd.ddpfPixelFormat.dwFlags & DDPF_STENCILBUFFER)
411 - {
412 - texformat = GL_DEPTH_STENCIL;
413 - texformat2 = GL_UNSIGNED_INT_24_8;
414 - texformat3 = GL_DEPTH24_STENCIL8;
415 - hasstencil = true;
416 - break;
417 - }
418 - else
419 - {
420 - texformat = GL_DEPTH_COMPONENT;
421 - texformat2 = GL_UNSIGNED_INT;
422 - texformat3 = GL_DEPTH_COMPONENT32;
423 - break;
424 - }
425 - }
426 - }
427 - }
428 -
429 -*/
430 -
431 -/*
432 - if(!(ddsd.dwFlags & DDSD_PIXELFORMAT))
433 - {
434 - ddsd.ddpfPixelFormat.dwRGBBitCount = ddInterface->GetBPP();
435 - switch(ddInterface->GetBPP())
436 - {
437 - case 8:
438 - texformat = GL_LUMINANCE;
439 - texformat2 = GL_UNSIGNED_BYTE;
440 - if(dxglcfg.texformat) texformat3 = GL_LUMINANCE8;
441 - else texformat3 = GL_RGBA8;
442 - ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8;
443 - ddsd.ddpfPixelFormat.dwRBitMask = 0;
444 - ddsd.ddpfPixelFormat.dwGBitMask = 0;
445 - ddsd.ddpfPixelFormat.dwBBitMask = 0;
446 - ddsd.lPitch = NextMultipleOfWord(ddsd.dwWidth);
447 - break;
448 - case 15:
449 - texformat = GL_BGRA;
450 - texformat2 = GL_UNSIGNED_SHORT_1_5_5_5_REV;
451 - if(dxglcfg.texformat) texformat3 = GL_RGB5_A1;
452 - else texformat3 = GL_RGBA8;
453 - ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
454 - ddsd.ddpfPixelFormat.dwRBitMask = 0x7C00;
455 - ddsd.ddpfPixelFormat.dwGBitMask = 0x3E0;
456 - ddsd.ddpfPixelFormat.dwBBitMask = 0x1F;
457 - ddsd.lPitch = NextMultipleOfWord(ddsd.dwWidth*2);
458 - ddsd.ddpfPixelFormat.dwRGBBitCount = 16;
459 - break;
460 - case 16:
461 - texformat = GL_RGB;
462 - texformat2 = GL_UNSIGNED_SHORT_5_6_5;
463 - if(dxglcfg.texformat) texformat3 = GL_RGB;
464 - else texformat3 = GL_RGBA8;
465 - ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
466 - ddsd.ddpfPixelFormat.dwRBitMask = 0xF800;
467 - ddsd.ddpfPixelFormat.dwGBitMask = 0x7E0;
468 - ddsd.ddpfPixelFormat.dwBBitMask = 0x1F;
469 - ddsd.lPitch = NextMultipleOfWord(ddsd.dwWidth*2);
470 - break;
471 - case 24:
472 - texformat = GL_BGR;
473 - texformat2 = GL_UNSIGNED_BYTE;
474 - if(dxglcfg.texformat) texformat3 = GL_RGB8;
475 - else texformat3 = GL_RGBA8;
476 - ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
477 - ddsd.ddpfPixelFormat.dwRBitMask = 0xFF0000;
478 - ddsd.ddpfPixelFormat.dwGBitMask = 0xFF00;
479 - ddsd.ddpfPixelFormat.dwBBitMask = 0xFF;
480 - ddsd.lPitch = NextMultipleOfWord(ddsd.dwWidth*3);
481 - break;
482 - case 32:
483 - texformat = GL_BGRA;
484 - texformat2 = GL_UNSIGNED_BYTE;
485 - texformat3 = GL_RGBA8;
486 - ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
487 - ddsd.ddpfPixelFormat.dwRBitMask = 0xFF0000;
488 - ddsd.ddpfPixelFormat.dwGBitMask = 0xFF00;
489 - ddsd.ddpfPixelFormat.dwBBitMask = 0xFF;
490 - ddsd.lPitch = NextMultipleOfWord(ddsd.dwWidth*4);
491 - break;
492 - default:
493 - *error = DDERR_INVALIDPIXELFORMAT;
494 - return;
495 - }
496 - }
497 -
498 -*/
\ No newline at end of file
Index: ddraw/TextureManager.h
@@ -34,7 +34,7 @@
3535 GLint wrapt;
3636 GLint miplevel;
3737 DWORD bordercolor;
38 - GLint internalformat;
 38+ GLint internalformats[8];
3939 GLenum format;
4040 GLenum type;
4141 GLuint pbo;
@@ -68,11 +68,11 @@
6969 void TextureManager_SetTexture(TextureManager *This, unsigned int level, TEXTURE *texture);
7070 void TextureManager__CreateTexture(TextureManager *This, TEXTURE *texture, int width, int height);
7171 void TextureManager__DeleteTexture(TextureManager *This, TEXTURE *texture);
72 -void TextureManager__UploadTexture(TextureManager *This, TEXTURE *texture, int level, const void *data, int width, int height);
 72+void TextureManager__UploadTexture(TextureManager *This, TEXTURE *texture, int level, const void *data, int width, int height, BOOL checkerror);
7373 void TextureManager__DownloadTexture(TextureManager *This, TEXTURE *texture, int level, void *data);
7474 void TextureManager_CreateTextureClassic(TextureManager *This, TEXTURE *texture, int width, int height);
7575 void TextureManager_DeleteTexture(TextureManager *This, TEXTURE *texture);
76 -void TextureManager_UploadTextureClassic(TextureManager *This, TEXTURE *texture, int level, const void *data, int width, int height);
 76+void TextureManager_UploadTextureClassic(TextureManager *This, TEXTURE *texture, int level, const void *data, int width, int height, BOOL checkerror);
7777 void TextureManager_DownloadTextureClassic(TextureManager *This, TEXTURE *texture, int level, void *data);
7878
7979 #ifdef __cplusplus
Index: ddraw/glRenderer.cpp
@@ -105,7 +105,7 @@
106106 if(bpp == 15) bpp = 16;
107107 if((x == bigx && y == bigy) || !bigbuffer)
108108 {
109 - TextureManager__UploadTexture(This->texman, texture, 0, buffer, x, y);
 109+ TextureManager__UploadTexture(This->texman, texture, 0, buffer, x, y, FALSE);
110110 }
111111 else
112112 {
@@ -125,7 +125,7 @@
126126 break;
127127 break;
128128 }
129 - TextureManager__UploadTexture(This->texman,texture,0,bigbuffer,bigx,bigy);
 129+ TextureManager__UploadTexture(This->texman, texture, 0, bigbuffer, bigx, bigy, FALSE);
130130 }
131131 }
132132
@@ -1171,7 +1171,7 @@
11721172 }
11731173 if((This->backx != x) || (This->backy != y))
11741174 {
1175 - TextureManager__UploadTexture(This->texman,This->backbuffer,0,NULL,x,y);
 1175+ TextureManager__UploadTexture(This->texman,This->backbuffer,0,NULL,x,y, FALSE);
11761176 This->backx = x;
11771177 This->backy = y;
11781178 }
@@ -1225,7 +1225,7 @@
12261226 {
12271227 if (This->backx > x) x = This->backx;
12281228 if (This->backx > y) y = This->backx;
1229 - TextureManager__UploadTexture(This->texman, This->backbuffer, 0, NULL, x, y);
 1229+ TextureManager__UploadTexture(This->texman, This->backbuffer, 0, NULL, x, y, FALSE);
12301230 This->backx = x;
12311231 This->backy = y;
12321232 }
@@ -1322,7 +1322,7 @@
13231323 {
13241324 This->shaders->SetShader(PROG_PAL256,NULL,NULL,0);
13251325 progtype = PROG_PAL256;
1326 - TextureManager__UploadTexture(This->texman,paltex,0,glDirectDrawPalette_GetPalette(dest->palette,NULL),256,1);
 1326+ TextureManager__UploadTexture(This->texman,paltex,0,glDirectDrawPalette_GetPalette(dest->palette,NULL),256,1,FALSE);
13271327 This->ext->glUniform1i(This->shaders->shaders[progtype].tex0,0);
13281328 This->ext->glUniform1i(This->shaders->shaders[progtype].pal,1);
13291329 TextureManager_SetTexture(This->texman,0,texture);
@@ -1864,7 +1864,7 @@
18651865 if ((surface->ddsd.dwWidth != surface->stencil->width) ||
18661866 (surface->ddsd.dwHeight != surface->stencil->height))
18671867 TextureManager__UploadTexture(This->texman, surface->stencil, 0, NULL,
1868 - surface->ddsd.dwWidth, surface->ddsd.dwHeight);
 1868+ surface->ddsd.dwWidth, surface->ddsd.dwHeight, FALSE);
18691869 This->util->SetFBO(&surface->stencilfbo, surface->stencil, 0, false);
18701870 view[0] = view[2] = 0;
18711871 view[1] = (GLfloat)surface->ddsd.dwWidth;