mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:08:12 +00:00
LibGL+LibSoftGPU: Add support for 8-bit luminance (+ alpha) textures
Used by Half-Life for single colour textures. The alpha variant is especially used for UI textures.
This commit is contained in:
parent
6e37487477
commit
c6a0365c58
3 changed files with 43 additions and 1 deletions
|
@ -915,7 +915,7 @@ void SoftwareGLContext::gl_tex_image_2d(GLenum target, GLint level, GLint intern
|
|||
internal_format = GL_RGBA;
|
||||
|
||||
// We only support symbolic constants for now
|
||||
RETURN_WITH_ERROR_IF(!(internal_format == GL_RGB || internal_format == GL_RGBA), GL_INVALID_ENUM);
|
||||
RETURN_WITH_ERROR_IF(!(internal_format == GL_RGB || internal_format == GL_RGBA || internal_format == GL_LUMINANCE8 || internal_format == GL_LUMINANCE8_ALPHA8), GL_INVALID_ENUM);
|
||||
RETURN_WITH_ERROR_IF(!(type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_SHORT_5_6_5), GL_INVALID_VALUE);
|
||||
RETURN_WITH_ERROR_IF(level < 0 || level > Texture2D::LOG2_MAX_TEXTURE_SIZE, GL_INVALID_VALUE);
|
||||
RETURN_WITH_ERROR_IF(width < 0 || height < 0 || width > (2 + Texture2D::MAX_TEXTURE_SIZE) || height > (2 + Texture2D::MAX_TEXTURE_SIZE), GL_INVALID_VALUE);
|
||||
|
@ -941,6 +941,14 @@ void SoftwareGLContext::gl_tex_image_2d(GLenum target, GLint level, GLint intern
|
|||
device_format = SoftGPU::ImageFormat::RGBA8888;
|
||||
break;
|
||||
|
||||
case GL_LUMINANCE8:
|
||||
device_format = SoftGPU::ImageFormat::L8;
|
||||
break;
|
||||
|
||||
case GL_LUMINANCE8_ALPHA8:
|
||||
device_format = SoftGPU::ImageFormat::L8A8;
|
||||
break;
|
||||
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue