1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +00:00

LibGL: Add stubs for shader and program related functions

This commit is contained in:
Stephan Unverwerth 2022-08-27 18:07:07 +02:00 committed by Andrew Kaster
parent 75495a5d65
commit 4568dcbb55
5 changed files with 123 additions and 0 deletions

View file

@ -10,6 +10,7 @@ set(SOURCES
List.cpp List.cpp
Matrix.cpp Matrix.cpp
NameAllocator.cpp NameAllocator.cpp
Shader.cpp
Stencil.cpp Stencil.cpp
Tex/Texture2D.cpp Tex/Texture2D.cpp
Texture.cpp Texture.cpp

View file

@ -813,6 +813,16 @@ GLAPI void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void
GLAPI void glDeleteBuffers(GLsizei n, GLuint const* buffers); GLAPI void glDeleteBuffers(GLsizei n, GLuint const* buffers);
GLAPI void glGenBuffers(GLsizei n, GLuint* buffers); GLAPI void glGenBuffers(GLsizei n, GLuint* buffers);
GLAPI GLuint glCreateShader(GLenum shader_type);
GLAPI void glDeleteShader(GLuint shader);
GLAPI void glShaderSource(GLuint shader, GLsizei count, GLchar const** string, GLint const* length);
GLAPI void glCompileShader(GLuint shader);
GLAPI GLuint glCreateProgram();
GLAPI void glDeleteProgram(GLuint program);
GLAPI void glAttachShader(GLuint program, GLuint shader);
GLAPI void glLinkProgram(GLuint program);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -62,6 +62,11 @@ void glArrayElement(GLint i)
g_gl_context->gl_array_element(i); g_gl_context->gl_array_element(i);
} }
void glAttachShader(GLuint program, GLuint shader)
{
g_gl_context->gl_attach_shader(program, shader);
}
void glBegin(GLenum mode) void glBegin(GLenum mode)
{ {
g_gl_context->gl_begin(mode); g_gl_context->gl_begin(mode);
@ -226,6 +231,11 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, void const* pointer
g_gl_context->gl_color_pointer(size, type, stride, pointer); g_gl_context->gl_color_pointer(size, type, stride, pointer);
} }
void glCompileShader(GLuint shader)
{
g_gl_context->gl_compile_shader(shader);
}
void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
{ {
g_gl_context->gl_copy_tex_image_2d(target, level, internalformat, x, y, width, height, border); g_gl_context->gl_copy_tex_image_2d(target, level, internalformat, x, y, width, height, border);
@ -236,6 +246,16 @@ void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffse
g_gl_context->gl_copy_tex_sub_image_2d(target, level, xoffset, yoffset, x, y, width, height); g_gl_context->gl_copy_tex_sub_image_2d(target, level, xoffset, yoffset, x, y, width, height);
} }
GLuint glCreateProgram()
{
return g_gl_context->gl_create_program();
}
GLuint glCreateShader(GLenum shader_type)
{
return g_gl_context->gl_create_shader(shader_type);
}
void glCullFace(GLenum mode) void glCullFace(GLenum mode)
{ {
g_gl_context->gl_cull_face(mode); g_gl_context->gl_cull_face(mode);
@ -266,6 +286,16 @@ void glDeleteLists(GLuint list, GLsizei range)
return g_gl_context->gl_delete_lists(list, range); return g_gl_context->gl_delete_lists(list, range);
} }
void glDeleteProgram(GLuint program)
{
g_gl_context->gl_delete_program(program);
}
void glDeleteShader(GLuint shader)
{
g_gl_context->gl_delete_shader(shader);
}
void glDeleteTextures(GLsizei n, GLuint const* textures) void glDeleteTextures(GLsizei n, GLuint const* textures)
{ {
g_gl_context->gl_delete_textures(n, textures); g_gl_context->gl_delete_textures(n, textures);
@ -563,6 +593,11 @@ void glLineWidth(GLfloat width)
g_gl_context->gl_line_width(width); g_gl_context->gl_line_width(width);
} }
void glLinkProgram(GLuint program)
{
g_gl_context->gl_link_program(program);
}
void glListBase(GLuint base) void glListBase(GLuint base)
{ {
return g_gl_context->gl_list_base(base); return g_gl_context->gl_list_base(base);
@ -841,6 +876,11 @@ void glShadeModel(GLenum mode)
g_gl_context->gl_shade_model(mode); g_gl_context->gl_shade_model(mode);
} }
void glShaderSource(GLuint shader, GLsizei count, GLchar const** string, GLint const* length)
{
g_gl_context->gl_shader_source(shader, count, string, length);
}
void glStencilFunc(GLenum func, GLint ref, GLuint mask) void glStencilFunc(GLenum func, GLint ref, GLuint mask)
{ {
g_gl_context->gl_stencil_func_separate(GL_FRONT_AND_BACK, func, ref, mask); g_gl_context->gl_stencil_func_separate(GL_FRONT_AND_BACK, func, ref, mask);

View file

@ -228,6 +228,16 @@ public:
void gl_delete_buffers(GLsizei n, GLuint const* buffers); void gl_delete_buffers(GLsizei n, GLuint const* buffers);
void gl_gen_buffers(GLsizei n, GLuint* buffers); void gl_gen_buffers(GLsizei n, GLuint* buffers);
GLuint gl_create_shader(GLenum shader_type);
void gl_delete_shader(GLuint shader);
void gl_shader_source(GLuint shader, GLsizei count, GLchar const** string, GLint const* length);
void gl_compile_shader(GLuint shader);
GLuint gl_create_program();
void gl_delete_program(GLuint program);
void gl_attach_shader(GLuint program, GLuint shader);
void gl_link_program(GLuint program);
private: private:
void sync_device_config(); void sync_device_config();
void sync_device_sampler_config(); void sync_device_sampler_config();

View file

@ -0,0 +1,62 @@
/*
* Copyright (c) 2022, Stephan Unverwerth <s.unverwerth@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Debug.h>
#include <LibGL/GLContext.h>
namespace GL {
GLuint GLContext::gl_create_shader(GLenum shader_type)
{
dbgln("gl_create_shader({}) unimplemented ", shader_type);
TODO();
return 0;
}
void GLContext::gl_delete_shader(GLuint shader)
{
dbgln("gl_delete_shader({}) unimplemented ", shader);
TODO();
}
void GLContext::gl_shader_source(GLuint shader, GLsizei count, GLchar const** string, GLint const* length)
{
dbgln("gl_shader_source({}, {}, {#x}, {#x}) unimplemented ", shader, count, string, length);
TODO();
}
void GLContext::gl_compile_shader(GLuint shader)
{
dbgln("gl_compile_shader({}) unimplemented ", shader);
TODO();
}
GLuint GLContext::gl_create_program()
{
dbgln("gl_create_program() unimplemented ");
TODO();
return 0;
}
void GLContext::gl_delete_program(GLuint program)
{
dbgln("gl_delete_program({}) unimplemented ", program);
TODO();
}
void GLContext::gl_attach_shader(GLuint program, GLuint shader)
{
dbgln("gl_attach_shader({}, {}) unimplemented ", program, shader);
TODO();
}
void GLContext::gl_link_program(GLuint program)
{
dbgln("gl_link_program({}) unimplemented ", program);
TODO();
}
}