Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
inColor: input vec3 0,
outColor: output vec4 0,
) {
outColor = vec4(inColor, 1.0)
}
"""
##
# Instantiate gl-based wgpu context
if BACKEND == "GL":
ctx = wgpu.wgpu_gl.GlWGPU()
elif BACKEND == "CTYPES":
ctx = wgpu.wgpu_ctypes.RsWGPU()
elif BACKEND == "FFI":
ctx = wgpu.wgpu_ffi.RsWGPU()
else:
raise RuntimeError(f"Invalid backend {BACKEND}")
adapter_id = ctx.request_adapter(
ctx.create_RequestAdapterOptions(
power_preference=ctx.PowerPreference_Default,
#backends = 1 | 2 | 4 | 8 # modern, but Dx12 is still buggy
backends = 2 | 4 # Vulkan or Metal
# on HP laptop: 2 and 8 are available, but 2 does not work. 8 works, but it wants zero bind groups :/
# 1 => Backend::Empty,
# 2 => Backend::Vulkan,
# 4 => Backend::Metal,
# 8 => Backend::Dx12,
# 16 => Backend::Dx11,
# 32 => Backend::Gl,
def __init__(self):
self._pipelines = []
ffi = wgpu.wgpu_ffi.ffi
# todo: this context is not really a context, its just an API, maybe keep it that way, or make it a context by including device_id
ctx = wgpu.wgpu_ffi.RsWGPU()
self._ctx = ctx
self._surface_size = 0, 0
# backends = 1 | 2 | 4 | 8 # modern, but Dx12 is still buggy
backends = 2 | 4 # Vulkan or Metal
# on HP laptop: 2 and 8 are available, but 2 does not work. 8 works, but it wants zero bind groups :/
# 1 => Backend::Empty,
# 2 => Backend::Vulkan,
# 4 => Backend::Metal,
# 8 => Backend::Dx12,
# 16 => Backend::Dx11,
# 32 => Backend::Gl,
# Initialize adapter id. It will be set from the callback that we pass
# to request_adapter_async. At the moment, the callback will be called
# directly (in-line), but this will change in the future when wgpu also