1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:37:34 +00:00

LibGL: Implement glTexSubImage2D

This commit is contained in:
Stephan Unverwerth 2021-08-31 22:35:52 +02:00 committed by Ali Mohammad Pur
parent 1aed453d8c
commit e7d3483618
7 changed files with 63 additions and 19 deletions

View file

@ -35,8 +35,8 @@ public:
virtual bool is_texture_2d() const override { return true; }
void upload_texture_data(GLenum target, GLint lod, GLint internal_format, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels, size_t pixels_per_row);
void replace_sub_texture_data(GLint lod, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* data);
void upload_texture_data(GLuint lod, GLint internal_format, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels, size_t pixels_per_row);
void replace_sub_texture_data(GLuint lod, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels, size_t pixels_per_row);
MipMap const& mipmap(unsigned lod) const;
@ -44,6 +44,9 @@ public:
Sampler2D const& sampler() const { return m_sampler; }
Sampler2D& sampler() { return m_sampler; }
int width_at_lod(unsigned level) const { return (level >= m_mipmaps.size()) ? 0 : max(1, m_mipmaps.at(level).width() >> level); }
int height_at_lod(unsigned level) const { return (level >= m_mipmaps.size()) ? 0 : max(1, m_mipmaps.at(level).height() >> level); }
private:
template<typename TCallback>
void swizzle(Vector<u32>& pixels, TCallback&& callback)