我该如何修复此 Python Arcade 几何着色器错误?

How can I fix this Python Arcade Geometry Shader error?

我有一个大问题。在最新版本的 Python Arcade Library 中(在版本 2.5.7 上程序 运行 成功)是从每个程序启动时的错误:

    Traceback (most recent call last):
  File "C:Users-PycharmProjectsarcadegame.py", line 35, in <module>
    main()
  File "C:Users-PycharmProjectsarcadegame.py", line 29, in main
    window = MyGame()
  File "C:Users-PycharmProjectsarcadegame.py", line 12, in __init__
    super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
  File "C:Users-PycharmProjectsarcadevenvlibsite-packagesarcadeapplication.py", line 143, in __init__
    self._ctx: ArcadeContext = ArcadeContext(self, gc_mode=gc_mode)
  File "C:Users-PycharmProjectsarcadevenvlibsite-packagesarcadecontext.py", line 81, in __init__
    fragment_shader=":resources:shaders/sprites/sprite_list_geometry_fs.glsl",
  File "C:Users-PycharmProjectsarcadevenvlibsite-packagesarcadecontext.py", line 346, in load_program
    defines=defines,
  File "C:Users-PycharmProjectsarcadevenvlibsite-packagesarcadeglcontext.py", line 631, in program
    out_attributes=out_attributes,
  File "C:Users-PycharmProjectsarcadevenvlibsite-packagesarcadeglprogram.py", line 94, in __init__
    shader = Program.compile_shader(shader_code, shader_type)
  File "C:Users-PycharmProjectsarcadevenvlibsite-packagesarcadeglprogram.py", line 427, in compile_shader
    for i, line in enumerate(source.split("n"))
arcade.gl.exceptions.ShaderException: Error compiling geometry shader (0): ERROR: 0:25: '4294967294' : Signed integer overflow.
 
 
---- [geometry shader] ---
001: #version 330
002: layout (points) in;
003: layout (triangle_strip, max_vertices = 4) out;
004:  
005: uniform Projection {
006:     uniform mat4 matrix;
007: } proj;
008:  
009: uniform sampler2D uv_texture;
010: uniform mat3 TextureTransform;
011:  
012: in float v_angle[1];
013: in vec4 v_color[1];
014: in vec2 v_size[1];
015: in int v_texture[1];
016: in int vertex_id[1];
017:  
018: out vec2 gs_uv;
019: out vec4 gs_color;
020:  
021: #define VP_CLIP 1.0
022:  
023: void main() {
024:     // Sprite index 4294967294 means the sprite is deleted or disabled
025:     if (vertex_id[0] == 4294967294) return;
026:  
027:     // Get center of the sprite
028:     vec2 center = gl_in[0].gl_Position.xy;
029:     vec2 hsize = v_size[0] / 2.0;
030:     float angle = radians(v_angle[0]);
031:     mat2 rot = mat2(
032:         cos(angle), sin(angle),
033:         -sin(angle), cos(angle)
034:     );
035:  
036:     // Emit a quad with the right position, rotation and texture coordinates
037:     // Read texture coordinates from UV texture here
038:     vec4 uv_data = texelFetch(uv_texture, ivec2(v_texture[0], 0), 0);
039:     vec2 tex_offset = uv_data.xy;
040:     vec2 tex_size = uv_data.zw;
041:  
042:     // Upper left
043:     gl_Position = proj.matrix * vec4(rot * vec2(-hsize.x, hsize.y) + center, 0.0, 1.0);
044:     vec3 tex1 = TextureTransform * vec3((vec2(0.0, 1.0) * tex_size + tex_offset) * vec2(1, -1), 1.0);
045:     gs_uv = tex1.xy / tex1.z;
046:     gs_color = v_color[0];
047:     EmitVertex();
048:  
049:     // lower left
050:     gl_Position = proj.matrix * vec4(rot * vec2(-hsize.x, -hsize.y) + center, 0.0, 1.0);
051:     vec3 tex2 = TextureTransform * vec3((vec2(0.0, 0.0) * tex_size + tex_offset) * vec2(1, -1), 1.0);
052:     gs_uv = tex2.xy / tex2.z;
053:     gs_color = v_color[0];
054:     EmitVertex();
055:  
056:     // upper right
057:     gl_Position = proj.matrix * vec4(rot * vec2(hsize.x, hsize.y) + center, 0.0, 1.0);
058:     vec3 tex3 = TextureTransform * vec3((vec2(1.0, 1.0) * tex_size + tex_offset) * vec2(1, -1), 1.0);
059:     gs_uv = tex3.xy / tex3.z;
060:     gs_color = v_color[0];
061:     EmitVertex();
062:  
063:     // lower right
064:     gl_Position = proj.matrix * vec4(rot * vec2(hsize.x, -hsize.y) + center, 0.0, 1.0);
065:     vec3 tex4 = TextureTransform * vec3((vec2(1.0, 0.0) * tex_size + tex_offset) * vec2(1, -1), 1.0);
066:     gs_uv = tex4.xy / tex4.z;
067:     gs_color = v_color[0];
068:     EmitVertex();
069:  
070:     EndPrimitive();
071: }

代码不重要。每个程序都有错误。 我在 Windows 10

上使用 PyCharm

它是街机代码中的东西。不在我的。 请帮助我:)

int 是一种单数数据类型(参见 Data Type (GLSL))。 4294967294 是十六进制 fffffffe。此值可以存储在类型 uint (unsinged int) 的变量中,但不能存储在类型 int 的变量中。 int中可以存储的最大值是2147483647。对于数据类型 int 十六进制 fffffffe-2.
使用数据类型 uint 或将常量从 4294967294 更改为 -2:

if (vertex_id[0] == 4294967294) return;

if (vertex_id[0] == -2) return;

使用arcade development branch或者等一两天2.6.3

编辑:2.6.3 已快速解决此问题。