gamescope icon indicating copy to clipboard operation
gamescope copied to clipboard

ReShade 0 size uniform allocation fail

Open mrsteyk opened this issue 6 months ago • 0 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Are you using any gamescope patches or a forked version of gamescope?

  • [x] The issue occurs on upstream gamescope without any modifications

Current Behavior

When ReShade effect has no uniforms - effect fails to initialise due to 0 byte buffer allocation which violates the Vulkan spec.

Steps To Reproduce

  1. Create test.fx in the right place with following content:
void PostProcessVS(in uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD)                                                                                                 
{                                                                                                                                                                                                               
        texcoord.x = (id == 2) ? 2.0 : 0.0;                                                                                                                                                                     
        texcoord.y = (id == 1) ? 2.0 : 0.0;                                                                                                                                                                     
        position = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);                                                                                                                          
}

texture texColorBuffer : COLOR;
sampler colorSamplerLinear { Texture = texColorBuffer; };

// workaround for gamescope zero-alloc bug!
//uniform float4 UniformSingleValue = float4(0.0f, 0.0f, 0.0f, 0.0f);

void PS(in float4 pos : SV_Position, in float2 texcoord : TEXCOORD, out float4 fragColor : SV_Target)
{
 //fragColor = tex2Dlod(colorSamplerLinear, float4(texcoord, 0, 0));
 fragColor = float4(1, 0, 0, 0);
}

technique Test {
 pass {
  VertexShader = PostProcessVS;
  PixelShader = PS;
 }
}
  1. Launch anything with it, for example vkcube: gamescope --reshade-effect test.fx -- vkcube
  2. Expected behaviour - red screen, but you will see original image and error in the log. Uncomment the uniform line and everything will work fine.

Hardware information

- Distro: Arch Linux
- CPU: AMD Ryzen 9 7950X 16-Core Processor
- GPU: NVIDIA GeForce RTX 3060
- Driver Version: nvidia-open 580.95.05

Software information

- Desktop environment: Hyprland 0.51.1 built from branch  at commit 71a1216abcc7031776630a6d88f105605c4dc1c9
- Session type: DRM/SDL
- Gamescope version: 7d4e835a25cc85017380cbd743d517b48932fb75
- Gamescope launch command(s): `gamescope --backend sdl --reshade-effect test.fx -- vkcube` / in tty: `gamescope --reshade-effect test.fx -- vkcube`

Which gamescope backends have the issue you are reporting?

  • [ ] Wayland (default for nested gamescope)
  • [x] DRM (default for embedded gamescope, i.e. gamescope-session)
  • [x] SDL
  • [ ] OpenVR

Logging, screenshots, or anything else

With force enabled validation layer with SDL backend:

...
[gamescope] [Info]  gamescope_reshade: Using technique: Test

Validation Error: [ VUID-VkBufferCreateInfo-size-00912 ] | MessageID = 0x7c54445e
vkCreateBuffer(): pCreateInfo->size is zero.
The Vulkan spec states: size must be greater than 0 (https://docs.vulkan.org/spec/latest/chapters/resources.html#VUID-VkBufferCreateInfo-size-00912)

Validation Error: [ VUID-VkMemoryAllocateInfo-allocationSize-07897 ] | MessageID = 0xa967ba00
vkAllocateMemory(): pAllocateInfo->allocationSize is 0.
The Vulkan spec states: If the parameters do not define an import or export operation, allocationSize must be greater than 0 (https://docs.vulkan.org/spec/latest/chapters/memory.html#VUID-VkMemoryAllocateInfo-allocationSize-07897)

Validation Error: [ VUID-VkMemoryAllocateInfo-allocationSize-07899 ] | MessageID = 0x5e299387
vkAllocateMemory(): pAllocateInfo->allocationSize is 0.
The Vulkan spec states: If the parameters define an export operation and the handle type is not VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID , allocationSize must be greater than 0 (https://docs.vulkan.org/spec/latest/chapters/memory.html#VUID-VkMemoryAllocateInfo-allocationSize-07899)

[gamescope] [Error] gamescope_reshade: vkAllocateMemory failed
...

mrsteyk avatar Oct 28 '25 07:10 mrsteyk