forked from libsdl-org/SDL
-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gpu: OpenGL 4 implementation #7
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
And use GLSL shaders until SDL shader language is ready
Instead of separatable shader and program pipeline.
Because OpenGL is not multithreaded we are only encoding 1 render pass at a time. All render passes can share the same framebuffer.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I wrote an OpenGL implementation and fixed some bugs in SDL_gpu.c and spinning cube test. It is working:
But:
No command buffer, every command is sent immediately to OpenGLIt requires OpenGL 4.6 for polygon offset clamp and uses Direct State Access from 4.5.
Change I made to the API:
SDL_SetGpuMesh()
:Mesh buffer is declared differently from other buffer in shader (
@input
vs@buffer(index)
). It is the same in GLSL. We could also add a parameter toSDL_GpuDraw*()
.@input
should also take an index to allow more than 1 buffer as mesh buffer.Remark about the API:
Do we really need CPU buffer. I see there are implemented the same in metal and it is also the case in OpenGL. I think an usage flag on GPU buffer could work (
SDL_GPU_BUFFER_USAGE_LOCKABLE_READ
,SDL_GPU_BUFFER_USAGE_LOCKABLE_WRITE
, ...).SDL_GPUSAMPADDR_CLAMPTOZERO
does not exit in OpenGL (maybe there is an extention?)SDL_GpuFillBuffer()
, likememset()
, is only good to fill 0. OpenGL can convert clear value to internal format if you pass the internal buffer format.I am not conviced about
GetBackbuffer
andPresent
too. I would simplify it a lot: user create a render texture, then callPresent()
to tell: put that texture on that window.Could we makeWe execute only 1 render pass at a time, all render passes can share the same framebuffer.RenderPass
persistent? OpenGL currently create a framebuffer, to store render textures, inStartRenderPass()
. Creating a framebuffer is not a fast operation.I complained about the lack of
glUniform()
equivalent in the past. I see now how you don't need it, you can forget about it.