glshim updated, added latest changes by ptitSeb

This commit is contained in:
lubomyr
2016-04-14 21:09:05 +03:00
parent 46cf1dd9a0
commit b2df9398f8
3 changed files with 16 additions and 3 deletions

View File

@@ -292,6 +292,15 @@ void glshim_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum r
return;
}
if ((current_fb!=0) && (renderbuffer!=0) && ((attachment==GL_DEPTH_ATTACHMENT) || (attachment==GL_STENCIL_ATTACHMENT))) {
GLuint tmp;
gles_glGetFramebufferAttachmentParameteriv(target, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &tmp);
if (tmp==renderbuffer) {
noerrorShim();
return;
}
}
errorGL();
gles_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
}

View File

@@ -828,7 +828,7 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst,
if ((src_format == GL_RGBA) && (dst_format == GL_RGBA) && (dst_type == GL_UNSIGNED_SHORT_5_5_5_1) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
*(GLushort*)dst_pos = ((GLushort)(((char*)src_pos)[2]&0xf8)>>(3-1)) | ((GLushort)(((char*)src_pos)[1]&0xf8)<<(5-2)) | ((GLushort)(((char*)src_pos)[0]&0xf8)<<(10-2)) | ((GLushort)(((char*)src_pos)[3]>0)?1:0);
*(GLushort*)dst_pos = ((GLushort)(((char*)src_pos)[2]&0xf8)>>(3-1)) | ((GLushort)(((char*)src_pos)[1]&0xf8)<<(5-2)) | ((GLushort)(((char*)src_pos)[0]&0xf8)<<(10-2)) | ((GLushort)(((char*)src_pos)[3])>>15);
src_pos += src_stride;
dst_pos += dst_stride;
}
@@ -840,7 +840,7 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst,
if ((src_format == GL_BGRA) && (dst_format == GL_RGBA) && (dst_type == GL_UNSIGNED_SHORT_5_5_5_1) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
*(GLushort*)dst_pos = ((GLushort)(((char*)src_pos)[0]&0xf8)>>(3-1)) | ((GLushort)(((char*)src_pos)[1]&0xf8)<<(5-2)) | ((GLushort)(((char*)src_pos)[2]&0xf8)<<(10-2)) | ((GLushort)(((char*)src_pos)[3]>0)?1:0);
*(GLushort*)dst_pos = ((GLushort)(((char*)src_pos)[0]&0xf8)>>(3-1)) | ((GLushort)(((char*)src_pos)[1]&0xf8)<<(5-2)) | ((GLushort)(((char*)src_pos)[2]&0xf8)<<(10-2)) | ((GLushort)(((char*)src_pos)[3])>>15);
src_pos += src_stride;
dst_pos += dst_stride;
}

View File

@@ -122,6 +122,10 @@ static int is_fake_compressed_rgba(GLenum internalformat)
void internal2format_type(GLenum internalformat, GLenum *format, GLenum *type)
{
switch(internalformat) {
case GL_ALPHA:
*format = GL_ALPHA;
*type = GL_UNSIGNED_BYTE;
break;
case GL_LUMINANCE:
*format = GL_LUMINANCE;
*type = GL_UNSIGNED_BYTE;
@@ -151,7 +155,7 @@ void internal2format_type(GLenum internalformat, GLenum *format, GLenum *type)
*type = GL_UNSIGNED_BYTE;
break;
default:
printf("LIBGL: Warning, unknonw Internalformat (%s)\n", PrintEnum(internalformat));
printf("LIBGL: Warning, unknown Internalformat (%s)\n", PrintEnum(internalformat));
*format = GL_RGBA;
*type = GL_UNSIGNED_BYTE;
break;