From f6884f4ad4790e2657793da159cac40b6bc94a0c Mon Sep 17 00:00:00 2001 From: dmaivel Date: Sat, 6 Jul 2024 21:16:25 -0400 Subject: [PATCH] Implement `glGetInternalformativ` --- src/client/glimpl.c | 18 ++++++++++++++++-- src/server/processor.c | 10 ++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/client/glimpl.c b/src/client/glimpl.c index 93fff27..70ec39d 100644 --- a/src/client/glimpl.c +++ b/src/client/glimpl.c @@ -8933,7 +8933,14 @@ void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, G void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) { - fprintf(stderr, "glGetInternalformativ: stub\n"); + pb_push(SGL_CMD_GETINTERNALFORMATIV); + pb_push(target); + pb_push(internalformat); + pb_push(pname); + pb_push(bufSize); + + glimpl_submit(); + memcpy(params, pb_ptr(SGL_OFFSET_REGISTER_RETVAL_V), bufSize * sizeof(int)); } void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint* params) @@ -8994,7 +9001,14 @@ void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint* params) void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64* params) { - fprintf(stderr, "glGetInternalformati64v: stub\n"); + pb_push(SGL_CMD_GETINTERNALFORMATI64V); + pb_push(target); + pb_push(internalformat); + pb_push(pname); + pb_push(bufSize); + + glimpl_submit(); + memcpy(params, pb_ptr(SGL_OFFSET_REGISTER_RETVAL_V), bufSize * sizeof(GLint64)); } void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) diff --git a/src/server/processor.c b/src/server/processor.c index 62d0d16..a323873 100644 --- a/src/server/processor.c +++ b/src/server/processor.c @@ -5196,6 +5196,11 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) break; } case SGL_CMD_GETINTERNALFORMATIV: { + int target = *pb++; + int internalformat = *pb++; + int pname = *pb++; + int bufSize = *pb++; + glGetInternalformativ(target, internalformat, pname, bufSize, p + SGL_OFFSET_REGISTER_RETVAL_V); break; } case SGL_CMD_GETACTIVEATOMICCOUNTERBUFFERIV: { @@ -5239,6 +5244,11 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) break; } case SGL_CMD_GETINTERNALFORMATI64V: { + int target = *pb++; + int internalformat = *pb++; + int pname = *pb++; + int bufSize = *pb++; + glGetInternalformati64v(target, internalformat, pname, bufSize, p + SGL_OFFSET_REGISTER_RETVAL_V); break; } case SGL_CMD_INVALIDATEFRAMEBUFFER: {