mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:47:34 +00:00
LibGL: Implement glGetTexLevelParameteriv
This commit is contained in:
parent
d83702cb92
commit
dae63352a3
5 changed files with 29 additions and 0 deletions
|
@ -580,6 +580,7 @@ GLAPI void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig,
|
|||
GLAPI void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GLAPI void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
|
||||
GLAPI void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
|
||||
GLAPI void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint* params);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -116,6 +116,7 @@ public:
|
|||
virtual void gl_light_model(GLenum pname, GLfloat x, GLfloat y, GLfloat z, GLfloat w) = 0;
|
||||
virtual void gl_bitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, GLubyte const* bitmap) = 0;
|
||||
virtual void gl_copy_tex_image_2d(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) = 0;
|
||||
virtual void gl_get_tex_parameter_integerv(GLenum target, GLint level, GLenum pname, GLint* params) = 0;
|
||||
virtual void gl_rect(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) = 0;
|
||||
|
||||
virtual void present() = 0;
|
||||
|
|
|
@ -61,3 +61,8 @@ void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x
|
|||
{
|
||||
g_gl_context->gl_copy_tex_image_2d(target, level, internalformat, x, y, width, height, border);
|
||||
}
|
||||
|
||||
void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint* params)
|
||||
{
|
||||
g_gl_context->gl_get_tex_parameter_integerv(target, level, pname, params);
|
||||
}
|
||||
|
|
|
@ -2658,6 +2658,27 @@ void SoftwareGLContext::gl_copy_tex_image_2d(GLenum target, GLint level, GLenum
|
|||
target, level, internalformat, x, y, width, height, border);
|
||||
}
|
||||
|
||||
void SoftwareGLContext::gl_get_tex_parameter_integerv(GLenum target, GLint level, GLenum pname, GLint* params)
|
||||
{
|
||||
RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
|
||||
// FIXME: support targets other than GL_TEXTURE_2D
|
||||
RETURN_WITH_ERROR_IF(target != GL_TEXTURE_2D, GL_INVALID_ENUM);
|
||||
// FIXME: support other parameter names
|
||||
RETURN_WITH_ERROR_IF(pname < GL_TEXTURE_WIDTH || pname > GL_TEXTURE_HEIGHT, GL_INVALID_ENUM);
|
||||
RETURN_WITH_ERROR_IF(level < 0 || level > Texture2D::LOG2_MAX_TEXTURE_SIZE, GL_INVALID_VALUE);
|
||||
// FIXME: GL_INVALID_VALUE is generated if target is GL_TEXTURE_BUFFER and level is not zero
|
||||
// FIXME: GL_INVALID_OPERATION is generated if GL_TEXTURE_COMPRESSED_IMAGE_SIZE is queried on texture images with an uncompressed internal format or on proxy targets
|
||||
|
||||
switch (pname) {
|
||||
case GL_TEXTURE_HEIGHT:
|
||||
*params = m_active_texture_unit->bound_texture_2d()->height_at_lod(level);
|
||||
break;
|
||||
case GL_TEXTURE_WIDTH:
|
||||
*params = m_active_texture_unit->bound_texture_2d()->width_at_lod(level);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SoftwareGLContext::gl_rect(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
|
||||
{
|
||||
APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_rect, x1, y1, x2, y2);
|
||||
|
|
|
@ -129,6 +129,7 @@ public:
|
|||
virtual void gl_light_model(GLenum pname, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override;
|
||||
virtual void gl_bitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, GLubyte const* bitmap) override;
|
||||
virtual void gl_copy_tex_image_2d(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) override;
|
||||
virtual void gl_get_tex_parameter_integerv(GLenum target, GLint level, GLenum pname, GLint* params) override;
|
||||
virtual void gl_rect(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) override;
|
||||
|
||||
virtual void present() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue