-
Notifications
You must be signed in to change notification settings - Fork 426
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
Magnum batch renderer prototype #1798
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
137a3ce
Magnum batch renderer prototype.
mosra 46c7f99
Clang Format, you really think you can format this better than me??
mosra faad5b2
Take NVidia 256-byte UBO alignment into account.
mosra 8d27af9
Test also CUDA interop.
mosra 63f4e24
Fix build with external Magnum.
mosra 221b6c5
Fix crash on exit -- forgot to unregister CUDA resources.
mosra e2d326e
Add a CMake tech debt TODO.
mosra 2dcc8a9
gfx: rename BatchRenderer::add() to addMeshHierarchy().
mosra fa53f05
Move the batch renderer to a dedicated gfx_batch library.
mosra 200de31
More robust CUDA device detection in the test.
mosra 5686884
Add a note about restrictions for gfx_batch dependencies.
mosra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# You have to add the following to your .git/config or global | ||
# ~/.gitconfig to make the binary diffs work (without the comment | ||
# character, of course): | ||
# | ||
# [diff "hex"] | ||
# textconv = hexdump -v -C | ||
# binary = true | ||
# | ||
|
||
*.ktx2 binary diff=hex | ||
*.glb binary diff=hex | ||
*.bin binary diff=hex |
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,273 @@ | ||
{ | ||
"asset": { | ||
"version": "2.0", | ||
"generator": "Magnum GltfSceneConverter" | ||
}, | ||
"extensionsUsed": [ | ||
"MAGNUMX_mesh_views", | ||
"KHR_texture_ktx" | ||
], | ||
"extensionsRequired": [ | ||
"MAGNUMX_mesh_views", | ||
"KHR_texture_ktx" | ||
], | ||
"buffers": [ | ||
{ | ||
"uri": "batch.bin", | ||
"byteLength": 1820 | ||
} | ||
], | ||
"bufferViews": [ | ||
{ | ||
"buffer": 0, | ||
"byteOffset": 0, | ||
"byteLength": 444 | ||
}, | ||
{ | ||
"buffer": 0, | ||
"byteOffset": 444, | ||
"byteLength": 1356, | ||
"byteStride": 32 | ||
}, | ||
{ | ||
"buffer": 0, | ||
"byteOffset": 456, | ||
"byteLength": 1356, | ||
"byteStride": 32 | ||
}, | ||
{ | ||
"buffer": 0, | ||
"byteOffset": 468, | ||
"byteLength": 1352, | ||
"byteStride": 32 | ||
} | ||
], | ||
"accessors": [ | ||
{ | ||
"bufferView": 0, | ||
"componentType": 5125, | ||
"count": 111, | ||
"type": "SCALAR" | ||
}, | ||
{ | ||
"bufferView": 1, | ||
"componentType": 5126, | ||
"count": 43, | ||
"type": "VEC3" | ||
}, | ||
{ | ||
"bufferView": 2, | ||
"componentType": 5126, | ||
"count": 43, | ||
"type": "VEC3" | ||
}, | ||
{ | ||
"bufferView": 3, | ||
"componentType": 5126, | ||
"count": 43, | ||
"type": "VEC2" | ||
} | ||
], | ||
"images": [ | ||
{ | ||
"uri": "batch.0.ktx2" | ||
} | ||
], | ||
"samplers": [ | ||
{ | ||
"wrapS": 10497, | ||
"wrapT": 10497, | ||
"minFilter": 9984, | ||
"magFilter": 9728 | ||
} | ||
], | ||
"textures": [ | ||
{ | ||
"sampler": 0, | ||
"extensions": { | ||
"KHR_texture_ktx": { | ||
"source": 0, | ||
"layer": 0 | ||
} | ||
} | ||
}, | ||
{ | ||
"sampler": 0, | ||
"extensions": { | ||
"KHR_texture_ktx": { | ||
"source": 0, | ||
"layer": 1 | ||
} | ||
} | ||
} | ||
], | ||
"materials": [ | ||
{ | ||
"pbrMetallicRoughness": { | ||
"baseColorTexture": { | ||
"index": 0 | ||
} | ||
} | ||
}, | ||
{ | ||
"pbrMetallicRoughness": { | ||
"baseColorFactor": [0, 1, 1, 1], | ||
"baseColorTexture": { | ||
"index": 1, | ||
"extensions": { | ||
"KHR_texture_transform": { | ||
"scale": [0.5, 0.5], | ||
"offset": [0, 0.5] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"pbrMetallicRoughness": { | ||
"baseColorFactor": [1, 0, 1, 1], | ||
"baseColorTexture": { | ||
"index": 1, | ||
"extensions": { | ||
"KHR_texture_transform": { | ||
"scale": [0.5, 0.5], | ||
"offset": [0.5, 0.5] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"pbrMetallicRoughness": { | ||
"baseColorFactor": [1, 1, 0, 1], | ||
"baseColorTexture": { | ||
"index": 1, | ||
"extensions": { | ||
"KHR_texture_transform": { | ||
"scale": [0.5, 0.5], | ||
"offset": [0, 0] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"meshes": [ | ||
{ | ||
"primitives": [ | ||
{ | ||
"indices": 0, | ||
"attributes": { | ||
"POSITION": 1, | ||
"NORMAL": 2, | ||
"TEXCOORD_0": 3 | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"nodes": [ | ||
{ | ||
"children": [1], | ||
"name": "square" | ||
}, | ||
{ | ||
"mesh": 0, | ||
"extras": { | ||
"meshViewIndexOffset": 0, | ||
"meshViewIndexCount": 6, | ||
"meshViewMaterial": 0 | ||
} | ||
}, | ||
{ | ||
"children": [3], | ||
"name": "circle" | ||
}, | ||
{ | ||
"mesh": 0, | ||
"extras": { | ||
"meshViewIndexOffset": 24, | ||
"meshViewIndexCount": 96, | ||
"meshViewMaterial": 1 | ||
} | ||
}, | ||
{ | ||
"children": [5], | ||
"name": "triangle" | ||
}, | ||
{ | ||
"mesh": 0, | ||
"extras": { | ||
"meshViewIndexOffset": 408, | ||
"meshViewIndexCount": 9, | ||
"meshViewMaterial": 2 | ||
} | ||
}, | ||
{ | ||
"children": [7, 8, 9, 10], | ||
"name": "four squares" | ||
}, | ||
{ | ||
"mesh": 0, | ||
"matrix": [ | ||
0.4, 0, 0, 0, | ||
0, 0.4, 0, 0, | ||
0, 0, 0.4, 0, | ||
-0.5, -0.5, 0, 1 | ||
], | ||
"extras": { | ||
"meshViewIndexOffset": 0, | ||
"meshViewIndexCount": 6, | ||
"meshViewMaterial": 0 | ||
} | ||
}, | ||
{ | ||
"mesh": 0, | ||
"matrix": [ | ||
0.4, 0, 0, 0, | ||
0, 0.4, 0, 0, | ||
0, 0, 0.4, 0, | ||
0.5, -0.5, 0, 1 | ||
], | ||
"extras": { | ||
"meshViewIndexOffset": 0, | ||
"meshViewIndexCount": 6, | ||
"meshViewMaterial": 1 | ||
} | ||
}, | ||
{ | ||
"mesh": 0, | ||
"matrix": [ | ||
0.4, 0, 0, 0, | ||
0, 0.4, 0, 0, | ||
0, 0, 0.4, 0, | ||
-0.5, 0.5, 0, 1 | ||
], | ||
"extras": { | ||
"meshViewIndexOffset": 0, | ||
"meshViewIndexCount": 6, | ||
"meshViewMaterial": 2 | ||
} | ||
}, | ||
{ | ||
"mesh": 0, | ||
"matrix": [ | ||
0.4, 0, 0, 0, | ||
0, 0.4, 0, 0, | ||
0, 0, 0.4, 0, | ||
0.5, 0.5, 0, 1 | ||
], | ||
"extras": { | ||
"meshViewIndexOffset": 0, | ||
"meshViewIndexCount": 6, | ||
"meshViewMaterial": 3 | ||
} | ||
} | ||
], | ||
"scenes": [ | ||
{ | ||
"nodes": [0, 2, 4, 6] | ||
} | ||
], | ||
"scene": 0 | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+374 Bytes
data/test_assets/screenshots/GfxBatchRendererTestMeshHierarchyNoTextures.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+659 Bytes
data/test_assets/screenshots/GfxBatchRendererTestMultipleMeshes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+656 Bytes
data/test_assets/screenshots/GfxBatchRendererTestMultipleScenes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+517 Bytes
data/test_assets/screenshots/GfxBatchRendererTestMultipleScenesClearScene1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't expect Habitat users to be doing KTX compression, except in offline tools. (I know we also imagine a load-time preprocessing use case that could invoke this, but I hope to discourage users from this mode of operation.)
Any concern about including this by default in the Habitat runtime, in terms of binary size bloat or whatever? An alternative would be a build switch that is off by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Er, actually, the reason I put it here is because
find_package(MagnumPlugins OPTIONAL_COMPONENTS KtxImageConverter)
causes a CMake error otherwise 🔥 Which I have to fix.But this particular plugin (unlike e.g. Basis, or OpenEXR) is a tiny self-contained 400-line code with no external dependencies that builds fast, so it felt like a good enough tradeoff until I fix the CMake modules.
Will add a TODO there, at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO added.