Segfault when creating mesh entity #38
Replies: 4 comments 4 replies
-
Ok, I have reached debugger in Visual Studio and here is what I've found out: |
Beta Was this translation helpful? Give feedback.
-
I'm not able to reproduce this issue. I agree that some Vulkan objects failed to compile, and it could be a missing shader. |
Beta Was this translation helpful? Give feedback.
-
I managed to temporarary fix the problem by editing rocky.mesh.frag code. It works but it renders only the cube, not the vertices (lines on the cube from the code I've shown above). #version 450
#pragma import_defines(USE_MESH_TEXTURE)
layout(location = 1) in vec2 uv;
// inter-stage interface block
struct Varyings {
vec4 color;
float wireframe;
vec3 barycentric;
};
layout(location = 2) flat in Varyings vary;
// outputs
layout(location = 0) out vec4 out_color;
// unis
#ifdef USE_MESH_TEXTURE
layout(binding=6) uniform sampler2D mesh_texture;
#endif
vec3 calculateBarycentric(vec2 p, vec2 a, vec2 b, vec2 c)
{
vec2 v0 = b - a, v1 = c - a, v2 = p - a;
float d00 = dot(v0, v0);
float d01 = dot(v0, v1);
float d11 = dot(v1, v1);
float d20 = dot(v2, v0);
float d21 = dot(v2, v1);
float denom = d00 * d11 - d01 * d01;
float v = (d11 * d20 - d01 * d21) / denom;
float w = (d00 * d21 - d01 * d20) / denom;
float u = 1.0 - v - w;
return vec3(u, v, w);
}
void main()
{
out_color = vary.color;
#ifdef USE_MESH_TEXTURE
out_color.rgb *= texture(mesh_texture, uv).rgb;
#endif
if (vary.wireframe > 0.0)
{
vec2 vertex0 = vec2(0.0, 0.0);
vec2 vertex1 = vec2(1.0, 0.0);
vec2 vertex2 = vec2(0.5, 1.0);
float b = min(vary.barycentric.x, min(vary.barycentric.y, vary.barycentric.z)) * vary.wireframe;
out_color.rgb = mix(vec3(1, 1, 1), out_color.rgb, clamp(b, 0.85, 1.0));
}
} |
Beta Was this translation helpful? Give feedback.
-
Do you have the latest code? Wasn't this fixed in 8e96f11 ? |
Beta Was this translation helpful? Give feedback.
-
I have tried to load line entity and it works perfectly, but when loading mesh entity I have segmentation fault (rdemo also fails). I guess it is related to shaders problem, but I don't know exactly why mesh loading gives me segfault. Currently I can't reach debugger in Visual Studio (my personal problem with laptop), so if you can reproduce this problem I will appreciate it! Here is the code:
Rocky: master
Platform: MSVC 17 2022 Win10
I have no NV extension for shaders enabled on laptop and it crashes. On my PC I have this extension enabled and it works (though I ran rdemo a couple of weeks ago).
Beta Was this translation helpful? Give feedback.
All reactions