bigwheels
bigwheels copied to clipboard
GPU mipmap generation broken when running with SwiftShader
Step 1: enable swiftshader https://github.com/google/bigwheels/blob/main/docs/software_rendering.md
Step 2: run a sample for example: 05_cube_textured or to see more clearly: run vk_27_mipmap_demo, select a different mip level (> 0) to be generated using GPU
Background: Mipmap creation code in https://github.com/google/bigwheels/blob/main/src/ppx/graphics_util.cpp#L273
My two cents on this issue. Mipmap generation, predates Swiftsahder inclusion on BW. So, it was never tested. In the mipmap demo, the image on the right is produced by our own code on GPU, while the one on the left is produce by doing the Mips in CPU using a thirdparty library. The mips are computed in GPU using a Compute Shader, In order here are some things that can go wrong here:
- Swift shader support for Compute Shaders.
1.1 The compute shader, is precompiled and the binary code (SPIRV) is stored in the two headers:
a)
include/ppx/generate_mip_shader_DX.h
b)include/ppx/generate_mip_shader_VK.h
My first guess will be that non of thats SPIRV is valid for SwiftShader - The shader setup: Maybe the shader setup code (src/ppx/graphics_util.cpp, in CreateImageFromBitmapGpu), makes some assumption that is not valid for SwiftShader, about the image loading (padding, stride or something similar). If this is the case maybe the
22_image_filter
demo program does not work as well? - SwitfShader, does a bad work interpolating the Mips? Does the 05_cube_textured demo program works as expected?, if you move the other slider, does the image on the left works as expected?