Giter Club home page Giter Club logo

Comments (25)

oxheron avatar oxheron commented on June 14, 2024

Sorry if the screenshot quality is bad

from bgfx.

oxheron avatar oxheron commented on June 14, 2024

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.

oxheron avatar oxheron commented on June 14, 2024

And this may not be specific to dynamic buffers either, just any index buffers that are subbuffers & need to be offsetted.

from bgfx.

bkaradzic avatar bkaradzic commented on June 14, 2024

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.

oxheron avatar oxheron commented on June 14, 2024

Sorry. Thought that was a build thing not working for me. Ill fix it

from bgfx.

oxheron avatar oxheron commented on June 14, 2024

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.

bkaradzic avatar bkaradzic commented on June 14, 2024

GL shaders + SPIRV are enough, I'm looking at GL bug, SPIRV just for VK reference.

from bgfx.

oxheron avatar oxheron commented on June 14, 2024

Should be good now.

from bgfx.

bkaradzic avatar bkaradzic commented on June 14, 2024

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.

oxheron avatar oxheron commented on June 14, 2024

ok. cant see why but, ill fix that now.

from bgfx.

bkaradzic avatar bkaradzic commented on June 14, 2024

I'm also on Linux, so .bat doesn't work there.

from bgfx.

oxheron avatar oxheron commented on June 14, 2024

yeah, that was just for windows. cause i didn't see your message about D3D till id already finished it.

from bgfx.

oxheron avatar oxheron commented on June 14, 2024

hopefully it works now

from bgfx.

bkaradzic avatar bkaradzic commented on June 14, 2024

Failed to load shaders/glsl/vs_bug.bin

from bgfx.

oxheron avatar oxheron commented on June 14, 2024

Did you build the shaders?

from bgfx.

oxheron avatar oxheron commented on June 14, 2024

Cause I just put the names so they should build with the system.

from bgfx.

bkaradzic avatar bkaradzic commented on June 14, 2024
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.

bkaradzic avatar bkaradzic commented on June 14, 2024

Ok, so now when I run GL I should see red triangle. And when I run VK I should see something else?

from bgfx.

oxheron avatar oxheron commented on June 14, 2024

No, its a really hard bug to show

from bgfx.

oxheron avatar oxheron commented on June 14, 2024

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.

oxheron avatar oxheron commented on June 14, 2024

Just visually i mean

from bgfx.

bkaradzic avatar bkaradzic commented on June 14, 2024

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.

oxheron avatar oxheron commented on June 14, 2024

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.

oxheron avatar oxheron commented on June 14, 2024

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.

oxheron avatar oxheron commented on June 14, 2024

I don't know if this would be a good long term fix or not however.

from bgfx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.