Comments (25)
Sorry if the screenshot quality is bad
from bgfx.
It doesn't look like there is going to be an easy fix for this in opengl, as the functions to offset buffers don't work on instance buffers, and glMultiDrawElementsIndirect doesn't have an offset either. However Im pretty sure a pure bgfx solution would work in Vulkan and D3D
from bgfx.
And this may not be specific to dynamic buffers either, just any index buffers that are subbuffers & need to be offsetted.
from bgfx.
Can you fix your example to actually work as any other example with shaders binaries being in runtime instead in source directory. I just ran example you provided and it just crashes.
from bgfx.
Sorry. Thought that was a build thing not working for me. Ill fix it
from bgfx.
I cant build the hlsl or metal shaders so ill just write a script in the cubes dir to do that if you're using windows. Also, so far this issue has only occurred on OpenGL and Vulkan.
from bgfx.
GL shaders + SPIRV are enough, I'm looking at GL bug, SPIRV just for VK reference.
from bgfx.
Should be good now.
from bgfx.
It doesn't work...
If you just name your shaders vs_, fs_, cs_ it would build with provided makefile, and it would just output where it needs to be.
from bgfx.
ok. cant see why but, ill fix that now.
from bgfx.
I'm also on Linux, so .bat doesn't work there.
from bgfx.
yeah, that was just for windows. cause i didn't see your message about D3D till id already finished it.
from bgfx.
hopefully it works now
from bgfx.
Failed to load shaders/glsl/vs_bug.bin
from bgfx.
Did you build the shaders?
from bgfx.
Cause I just put the names so they should build with the system.
from bgfx.
diff --git a/examples/01-cubes/fs_bug.sc b/examples/01-cubes/fs_bug.sc
index 4b544fe..226f516 100644
--- a/examples/01-cubes/fs_bug.sc
+++ b/examples/01-cubes/fs_bug.sc
@@ -1,7 +1,5 @@
-vec4 vec4_splat(float input)
-{
- return vec4(input, input, input, input);
-}
+
+#include <bgfx_shader.sh>
void main()
{
diff --git a/examples/01-cubes/vs_bug.sc b/examples/01-cubes/vs_bug.sc
index 36c3aa7..2748563 100644
--- a/examples/01-cubes/vs_bug.sc
+++ b/examples/01-cubes/vs_bug.sc
@@ -1,6 +1,8 @@
$input a_position
+#include <bgfx_shader.sh>
+
void main()
{
- gl_Position = vec4(a_position, 1);
+ gl_Position = vec4(a_position, 1.0);
}
from bgfx.
Ok, so now when I run GL I should see red triangle. And when I run VK I should see something else?
from bgfx.
No, its a really hard bug to show
from bgfx.
But it only shows up in a rendering debugger. If you read my initial comment youll see what I mean. Also, after reading that if you have a better idea on how to confirm a bug like that then Ill implement it.
from bgfx.
Just visually i mean
from bgfx.
Ok, I'll try to understand what's going on... It's usually better to have repro to be obvious when something is wrong.
from bgfx.
yeah no, sorry. I 100% agree. I will say, I think my thought is that when you use dynamic index buffers bgfx packs all of the data into one index buffer, and an offset is used to make sure the right buffer is selected. But when you do a indirect call there is no way for this offset to be set for index buffers (because all index buffer offsets are part of the indirect call, which is created on the gpu). I can't say why it seems to get the vertex buffer right as I would assume this issue happens on the vertex buffers as well (but it doesn't).
from bgfx.
I implemented a potential temporary fix here, on the master branch https://github.com/oxheron/bgfx, if you want to take a look at it. It just provides an interface for users to get the index buffer offset, so it puts it on the users to add that into their indirect buffer calls. This should probably be tested more, but it worked for me on Vulkan so far (and seems that it could be a just bgfx side call anyways).
from bgfx.
I don't know if this would be a good long term fix or not however.
from bgfx.
Related Issues (20)
- Bug: DX3D12 crash in Debug mode HOT 7
- Small fix on soname defining on ldflags for Android examples. HOT 2
- Crash on linux (default backend - vulkan) with custom window handle and native display is NULL HOT 6
- Shaderc.cpp incorrectly adds PSSL preamble to compute shader HOT 1
- macOS version compatibility HOT 2
- Bad Vulkan performance due to weak index/vertex buffer management HOT 1
- Crash on resize: Nvidia RTX 4090 + Vulkan + Linux HOT 5
- Metal: example-01-helloworld corrupted render when MSAA is enabled HOT 2
- Shifted window buffer location when resizing a window HOT 1
- Vulkan Backend - incorrect mipmap generation for cubemap frame buffers. HOT 4
- Unable to build bgfx for iOS Simulator x86_64 arch HOT 4
- Vulkan on Android: the frame isn't updating (ONLY THE FIRST FRAME IS RENDERED) HOT 4
- Screenshot taken always from the main window backbuffer on MacOS/Metal
- gl_NumWorkGroups doesn't compile when the target is DirectX HOT 1
- Feature request: Support FSR 3 instead of FSR 1
- Allow one executable to run with Vulkan on Wayland and X11 HOT 1
- BX and BGFX do not support the conformant MSVC preprocessor HOT 12
- Examples crash on startup on Ubuntu 22.04 HOT 7
- A D3D11 debuglayer warning in 00-helloworld example project.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bgfx.