Open BeezBumba opened 1 month ago
Sorry I forgot the actual link. https://developer.chrome.com/blog/from-webgl-to-webgpu
The WebGPU using a different shading language than WebGL, but the concepts are fairly the same.
I saw shader_frag and shader_vert files in the code directory. WebGL can't support geometry shaders. so could there have been a shader_geo.hlsl file? That might be easier if it's possible.
those shaders are just used for the emulator overlay menu - "New Game, Save State, etc..." it's not used by the emulator itself
So what is your option on the whole conversion? Do you think it's possible at all?
My knowledge of shaders unfortunately is quite basic - so I would really not know
Its not to much about shaders. It's just the conversion from WebGL to WebGPU.
Well can I ask what spots you changed so the emulator uses webGL?
and the spots where you are using the webgl context
The emulator uses WebGL because that is what emscripten translates to when compiling from OpenGL. See this article -
https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html
Here in the code is where it sets up the OpenGL Context -
So I don't actually use any WebGL commands, it's just straight up OpenGL which the compiler at a lower level turns into WebGL. I'm not sure how you would get it to use something else, the emulator would have to be rewritten to use something other than OpenGL - which in Desktop could use different backends (Vulkan, Direct3D, etc...) but on the web you don't have those options. So don't really think this is possible in my opinion.
Do you know how to disable the emulator emulating lag?
Emulators do that just for the pure accuracy.
I don't believe there is any lag, the main tool for maintaining correct framerate is by syncing to the refresh rate of the monitor. this is done using the emscripten_set_main_loop() function:
you can read about it here
https://emscripten.org/docs/api_reference/emscripten.h.html
one thing you can experiment with is setting the variable doubleSpeed to true here -
that will attempt to run 2 frames for every 1 frame of time, however on slow machines it won't be able to keep up and won't yield any benefit.
I asked this because some games on Ipad are a lot better now with vertex buffer objects. but that update still did something with safari.
I found an article that talks about the conversion from WebGL to WebGPU. WebGPU is said to have compute shaders and geometry shaders. Geometry shaders are what the emulator needs because, with them, every triangle has a shader that finds the right pixel colors. This explains why there is no color in the images. I posted this in a new issue since the other one was pretty long.
![Screenshot 2024-06-13 174826](https://github.com/user-attachments/assets/80772d2d-99bd-4e1a-9a32-d47095a2c7ee)