Hull, Domain and Geometry Shaders for DirectX and OpenGL#7352
Hull, Domain and Geometry Shaders for DirectX and OpenGL#7352cpt-max wants to merge 62 commits intoMonoGame:developfrom
Conversation
… and matrix transpose
MonoGame 3.8 Release
Update master
Fix Missing Android Package
…ines for EffectProcessor.
…arameter updating when uniform buffers are not available.
…orm buffer objects.
…gs when no errors are present.
|
Thought I should mention I couldn't get this to build shaders on my minspec GPUs (an Intel HD4000 and a Radeon M9 370X, the Macbook 2015 one) even though they ostensibly support OpenGL>4.0, but in reality have poor driver support. I wasn't able to get any relevant error messages. Apologies for the unconstructive reply but I imagine most folks will be focusing on testing the newer shader models and GL4 features which SPIRV appears to handle well, but I think many monogame devs want to support older hardware too. I wasn't able to do so without reverting back to mojoshader for those devices, which is quite reliable when it comes to building legacy shaders. I'll give this another try with the latest ShaderConductor and SPIRV builds soon and hopefully come up with some solutions. |
It fails at runtime, not during content building, right? I assume you get an exception in Shader.GetShaderHandle() in Shader.OpenGL.cs. You really get nothing useful from GL.GetShaderInfoLog()?
You got the right impression. With ShaderConductor you really want to use shader model 4 or higher. Shader model 2 and 3 will map to OpenGL 2, which is just not that well supported.
All you really need is OpenGL 3.3 (released in 2010), you really think there's a lot of demand for even older hardware? |
Fixed NullReferenceException in EffectParameter's SetMatrixArray and SetMatrixArrayTransposed methods.
|
A little update, as I finally have some time for MonoGame stuff again. I addressed a few issues mentioned above:
The root of the float4x4 problem is this: layout(location = 3) in mat4 in_var_BLENDWEIGHT0;The easiest solution would be if ShaderConductor could flatten the matrix, just like MojoShader does. I made a request on the SPIRV-Cross GitHub. |
…o transpose in C#.
…into glshaderstages
|
I just noticed that ShaderConductor actually has a flag to switch between row-major and column-major matrices, this allowed me to remove the manual matrix transposing for OpenGL. I could slap myself for not seeing this earlier. |
|
Matrices should work now as vertex shader inputs. I had to store the matrix size in the effects file for this, so effects need to be recompiled. Unfortunately I found a problem with the row-major/column-major switch I made recently (7fc7d9b) |
|
Apparently the square matrix limitation only applies to OpenGL 2 (shader models 2 and 3). |
|
Thank you again for all this work! It's a big and important chunk which will also have effects on the console implementations. 3.8.1 should be releasing soon, so one of the next goals will be reviewing this PR. |
|
i can not wait anymore :( it looks so amazing! |
|
Closing this PR, as it's contained in #7533 |
This PR is based on my previous PR #7242 which was DirectX only. Now those new shader stages also work in OpenGL. A switch from MojoShader to ShaderConductor was neccessary to make this happen, so PR #7345 is also included.
Here you find a sample project containing a simple Hull, Domain and Geometry shader.
This shader migration document explains what changes need to be made to old shader code.
Here are some more details about the shader model support in OpenGL.
Anyone wanting to try out this branch, please use #7533 instead. It fully contains this branch and is kept up to date.