TINYGL: Make use of ColorMask templates for NearestTexelBuffer
This commit is contained in:
parent
a967465b40
commit
4c1fdb81d5
4 changed files with 238 additions and 48 deletions
|
@ -155,21 +155,7 @@ void GLContext::glopTexImage2D(GLParam *p) {
|
|||
}
|
||||
if (!found)
|
||||
error("TinyGL texture: format 0x%04x and type 0x%04x combination not supported", format, type);
|
||||
Graphics::PixelBuffer src(pf, pixels);
|
||||
Graphics::PixelFormat internalPf;
|
||||
#if defined(SCUMM_LITTLE_ENDIAN)
|
||||
if (internalformat == TGL_RGBA)
|
||||
internalPf = Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
|
||||
else if (internalformat == TGL_RGB)
|
||||
internalPf = Graphics::PixelFormat(3, 8, 8, 8, 0, 0, 8, 16, 0);
|
||||
#else
|
||||
if (internalformat == TGL_RGBA)
|
||||
internalPf = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
|
||||
else if (internalformat == TGL_RGB)
|
||||
internalPf = Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0);
|
||||
#endif
|
||||
Graphics::PixelBuffer srcInternal(internalPf, width * height, DisposeAfterUse::YES);
|
||||
srcInternal.copyBuffer(0, width * height, src);
|
||||
|
||||
if (width > _textureSize || height > _textureSize)
|
||||
filter = texture_mag_filter;
|
||||
else
|
||||
|
@ -179,17 +165,45 @@ void GLContext::glopTexImage2D(GLParam *p) {
|
|||
case TGL_LINEAR_MIPMAP_LINEAR:
|
||||
case TGL_LINEAR:
|
||||
im->pixmap = new BilinearTexelBuffer(
|
||||
srcInternal,
|
||||
pixels, pf,
|
||||
width, height,
|
||||
_textureSize
|
||||
);
|
||||
break;
|
||||
default:
|
||||
im->pixmap = new NearestTexelBuffer(
|
||||
srcInternal,
|
||||
width, height,
|
||||
_textureSize
|
||||
);
|
||||
if (format == TGL_RGBA && type == TGL_UNSIGNED_BYTE) {
|
||||
im->pixmap = new NearestTexelBuffer<TGL_RGBA, TGL_UNSIGNED_BYTE>(
|
||||
pixels, pf,
|
||||
width, height,
|
||||
_textureSize
|
||||
);
|
||||
} else if (format == TGL_RGB && type == TGL_UNSIGNED_BYTE) {
|
||||
im->pixmap = new NearestTexelBuffer<TGL_RGB, TGL_UNSIGNED_BYTE>(
|
||||
pixels, pf,
|
||||
width, height,
|
||||
_textureSize
|
||||
);
|
||||
} else if (format == TGL_RGB && type == TGL_UNSIGNED_SHORT_5_6_5) {
|
||||
im->pixmap = new NearestTexelBuffer<TGL_RGB, TGL_UNSIGNED_SHORT_5_6_5>(
|
||||
pixels, pf,
|
||||
width, height,
|
||||
_textureSize
|
||||
);
|
||||
} else if (format == TGL_RGBA && type == TGL_UNSIGNED_SHORT_5_5_5_1) {
|
||||
im->pixmap = new NearestTexelBuffer<TGL_RGBA, TGL_UNSIGNED_SHORT_5_5_5_1>(
|
||||
pixels, pf,
|
||||
width, height,
|
||||
_textureSize
|
||||
);
|
||||
} else if (format == TGL_RGBA && type == TGL_UNSIGNED_SHORT_4_4_4_4) {
|
||||
im->pixmap = new NearestTexelBuffer<TGL_RGBA, TGL_UNSIGNED_SHORT_4_4_4_4>(
|
||||
pixels, pf,
|
||||
width, height,
|
||||
_textureSize
|
||||
);
|
||||
} else {
|
||||
error("TinyGL texture: format 0x%04x and type 0x%04x combination not supported", format, type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue