1

我有一个大问题。在最新版本的 Python Arcade 库中(在版本 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

它在街机代码中。不在我的。请帮我 :)

4

2 回答 2

3

int是一种单一的数据类型(请参阅数据类型 (GLSL))。4294967294是十六进制的fffffffe。该值可以存储在类型变量uintunsinged int)中,但不能存储在类型变量中int。可以存储的最大值int2147483647。对于数据类型,int十六进制fffffffe-2
使用数据类型uint或将常量从4294967294更改为-2

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

if (vertex_id[0] == -2) return;
于 2021-09-20T15:46:39.853 回答
2

用街机开发分支还是等一两天2.6.3

编辑:2.6.3 被快速跟踪以解决这个问题。

于 2021-09-21T12:08:05.510 回答