| Index: ddraw/BufferObject.cpp |
| — | — | @@ -1,5 +1,5 @@ |
| 2 | 2 | // DXGL
|
| 3 | | -// Copyright (C) 2015 William Feely
|
| | 3 | +// Copyright (C) 2015-2018 William Feely
|
| 4 | 4 |
|
| 5 | 5 | // This library is free software; you can redistribute it and/or
|
| 6 | 6 | // modify it under the terms of the GNU Lesser General Public
|
| — | — | @@ -7,7 +7,7 @@ |
| 8 | 8 | // version 2.1 of the License, or (at your option) any later version.
|
| 9 | 9 |
|
| 10 | 10 | // This library is distributed in the hope that it will be useful,
|
| 11 | | -// but WITHOUT ANY W ARRANTY; without even the implied warranty of
|
| | 11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | 13 | // Lesser General Public License for more details.
|
| 14 | 14 |
|
| — | — | @@ -33,6 +33,7 @@ |
| 34 | 34 | buffer->refcount = 1;
|
| 35 | 35 | buffer->ext = ext;
|
| 36 | 36 | buffer->util = util;
|
| | 37 | + buffer->size = 0;
|
| 37 | 38 | glUtil_AddRef(util);
|
| 38 | 39 | ext->glGenBuffers(1, &buffer->buffer);
|
| 39 | 40 | *out = buffer;
|
| — | — | @@ -56,7 +57,7 @@ |
| 57 | 58 |
|
| 58 | 59 | void BufferObject_SetData(BufferObject *This, GLenum target, GLsizeiptr size, GLvoid *data, GLenum usage)
|
| 59 | 60 | {
|
| 60 | | - if (This->ext->GLEXT_ARB_direct_state_access)
|
| | 61 | + /*if (This->ext->GLEXT_ARB_direct_state_access)
|
| 61 | 62 | {
|
| 62 | 63 | This->ext->glNamedBufferData(This->buffer, size, data, usage);
|
| 63 | 64 | }
|
| — | — | @@ -65,11 +66,11 @@ |
| 66 | 67 | This->ext->glNamedBufferDataEXT(This->buffer, size, data, usage);
|
| 67 | 68 | }
|
| 68 | 69 | else
|
| 69 | | - {
|
| | 70 | + {*/
|
| 70 | 71 | glUtil_BindBuffer(This->util, This, target);
|
| 71 | 72 | This->ext->glBufferData(target, size, data, usage);
|
| 72 | 73 | glUtil_UndoBindBuffer(This->util, target);
|
| 73 | | - }
|
| | 74 | + /*}*/
|
| 74 | 75 | }
|
| 75 | 76 |
|
| 76 | 77 | void BufferObject_Bind(BufferObject *This, GLenum target)
|
| — | — | @@ -84,7 +85,7 @@ |
| 85 | 86 | void *BufferObject_Map(BufferObject *This, GLenum target, GLenum access)
|
| 86 | 87 | {
|
| 87 | 88 | void *ptr;
|
| 88 | | - if (This->ext->GLEXT_ARB_direct_state_access)
|
| | 89 | + /*if (This->ext->GLEXT_ARB_direct_state_access)
|
| 89 | 90 | {
|
| 90 | 91 | ptr = This->ext->glMapNamedBuffer(This->buffer, access);
|
| 91 | 92 | }
|
| — | — | @@ -93,17 +94,17 @@ |
| 94 | 95 | ptr = This->ext->glMapNamedBufferEXT(This->buffer, access);
|
| 95 | 96 | }
|
| 96 | 97 | else
|
| 97 | | - {
|
| | 98 | + {*/
|
| 98 | 99 | glUtil_BindBuffer(This->util, This, target);
|
| 99 | 100 | ptr = This->ext->glMapBuffer(target, access);
|
| 100 | 101 | glUtil_UndoBindBuffer(This->util, target);
|
| 101 | | - }
|
| | 102 | + /*}*/
|
| 102 | 103 | return ptr;
|
| 103 | 104 | }
|
| 104 | 105 | GLboolean BufferObject_Unmap(BufferObject *This, GLenum target)
|
| 105 | 106 | {
|
| 106 | 107 | GLboolean ret;
|
| 107 | | - if (This->ext->GLEXT_ARB_direct_state_access)
|
| | 108 | + /*if (This->ext->GLEXT_ARB_direct_state_access)
|
| 108 | 109 | {
|
| 109 | 110 | ret = This->ext->glUnmapNamedBuffer(This->buffer);
|
| 110 | 111 | }
|
| — | — | @@ -112,11 +113,11 @@ |
| 113 | 114 | ret = This->ext->glUnmapNamedBufferEXT(This->buffer);
|
| 114 | 115 | }
|
| 115 | 116 | else
|
| 116 | | - {
|
| | 117 | + {*/
|
| 117 | 118 | glUtil_BindBuffer(This->util, This, target);
|
| 118 | 119 | ret = This->ext->glUnmapBuffer(target);
|
| 119 | 120 | glUtil_UndoBindBuffer(This->util, target);
|
| 120 | | - }
|
| | 121 | + /*}*/
|
| 121 | 122 | return ret;
|
| 122 | 123 | }
|
| 123 | 124 |
|
| Index: ddraw/glTexture.cpp |
| — | — | @@ -137,6 +137,8 @@ |
| 138 | 138 | ZeroMemory(newtexture, sizeof(glTexture));
|
| 139 | 139 | memcpy(&newtexture->levels[0].ddsd, ddsd, sizeof(DDSURFACEDESC2));
|
| 140 | 140 | newtexture->useconv = FALSE;
|
| | 141 | + newtexture->pboPack = NULL;
|
| | 142 | + newtexture->pboUnpack = NULL;
|
| 141 | 143 | if (bigwidth)
|
| 142 | 144 | {
|
| 143 | 145 | newtexture->bigwidth = bigwidth;
|
| — | — | @@ -425,9 +427,13 @@ |
| 426 | 428 | int bpp = This->levels[level].ddsd.ddpfPixelFormat.dwRGBBitCount;
|
| 427 | 429 | int x = This->levels[level].ddsd.dwWidth;
|
| 428 | 430 | int y = This->levels[level].ddsd.dwHeight;
|
| | 431 | + int i;
|
| 429 | 432 | int bigpitch = NextMultipleOf4((bpp / 8)*This->bigwidth);
|
| 430 | 433 | int pitch = This->levels[level].ddsd.lPitch;
|
| 431 | 434 | int bigx, bigy;
|
| | 435 | + int inpitch, outpitch;
|
| | 436 | + GLenum error;
|
| | 437 | + char *readbuffer;
|
| 432 | 438 | if (level)
|
| 433 | 439 | {
|
| 434 | 440 | bigx = This->levels[level].ddsd.dwWidth;
|
| — | — | @@ -438,46 +444,83 @@ |
| 439 | 445 | bigx = This->bigwidth;
|
| 440 | 446 | bigy = This->bigheight;
|
| 441 | 447 | }
|
| 442 | | - if ((bigx == x && bigy == y) || !This->levels[level].bigbuffer)
|
| | 448 | + if (This->useconv)
|
| 443 | 449 | {
|
| | 450 | + if ((bigx == x && bigy == y) || !This->levels[level].bigbuffer)
|
| | 451 | + {
|
| | 452 | + if (!This->pboPack)
|
| | 453 | + BufferObject_Create(&This->pboPack, This->renderer->ext, This->renderer->util);
|
| | 454 | + }
|
| | 455 | + else return; // Non-primary surfaces should not have scaling
|
| | 456 | + inpitch = NextMultipleOf4(This->levels[level].ddsd.dwWidth * This->internalsize);
|
| | 457 | + outpitch = NextMultipleOf4(This->levels[level].ddsd.dwHeight
|
| | 458 | + * (NextMultipleOf8(This->levels[level].ddsd.ddpfPixelFormat.dwRGBBitCount)/8));
|
| | 459 | + if (This->pboPack->size < inpitch * This->levels[level].ddsd.dwHeight)
|
| | 460 | + BufferObject_SetData(This->pboPack, GL_PIXEL_PACK_BUFFER,
|
| | 461 | + inpitch * This->levels[level].ddsd.dwHeight, NULL, GL_DYNAMIC_READ);
|
| | 462 | + BufferObject_Bind(This->pboPack, GL_PIXEL_PACK_BUFFER);
|
| 444 | 463 | if (This->renderer->ext->GLEXT_EXT_direct_state_access)
|
| 445 | | - This->renderer->ext->glGetTextureImageEXT(This->id, GL_TEXTURE_2D, level, This->format, This->type, This->levels[level].buffer);
|
| | 464 | + This->renderer->ext->glGetTextureImageEXT(This->id, GL_TEXTURE_2D, level, This->format, This->type, 0);
|
| 446 | 465 | else
|
| 447 | 466 | {
|
| 448 | 467 | glUtil_SetActiveTexture(This->renderer->util, 0);
|
| 449 | 468 | glUtil_SetTexture(This->renderer->util, 0, This);
|
| 450 | | - glGetTexImage(GL_TEXTURE_2D, level, This->format, This->type, This->levels[level].buffer);
|
| | 469 | + glGetTexImage(GL_TEXTURE_2D, level, This->format, This->type, 0);
|
| 451 | 470 | }
|
| | 471 | + BufferObject_Unbind(This->pboPack, GL_PIXEL_PACK_BUFFER);
|
| | 472 | + readbuffer = (char*)BufferObject_Map(This->pboPack, GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
|
| | 473 | + error = glGetError();
|
| | 474 | + if (error == GL_NO_ERROR)
|
| | 475 | + {
|
| | 476 | + for (i = 0; i < This->levels[level].ddsd.dwHeight; i++)
|
| | 477 | + colorconvproc[This->convfunctiondownload](This->levels[level].ddsd.dwWidth,
|
| | 478 | + This->levels[level].buffer + (i*outpitch), readbuffer + (i + inpitch));
|
| | 479 | + }
|
| | 480 | + BufferObject_Unmap(This->pboPack, GL_PIXEL_PACK_BUFFER);
|
| 452 | 481 | }
|
| 453 | 482 | else
|
| 454 | 483 | {
|
| 455 | | - if (This->renderer->ext->GLEXT_EXT_direct_state_access)
|
| 456 | | - This->renderer->ext->glGetTextureImageEXT(This->id, GL_TEXTURE_2D, level, This->format, This->type, This->levels[level].bigbuffer);
|
| 457 | | - else
|
| | 484 | + if ((bigx == x && bigy == y) || !This->levels[level].bigbuffer)
|
| 458 | 485 | {
|
| 459 | | - glUtil_SetActiveTexture(This->renderer->util, 0);
|
| 460 | | - glUtil_SetTexture(This->renderer->util, 0, This);
|
| 461 | | - glGetTexImage(GL_TEXTURE_2D, level, This->format, This->type, This->levels[level].bigbuffer);
|
| | 486 | + if (This->renderer->ext->GLEXT_EXT_direct_state_access)
|
| | 487 | + This->renderer->ext->glGetTextureImageEXT(This->id, GL_TEXTURE_2D, level, This->format, This->type, This->levels[level].buffer);
|
| | 488 | + else
|
| | 489 | + {
|
| | 490 | + glUtil_SetActiveTexture(This->renderer->util, 0);
|
| | 491 | + glUtil_SetTexture(This->renderer->util, 0, This);
|
| | 492 | + glGetTexImage(GL_TEXTURE_2D, level, This->format, This->type, This->levels[level].buffer);
|
| | 493 | + }
|
| 462 | 494 | }
|
| 463 | | - switch (bpp)
|
| | 495 | + else
|
| 464 | 496 | {
|
| 465 | | - case 8:
|
| 466 | | - ScaleNearest8(This->levels[level].buffer, This->levels[level].bigbuffer,
|
| 467 | | - x, y, bigx, bigy, bigpitch, pitch);
|
| 468 | | - break;
|
| 469 | | - case 15:
|
| 470 | | - case 16:
|
| 471 | | - ScaleNearest16(This->levels[level].buffer, This->levels[level].bigbuffer,
|
| 472 | | - x, y, bigx, bigy, bigpitch / 2, pitch / 2);
|
| 473 | | - break;
|
| 474 | | - case 24:
|
| 475 | | - ScaleNearest24(This->levels[level].buffer, This->levels[level].bigbuffer,
|
| 476 | | - x, y, bigx, bigy, bigpitch, pitch);
|
| 477 | | - break;
|
| 478 | | - case 32:
|
| 479 | | - ScaleNearest32(This->levels[level].buffer, This->levels[level].bigbuffer,
|
| 480 | | - x, y, bigx, bigy, bigpitch / 4, pitch / 4);
|
| 481 | | - break;
|
| | 497 | + if (This->renderer->ext->GLEXT_EXT_direct_state_access)
|
| | 498 | + This->renderer->ext->glGetTextureImageEXT(This->id, GL_TEXTURE_2D, level, This->format, This->type, This->levels[level].bigbuffer);
|
| | 499 | + else
|
| | 500 | + {
|
| | 501 | + glUtil_SetActiveTexture(This->renderer->util, 0);
|
| | 502 | + glUtil_SetTexture(This->renderer->util, 0, This);
|
| | 503 | + glGetTexImage(GL_TEXTURE_2D, level, This->format, This->type, This->levels[level].bigbuffer);
|
| | 504 | + }
|
| | 505 | + switch (bpp)
|
| | 506 | + {
|
| | 507 | + case 8:
|
| | 508 | + ScaleNearest8(This->levels[level].buffer, This->levels[level].bigbuffer,
|
| | 509 | + x, y, bigx, bigy, bigpitch, pitch);
|
| | 510 | + break;
|
| | 511 | + case 15:
|
| | 512 | + case 16:
|
| | 513 | + ScaleNearest16(This->levels[level].buffer, This->levels[level].bigbuffer,
|
| | 514 | + x, y, bigx, bigy, bigpitch / 2, pitch / 2);
|
| | 515 | + break;
|
| | 516 | + case 24:
|
| | 517 | + ScaleNearest24(This->levels[level].buffer, This->levels[level].bigbuffer,
|
| | 518 | + x, y, bigx, bigy, bigpitch, pitch);
|
| | 519 | + break;
|
| | 520 | + case 32:
|
| | 521 | + ScaleNearest32(This->levels[level].buffer, This->levels[level].bigbuffer,
|
| | 522 | + x, y, bigx, bigy, bigpitch / 4, pitch / 4);
|
| | 523 | + break;
|
| | 524 | + }
|
| 482 | 525 | }
|
| 483 | 526 | }
|
| 484 | 527 | This->levels[level].dirty &= ~2;
|
| — | — | @@ -487,6 +530,9 @@ |
| 488 | 531 | {
|
| 489 | 532 | GLenum error;
|
| 490 | 533 | void *data;
|
| | 534 | + int inpitch, outpitch;
|
| | 535 | + int i;
|
| | 536 | + char *writebuffer;
|
| 491 | 537 | if (dorealloc)
|
| 492 | 538 | {
|
| 493 | 539 | This->levels[level].ddsd.dwWidth = width;
|
| — | — | @@ -506,15 +552,79 @@ |
| 507 | 553 | (This->levels[level].ddsd.dwHeight != This->bigheight)))
|
| 508 | 554 | data = This->levels[level].bigbuffer;
|
| 509 | 555 | else data = This->levels[level].buffer;
|
| 510 | | - if (checkerror)
|
| | 556 | + if (This->useconv)
|
| 511 | 557 | {
|
| 512 | | - do
|
| | 558 | + if (!This->pboUnpack)
|
| | 559 | + BufferObject_Create(&This->pboUnpack, This->renderer->ext, This->renderer->util);
|
| | 560 | + outpitch = NextMultipleOf4(This->levels[level].ddsd.dwWidth * This->internalsize);
|
| | 561 | + inpitch = NextMultipleOf4(This->levels[level].ddsd.dwHeight
|
| | 562 | + * (NextMultipleOf8(This->levels[level].ddsd.ddpfPixelFormat.dwRGBBitCount) / 8));
|
| | 563 | + if (This->pboUnpack->size < outpitch * This->levels[level].ddsd.dwHeight)
|
| | 564 | + BufferObject_SetData(This->pboUnpack, GL_PIXEL_UNPACK_BUFFER,
|
| | 565 | + outpitch * This->levels[level].ddsd.dwHeight, NULL, GL_DYNAMIC_DRAW);
|
| | 566 | + writebuffer = (char*)BufferObject_Map(This->pboUnpack, GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
|
| | 567 | + for (i = 0; i < This->levels[level].ddsd.dwHeight; i++)
|
| | 568 | + colorconvproc[This->convfunctionupload](This->levels[level].ddsd.dwWidth,
|
| | 569 | + writebuffer + (i*outpitch), This->levels[level].buffer + (i + inpitch));
|
| | 570 | + BufferObject_Unmap(This->pboUnpack, GL_PIXEL_UNPACK_BUFFER);
|
| | 571 | + BufferObject_Bind(This->pboUnpack, GL_PIXEL_UNPACK_BUFFER);
|
| | 572 | + if (This->renderer->ext->GLEXT_EXT_direct_state_access)
|
| 513 | 573 | {
|
| 514 | | - ClearError();
|
| | 574 | + /*if (dorealloc)This->renderer->ext->glTextureImage2DEXT(This->id, GL_TEXTURE_2D, level, This->internalformats[0],
|
| | 575 | + width, height, 0, This->format, This->type, data);
|
| | 576 | + else */This->renderer->ext->glTextureSubImage2DEXT(This->id, GL_TEXTURE_2D, level,
|
| | 577 | + 0, 0, width, height, This->format, This->type, 0);
|
| | 578 | + }
|
| | 579 | + else
|
| | 580 | + {
|
| | 581 | + glUtil_SetActiveTexture(util, 0);
|
| | 582 | + glUtil_SetTexture(util, 0, This);
|
| | 583 | + /*if (dorealloc)glTexImage2D(GL_TEXTURE_2D, level, This->internalformats[0], width, height, 0, This->format, This->type, data);
|
| | 584 | + else */glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, width, height, This->format, This->type, 0);
|
| | 585 | + }
|
| | 586 | + BufferObject_Unbind(This->pboUnpack, GL_PIXEL_UNPACK_BUFFER);
|
| | 587 | + }
|
| | 588 | + else
|
| | 589 | + {
|
| | 590 | + if (checkerror)
|
| | 591 | + {
|
| | 592 | + do
|
| | 593 | + {
|
| | 594 | + ClearError();
|
| | 595 | + if (This->renderer->ext->GLEXT_EXT_direct_state_access)
|
| | 596 | + {
|
| | 597 | + if (dorealloc)This->renderer->ext->glTextureImage2DEXT(This->id, GL_TEXTURE_2D, level,
|
| | 598 | + This->internalformats[0], width, height, 0, This->format, This->type, data);
|
| | 599 | + else This->renderer->ext->glTextureSubImage2DEXT(This->id, GL_TEXTURE_2D, level,
|
| | 600 | + 0, 0, width, height, This->format, This->type, data);
|
| | 601 | + }
|
| | 602 | + else
|
| | 603 | + {
|
| | 604 | + glUtil_SetActiveTexture(util, 0);
|
| | 605 | + glUtil_SetTexture(util, 0, This);
|
| | 606 | + if (dorealloc) glTexImage2D(GL_TEXTURE_2D, level, This->internalformats[0], width, height, 0, This->format, This->type, data);
|
| | 607 | + else glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, width, height, This->format, This->type, data);
|
| | 608 | + }
|
| | 609 | + error = glGetError();
|
| | 610 | + if (error != GL_NO_ERROR)
|
| | 611 | + {
|
| | 612 | + if (This->internalformats[1] == 0)
|
| | 613 | + {
|
| | 614 | + FIXME("Failed to update texture, cannot find internal format");
|
| | 615 | + break;
|
| | 616 | + }
|
| | 617 | + memmove(&This->internalformats[0], &This->internalformats[1], 7 * sizeof(GLint));
|
| | 618 | + This->internalformats[7] = 0;
|
| | 619 | + }
|
| | 620 | + else break;
|
| | 621 | + } while (1);
|
| | 622 | + }
|
| | 623 | + else
|
| | 624 | + {
|
| 515 | 625 | if (This->renderer->ext->GLEXT_EXT_direct_state_access)
|
| 516 | 626 | {
|
| 517 | | - if (dorealloc)This->renderer->ext->glTextureImage2DEXT(This->id, GL_TEXTURE_2D, level,
|
| 518 | | - This->internalformats[0], width, height, 0, This->format, This->type, data);
|
| | 627 | + if (dorealloc)This->renderer->ext->glTextureImage2DEXT(This->id, GL_TEXTURE_2D, level, This->internalformats[0],
|
| | 628 | + width, height, 0, This->format, This->type, data);
|
| 519 | 629 | else This->renderer->ext->glTextureSubImage2DEXT(This->id, GL_TEXTURE_2D, level,
|
| 520 | 630 | 0, 0, width, height, This->format, This->type, data);
|
| 521 | 631 | }
|
| — | — | @@ -522,42 +632,10 @@ |
| 523 | 633 | {
|
| 524 | 634 | glUtil_SetActiveTexture(util, 0);
|
| 525 | 635 | glUtil_SetTexture(util, 0, This);
|
| 526 | | - if (dorealloc) glTexImage2D(GL_TEXTURE_2D, level, This->internalformats[0], width, height, 0, This->format, This->type, data);
|
| | 636 | + if (dorealloc)glTexImage2D(GL_TEXTURE_2D, level, This->internalformats[0], width, height, 0, This->format, This->type, data);
|
| 527 | 637 | else glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, width, height, This->format, This->type, data);
|
| 528 | 638 | }
|
| 529 | | - error = glGetError();
|
| 530 | | - if (error != GL_NO_ERROR)
|
| 531 | | - {
|
| 532 | | - if (This->internalformats[1] == 0)
|
| 533 | | - {
|
| 534 | | - FIXME("Failed to update texture, cannot find internal format");
|
| 535 | | - break;
|
| 536 | | - }
|
| 537 | | - memmove(&This->internalformats[0], &This->internalformats[1], 7 * sizeof(GLint));
|
| 538 | | - This->internalformats[7] = 0;
|
| 539 | | - }
|
| 540 | | - else break;
|
| 541 | | - } while (1);
|
| 542 | | - }
|
| 543 | | - else
|
| 544 | | - {
|
| 545 | | - if (This->renderer->ext->GLEXT_EXT_direct_state_access)
|
| 546 | | - {
|
| 547 | | - if (dorealloc)This->renderer->ext->glTextureImage2DEXT(This->id, GL_TEXTURE_2D, level, This->internalformats[0],
|
| 548 | | - width, height, 0, This->format, This->type, data);
|
| 549 | | - else This->renderer->ext->glTextureSubImage2DEXT(This->id, GL_TEXTURE_2D, level,
|
| 550 | | - 0, 0, width, height, This->format, This->type, data);
|
| 551 | 639 | }
|
| 552 | | - else
|
| 553 | | - {
|
| 554 | | -
|
| 555 | | - }
|
| 556 | | - {
|
| 557 | | - glUtil_SetActiveTexture(util, 0);
|
| 558 | | - glUtil_SetTexture(util, 0, This);
|
| 559 | | - if (dorealloc)glTexImage2D(GL_TEXTURE_2D, level, This->internalformats[0], width, height, 0, This->format, This->type, data);
|
| 560 | | - else glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, width, height, This->format, This->type, data);
|
| 561 | | - }
|
| 562 | 640 | }
|
| 563 | 641 | This->levels[level].dirty &= ~1;
|
| 564 | 642 | }
|
| — | — | @@ -820,7 +898,9 @@ |
| 821 | 899 | This->useconv = TRUE;
|
| 822 | 900 | This->convfunctionupload = 0;
|
| 823 | 901 | This->convfunctiondownload = 1;
|
| | 902 | + This->internalsize = 4; // Store in 8888 texture
|
| 824 | 903 | This->internalformats[0] = GL_RGBA8;
|
| | 904 | + This->format = GL_BGRA;
|
| 825 | 905 | This->type = GL_UNSIGNED_BYTE;
|
| 826 | 906 | This->colororder = 1;
|
| 827 | 907 | This->colorsizes[0] = 7;
|
| — | — | @@ -1049,7 +1129,7 @@ |
| 1050 | 1130 | {
|
| 1051 | 1131 | if (This->internalformats[1] == 0)
|
| 1052 | 1132 | {
|
| 1053 | | - FIXME("Failed to create texture, cannot find internal format");
|
| | 1133 | + FIXME("Failed to create texture, cannot find internal format\n");
|
| 1054 | 1134 | break;
|
| 1055 | 1135 | }
|
| 1056 | 1136 | memmove(&This->internalformats[0], &This->internalformats[1], 7 * sizeof(GLint));
|
| — | — | @@ -1068,6 +1148,8 @@ |
| 1069 | 1149 | {
|
| 1070 | 1150 | glRenderer__RemoveTextureFromD3D(This->renderer, This);
|
| 1071 | 1151 | glDeleteTextures(1, &This->id);
|
| | 1152 | + if (This->pboPack) BufferObject_Release(This->pboPack);
|
| | 1153 | + if (This->pboUnpack) BufferObject_Release(This->pboUnpack);
|
| 1072 | 1154 | free(This);
|
| 1073 | 1155 | }
|
| 1074 | 1156 |
|
| Index: ddraw/struct.h |
| — | — | @@ -314,10 +314,13 @@ |
| 315 | 315 | BOOL useconv;
|
| 316 | 316 | int convfunctionupload;
|
| 317 | 317 | int convfunctiondownload;
|
| | 318 | + int internalsize;
|
| 318 | 319 | struct glTexture *palette;
|
| 319 | 320 | struct glTexture *stencil;
|
| 320 | 321 | struct glTexture *dummycolor;
|
| 321 | 322 | struct glRenderer *renderer;
|
| | 323 | + BufferObject *pboPack;
|
| | 324 | + BufferObject *pboUnpack;
|
| 322 | 325 | } glTexture;
|
| 323 | 326 |
|
| 324 | 327 | // Color orders:
|
| Index: dxglcfg/dxgltest.cpp |
| — | — | @@ -254,7 +254,7 @@ |
| 255 | 255 | error = DirectDrawCreate(NULL, &lpdd, NULL);
|
| 256 | 256 | if (error == DD_OK)
|
| 257 | 257 | {
|
| 258 | | - error = lpdd->EnumDisplayModes(DDEDM_REFRESHRATES, NULL, GetDlgItem(hWnd, IDC_VIDMODES), EnumModesCallback8);
|
| | 258 | + error = lpdd->EnumDisplayModes(DDEDM_REFRESHRATES, NULL, GetDlgItem(hWnd, IDC_VIDMODES), EnumModesCallback32);
|
| 259 | 259 | IDirectDraw_Release(lpdd);
|
| 260 | 260 | }
|
| 261 | 261 | SendDlgItemMessage(hWnd, IDC_VIDMODES, LB_SETCURSEL, modenum, 0);
|
| — | — | @@ -278,7 +278,7 @@ |
| 279 | 279 | error = DirectDrawCreate(NULL,&lpdd,NULL);
|
| 280 | 280 | if(error == DD_OK)
|
| 281 | 281 | {
|
| 282 | | - error = lpdd->EnumDisplayModes(DDEDM_REFRESHRATES,NULL,GetDlgItem(hWnd,IDC_VIDMODES),EnumModesCallback8);
|
| | 282 | + error = lpdd->EnumDisplayModes(DDEDM_REFRESHRATES,NULL,GetDlgItem(hWnd,IDC_VIDMODES),EnumModesCallback32);
|
| 283 | 283 | IDirectDraw_Release(lpdd);
|
| 284 | 284 | }
|
| 285 | 285 | SendDlgItemMessage(hWnd,IDC_VIDMODES,LB_SETCURSEL,modenum,0);
|
| Index: dxglcfg/surfacegen.cpp |
| — | — | @@ -1,5 +1,5 @@ |
| 2 | 2 | // DXGL
|
| 3 | | -// Copyright (C) 2011-2013 William Feely
|
| | 3 | +// Copyright (C) 2011-2018 William Feely
|
| 4 | 4 |
|
| 5 | 5 | // This library is free software; you can redistribute it and/or
|
| 6 | 6 | // modify it under the terms of the GNU Lesser General Public
|
| — | — | @@ -244,6 +244,17 @@ |
| 245 | 245 | }
|
| 246 | 246 | }
|
| 247 | 247 | }
|
| | 248 | + else if ((ddsd.ddpfPixelFormat.dwRBitMask | ddsd.ddpfPixelFormat.dwGBitMask |
|
| | 249 | + ddsd.ddpfPixelFormat.dwBBitMask) == 0xFF)
|
| | 250 | + {
|
| | 251 | + for (y = 0; y < ddsd.dwHeight; y++)
|
| | 252 | + {
|
| | 253 | + for (x = 0; x < ddsd.dwWidth; x++)
|
| | 254 | + {
|
| | 255 | + buffer16[x + ((ddsd.lPitch/2)*y)] = (unsigned short)((x / (ddsd.dwWidth / 16.)) + 16 * floor((y / (ddsd.dwHeight / 16.))));
|
| | 256 | + }
|
| | 257 | + }
|
| | 258 | + }
|
| 248 | 259 | else
|
| 249 | 260 | {
|
| 250 | 261 | for(y = 0; y < ddsd.dwHeight; y++)
|