comparison src/video/qnxgf/SDL_qnxgf.c @ 3412:fe9c8a5cab51

Fixes in GLES configuration selection.
author Mike Gorchak <lestat@i.com.ua>
date Thu, 22 Oct 2009 06:09:03 +0000
parents 51750b7a966f
children 87182c69e080
comparison
equal deleted inserted replaced
3411:d15a4daa4a58 3412:fe9c8a5cab51
1461 if (_this->gl_config.alpha_size) { 1461 if (_this->gl_config.alpha_size) {
1462 wdata->gles_attributes[attr_pos++] = _this->gl_config.alpha_size; 1462 wdata->gles_attributes[attr_pos++] = _this->gl_config.alpha_size;
1463 } else { 1463 } else {
1464 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; 1464 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
1465 } 1465 }
1466
1466 wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE; 1467 wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE;
1467 wdata->gles_attributes[attr_pos++] = _this->gl_config.depth_size; 1468 if (_this->gl_config.depth_size) {
1469 wdata->gles_attributes[attr_pos++] = _this->gl_config.depth_size;
1470 } else {
1471 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
1472 }
1473
1468 if (_this->gl_config.buffer_size) { 1474 if (_this->gl_config.buffer_size) {
1469 wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE; 1475 wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE;
1470 wdata->gles_attributes[attr_pos++] = _this->gl_config.buffer_size; 1476 wdata->gles_attributes[attr_pos++] = _this->gl_config.buffer_size;
1471 } 1477 }
1472 if (_this->gl_config.stencil_size) { 1478 if (_this->gl_config.stencil_size) {
1473 wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE; 1479 wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE;
1474 wdata->gles_attributes[attr_pos++] = _this->gl_config.buffer_size; 1480 wdata->gles_attributes[attr_pos++] = _this->gl_config.stencil_size;
1475 } 1481 }
1476 1482
1477 /* Set number of samples in multisampling */ 1483 /* Set number of samples in multisampling */
1478 if (_this->gl_config.multisamplesamples) { 1484 if (_this->gl_config.multisamplesamples) {
1479 wdata->gles_attributes[attr_pos++] = EGL_SAMPLES; 1485 wdata->gles_attributes[attr_pos++] = EGL_SAMPLES;
1584 1590
1585 /* Now check each configuration to find out the best */ 1591 /* Now check each configuration to find out the best */
1586 for (cit = 0; cit < configs; cit++) { 1592 for (cit = 0; cit < configs; cit++) {
1587 uint32_t stencil_found; 1593 uint32_t stencil_found;
1588 uint32_t depth_found; 1594 uint32_t depth_found;
1595 EGLint cur_depth;
1596 EGLint cur_stencil;
1589 1597
1590 stencil_found = 0; 1598 stencil_found = 0;
1591 depth_found = 0; 1599 depth_found = 0;
1592 1600
1593 if (_this->gl_config.stencil_size) { 1601 if (_this->gl_config.stencil_size) {
1594 status = 1602 status =
1595 eglGetConfigAttrib(gfdata->egldisplay, 1603 eglGetConfigAttrib(gfdata->egldisplay,
1596 wdata->gles_configs[cit], EGL_STENCIL_SIZE, 1604 wdata->gles_configs[cit], EGL_STENCIL_SIZE,
1597 &attr_value); 1605 &cur_stencil);
1598 if (status == EGL_TRUE) { 1606 if (status == EGL_TRUE) {
1599 if (attr_value != 0) { 1607 if (attr_value != 0) {
1600 stencil_found = 1; 1608 stencil_found = 1;
1601 } 1609 }
1602 } 1610 }
1606 1614
1607 if (_this->gl_config.depth_size) { 1615 if (_this->gl_config.depth_size) {
1608 status = 1616 status =
1609 eglGetConfigAttrib(gfdata->egldisplay, 1617 eglGetConfigAttrib(gfdata->egldisplay,
1610 wdata->gles_configs[cit], EGL_DEPTH_SIZE, 1618 wdata->gles_configs[cit], EGL_DEPTH_SIZE,
1611 &attr_value); 1619 &cur_depth);
1612 if (status == EGL_TRUE) { 1620 if (status == EGL_TRUE) {
1613 if (attr_value != 0) { 1621 if (attr_value != 0) {
1614 depth_found = 1; 1622 depth_found = 1;
1615 } 1623 }
1616 } 1624 }
1618 depth_found = 1; 1626 depth_found = 1;
1619 } 1627 }
1620 1628
1621 /* Exit from loop if found appropriate configuration */ 1629 /* Exit from loop if found appropriate configuration */
1622 if ((depth_found != 0) && (stencil_found != 0)) { 1630 if ((depth_found != 0) && (stencil_found != 0)) {
1623 break; 1631 /* Store last satisfied configuration id */
1624 } 1632 wdata->gles_config = cit;
1625 } 1633
1626 1634 if (cur_depth==_this->gl_config.depth_size)
1627 /* If best could not be found, use first */ 1635 {
1628 if (cit == configs) { 1636 /* Exact match on depth bits */
1637 if (!_this->gl_config.stencil_size)
1638 {
1639 /* Stencil is not required */
1640 break;
1641 }
1642 else
1643 {
1644 if (cur_stencil==_this->gl_config.stencil_size)
1645 {
1646 /* Exact match on stencil bits */
1647 break;
1648 }
1649 }
1650 }
1651 }
1652 }
1653
1654 /* If best could not be found, use first or last satisfied */
1655 if ((cit == configs) && (wdata->gles_config==0)) {
1629 cit = 0; 1656 cit = 0;
1630 } 1657 wdata->gles_config = cit;
1631 wdata->gles_config = cit; 1658 }
1632 1659
1633 /* Create OpenGL ES context */ 1660 /* Create OpenGL ES context */
1634 wdata->gles_context = 1661 wdata->gles_context =
1635 eglCreateContext(gfdata->egldisplay, 1662 eglCreateContext(gfdata->egldisplay,
1636 wdata->gles_configs[wdata->gles_config], 1663 wdata->gles_configs[wdata->gles_config],