diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibGL/GL/gl.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLContext.cpp | 28 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLContext.h | 2 |
3 files changed, 31 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h index 4956561d1c..1011b571fd 100644 --- a/Userland/Libraries/LibGL/GL/gl.h +++ b/Userland/Libraries/LibGL/GL/gl.h @@ -451,6 +451,7 @@ extern "C" { #define GL_REFLECTION_MAP 0x8512 // Texture gen parameters +#define GL_TEXTURE_BORDER_COLOR 0x1004 #define GL_TEXTURE_GEN_MODE 0x2500 #define GL_OBJECT_PLANE 0x2501 #define GL_EYE_PLANE 0x2502 diff --git a/Userland/Libraries/LibGL/GLContext.cpp b/Userland/Libraries/LibGL/GLContext.cpp index 1d48651fbc..1e72994c68 100644 --- a/Userland/Libraries/LibGL/GLContext.cpp +++ b/Userland/Libraries/LibGL/GLContext.cpp @@ -1028,6 +1028,33 @@ void GLContext::gl_tex_parameter(GLenum target, GLenum pname, GLfloat param) m_sampler_config_is_dirty = true; } +void GLContext::gl_tex_parameterfv(GLenum target, GLenum pname, GLfloat const* params) +{ + APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_tex_parameterfv, target, pname, params); + + RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION); + + // FIXME: We currently only support GL_TETXURE_2D targets. 1D, 3D and CUBE should also be supported (https://docs.gl/gl2/glTexParameter) + RETURN_WITH_ERROR_IF(target != GL_TEXTURE_2D, GL_INVALID_ENUM); + + // FIXME: implement the remaining parameters. (https://docs.gl/gl2/glTexParameter) + RETURN_WITH_ERROR_IF(!(pname == GL_TEXTURE_BORDER_COLOR), GL_INVALID_ENUM); + + // We assume GL_TEXTURE_2D (see above) + auto texture_2d = m_active_texture_unit->texture_2d_target_texture(); + RETURN_WITH_ERROR_IF(texture_2d.is_null(), GL_INVALID_OPERATION); + + switch (pname) { + case GL_TEXTURE_BORDER_COLOR: + texture_2d->sampler().set_border_color(params[0], params[1], params[2], params[3]); + break; + default: + VERIFY_NOT_REACHED(); + } + + m_sampler_config_is_dirty = true; +} + void GLContext::gl_front_face(GLenum face) { APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_front_face, face); @@ -3031,6 +3058,7 @@ void GLContext::sync_device_sampler_config() VERIFY_NOT_REACHED(); } + config.border_color = sampler.border_color(); m_rasterizer->set_sampler_config(i, config); } } diff --git a/Userland/Libraries/LibGL/GLContext.h b/Userland/Libraries/LibGL/GLContext.h index 964040b5ee..1afba6bd73 100644 --- a/Userland/Libraries/LibGL/GLContext.h +++ b/Userland/Libraries/LibGL/GLContext.h @@ -101,6 +101,7 @@ public: void gl_tex_image_2d(GLenum target, GLint level, GLint internal_format, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid const* data); void gl_tex_sub_image_2d(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid const* data); void gl_tex_parameter(GLenum target, GLenum pname, GLfloat param); + void gl_tex_parameterfv(GLenum target, GLenum pname, GLfloat const* params); void gl_tex_coord(GLfloat s, GLfloat t, GLfloat r, GLfloat q); void gl_multi_tex_coord(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); void gl_tex_env(GLenum target, GLenum pname, GLfloat param); @@ -366,6 +367,7 @@ private: decltype(&GLContext::gl_hint), decltype(&GLContext::gl_read_buffer), decltype(&GLContext::gl_tex_parameter), + decltype(&GLContext::gl_tex_parameterfv), decltype(&GLContext::gl_depth_mask), decltype(&GLContext::gl_draw_arrays), decltype(&GLContext::gl_draw_elements), |