Is it possible to implement the basics of OpenGL in kernel?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
mrjbom
Member
Member
Posts: 322
Joined: Sun Jul 21, 2019 7:34 am

Is it possible to implement the basics of OpenGL in kernel?

Post by mrjbom »

The question arose whether it would be possible to implement the basic set of OpenGL functions.
I will consider Nvidia graphics cards.
As far as I know, all implemented functions according to the OpenGL specification are on the graphics card, it remains only to find the address of the function and interact with it.

Is it possible to draw some primitive object on the screen using OpenGL, protected mode and graphic mode?
GMorgan
Posts: 22
Joined: Sun Jul 14, 2019 4:27 pm

Re: Is it possible to implement the basics of OpenGL in kern

Post by GMorgan »

Literally anything could be in kernel. MS used to render the mouse cursor in kernel.
User avatar
mrjbom
Member
Member
Posts: 322
Joined: Sun Jul 21, 2019 7:34 am

Re: Is it possible to implement the basics of OpenGL in kern

Post by mrjbom »

GMorgan wrote:Literally anything could be in kernel. MS used to render the mouse cursor in kernel.
How to do it?
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: Is it possible to implement the basics of OpenGL in kern

Post by Korona »

OpenGL is not implemented in the graphics card, it is implemented in the graphics card driver. It requires extensive support, including but not limited to: a VRAM memory manager, a compiler of the shader language to the GPU's native instruction set and a command submission engine. Look into Mesa to see how a shader compiler and command buffers work on modern GPUs.
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
User avatar
mrjbom
Member
Member
Posts: 322
Joined: Sun Jul 21, 2019 7:34 am

Re: Is it possible to implement the basics of OpenGL in kern

Post by mrjbom »

Korona wrote:OpenGL is not implemented in the graphics card, it is implemented in the graphics card driver. It requires extensive support, including but not limited to: a VRAM memory manager, a compiler of the shader language to the GPU's native instruction set and a command submission engine. Look into Mesa to see how a shader compiler and command buffers work on modern GPUs.
Do you think it is possible to transfer a part of Mesa to your kernel and use it?
FusT
Member
Member
Posts: 91
Joined: Wed Sep 19, 2012 3:43 am
Location: The Netherlands

Re: Is it possible to implement the basics of OpenGL in kern

Post by FusT »

GMorgan wrote:Literally anything could be in kernel. MS used to render the mouse cursor in kernel.
I'll just quote GMorgan here.

You can implement anything in kernel space. It wouldn't be terribly different from implementing in user-space.
You'd need, amongst others, dynamic memory allocation and a working C library.
Then start porting all supporting libraries to your OS, then port libmesa to your OS.
Post Reply