diff --git a/base/sources/backends/data/android/settings.gradle.kts b/base/sources/backends/data/android/settings.gradle.kts index 2ef8764d..9db63c86 100644 --- a/base/sources/backends/data/android/settings.gradle.kts +++ b/base/sources/backends/data/android/settings.gradle.kts @@ -15,4 +15,3 @@ dependencyResolutionManagement { rootProject.name = "{name}" include(":app") - \ No newline at end of file diff --git a/base/sources/backends/data/android_java/org/armory3d/AndroidHttpRequest.java b/base/sources/backends/data/android_java/org/armory3d/AndroidHttpRequest.java index 7abb495d..31a1bc47 100644 --- a/base/sources/backends/data/android_java/org/armory3d/AndroidHttpRequest.java +++ b/base/sources/backends/data/android_java/org/armory3d/AndroidHttpRequest.java @@ -1,11 +1,11 @@ package arm; +import androidx.annotation.Keep; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; -import androidx.annotation.Keep; class AndroidHttpRequest { @@ -13,13 +13,13 @@ class AndroidHttpRequest { public static byte[] androidHttpRequest(String url_base, String url_path) throws Exception { try { // https://developer.android.com/reference/java/net/HttpURLConnection.html - URL url = new URL("https://" + url_base + "/" + url_path); + URL url = new URL("https://" + url_base + "/" + url_path); HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection(); - InputStream in = new BufferedInputStream(urlConnection.getInputStream()); + InputStream in = new BufferedInputStream(urlConnection.getInputStream()); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - int i; - byte[] data = new byte[4]; + int i; + byte[] data = new byte[4]; while ((i = in.read(data, 0, data.length)) != -1) { buffer.write(data, 0, i); } diff --git a/base/sources/backends/data/wasm/manifest.json b/base/sources/backends/data/wasm/manifest.json index 567e4c8f..da1cca3b 100644 --- a/base/sources/backends/data/wasm/manifest.json +++ b/base/sources/backends/data/wasm/manifest.json @@ -12,4 +12,4 @@ "type": "image/png" } ] -} +} \ No newline at end of file diff --git a/base/sources/backends/data/wasm/start.js b/base/sources/backends/data/wasm/start.js index 15219fe0..ffb9168a 100644 --- a/base/sources/backends/data/wasm/start.js +++ b/base/sources/backends/data/wasm/start.js @@ -141,11 +141,11 @@ async function init() { if (!navigator.gpu) { throw new Error('WebGPU not supported'); } - let adapter = await navigator.gpu.requestAdapter(); - let bc7_supported = adapter.features.has('texture-compression-bc'); - let device = await adapter.requestDevice({ - requiredFeatures: bc7_supported ? ['texture-compression-bc'] : [], - }); + let adapter = await navigator.gpu.requestAdapter(); + let bc7_supported = adapter.features.has('texture-compression-bc'); + let device = await adapter.requestDevice({ + requiredFeatures : bc7_supported ? [ 'texture-compression-bc' ] : [], + }); let canvas = document.getElementById('iron'); canvas.width = window.innerWidth; @@ -165,8 +165,8 @@ async function init() { imports : { wgpuCreateInstance : function(pdescriptor) { - let inst = navigator.gpu; - return ptr_to_id(inst); + let inst = navigator.gpu; + return ptr_to_id(inst); }, // wgpuInstanceRequestAdapter : function(pinstance, poptions, pcallback_info) { // let callback_index = heapu32[(pcallback_info + 12) >> 2]; @@ -174,616 +174,614 @@ async function init() { // return 0n; // }, wgpuInstanceRequestAdapterSync : function() { - return ptr_to_id(adapter); + return ptr_to_id(adapter); }, wgpuAdapterGetInfo : function(padapter, pinfo) { - return 0; + return 0; }, wgpuAdapterInfoFreeMembers : function(padapter_info) {}, // wgpuAdapterRequestDevice : function(padapter, pdescriptor, pcallback_info) { // return 0; // }, wgpuAdapterRequestDeviceSync : function() { - return ptr_to_id(device); + return ptr_to_id(device); }, wgpuDeviceHasFeature : function(pdevice, feature) { - // WGPUFeatureName_TextureCompressionBC = 4 - if (feature === 4) { return bc7_supported ? 1 : 0; } - return 0; + // WGPUFeatureName_TextureCompressionBC = 4 + if (feature === 4) { + return bc7_supported ? 1 : 0; + } + return 0; }, wgpuDeviceCreateTexture : function(pdevice, pdescriptor) { - let device = id_to_ptr(pdevice); - // WGPUTextureDescriptor - let desc = { - usage : read_u32(pdescriptor + 16), - dimension : "2d", - size : {width : read_u32(pdescriptor + 28), height : read_u32(pdescriptor + 32), depthOrArrayLayers : 1}, - format : id_to_texture_format(read_u32(pdescriptor + 40)), - mipLevelCount : 1, - sampleCount : 1 - }; - let texture = device.createTexture(desc); - return ptr_to_id(texture); + let device = id_to_ptr(pdevice); + // WGPUTextureDescriptor + let desc = { + usage : read_u32(pdescriptor + 16), + dimension : "2d", + size : {width : read_u32(pdescriptor + 28), height : read_u32(pdescriptor + 32), depthOrArrayLayers : 1}, + format : id_to_texture_format(read_u32(pdescriptor + 40)), + mipLevelCount : 1, + sampleCount : 1 + }; + let texture = device.createTexture(desc); + return ptr_to_id(texture); }, wgpuTextureCreateView : function(ptexture, pdescriptor) { - let texture = id_to_ptr(ptexture); - // WGPUTextureViewDescriptor - let desc = - {format : id_to_texture_format(read_u32(pdescriptor + 12)), dimension : "2d", mipLevelCount : 1, arrayLayerCount : 1, aspect : "all"}; - let view = texture.createView(desc); - return ptr_to_id(view); + let texture = id_to_ptr(ptexture); + // WGPUTextureViewDescriptor + let desc = + {format : id_to_texture_format(read_u32(pdescriptor + 12)), dimension : "2d", mipLevelCount : 1, arrayLayerCount : 1, aspect : "all"}; + let view = texture.createView(desc); + return ptr_to_id(view); }, wgpuDeviceGetQueue : function(pdevice) { - let device = id_to_ptr(pdevice); - return ptr_to_id(device.queue); + let device = id_to_ptr(pdevice); + return ptr_to_id(device.queue); }, wgpuDeviceCreateBindGroupLayout : function(pdevice, pdescriptor) { - let device = id_to_ptr(pdevice); - // WGPUBindGroupLayoutDescriptor - let desc = {entryCount : read_u32(pdescriptor + 12), entries : []}; - let pentries = read_u32(pdescriptor + 16); + let device = id_to_ptr(pdevice); + // WGPUBindGroupLayoutDescriptor + let desc = {entryCount : read_u32(pdescriptor + 12), entries : []}; + let pentries = read_u32(pdescriptor + 16); - // WGPUBindGroupLayoutEntry - for (let i = 0; i < desc.entryCount; ++i) { - let e = { - binding : read_u32(i * 88 + pentries + 4), - visibility : read_u32(i * 88 + pentries + 8), - }; + // WGPUBindGroupLayoutEntry + for (let i = 0; i < desc.entryCount; ++i) { + let e = { + binding : read_u32(i * 88 + pentries + 4), + visibility : read_u32(i * 88 + pentries + 8), + }; - if (read_u32(i * 88 + pentries + 28) != 0x00000000) { // WGPUBufferBindingType_BindingNotUsed - e.buffer = { - type : read_u32(i * 88 + pentries + 28), - hasDynamicOffset : read_u32(i * 88 + pentries + 32), - minBindingSize : read_u32(i * 88 + pentries + 36) - }; - if (e.buffer.type === 0x00000002) - e.buffer.type = "uniform"; - } + if (read_u32(i * 88 + pentries + 28) != 0x00000000) { // WGPUBufferBindingType_BindingNotUsed + e.buffer = { + type : read_u32(i * 88 + pentries + 28), + hasDynamicOffset : read_u32(i * 88 + pentries + 32), + minBindingSize : read_u32(i * 88 + pentries + 36) + }; + if (e.buffer.type === 0x00000002) + e.buffer.type = "uniform"; + } - if (read_u32(i * 88 + pentries + 52) != 0x00000000) { // WGPUSamplerBindingType_BindingNotUsed - e.sampler = {type : read_u32(i * 88 + pentries + 52)}; - if (e.sampler.type === 0x00000002) - e.sampler.type = "filtering"; - else if (e.sampler.type === 0x00000003) - e.sampler.type = "non-filtering"; - } + if (read_u32(i * 88 + pentries + 52) != 0x00000000) { // WGPUSamplerBindingType_BindingNotUsed + e.sampler = {type : read_u32(i * 88 + pentries + 52)}; + if (e.sampler.type === 0x00000002) + e.sampler.type = "filtering"; + else if (e.sampler.type === 0x00000003) + e.sampler.type = "non-filtering"; + } - if (read_u32(i * 88 + pentries + 60) != 0x00000000) { // WGPUTextureSampleType_BindingNotUsed - e.texture = { - sampleType : read_u32(i * 88 + pentries + 60), - viewDimension : "2d", // read_u32(i * 88 + pentries + 64), - multisampled : read_u32(i * 88 + pentries + 68) - }; - if (e.texture.sampleType === 0x00000002) - e.texture.sampleType = "float"; - else if (e.texture.sampleType === 0x00000003) - e.texture.sampleType = "unfilterable-float"; - } + if (read_u32(i * 88 + pentries + 60) != 0x00000000) { // WGPUTextureSampleType_BindingNotUsed + e.texture = { + sampleType : read_u32(i * 88 + pentries + 60), + viewDimension : "2d", // read_u32(i * 88 + pentries + 64), + multisampled : read_u32(i * 88 + pentries + 68) + }; + if (e.texture.sampleType === 0x00000002) + e.texture.sampleType = "float"; + else if (e.texture.sampleType === 0x00000003) + e.texture.sampleType = "unfilterable-float"; + } - desc.entries.push(e); - } - let bgl = device.createBindGroupLayout(desc); - return ptr_to_id(bgl); + desc.entries.push(e); + } + let bgl = device.createBindGroupLayout(desc); + return ptr_to_id(bgl); }, wgpuDeviceCreateBuffer : function(pdevice, pdescriptor) { - let device = id_to_ptr(pdevice); - // WGPUBufferDescriptor - let desc = {usage : read_u32(pdescriptor + 16), size : read_u32(pdescriptor + 24), mappedAtCreation : read_u32(pdescriptor + 32)}; - let buffer = device.createBuffer(desc); - return ptr_to_id(buffer); + let device = id_to_ptr(pdevice); + // WGPUBufferDescriptor + let desc = {usage : read_u32(pdescriptor + 16), size : read_u32(pdescriptor + 24), mappedAtCreation : read_u32(pdescriptor + 32)}; + let buffer = device.createBuffer(desc); + return ptr_to_id(buffer); }, wgpuBufferGetMappedRange : function(pbuffer, offset, size) { - let buffer = id_to_ptr(pbuffer); - let ptr = instance.exports.wasm_malloc(size); - let ab = buffer.getMappedRange(offset, size); - let u8 = new Uint8Array(ab); - for (let i = 0; i < u8.length; ++i) { - heapu8[ptr + i] = u8[i]; - } - return ptr; + let buffer = id_to_ptr(pbuffer); + let ptr = instance.exports.wasm_malloc(size); + let ab = buffer.getMappedRange(offset, size); + let u8 = new Uint8Array(ab); + for (let i = 0; i < u8.length; ++i) { + heapu8[ptr + i] = u8[i]; + } + return ptr; }, wgpuBufferUnmap : function(pbuffer) { - let buffer = id_to_ptr(pbuffer); - buffer.unmap(); + let buffer = id_to_ptr(pbuffer); + buffer.unmap(); }, wgpuDeviceCreateCommandEncoder : function(pdevice, pdescriptor) { - let device = id_to_ptr(pdevice); - // WGPUCommandBufferDescriptor - let desc = null; - let encoder = device.createCommandEncoder(desc); - return ptr_to_id(encoder); + let device = id_to_ptr(pdevice); + // WGPUCommandBufferDescriptor + let desc = null; + let encoder = device.createCommandEncoder(desc); + return ptr_to_id(encoder); }, wgpuCommandEncoderCopyBufferToTexture : function(pcommand_encoder, psource, pdestination, pcopysize) { - let encoder = id_to_ptr(pcommand_encoder); - // WGPUTexelCopyBufferInfo - let source = {bytesPerRow : read_u32(psource + 8), rowsPerImage : read_u32(psource + 12), buffer : id_to_ptr(read_u32(psource + 16))}; - // WGPUTexelCopyTextureInfo - let destination = {texture : id_to_ptr(read_u32(pdestination))}; - // WGPUExtent3D - let copysize = {width : read_u32(pcopysize), height : read_u32(pcopysize + 4), depthOrArrayLayers : read_u32(pcopysize + 8)}; - encoder.copyBufferToTexture(source, destination, copysize); + let encoder = id_to_ptr(pcommand_encoder); + // WGPUTexelCopyBufferInfo + let source = {bytesPerRow : read_u32(psource + 8), rowsPerImage : read_u32(psource + 12), buffer : id_to_ptr(read_u32(psource + 16))}; + // WGPUTexelCopyTextureInfo + let destination = {texture : id_to_ptr(read_u32(pdestination))}; + // WGPUExtent3D + let copysize = {width : read_u32(pcopysize), height : read_u32(pcopysize + 4), depthOrArrayLayers : read_u32(pcopysize + 8)}; + encoder.copyBufferToTexture(source, destination, copysize); }, wgpuCommandEncoderFinish : function(pcommand_encoder, pdescriptor) { - let encoder = id_to_ptr(pcommand_encoder); - // WGPUCommandBufferDescriptor - let desc = null; - let command_buffer = encoder.finish(desc); - return ptr_to_id(command_buffer); + let encoder = id_to_ptr(pcommand_encoder); + // WGPUCommandBufferDescriptor + let desc = null; + let command_buffer = encoder.finish(desc); + return ptr_to_id(command_buffer); }, wgpuQueueSubmit : function(pqueue, command_buffer_count, pcommand_buffers) { - let queue = id_to_ptr(pqueue); - let command_buffers = []; - for (let i = 0; i < command_buffer_count; i++) { - let c = id_to_ptr(read_u32(pcommand_buffers + i * 4)); - command_buffers.push(c); - } - queue.submit(command_buffers); + let queue = id_to_ptr(pqueue); + let command_buffers = []; + for (let i = 0; i < command_buffer_count; i++) { + let c = id_to_ptr(read_u32(pcommand_buffers + i * 4)); + command_buffers.push(c); + } + queue.submit(command_buffers); }, wgpuBufferRelease : function(pbuffer) { - release_id(pbuffer); + release_id(pbuffer); }, wgpuDeviceCreateSampler : function(pdevice, pdescriptor) { - let device = id_to_ptr(pdevice); - // WGPUSamplerDescriptor - let desc = { - addressModeU : "repeat", - addressModeV : "repeat", - addressModeW : "repeat", - magFilter : id_to_filter_mode(read_u32(pdescriptor + 24)), - minFilter : id_to_filter_mode(read_u32(pdescriptor + 28)), - mipmapFilter : id_to_filter_mode(read_u32(pdescriptor + 32)), - maxAnisotropy : 1 - }; - let sampler = device.createSampler(desc); - return ptr_to_id(sampler); + let device = id_to_ptr(pdevice); + // WGPUSamplerDescriptor + let desc = { + addressModeU : "repeat", + addressModeV : "repeat", + addressModeW : "repeat", + magFilter : id_to_filter_mode(read_u32(pdescriptor + 24)), + minFilter : id_to_filter_mode(read_u32(pdescriptor + 28)), + mipmapFilter : id_to_filter_mode(read_u32(pdescriptor + 32)), + maxAnisotropy : 1 + }; + let sampler = device.createSampler(desc); + return ptr_to_id(sampler); }, wgpuSurfaceGetCapabilities : function(psurface, padapter, pcapabilities) { - return 0; + return 0; }, wgpuSurfaceCapabilitiesFreeMembers : function(pcapabilities) {}, wgpuBufferDestroy : function(pbuffer) { - let buffer = id_to_ptr(pbuffer); - buffer.destroy(); + let buffer = id_to_ptr(pbuffer); + buffer.destroy(); }, wgpuSurfaceGetCurrentTexture : function(psurface, psurface_texture) { - let surface = id_to_ptr(psurface) || context; - let texture = surface.getCurrentTexture(); - // WGPUSurfaceTexture - heapu32[psurface_texture / 4 + 1] = ptr_to_id(texture); + let surface = id_to_ptr(psurface) || context; + let texture = surface.getCurrentTexture(); + // WGPUSurfaceTexture + heapu32[psurface_texture / 4 + 1] = ptr_to_id(texture); }, wgpuCommandEncoderBeginRenderPass : function(pcommand_encoder, pdescriptor) { - let encoder = id_to_ptr(pcommand_encoder); + let encoder = id_to_ptr(pcommand_encoder); - // WGPURenderPassDescriptor - let desc = {colorAttachmentCount : read_u32(pdescriptor + 12), colorAttachments : []}; - let pcas = read_u32(pdescriptor + 16); - for (let i = 0; i < desc.colorAttachmentCount; ++i) { - // WGPURenderPassColorAttachment - let ca = { - view : id_to_ptr(read_u32(pcas + 4 + i * 56)), - loadOp : read_u32(pcas + 16 + i * 56) == 0x00000001 ? "load" : "clear", - storeOp : "store", - clearValue : [ read_f64(pcas + 24 + i * 56), read_f64(pcas + 32 + i * 56), read_f64(pcas + 40 + i * 56), read_f64(pcas + 48 + i * 56) ] - }; - desc.colorAttachments.push(ca); - } + // WGPURenderPassDescriptor + let desc = {colorAttachmentCount : read_u32(pdescriptor + 12), colorAttachments : []}; + let pcas = read_u32(pdescriptor + 16); + for (let i = 0; i < desc.colorAttachmentCount; ++i) { + // WGPURenderPassColorAttachment + let ca = { + view : id_to_ptr(read_u32(pcas + 4 + i * 56)), + loadOp : read_u32(pcas + 16 + i * 56) == 0x00000001 ? "load" : "clear", + storeOp : "store", + clearValue : [ read_f64(pcas + 24 + i * 56), read_f64(pcas + 32 + i * 56), read_f64(pcas + 40 + i * 56), read_f64(pcas + 48 + i * 56) ] + }; + desc.colorAttachments.push(ca); + } - // WGPURenderPassDepthStencilAttachment - let pdsa = read_u32(pdescriptor + 20); - if (pdsa !== 0) { - desc.depthStencilAttachment = { - view : id_to_ptr(read_u32(pdsa + 4)), - depthLoadOp : read_u32(pdsa + 8) == 0x00000001 ? "load" : "clear", - depthStoreOp : "store", - depthClearValue : 1.0 - }; - } + // WGPURenderPassDepthStencilAttachment + let pdsa = read_u32(pdescriptor + 20); + if (pdsa !== 0) { + desc.depthStencilAttachment = { + view : id_to_ptr(read_u32(pdsa + 4)), + depthLoadOp : read_u32(pdsa + 8) == 0x00000001 ? "load" : "clear", + depthStoreOp : "store", + depthClearValue : 1.0 + }; + } - let render_pass = encoder.beginRenderPass(desc); - return ptr_to_id(render_pass); + let render_pass = encoder.beginRenderPass(desc); + return ptr_to_id(render_pass); }, wgpuRenderPassEncoderSetViewport : function(prender_pass_encoder, x, y, width, height, min_depth, max_depth) { - let render_pass = id_to_ptr(prender_pass_encoder); - render_pass.setViewport(x, y, width, height, min_depth, max_depth); + let render_pass = id_to_ptr(prender_pass_encoder); + render_pass.setViewport(x, y, width, height, min_depth, max_depth); }, wgpuRenderPassEncoderSetScissorRect : function(prender_pass_encoder, x, y, width, height) { - let render_pass = id_to_ptr(prender_pass_encoder); - render_pass.setScissorRect(x, y, width, height); + let render_pass = id_to_ptr(prender_pass_encoder); + render_pass.setScissorRect(x, y, width, height); }, wgpuRenderPassEncoderEnd : function(prender_pass_encoder) { - let render_pass = id_to_ptr(prender_pass_encoder); - render_pass.end(); + let render_pass = id_to_ptr(prender_pass_encoder); + render_pass.end(); }, wgpuRenderPassEncoderRelease : function(prender_pass_encoder) { - release_id(prender_pass_encoder); + release_id(prender_pass_encoder); }, wgpuCommandBufferRelease : function(pcommand_buffer) { - release_id(pcommand_buffer); + release_id(pcommand_buffer); }, wgpuCommandEncoderRelease : function(pcommand_encoder) { - release_id(pcommand_encoder); + release_id(pcommand_encoder); }, wgpuSurfacePresent : function(psurface) { - return 0; + return 0; }, wgpuRenderPassEncoderDrawIndexed : function(prender_pass_encoder, index_count, instance_count, first_index, base_vertex, first_instance) { - let render_pass = id_to_ptr(prender_pass_encoder); - render_pass.drawIndexed(index_count, instance_count, first_index, base_vertex, first_instance); + let render_pass = id_to_ptr(prender_pass_encoder); + render_pass.drawIndexed(index_count, instance_count, first_index, base_vertex, first_instance); }, wgpuRenderPassEncoderSetPipeline : function(prender_pass_encoder, ppipeline) { - let render_pass = id_to_ptr(prender_pass_encoder); - let pipeline = id_to_ptr(ppipeline); - render_pass.setPipeline(pipeline); + let render_pass = id_to_ptr(prender_pass_encoder); + let pipeline = id_to_ptr(ppipeline); + render_pass.setPipeline(pipeline); }, wgpuRenderPassEncoderSetVertexBuffer : function(prender_pass_encoder, slot, pbuffer, offset, size) { - let render_pass = id_to_ptr(prender_pass_encoder); - let buffer = id_to_ptr(pbuffer); - render_pass.setVertexBuffer(slot, buffer, Number(offset), Number(size)); + let render_pass = id_to_ptr(prender_pass_encoder); + let buffer = id_to_ptr(pbuffer); + render_pass.setVertexBuffer(slot, buffer, Number(offset), Number(size)); }, wgpuRenderPassEncoderSetIndexBuffer : function(prender_pass_encoder, pbuffer, format, offset, size) { - let render_pass = id_to_ptr(prender_pass_encoder); - let buffer = id_to_ptr(pbuffer); - render_pass.setIndexBuffer(buffer, 'uint32', Number(offset), Number(size)); + let render_pass = id_to_ptr(prender_pass_encoder); + let buffer = id_to_ptr(pbuffer); + render_pass.setIndexBuffer(buffer, 'uint32', Number(offset), Number(size)); }, wgpuDeviceCreateBindGroup : function(pdevice, pdescriptor) { - let device = id_to_ptr(pdevice); - // WGPUBindGroupDescriptor - let desc = {layout : id_to_ptr(read_u32(pdescriptor + 12)), entryCount : read_u32(pdescriptor + 16), entries : []}; - let pentries = read_u32(pdescriptor + 20); - for (let i = 0; i < desc.entryCount; i++) { - // WGPUBindGroupEntry - let e = { - binding : read_u32(pentries + 4 + i * 40), - }; + let device = id_to_ptr(pdevice); + // WGPUBindGroupDescriptor + let desc = {layout : id_to_ptr(read_u32(pdescriptor + 12)), entryCount : read_u32(pdescriptor + 16), entries : []}; + let pentries = read_u32(pdescriptor + 20); + for (let i = 0; i < desc.entryCount; i++) { + // WGPUBindGroupEntry + let e = { + binding : read_u32(pentries + 4 + i * 40), + }; - if (read_u32(pentries + 8 + i * 40) !== 0) { - e.resource = { - buffer : id_to_ptr(read_u32(pentries + 8 + i * 40)), - offset : read_u32(pentries + 16 + i * 40), - size : read_u32(pentries + 24 + i * 40) - } - } - if (read_u32(pentries + 32 + i * 40) !== 0) { - e.resource = id_to_ptr(read_u32(pentries + 32 + i * 40)); - } - if (read_u32(pentries + 36 + i * 40) !== 0) { - e.resource = id_to_ptr(read_u32(pentries + 36 + i * 40)); - } + if (read_u32(pentries + 8 + i * 40) !== 0) { + e.resource = { + buffer : id_to_ptr(read_u32(pentries + 8 + i * 40)), + offset : read_u32(pentries + 16 + i * 40), + size : read_u32(pentries + 24 + i * 40) + } + } + if (read_u32(pentries + 32 + i * 40) !== 0) { + e.resource = id_to_ptr(read_u32(pentries + 32 + i * 40)); + } + if (read_u32(pentries + 36 + i * 40) !== 0) { + e.resource = id_to_ptr(read_u32(pentries + 36 + i * 40)); + } - desc.entries.push(e); - } - let bg = device.createBindGroup(desc); - return ptr_to_id(bg); + desc.entries.push(e); + } + let bg = device.createBindGroup(desc); + return ptr_to_id(bg); }, wgpuRenderPassEncoderSetBindGroup : function(prender_pass_encoder, group_index, pgroup, dynamic_offset_count, pdynamic_offsets) { - let render_pass = id_to_ptr(prender_pass_encoder); - let group = id_to_ptr(pgroup); - let dynamic_offsets = []; - for (let i = 0; i < dynamic_offset_count; i++) { - let doff = read_u32(pdynamic_offsets + i * 4); - dynamic_offsets.push(doff); - } - render_pass.setBindGroup(group_index, group, dynamic_offsets); + let render_pass = id_to_ptr(prender_pass_encoder); + let group = id_to_ptr(pgroup); + let dynamic_offsets = []; + for (let i = 0; i < dynamic_offset_count; i++) { + let doff = read_u32(pdynamic_offsets + i * 4); + dynamic_offsets.push(doff); + } + render_pass.setBindGroup(group_index, group, dynamic_offsets); }, wgpuBindGroupRelease : function(pbind_group) { - release_id(pbind_group); + release_id(pbind_group); }, wgpuRenderPipelineRelease : function(prender_pipeline) { - release_id(prender_pipeline); + release_id(prender_pipeline); }, wgpuPipelineLayoutRelease : function(ppipeline_layout) { - release_id(ppipeline_layout); + release_id(ppipeline_layout); }, wgpuDeviceCreatePipelineLayout : function(pdevice, pdescriptor) { - let device = id_to_ptr(pdevice); - // WGPUPipelineLayoutDescriptor - let desc = {bindGroupLayoutCount : read_u32(pdescriptor + 12), bindGroupLayouts : []}; - let pbgl = read_u32(pdescriptor + 16); - for (let i = 0; i < desc.bindGroupLayoutCount; ++i) { - // WGPUBindGroupLayout - let bgl = id_to_ptr(read_u32(pbgl + i * 4)); - desc.bindGroupLayouts.push(bgl); - } - let pl = device.createPipelineLayout(desc); - return ptr_to_id(pl); + let device = id_to_ptr(pdevice); + // WGPUPipelineLayoutDescriptor + let desc = {bindGroupLayoutCount : read_u32(pdescriptor + 12), bindGroupLayouts : []}; + let pbgl = read_u32(pdescriptor + 16); + for (let i = 0; i < desc.bindGroupLayoutCount; ++i) { + // WGPUBindGroupLayout + let bgl = id_to_ptr(read_u32(pbgl + i * 4)); + desc.bindGroupLayouts.push(bgl); + } + let pl = device.createPipelineLayout(desc); + return ptr_to_id(pl); }, wgpuDeviceCreateShaderModule : function(pdevice, pdescriptor) { - let device = id_to_ptr(pdevice); - // WGPUShaderSourceWGSL - let pwgsl = read_u32(pdescriptor); - let wgsl = {chain : {sType : read_u32(pwgsl + 4)}, code : {data : read_u32(pwgsl + 8), length : read_u32(pwgsl + 12)}}; - // WGPUShaderModuleDescriptor - let desc = {code : read_string_n(wgsl.code.data, wgsl.code.length)}; - let sm = device.createShaderModule(desc); - return ptr_to_id(sm); + let device = id_to_ptr(pdevice); + // WGPUShaderSourceWGSL + let pwgsl = read_u32(pdescriptor); + let wgsl = {chain : {sType : read_u32(pwgsl + 4)}, code : {data : read_u32(pwgsl + 8), length : read_u32(pwgsl + 12)}}; + // WGPUShaderModuleDescriptor + let desc = {code : read_string_n(wgsl.code.data, wgsl.code.length)}; + let sm = device.createShaderModule(desc); + return ptr_to_id(sm); }, wgpuDeviceCreateRenderPipeline : function(pdevice, pdescriptor) { - let device = id_to_ptr(pdevice); + let device = id_to_ptr(pdevice); - // WGPUFragmentState - let pfrag = read_u32(pdescriptor + 92); - let frag = {module : id_to_ptr(read_u32(pfrag + 4)), entryPoint : "main", targetCount : read_u32(pfrag + 24), targets : []}; - let ptragets = read_u32(pfrag + 28); - for (let i = 0; i < frag.targetCount; ++i) { - // WGPUColorTargetState - let t = {format : id_to_texture_format(read_u32(ptragets + 4 + i * 24)), writeMask : read_u32(ptragets + 16 + i * 24)}; - let pbs = read_u32(ptragets + 8 + i * 24); // WGPUBlendState - if (pbs != 0) { - t.blend = { - color : {operation : "add", srcFactor : id_to_blend_factor(read_u32(pbs + 4)), dstFactor : id_to_blend_factor(read_u32(pbs + 8))}, - alpha : {operation : "add", srcFactor : id_to_blend_factor(read_u32(pbs + 16)), dstFactor : id_to_blend_factor(read_u32(pbs + 20))} - }; - } - frag.targets.push(t); - } + // WGPUFragmentState + let pfrag = read_u32(pdescriptor + 92); + let frag = {module : id_to_ptr(read_u32(pfrag + 4)), entryPoint : "main", targetCount : read_u32(pfrag + 24), targets : []}; + let ptragets = read_u32(pfrag + 28); + for (let i = 0; i < frag.targetCount; ++i) { + // WGPUColorTargetState + let t = {format : id_to_texture_format(read_u32(ptragets + 4 + i * 24)), writeMask : read_u32(ptragets + 16 + i * 24)}; + let pbs = read_u32(ptragets + 8 + i * 24); // WGPUBlendState + if (pbs != 0) { + t.blend = { + color : {operation : "add", srcFactor : id_to_blend_factor(read_u32(pbs + 4)), dstFactor : id_to_blend_factor(read_u32(pbs + 8))}, + alpha : {operation : "add", srcFactor : id_to_blend_factor(read_u32(pbs + 16)), dstFactor : id_to_blend_factor(read_u32(pbs + 20))} + }; + } + frag.targets.push(t); + } - // WGPURenderPipelineDescriptor - let desc = { - layout : id_to_ptr(read_u32(pdescriptor + 12)), - // WGPUVertexState - vertex : {module : id_to_ptr(read_u32(pdescriptor + 20)), entryPoint : "main", bufferCount : 1, buffers : []}, - primitive : {topology : "triangle-list", frontFace : "ccw", cullMode : read_u32(pdescriptor + 64)}, - fragment : frag, - }; + // WGPURenderPipelineDescriptor + let desc = { + layout : id_to_ptr(read_u32(pdescriptor + 12)), + // WGPUVertexState + vertex : {module : id_to_ptr(read_u32(pdescriptor + 20)), entryPoint : "main", bufferCount : 1, buffers : []}, + primitive : {topology : "triangle-list", frontFace : "ccw", cullMode : read_u32(pdescriptor + 64)}, + fragment : frag, + }; - if (desc.primitive.cullMode === 0x00000001) - desc.primitive.cullMode = "none"; - else if (desc.primitive.cullMode === 0x00000002) - desc.primitive.cullMode = "front"; - else if (desc.primitive.cullMode === 0x00000003) - desc.primitive.cullMode = "back"; + if (desc.primitive.cullMode === 0x00000001) + desc.primitive.cullMode = "none"; + else if (desc.primitive.cullMode === 0x00000002) + desc.primitive.cullMode = "front"; + else if (desc.primitive.cullMode === 0x00000003) + desc.primitive.cullMode = "back"; - // WGPUDepthStencilState - let pds = read_u32(pdescriptor + 72); - if (pds != 0) { - let ds = {format : id_to_texture_format(read_u32(pds + 4)), depthWriteEnabled : read_u32(pds + 8), depthCompare : read_u32(pds + 12)}; - if (ds.depthCompare === 0x00000002) - ds.depthCompare = "less"; - else if (ds.depthCompare === 0x00000008) - ds.depthCompare = "always"; - desc.depthStencil = ds; - } + // WGPUDepthStencilState + let pds = read_u32(pdescriptor + 72); + if (pds != 0) { + let ds = {format : id_to_texture_format(read_u32(pds + 4)), depthWriteEnabled : read_u32(pds + 8), depthCompare : read_u32(pds + 12)}; + if (ds.depthCompare === 0x00000002) + ds.depthCompare = "less"; + else if (ds.depthCompare === 0x00000008) + ds.depthCompare = "always"; + desc.depthStencil = ds; + } - let pbuffers = read_u32(pdescriptor + 44); - for (let i = 0; i < desc.vertex.bufferCount; ++i) { - // WGPUVertexBufferLayout - let b = {arrayStride : read_u32(pbuffers + 8 + i * 24), attributeCount : read_u32(pbuffers + 16 + i * 24), attributes : []}; - let pattributes = read_u32(pbuffers + 20 + i * 24); - for (let i = 0; i < b.attributeCount; ++i) { - // WGPUVertexAttribute - let a = { - format : id_to_vertex_format(read_u32(pattributes + 4 + i * 24)), - offset : read_u32(pattributes + 8 + i * 24), - shaderLocation : read_u32(pattributes + 16 + i * 24) - }; - b.attributes.push(a); - } - desc.vertex.buffers.push(b); - } + let pbuffers = read_u32(pdescriptor + 44); + for (let i = 0; i < desc.vertex.bufferCount; ++i) { + // WGPUVertexBufferLayout + let b = {arrayStride : read_u32(pbuffers + 8 + i * 24), attributeCount : read_u32(pbuffers + 16 + i * 24), attributes : []}; + let pattributes = read_u32(pbuffers + 20 + i * 24); + for (let i = 0; i < b.attributeCount; ++i) { + // WGPUVertexAttribute + let a = { + format : id_to_vertex_format(read_u32(pattributes + 4 + i * 24)), + offset : read_u32(pattributes + 8 + i * 24), + shaderLocation : read_u32(pattributes + 16 + i * 24) + }; + b.attributes.push(a); + } + desc.vertex.buffers.push(b); + } - let rp = device.createRenderPipeline(desc); - return ptr_to_id(rp); + let rp = device.createRenderPipeline(desc); + return ptr_to_id(rp); }, wgpuShaderModuleRelease : function(pshader_module) { - release_id(pshader_module); + release_id(pshader_module); }, wgpuQueueWriteBuffer : function(pqueue, pbuffer, buffer_offset, pdata, size) { - let queue = id_to_ptr(pqueue); - let buffer = id_to_ptr(pbuffer); - let data = heapu8.subarray(pdata, pdata + size); - queue.writeBuffer(buffer, Number(buffer_offset), data); + let queue = id_to_ptr(pqueue); + let buffer = id_to_ptr(pbuffer); + let data = heapu8.subarray(pdata, pdata + size); + queue.writeBuffer(buffer, Number(buffer_offset), data); }, wgpuTextureDestroy : function(ptexture) { - let texture = id_to_ptr(ptexture); - texture.destroy(); + let texture = id_to_ptr(ptexture); + texture.destroy(); }, wgpuTextureRelease : function(ptexture) { - release_id(ptexture); + release_id(ptexture); }, wgpuTextureViewRelease : function(ptexture_view) { - release_id(ptexture_view); + release_id(ptexture_view); }, wgpuCommandEncoderCopyBufferToBuffer : function(pcommand_encoder, psource, source_offset, pdestination, destination_offset, size) { - let encoder = id_to_ptr(pcommand_encoder); - let source = id_to_ptr(psource); - let destination = id_to_ptr(pdestination); - encoder.copyBufferToBuffer(source, Number(source_offset), destination, Number(destination_offset), Number(size)); + let encoder = id_to_ptr(pcommand_encoder); + let source = id_to_ptr(psource); + let destination = id_to_ptr(pdestination); + encoder.copyBufferToBuffer(source, Number(source_offset), destination, Number(destination_offset), Number(size)); }, wgpuSurfaceConfigure : function(psurface, pconfig) { - let surface = id_to_ptr(psurface) || context; - // WGPUSurfaceConfiguration - let config = { - device : id_to_ptr(read_u32(pconfig + 4)), - format : id_to_texture_format(read_u32(pconfig + 8)), - usage : read_u32(pconfig + 16), - width : read_u32(pconfig + 24), - height : read_u32(pconfig + 28), - viewFormatCount : read_u32(pconfig + 32), - viewFormats : [], - alphaMode : read_u32(pconfig + 40), - presentMode : read_u32(pconfig + 44) - }; - if (config.alphaMode === 0x00000001) - config.alphaMode = "opaque"; - if (config.presentMode === 0x00000001) - config.presentMode = "fifo"; - if (config.presentMode === 0x00000004) - config.presentMode = "mailbox"; - let pview_formats = read_u32(pconfig + 36); - for (let i = 0; i < config.viewFormatCount; ++i) { - let f = id_to_texture_format(read_u32(pview_formats + i * 4)); - config.viewFormats.push(f); - } - surface.configure(config); + let surface = id_to_ptr(psurface) || context; + // WGPUSurfaceConfiguration + let config = { + device : id_to_ptr(read_u32(pconfig + 4)), + format : id_to_texture_format(read_u32(pconfig + 8)), + usage : read_u32(pconfig + 16), + width : read_u32(pconfig + 24), + height : read_u32(pconfig + 28), + viewFormatCount : read_u32(pconfig + 32), + viewFormats : [], + alphaMode : read_u32(pconfig + 40), + presentMode : read_u32(pconfig + 44) + }; + if (config.alphaMode === 0x00000001) + config.alphaMode = "opaque"; + if (config.presentMode === 0x00000001) + config.presentMode = "fifo"; + if (config.presentMode === 0x00000004) + config.presentMode = "mailbox"; + let pview_formats = read_u32(pconfig + 36); + for (let i = 0; i < config.viewFormatCount; ++i) { + let f = id_to_texture_format(read_u32(pview_formats + i * 4)); + config.viewFormats.push(f); + } + surface.configure(config); }, js_printf : function(format) { - console.log(read_string(format)); + console.log(read_string(format)); }, js_fopen : function(filename) { - let str; - if (read_string(filename) === "/./data/config.json" || read_string(filename) === "/./data//config.json") { //// - str = config_json; - } - else if (file_dropped != null) { - file_buffer_pos = 0; - file_buffer = file_dropped; - file_dropped = null; - return 1; - } - else if (virtual_fs.has(read_string(filename))) { - file_buffer_pos = 0; - file_buffer = virtual_fs.get(read_string(filename)); - return 1; - } - else { - let req = new XMLHttpRequest(); - req.open("GET", read_string(filename), false); - req.overrideMimeType("text/plain; charset=x-user-defined"); - req.send(); - if (req.status === 0 || req.status >= 400) { - return 0; - } - str = req.response; - } - file_buffer_pos = 0; - file_buffer = new ArrayBuffer(str.length); - let buf_view = new Uint8Array(file_buffer); - for (let i = 0; i < str.length; ++i) { - buf_view[i] = str.charCodeAt(i); - } - return 1; + let str; + if (read_string(filename) === "/./data/config.json" || read_string(filename) === "/./data//config.json") { //// + str = config_json; + } + else if (file_dropped != null) { + file_buffer_pos = 0; + file_buffer = file_dropped; + file_dropped = null; + return 1; + } + else if (virtual_fs.has(read_string(filename))) { + file_buffer_pos = 0; + file_buffer = virtual_fs.get(read_string(filename)); + return 1; + } + else { + let req = new XMLHttpRequest(); + req.open("GET", read_string(filename), false); + req.overrideMimeType("text/plain; charset=x-user-defined"); + req.send(); + if (req.status === 0 || req.status >= 400) { + return 0; + } + str = req.response; + } + file_buffer_pos = 0; + file_buffer = new ArrayBuffer(str.length); + let buf_view = new Uint8Array(file_buffer); + for (let i = 0; i < str.length; ++i) { + buf_view[i] = str.charCodeAt(i); + } + return 1; }, js_ftell : function(stream) { - return file_buffer_pos; + return file_buffer_pos; }, js_fseek : function(stream, offset, origin) { - file_buffer_pos = offset; - if (origin == 1) - file_buffer_pos += file_buffer.byteLength; // SEEK_END - return 0; + file_buffer_pos = offset; + if (origin == 1) + file_buffer_pos += file_buffer.byteLength; // SEEK_END + return 0; }, js_fread : function(ptr, size, count, stream) { - let buf_view = new Uint8Array(file_buffer); - for (let i = 0; i < count; ++i) { - heapu8[ptr + i] = buf_view[file_buffer_pos++]; - } - return count; + let buf_view = new Uint8Array(file_buffer); + for (let i = 0; i < count; ++i) { + heapu8[ptr + i] = buf_view[file_buffer_pos++]; + } + return count; }, js_fwrite : function(ptr, size, count, stream) { - config_json = read_string_n(ptr, count); //// + config_json = read_string_n(ptr, count); //// }, js_time : function() { - return window.performance.now(); + return window.performance.now(); }, js_pow : function(x) { - return Math.pow(x); + return Math.pow(x); }, js_sin : function(x) { - return Math.sin(x); + return Math.sin(x); }, js_cos : function(x) { - return Math.cos(x); + return Math.cos(x); }, js_tan : function(x) { - return Math.tan(x); + return Math.tan(x); }, js_log : function(base, exponent) { - return Math.log(base, exponent); + return Math.log(base, exponent); }, js_exp : function(x) { - return Math.exp(x); + return Math.exp(x); }, js_sqrt : function(x) { - return Math.sqrt(x); + return Math.sqrt(x); }, js_acos : function(x) { - return Math.acos(x); + return Math.acos(x); }, js_asin : function(x) { - return Math.asin(x); + return Math.asin(x); }, js_atan : function(x) { - return Math.atan(x); + return Math.atan(x); }, js_atan2 : function(x, y) { - return Math.atan2(x, y); + return Math.atan2(x, y); }, js_canvas_w : function() { - return canvas.width; + return canvas.width; }, js_canvas_h : function() { - return canvas.height; + return canvas.height; }, js_mouse_set_cursor : function(i) { - if (i == 0) // arrow - canvas.style.cursor = 'default'; - else if (i == 1) // hand - canvas.style.cursor = 'pointer'; - else if (i == 2) // ibeam - canvas.style.cursor = 'text'; - else if (i == 3) // sizewe - canvas.style.cursor = 'ew-resize'; - else if (i == 4) // sizens - canvas.style.cursor = 'ns-resize'; + if (i == 0) // arrow + canvas.style.cursor = 'default'; + else if (i == 1) // hand + canvas.style.cursor = 'pointer'; + else if (i == 2) // ibeam + canvas.style.cursor = 'text'; + else if (i == 3) // sizewe + canvas.style.cursor = 'ew-resize'; + else if (i == 4) // sizens + canvas.style.cursor = 'ns-resize'; }, js_mouse_show : function() { - canvas.style.cursor = 'default'; + canvas.style.cursor = 'default'; }, js_mouse_hide : function() { - canvas.style.cursor = 'none'; + canvas.style.cursor = 'none'; }, js_window_set_title : function(str) { - document.title = read_string(str); + document.title = read_string(str); }, js_window_change_mode : function(i) { - i == 0 ? document.exitFullscreen() : canvas.requestFullscreen(); + i == 0 ? document.exitFullscreen() : canvas.requestFullscreen(); }, js_load_url : function(str) { - window.open(read_string(str), "_blank"); + window.open(read_string(str), "_blank"); }, js_open_dialog : async function() { - let [handle] = await window.showOpenFilePicker({multiple : false}); - let file = await handle.getFile(); - file_dropped = await file.arrayBuffer(); - let ptr = instance.exports.wasm_malloc(file.name.length + 1); - write_string(ptr, file.name) - instance.exports.wasm_drop_files(ptr); + let [handle] = await window.showOpenFilePicker({multiple : false}); + let file = await handle.getFile(); + file_dropped = await file.arrayBuffer(); + let ptr = instance.exports.wasm_malloc(file.name.length + 1); + write_string(ptr, file.name) + instance.exports.wasm_drop_files(ptr); }, js_save_dialog : function() { - alert("Not implemented yet.") + alert("Not implemented yet.") }, js_thread_create : function(func_ptr, param_ptr, done_ptr) { - const worker = new Worker('worker.js'); - worker.postMessage({ wasm_module: module, memory, func_ptr, param_ptr, done_ptr }); + const worker = new Worker('worker.js'); + worker.postMessage({wasm_module : module, memory, func_ptr, param_ptr, done_ptr}); }, js_net_request : function(purl_base, purl_path, pdata, port, method, callback_id, callbackdata, pdst_path) { - let url_base = read_string(purl_base); - let url_path = read_string(purl_path); - let dst_path = pdst_path !== 0 ? read_string(pdst_path) : null; - let url = `https://${url_base}:${port}/${url_path}`; - let options = {method : 'GET', headers : {}}; - if (dst_path) { - fetch(url, options) - .then(response => response.arrayBuffer()) - .then(buffer => { - virtual_fs.set(dst_path, buffer); - instance.exports.wasm_net_callback(callback_id, 0); - }); - } - else { - fetch(url, options) - .then(response => response.text()) - .then(text => { - let buffer_ptr = 0; - if (text !== null) { - buffer_ptr = instance.exports.wasm_malloc(text.length + 1); - write_string(buffer_ptr, text); - } - instance.exports.wasm_net_callback(callback_id, buffer_ptr); - }); - } + let url_base = read_string(purl_base); + let url_path = read_string(purl_path); + let dst_path = pdst_path !== 0 ? read_string(pdst_path) : null; + let url = `https://${url_base}:${port}/${url_path}`; + let options = {method : 'GET', headers : {}}; + if (dst_path) { + fetch(url, options).then(response => response.arrayBuffer()).then(buffer => { + virtual_fs.set(dst_path, buffer); + instance.exports.wasm_net_callback(callback_id, 0); + }); + } + else { + fetch(url, options).then(response => response.text()).then(text => { + let buffer_ptr = 0; + if (text !== null) { + buffer_ptr = instance.exports.wasm_malloc(text.length + 1); + write_string(buffer_ptr, text); + } + instance.exports.wasm_net_callback(callback_id, buffer_ptr); + }); + } }, } }); diff --git a/base/sources/backends/data/wasm/sw.js b/base/sources/backends/data/wasm/sw.js index d96fbf89..a857c3ce 100644 --- a/base/sources/backends/data/wasm/sw.js +++ b/base/sources/backends/data/wasm/sw.js @@ -1,25 +1,6 @@ -const ASSETS_TO_CACHE = [ - '/index.html', - '/start.js', - '/start.wasm', - '/worker.js', - '/manifest.json', - '/icon.png' -]; +const ASSETS_TO_CACHE = [ '/index.html', '/start.js', '/start.wasm', '/worker.js', '/manifest.json', '/icon.png' ]; -self.addEventListener('install', (event) => { - event.waitUntil( - caches.open('armorpaint-1').then((cache) => { - return cache.addAll(ASSETS_TO_CACHE); - }) - ); -}); +self.addEventListener('install', (event) => { event.waitUntil(caches.open('armorpaint-1').then((cache) => { return cache.addAll(ASSETS_TO_CACHE); })); }); -self.addEventListener('fetch', (event) => { - event.respondWith( - fetch(event.request).catch(() => { - return caches.match(event.request); - }) - ); -}); +self.addEventListener('fetch', (event) => { event.respondWith(fetch(event.request).catch(() => { return caches.match(event.request); })); }); diff --git a/base/sources/backends/direct3d12_gpu.c b/base/sources/backends/direct3d12_gpu.c index ab5c6f60..0bb76e63 100644 --- a/base/sources/backends/direct3d12_gpu.c +++ b/base/sources/backends/direct3d12_gpu.c @@ -290,8 +290,8 @@ void gpu_render_target_init2(gpu_texture_t *render_target, uint32_t width, uint3 } void create_root_signature(bool linear_sampling) { - ID3DBlob *root_blob = NULL; - ID3DBlob *error_blob = NULL; + ID3DBlob *root_blob = NULL; + ID3DBlob *error_blob = NULL; D3D12_ROOT_PARAMETER parameters[3] = {0}; D3D12_DESCRIPTOR_RANGE range = { .RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV, diff --git a/base/sources/backends/macos_system.m b/base/sources/backends/macos_system.m index 67906ba1..42bc368c 100644 --- a/base/sources/backends/macos_system.m +++ b/base/sources/backends/macos_system.m @@ -1159,7 +1159,7 @@ volatile int iron_exec_async_done = 1; char *iron_exec_async_output_file = NULL; void iron_exec_async(const char *path, char *argv[]) { - iron_exec_async_done = 0; + iron_exec_async_done = 0; NSTask *task = [[NSTask alloc] init]; NSString *launch = [NSString stringWithUTF8String:path]; NSMutableArray *args = [NSMutableArray array]; diff --git a/base/sources/backends/webgpu.h b/base/sources/backends/webgpu.h index f04ffc16..875ee449 100644 --- a/base/sources/backends/webgpu.h +++ b/base/sources/backends/webgpu.h @@ -8,36 +8,36 @@ #define WGPU_NULLABLE -#include -#include #include +#include +#include typedef struct WGPUStringView { - WGPU_NULLABLE char const * data; - size_t length; + WGPU_NULLABLE char const *data; + size_t length; } WGPUStringView; typedef uint64_t WGPUFlags; typedef uint32_t WGPUBool; -typedef struct WGPUAdapterImpl* WGPUAdapter; -typedef struct WGPUBindGroupImpl* WGPUBindGroup; -typedef struct WGPUBindGroupLayoutImpl* WGPUBindGroupLayout; -typedef struct WGPUBufferImpl* WGPUBuffer; -typedef struct WGPUCommandBufferImpl* WGPUCommandBuffer; -typedef struct WGPUCommandEncoderImpl* WGPUCommandEncoder; -typedef struct WGPUDeviceImpl* WGPUDevice; -typedef struct WGPUInstanceImpl* WGPUInstance; -typedef struct WGPUPipelineLayoutImpl* WGPUPipelineLayout; -typedef struct WGPUQuerySetImpl* WGPUQuerySet; -typedef struct WGPUQueueImpl* WGPUQueue; -typedef struct WGPURenderPassEncoderImpl* WGPURenderPassEncoder; -typedef struct WGPURenderPipelineImpl* WGPURenderPipeline; -typedef struct WGPUSamplerImpl* WGPUSampler; -typedef struct WGPUShaderModuleImpl* WGPUShaderModule; -typedef struct WGPUSurfaceImpl* WGPUSurface; -typedef struct WGPUTextureImpl* WGPUTexture; -typedef struct WGPUTextureViewImpl* WGPUTextureView; +typedef struct WGPUAdapterImpl *WGPUAdapter; +typedef struct WGPUBindGroupImpl *WGPUBindGroup; +typedef struct WGPUBindGroupLayoutImpl *WGPUBindGroupLayout; +typedef struct WGPUBufferImpl *WGPUBuffer; +typedef struct WGPUCommandBufferImpl *WGPUCommandBuffer; +typedef struct WGPUCommandEncoderImpl *WGPUCommandEncoder; +typedef struct WGPUDeviceImpl *WGPUDevice; +typedef struct WGPUInstanceImpl *WGPUInstance; +typedef struct WGPUPipelineLayoutImpl *WGPUPipelineLayout; +typedef struct WGPUQuerySetImpl *WGPUQuerySet; +typedef struct WGPUQueueImpl *WGPUQueue; +typedef struct WGPURenderPassEncoderImpl *WGPURenderPassEncoder; +typedef struct WGPURenderPipelineImpl *WGPURenderPipeline; +typedef struct WGPUSamplerImpl *WGPUSampler; +typedef struct WGPUShaderModuleImpl *WGPUShaderModule; +typedef struct WGPUSurfaceImpl *WGPUSurface; +typedef struct WGPUTextureImpl *WGPUTexture; +typedef struct WGPUTextureViewImpl *WGPUTextureView; struct WGPUAdapterInfo; struct WGPUBindGroupEntry; @@ -96,1047 +96,1051 @@ struct WGPURequestDeviceCallbackInfo; struct WGPUUncapturedErrorCallbackInfo; typedef enum WGPUAdapterType { - WGPUAdapterType_DiscreteGPU = 0x00000001, - WGPUAdapterType_IntegratedGPU = 0x00000002, - WGPUAdapterType_CPU = 0x00000003, - WGPUAdapterType_Unknown = 0x00000004, - WGPUAdapterType_Force32 = 0x7FFFFFFF + WGPUAdapterType_DiscreteGPU = 0x00000001, + WGPUAdapterType_IntegratedGPU = 0x00000002, + WGPUAdapterType_CPU = 0x00000003, + WGPUAdapterType_Unknown = 0x00000004, + WGPUAdapterType_Force32 = 0x7FFFFFFF } WGPUAdapterType; typedef enum WGPUAddressMode { - WGPUAddressMode_Undefined = 0x00000000, - WGPUAddressMode_ClampToEdge = 0x00000001, - WGPUAddressMode_Repeat = 0x00000002, - WGPUAddressMode_MirrorRepeat = 0x00000003, - WGPUAddressMode_Force32 = 0x7FFFFFFF + WGPUAddressMode_Undefined = 0x00000000, + WGPUAddressMode_ClampToEdge = 0x00000001, + WGPUAddressMode_Repeat = 0x00000002, + WGPUAddressMode_MirrorRepeat = 0x00000003, + WGPUAddressMode_Force32 = 0x7FFFFFFF } WGPUAddressMode; typedef enum WGPUBackendType { - WGPUBackendType_Undefined = 0x00000000, - WGPUBackendType_Null = 0x00000001, - WGPUBackendType_WebGPU = 0x00000002, - WGPUBackendType_D3D11 = 0x00000003, - WGPUBackendType_D3D12 = 0x00000004, - WGPUBackendType_Metal = 0x00000005, - WGPUBackendType_Vulkan = 0x00000006, - WGPUBackendType_OpenGL = 0x00000007, - WGPUBackendType_OpenGLES = 0x00000008, - WGPUBackendType_Force32 = 0x7FFFFFFF + WGPUBackendType_Undefined = 0x00000000, + WGPUBackendType_Null = 0x00000001, + WGPUBackendType_WebGPU = 0x00000002, + WGPUBackendType_D3D11 = 0x00000003, + WGPUBackendType_D3D12 = 0x00000004, + WGPUBackendType_Metal = 0x00000005, + WGPUBackendType_Vulkan = 0x00000006, + WGPUBackendType_OpenGL = 0x00000007, + WGPUBackendType_OpenGLES = 0x00000008, + WGPUBackendType_Force32 = 0x7FFFFFFF } WGPUBackendType; typedef enum WGPUBlendFactor { - WGPUBlendFactor_Undefined = 0x00000000, - WGPUBlendFactor_Zero = 0x00000001, - WGPUBlendFactor_One = 0x00000002, - WGPUBlendFactor_Src = 0x00000003, - WGPUBlendFactor_OneMinusSrc = 0x00000004, - WGPUBlendFactor_SrcAlpha = 0x00000005, - WGPUBlendFactor_OneMinusSrcAlpha = 0x00000006, - WGPUBlendFactor_Dst = 0x00000007, - WGPUBlendFactor_OneMinusDst = 0x00000008, - WGPUBlendFactor_DstAlpha = 0x00000009, - WGPUBlendFactor_OneMinusDstAlpha = 0x0000000A, - WGPUBlendFactor_SrcAlphaSaturated = 0x0000000B, - WGPUBlendFactor_Constant = 0x0000000C, - WGPUBlendFactor_OneMinusConstant = 0x0000000D, - WGPUBlendFactor_Src1 = 0x0000000E, - WGPUBlendFactor_OneMinusSrc1 = 0x0000000F, - WGPUBlendFactor_Src1Alpha = 0x00000010, - WGPUBlendFactor_OneMinusSrc1Alpha = 0x00000011, - WGPUBlendFactor_Force32 = 0x7FFFFFFF + WGPUBlendFactor_Undefined = 0x00000000, + WGPUBlendFactor_Zero = 0x00000001, + WGPUBlendFactor_One = 0x00000002, + WGPUBlendFactor_Src = 0x00000003, + WGPUBlendFactor_OneMinusSrc = 0x00000004, + WGPUBlendFactor_SrcAlpha = 0x00000005, + WGPUBlendFactor_OneMinusSrcAlpha = 0x00000006, + WGPUBlendFactor_Dst = 0x00000007, + WGPUBlendFactor_OneMinusDst = 0x00000008, + WGPUBlendFactor_DstAlpha = 0x00000009, + WGPUBlendFactor_OneMinusDstAlpha = 0x0000000A, + WGPUBlendFactor_SrcAlphaSaturated = 0x0000000B, + WGPUBlendFactor_Constant = 0x0000000C, + WGPUBlendFactor_OneMinusConstant = 0x0000000D, + WGPUBlendFactor_Src1 = 0x0000000E, + WGPUBlendFactor_OneMinusSrc1 = 0x0000000F, + WGPUBlendFactor_Src1Alpha = 0x00000010, + WGPUBlendFactor_OneMinusSrc1Alpha = 0x00000011, + WGPUBlendFactor_Force32 = 0x7FFFFFFF } WGPUBlendFactor; typedef enum WGPUBlendOperation { - WGPUBlendOperation_Undefined = 0x00000000, - WGPUBlendOperation_Add = 0x00000001, - WGPUBlendOperation_Subtract = 0x00000002, - WGPUBlendOperation_ReverseSubtract = 0x00000003, - WGPUBlendOperation_Min = 0x00000004, - WGPUBlendOperation_Max = 0x00000005, - WGPUBlendOperation_Force32 = 0x7FFFFFFF + WGPUBlendOperation_Undefined = 0x00000000, + WGPUBlendOperation_Add = 0x00000001, + WGPUBlendOperation_Subtract = 0x00000002, + WGPUBlendOperation_ReverseSubtract = 0x00000003, + WGPUBlendOperation_Min = 0x00000004, + WGPUBlendOperation_Max = 0x00000005, + WGPUBlendOperation_Force32 = 0x7FFFFFFF } WGPUBlendOperation; typedef enum WGPUBufferBindingType { - WGPUBufferBindingType_BindingNotUsed = 0x00000000, - WGPUBufferBindingType_Undefined = 0x00000001, - WGPUBufferBindingType_Uniform = 0x00000002, - WGPUBufferBindingType_Storage = 0x00000003, - WGPUBufferBindingType_ReadOnlyStorage = 0x00000004, - WGPUBufferBindingType_Force32 = 0x7FFFFFFF + WGPUBufferBindingType_BindingNotUsed = 0x00000000, + WGPUBufferBindingType_Undefined = 0x00000001, + WGPUBufferBindingType_Uniform = 0x00000002, + WGPUBufferBindingType_Storage = 0x00000003, + WGPUBufferBindingType_ReadOnlyStorage = 0x00000004, + WGPUBufferBindingType_Force32 = 0x7FFFFFFF } WGPUBufferBindingType; typedef enum WGPUCallbackMode { - WGPUCallbackMode_WaitAnyOnly = 0x00000001, - WGPUCallbackMode_AllowProcessEvents = 0x00000002, - WGPUCallbackMode_AllowSpontaneous = 0x00000003, - WGPUCallbackMode_Force32 = 0x7FFFFFFF + WGPUCallbackMode_WaitAnyOnly = 0x00000001, + WGPUCallbackMode_AllowProcessEvents = 0x00000002, + WGPUCallbackMode_AllowSpontaneous = 0x00000003, + WGPUCallbackMode_Force32 = 0x7FFFFFFF } WGPUCallbackMode; typedef enum WGPUCompareFunction { - WGPUCompareFunction_Undefined = 0x00000000, - WGPUCompareFunction_Never = 0x00000001, - WGPUCompareFunction_Less = 0x00000002, - WGPUCompareFunction_Equal = 0x00000003, - WGPUCompareFunction_LessEqual = 0x00000004, - WGPUCompareFunction_Greater = 0x00000005, - WGPUCompareFunction_NotEqual = 0x00000006, - WGPUCompareFunction_GreaterEqual = 0x00000007, - WGPUCompareFunction_Always = 0x00000008, - WGPUCompareFunction_Force32 = 0x7FFFFFFF + WGPUCompareFunction_Undefined = 0x00000000, + WGPUCompareFunction_Never = 0x00000001, + WGPUCompareFunction_Less = 0x00000002, + WGPUCompareFunction_Equal = 0x00000003, + WGPUCompareFunction_LessEqual = 0x00000004, + WGPUCompareFunction_Greater = 0x00000005, + WGPUCompareFunction_NotEqual = 0x00000006, + WGPUCompareFunction_GreaterEqual = 0x00000007, + WGPUCompareFunction_Always = 0x00000008, + WGPUCompareFunction_Force32 = 0x7FFFFFFF } WGPUCompareFunction; typedef enum WGPUCompositeAlphaMode { - WGPUCompositeAlphaMode_Auto = 0x00000000, - WGPUCompositeAlphaMode_Opaque = 0x00000001, - WGPUCompositeAlphaMode_Premultiplied = 0x00000002, - WGPUCompositeAlphaMode_Unpremultiplied = 0x00000003, - WGPUCompositeAlphaMode_Inherit = 0x00000004, - WGPUCompositeAlphaMode_Force32 = 0x7FFFFFFF + WGPUCompositeAlphaMode_Auto = 0x00000000, + WGPUCompositeAlphaMode_Opaque = 0x00000001, + WGPUCompositeAlphaMode_Premultiplied = 0x00000002, + WGPUCompositeAlphaMode_Unpremultiplied = 0x00000003, + WGPUCompositeAlphaMode_Inherit = 0x00000004, + WGPUCompositeAlphaMode_Force32 = 0x7FFFFFFF } WGPUCompositeAlphaMode; typedef enum WGPUCullMode { - WGPUCullMode_Undefined = 0x00000000, - WGPUCullMode_None = 0x00000001, - WGPUCullMode_Front = 0x00000002, - WGPUCullMode_Back = 0x00000003, - WGPUCullMode_Force32 = 0x7FFFFFFF + WGPUCullMode_Undefined = 0x00000000, + WGPUCullMode_None = 0x00000001, + WGPUCullMode_Front = 0x00000002, + WGPUCullMode_Back = 0x00000003, + WGPUCullMode_Force32 = 0x7FFFFFFF } WGPUCullMode; typedef enum WGPUDeviceLostReason { - WGPUDeviceLostReason_Unknown = 0x00000001, - WGPUDeviceLostReason_Destroyed = 0x00000002, - WGPUDeviceLostReason_CallbackCancelled = 0x00000003, - WGPUDeviceLostReason_FailedCreation = 0x00000004, - WGPUDeviceLostReason_Force32 = 0x7FFFFFFF + WGPUDeviceLostReason_Unknown = 0x00000001, + WGPUDeviceLostReason_Destroyed = 0x00000002, + WGPUDeviceLostReason_CallbackCancelled = 0x00000003, + WGPUDeviceLostReason_FailedCreation = 0x00000004, + WGPUDeviceLostReason_Force32 = 0x7FFFFFFF } WGPUDeviceLostReason; typedef enum WGPUErrorType { - WGPUErrorType_NoError = 0x00000001, - WGPUErrorType_Validation = 0x00000002, - WGPUErrorType_OutOfMemory = 0x00000003, - WGPUErrorType_Internal = 0x00000004, - WGPUErrorType_Unknown = 0x00000005, - WGPUErrorType_Force32 = 0x7FFFFFFF + WGPUErrorType_NoError = 0x00000001, + WGPUErrorType_Validation = 0x00000002, + WGPUErrorType_OutOfMemory = 0x00000003, + WGPUErrorType_Internal = 0x00000004, + WGPUErrorType_Unknown = 0x00000005, + WGPUErrorType_Force32 = 0x7FFFFFFF } WGPUErrorType; typedef enum WGPUFeatureLevel { - WGPUFeatureLevel_Undefined = 0x00000000, - WGPUFeatureLevel_Compatibility = 0x00000001, - WGPUFeatureLevel_Core = 0x00000002, - WGPUFeatureLevel_Force32 = 0x7FFFFFFF + WGPUFeatureLevel_Undefined = 0x00000000, + WGPUFeatureLevel_Compatibility = 0x00000001, + WGPUFeatureLevel_Core = 0x00000002, + WGPUFeatureLevel_Force32 = 0x7FFFFFFF } WGPUFeatureLevel; typedef enum WGPUFeatureName { - WGPUFeatureName_CoreFeaturesAndLimits = 0x00000001, - WGPUFeatureName_DepthClipControl = 0x00000002, - WGPUFeatureName_Depth32FloatStencil8 = 0x00000003, - WGPUFeatureName_TextureCompressionBC = 0x00000004, - WGPUFeatureName_TextureCompressionBCSliced3D = 0x00000005, - WGPUFeatureName_TextureCompressionETC2 = 0x00000006, - WGPUFeatureName_TextureCompressionASTC = 0x00000007, - WGPUFeatureName_TextureCompressionASTCSliced3D = 0x00000008, - WGPUFeatureName_TimestampQuery = 0x00000009, - WGPUFeatureName_IndirectFirstInstance = 0x0000000A, - WGPUFeatureName_ShaderF16 = 0x0000000B, - WGPUFeatureName_RG11B10UfloatRenderable = 0x0000000C, - WGPUFeatureName_BGRA8UnormStorage = 0x0000000D, - WGPUFeatureName_Float32Filterable = 0x0000000E, - WGPUFeatureName_Float32Blendable = 0x0000000F, - WGPUFeatureName_ClipDistances = 0x00000010, - WGPUFeatureName_DualSourceBlending = 0x00000011, - WGPUFeatureName_Subgroups = 0x00000012, - WGPUFeatureName_TextureFormatsTier1 = 0x00000013, - WGPUFeatureName_TextureFormatsTier2 = 0x00000014, - WGPUFeatureName_PrimitiveIndex = 0x00000015, - WGPUFeatureName_TextureComponentSwizzle = 0x00000016, - WGPUFeatureName_Force32 = 0x7FFFFFFF + WGPUFeatureName_CoreFeaturesAndLimits = 0x00000001, + WGPUFeatureName_DepthClipControl = 0x00000002, + WGPUFeatureName_Depth32FloatStencil8 = 0x00000003, + WGPUFeatureName_TextureCompressionBC = 0x00000004, + WGPUFeatureName_TextureCompressionBCSliced3D = 0x00000005, + WGPUFeatureName_TextureCompressionETC2 = 0x00000006, + WGPUFeatureName_TextureCompressionASTC = 0x00000007, + WGPUFeatureName_TextureCompressionASTCSliced3D = 0x00000008, + WGPUFeatureName_TimestampQuery = 0x00000009, + WGPUFeatureName_IndirectFirstInstance = 0x0000000A, + WGPUFeatureName_ShaderF16 = 0x0000000B, + WGPUFeatureName_RG11B10UfloatRenderable = 0x0000000C, + WGPUFeatureName_BGRA8UnormStorage = 0x0000000D, + WGPUFeatureName_Float32Filterable = 0x0000000E, + WGPUFeatureName_Float32Blendable = 0x0000000F, + WGPUFeatureName_ClipDistances = 0x00000010, + WGPUFeatureName_DualSourceBlending = 0x00000011, + WGPUFeatureName_Subgroups = 0x00000012, + WGPUFeatureName_TextureFormatsTier1 = 0x00000013, + WGPUFeatureName_TextureFormatsTier2 = 0x00000014, + WGPUFeatureName_PrimitiveIndex = 0x00000015, + WGPUFeatureName_TextureComponentSwizzle = 0x00000016, + WGPUFeatureName_Force32 = 0x7FFFFFFF } WGPUFeatureName; typedef enum WGPUFilterMode { - WGPUFilterMode_Undefined = 0x00000000, - WGPUFilterMode_Nearest = 0x00000001, - WGPUFilterMode_Linear = 0x00000002, - WGPUFilterMode_Force32 = 0x7FFFFFFF + WGPUFilterMode_Undefined = 0x00000000, + WGPUFilterMode_Nearest = 0x00000001, + WGPUFilterMode_Linear = 0x00000002, + WGPUFilterMode_Force32 = 0x7FFFFFFF } WGPUFilterMode; typedef enum WGPUFrontFace { - WGPUFrontFace_Undefined = 0x00000000, - WGPUFrontFace_CCW = 0x00000001, - WGPUFrontFace_CW = 0x00000002, - WGPUFrontFace_Force32 = 0x7FFFFFFF + WGPUFrontFace_Undefined = 0x00000000, + WGPUFrontFace_CCW = 0x00000001, + WGPUFrontFace_CW = 0x00000002, + WGPUFrontFace_Force32 = 0x7FFFFFFF } WGPUFrontFace; typedef enum WGPUIndexFormat { - WGPUIndexFormat_Undefined = 0x00000000, - WGPUIndexFormat_Uint16 = 0x00000001, - WGPUIndexFormat_Uint32 = 0x00000002, - WGPUIndexFormat_Force32 = 0x7FFFFFFF + WGPUIndexFormat_Undefined = 0x00000000, + WGPUIndexFormat_Uint16 = 0x00000001, + WGPUIndexFormat_Uint32 = 0x00000002, + WGPUIndexFormat_Force32 = 0x7FFFFFFF } WGPUIndexFormat; typedef enum WGPUInstanceFeatureName { - WGPUInstanceFeatureName_TimedWaitAny = 0x00000001, - WGPUInstanceFeatureName_ShaderSourceSPIRV = 0x00000002, - WGPUInstanceFeatureName_MultipleDevicesPerAdapter = 0x00000003, - WGPUInstanceFeatureName_Force32 = 0x7FFFFFFF + WGPUInstanceFeatureName_TimedWaitAny = 0x00000001, + WGPUInstanceFeatureName_ShaderSourceSPIRV = 0x00000002, + WGPUInstanceFeatureName_MultipleDevicesPerAdapter = 0x00000003, + WGPUInstanceFeatureName_Force32 = 0x7FFFFFFF } WGPUInstanceFeatureName; typedef enum WGPULoadOp { - WGPULoadOp_Undefined = 0x00000000, - WGPULoadOp_Load = 0x00000001, - WGPULoadOp_Clear = 0x00000002, - WGPULoadOp_Force32 = 0x7FFFFFFF + WGPULoadOp_Undefined = 0x00000000, + WGPULoadOp_Load = 0x00000001, + WGPULoadOp_Clear = 0x00000002, + WGPULoadOp_Force32 = 0x7FFFFFFF } WGPULoadOp; typedef enum WGPUMipmapFilterMode { - WGPUMipmapFilterMode_Undefined = 0x00000000, - WGPUMipmapFilterMode_Nearest = 0x00000001, - WGPUMipmapFilterMode_Linear = 0x00000002, - WGPUMipmapFilterMode_Force32 = 0x7FFFFFFF + WGPUMipmapFilterMode_Undefined = 0x00000000, + WGPUMipmapFilterMode_Nearest = 0x00000001, + WGPUMipmapFilterMode_Linear = 0x00000002, + WGPUMipmapFilterMode_Force32 = 0x7FFFFFFF } WGPUMipmapFilterMode; typedef enum WGPUOptionalBool { - WGPUOptionalBool_False = 0x00000000, - WGPUOptionalBool_True = 0x00000001, - WGPUOptionalBool_Undefined = 0x00000002, - WGPUOptionalBool_Force32 = 0x7FFFFFFF + WGPUOptionalBool_False = 0x00000000, + WGPUOptionalBool_True = 0x00000001, + WGPUOptionalBool_Undefined = 0x00000002, + WGPUOptionalBool_Force32 = 0x7FFFFFFF } WGPUOptionalBool; typedef enum WGPUPowerPreference { - WGPUPowerPreference_Undefined = 0x00000000, - WGPUPowerPreference_LowPower = 0x00000001, - WGPUPowerPreference_HighPerformance = 0x00000002, - WGPUPowerPreference_Force32 = 0x7FFFFFFF + WGPUPowerPreference_Undefined = 0x00000000, + WGPUPowerPreference_LowPower = 0x00000001, + WGPUPowerPreference_HighPerformance = 0x00000002, + WGPUPowerPreference_Force32 = 0x7FFFFFFF } WGPUPowerPreference; typedef enum WGPUPresentMode { - WGPUPresentMode_Undefined = 0x00000000, - WGPUPresentMode_Fifo = 0x00000001, - WGPUPresentMode_FifoRelaxed = 0x00000002, - WGPUPresentMode_Immediate = 0x00000003, - WGPUPresentMode_Mailbox = 0x00000004, - WGPUPresentMode_Force32 = 0x7FFFFFFF + WGPUPresentMode_Undefined = 0x00000000, + WGPUPresentMode_Fifo = 0x00000001, + WGPUPresentMode_FifoRelaxed = 0x00000002, + WGPUPresentMode_Immediate = 0x00000003, + WGPUPresentMode_Mailbox = 0x00000004, + WGPUPresentMode_Force32 = 0x7FFFFFFF } WGPUPresentMode; typedef enum WGPUPrimitiveTopology { - WGPUPrimitiveTopology_Undefined = 0x00000000, - WGPUPrimitiveTopology_PointList = 0x00000001, - WGPUPrimitiveTopology_LineList = 0x00000002, - WGPUPrimitiveTopology_LineStrip = 0x00000003, - WGPUPrimitiveTopology_TriangleList = 0x00000004, - WGPUPrimitiveTopology_TriangleStrip = 0x00000005, - WGPUPrimitiveTopology_Force32 = 0x7FFFFFFF + WGPUPrimitiveTopology_Undefined = 0x00000000, + WGPUPrimitiveTopology_PointList = 0x00000001, + WGPUPrimitiveTopology_LineList = 0x00000002, + WGPUPrimitiveTopology_LineStrip = 0x00000003, + WGPUPrimitiveTopology_TriangleList = 0x00000004, + WGPUPrimitiveTopology_TriangleStrip = 0x00000005, + WGPUPrimitiveTopology_Force32 = 0x7FFFFFFF } WGPUPrimitiveTopology; typedef enum WGPUQueueWorkDoneStatus { - WGPUQueueWorkDoneStatus_Success = 0x00000001, - WGPUQueueWorkDoneStatus_CallbackCancelled = 0x00000002, - WGPUQueueWorkDoneStatus_Error = 0x00000003, - WGPUQueueWorkDoneStatus_Force32 = 0x7FFFFFFF + WGPUQueueWorkDoneStatus_Success = 0x00000001, + WGPUQueueWorkDoneStatus_CallbackCancelled = 0x00000002, + WGPUQueueWorkDoneStatus_Error = 0x00000003, + WGPUQueueWorkDoneStatus_Force32 = 0x7FFFFFFF } WGPUQueueWorkDoneStatus; typedef enum WGPURequestAdapterStatus { - WGPURequestAdapterStatus_Success = 0x00000001, - WGPURequestAdapterStatus_CallbackCancelled = 0x00000002, - WGPURequestAdapterStatus_Unavailable = 0x00000003, - WGPURequestAdapterStatus_Error = 0x00000004, - WGPURequestAdapterStatus_Force32 = 0x7FFFFFFF + WGPURequestAdapterStatus_Success = 0x00000001, + WGPURequestAdapterStatus_CallbackCancelled = 0x00000002, + WGPURequestAdapterStatus_Unavailable = 0x00000003, + WGPURequestAdapterStatus_Error = 0x00000004, + WGPURequestAdapterStatus_Force32 = 0x7FFFFFFF } WGPURequestAdapterStatus; typedef enum WGPURequestDeviceStatus { - WGPURequestDeviceStatus_Success = 0x00000001, - WGPURequestDeviceStatus_CallbackCancelled = 0x00000002, - WGPURequestDeviceStatus_Error = 0x00000003, - WGPURequestDeviceStatus_Force32 = 0x7FFFFFFF + WGPURequestDeviceStatus_Success = 0x00000001, + WGPURequestDeviceStatus_CallbackCancelled = 0x00000002, + WGPURequestDeviceStatus_Error = 0x00000003, + WGPURequestDeviceStatus_Force32 = 0x7FFFFFFF } WGPURequestDeviceStatus; typedef enum WGPUSamplerBindingType { - WGPUSamplerBindingType_BindingNotUsed = 0x00000000, - WGPUSamplerBindingType_Undefined = 0x00000001, - WGPUSamplerBindingType_Filtering = 0x00000002, - WGPUSamplerBindingType_NonFiltering = 0x00000003, - WGPUSamplerBindingType_Comparison = 0x00000004, - WGPUSamplerBindingType_Force32 = 0x7FFFFFFF + WGPUSamplerBindingType_BindingNotUsed = 0x00000000, + WGPUSamplerBindingType_Undefined = 0x00000001, + WGPUSamplerBindingType_Filtering = 0x00000002, + WGPUSamplerBindingType_NonFiltering = 0x00000003, + WGPUSamplerBindingType_Comparison = 0x00000004, + WGPUSamplerBindingType_Force32 = 0x7FFFFFFF } WGPUSamplerBindingType; typedef enum WGPUStatus { - WGPUStatus_Success = 0x00000001, - WGPUStatus_Error = 0x00000002, - WGPUStatus_Force32 = 0x7FFFFFFF + WGPUStatus_Success = 0x00000001, + WGPUStatus_Error = 0x00000002, + WGPUStatus_Force32 = 0x7FFFFFFF } WGPUStatus; typedef enum WGPUStencilOperation { - WGPUStencilOperation_Undefined = 0x00000000, - WGPUStencilOperation_Keep = 0x00000001, - WGPUStencilOperation_Zero = 0x00000002, - WGPUStencilOperation_Replace = 0x00000003, - WGPUStencilOperation_Invert = 0x00000004, - WGPUStencilOperation_IncrementClamp = 0x00000005, - WGPUStencilOperation_DecrementClamp = 0x00000006, - WGPUStencilOperation_IncrementWrap = 0x00000007, - WGPUStencilOperation_DecrementWrap = 0x00000008, - WGPUStencilOperation_Force32 = 0x7FFFFFFF + WGPUStencilOperation_Undefined = 0x00000000, + WGPUStencilOperation_Keep = 0x00000001, + WGPUStencilOperation_Zero = 0x00000002, + WGPUStencilOperation_Replace = 0x00000003, + WGPUStencilOperation_Invert = 0x00000004, + WGPUStencilOperation_IncrementClamp = 0x00000005, + WGPUStencilOperation_DecrementClamp = 0x00000006, + WGPUStencilOperation_IncrementWrap = 0x00000007, + WGPUStencilOperation_DecrementWrap = 0x00000008, + WGPUStencilOperation_Force32 = 0x7FFFFFFF } WGPUStencilOperation; typedef enum WGPUStorageTextureAccess { - WGPUStorageTextureAccess_BindingNotUsed = 0x00000000, - WGPUStorageTextureAccess_Undefined = 0x00000001, - WGPUStorageTextureAccess_WriteOnly = 0x00000002, - WGPUStorageTextureAccess_ReadOnly = 0x00000003, - WGPUStorageTextureAccess_ReadWrite = 0x00000004, - WGPUStorageTextureAccess_Force32 = 0x7FFFFFFF + WGPUStorageTextureAccess_BindingNotUsed = 0x00000000, + WGPUStorageTextureAccess_Undefined = 0x00000001, + WGPUStorageTextureAccess_WriteOnly = 0x00000002, + WGPUStorageTextureAccess_ReadOnly = 0x00000003, + WGPUStorageTextureAccess_ReadWrite = 0x00000004, + WGPUStorageTextureAccess_Force32 = 0x7FFFFFFF } WGPUStorageTextureAccess; typedef enum WGPUStoreOp { - WGPUStoreOp_Undefined = 0x00000000, - WGPUStoreOp_Store = 0x00000001, - WGPUStoreOp_Discard = 0x00000002, - WGPUStoreOp_Force32 = 0x7FFFFFFF + WGPUStoreOp_Undefined = 0x00000000, + WGPUStoreOp_Store = 0x00000001, + WGPUStoreOp_Discard = 0x00000002, + WGPUStoreOp_Force32 = 0x7FFFFFFF } WGPUStoreOp; typedef enum WGPUSType { - WGPUSType_ShaderSourceSPIRV = 0x00000001, - WGPUSType_ShaderSourceWGSL = 0x00000002, - WGPUSType_RenderPassMaxDrawCount = 0x00000003, - WGPUSType_SurfaceSourceMetalLayer = 0x00000004, - WGPUSType_SurfaceSourceWindowsHWND = 0x00000005, - WGPUSType_SurfaceSourceXlibWindow = 0x00000006, - WGPUSType_SurfaceSourceWaylandSurface = 0x00000007, - WGPUSType_SurfaceSourceAndroidNativeWindow = 0x00000008, - WGPUSType_SurfaceSourceXCBWindow = 0x00000009, - WGPUSType_SurfaceColorManagement = 0x0000000A, - WGPUSType_RequestAdapterWebXROptions = 0x0000000B, - WGPUSType_Force32 = 0x7FFFFFFF + WGPUSType_ShaderSourceSPIRV = 0x00000001, + WGPUSType_ShaderSourceWGSL = 0x00000002, + WGPUSType_RenderPassMaxDrawCount = 0x00000003, + WGPUSType_SurfaceSourceMetalLayer = 0x00000004, + WGPUSType_SurfaceSourceWindowsHWND = 0x00000005, + WGPUSType_SurfaceSourceXlibWindow = 0x00000006, + WGPUSType_SurfaceSourceWaylandSurface = 0x00000007, + WGPUSType_SurfaceSourceAndroidNativeWindow = 0x00000008, + WGPUSType_SurfaceSourceXCBWindow = 0x00000009, + WGPUSType_SurfaceColorManagement = 0x0000000A, + WGPUSType_RequestAdapterWebXROptions = 0x0000000B, + WGPUSType_Force32 = 0x7FFFFFFF } WGPUSType; typedef enum WGPUSurfaceGetCurrentTextureStatus { - WGPUSurfaceGetCurrentTextureStatus_SuccessOptimal = 0x00000001, - WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal = 0x00000002, - WGPUSurfaceGetCurrentTextureStatus_Timeout = 0x00000003, - WGPUSurfaceGetCurrentTextureStatus_Outdated = 0x00000004, - WGPUSurfaceGetCurrentTextureStatus_Lost = 0x00000005, - WGPUSurfaceGetCurrentTextureStatus_Error = 0x00000006, - WGPUSurfaceGetCurrentTextureStatus_Force32 = 0x7FFFFFFF + WGPUSurfaceGetCurrentTextureStatus_SuccessOptimal = 0x00000001, + WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal = 0x00000002, + WGPUSurfaceGetCurrentTextureStatus_Timeout = 0x00000003, + WGPUSurfaceGetCurrentTextureStatus_Outdated = 0x00000004, + WGPUSurfaceGetCurrentTextureStatus_Lost = 0x00000005, + WGPUSurfaceGetCurrentTextureStatus_Error = 0x00000006, + WGPUSurfaceGetCurrentTextureStatus_Force32 = 0x7FFFFFFF } WGPUSurfaceGetCurrentTextureStatus; typedef enum WGPUTextureAspect { - WGPUTextureAspect_Undefined = 0x00000000, - WGPUTextureAspect_All = 0x00000001, - WGPUTextureAspect_StencilOnly = 0x00000002, - WGPUTextureAspect_DepthOnly = 0x00000003, - WGPUTextureAspect_Force32 = 0x7FFFFFFF + WGPUTextureAspect_Undefined = 0x00000000, + WGPUTextureAspect_All = 0x00000001, + WGPUTextureAspect_StencilOnly = 0x00000002, + WGPUTextureAspect_DepthOnly = 0x00000003, + WGPUTextureAspect_Force32 = 0x7FFFFFFF } WGPUTextureAspect; typedef enum WGPUTextureDimension { - WGPUTextureDimension_Undefined = 0x00000000, - WGPUTextureDimension_1D = 0x00000001, - WGPUTextureDimension_2D = 0x00000002, - WGPUTextureDimension_3D = 0x00000003, - WGPUTextureDimension_Force32 = 0x7FFFFFFF + WGPUTextureDimension_Undefined = 0x00000000, + WGPUTextureDimension_1D = 0x00000001, + WGPUTextureDimension_2D = 0x00000002, + WGPUTextureDimension_3D = 0x00000003, + WGPUTextureDimension_Force32 = 0x7FFFFFFF } WGPUTextureDimension; typedef enum WGPUTextureFormat { - WGPUTextureFormat_Undefined = 0x00000000, - WGPUTextureFormat_R8Unorm = 0x00000001, - WGPUTextureFormat_R8Snorm = 0x00000002, - WGPUTextureFormat_R8Uint = 0x00000003, - WGPUTextureFormat_R8Sint = 0x00000004, - WGPUTextureFormat_R16Unorm = 0x00000005, - WGPUTextureFormat_R16Snorm = 0x00000006, - WGPUTextureFormat_R16Uint = 0x00000007, - WGPUTextureFormat_R16Sint = 0x00000008, - WGPUTextureFormat_R16Float = 0x00000009, - WGPUTextureFormat_RG8Unorm = 0x0000000A, - WGPUTextureFormat_RG8Snorm = 0x0000000B, - WGPUTextureFormat_RG8Uint = 0x0000000C, - WGPUTextureFormat_RG8Sint = 0x0000000D, - WGPUTextureFormat_R32Float = 0x0000000E, - WGPUTextureFormat_R32Uint = 0x0000000F, - WGPUTextureFormat_R32Sint = 0x00000010, - WGPUTextureFormat_RG16Unorm = 0x00000011, - WGPUTextureFormat_RG16Snorm = 0x00000012, - WGPUTextureFormat_RG16Uint = 0x00000013, - WGPUTextureFormat_RG16Sint = 0x00000014, - WGPUTextureFormat_RG16Float = 0x00000015, - WGPUTextureFormat_RGBA8Unorm = 0x00000016, - WGPUTextureFormat_RGBA8UnormSrgb = 0x00000017, - WGPUTextureFormat_RGBA8Snorm = 0x00000018, - WGPUTextureFormat_RGBA8Uint = 0x00000019, - WGPUTextureFormat_RGBA8Sint = 0x0000001A, - WGPUTextureFormat_BGRA8Unorm = 0x0000001B, - WGPUTextureFormat_BGRA8UnormSrgb = 0x0000001C, - WGPUTextureFormat_RGB10A2Uint = 0x0000001D, - WGPUTextureFormat_RGB10A2Unorm = 0x0000001E, - WGPUTextureFormat_RG11B10Ufloat = 0x0000001F, - WGPUTextureFormat_RGB9E5Ufloat = 0x00000020, - WGPUTextureFormat_RG32Float = 0x00000021, - WGPUTextureFormat_RG32Uint = 0x00000022, - WGPUTextureFormat_RG32Sint = 0x00000023, - WGPUTextureFormat_RGBA16Unorm = 0x00000024, - WGPUTextureFormat_RGBA16Snorm = 0x00000025, - WGPUTextureFormat_RGBA16Uint = 0x00000026, - WGPUTextureFormat_RGBA16Sint = 0x00000027, - WGPUTextureFormat_RGBA16Float = 0x00000028, - WGPUTextureFormat_RGBA32Float = 0x00000029, - WGPUTextureFormat_RGBA32Uint = 0x0000002A, - WGPUTextureFormat_RGBA32Sint = 0x0000002B, - WGPUTextureFormat_Stencil8 = 0x0000002C, - WGPUTextureFormat_Depth16Unorm = 0x0000002D, - WGPUTextureFormat_Depth24Plus = 0x0000002E, - WGPUTextureFormat_Depth24PlusStencil8 = 0x0000002F, - WGPUTextureFormat_Depth32Float = 0x00000030, - WGPUTextureFormat_Depth32FloatStencil8 = 0x00000031, - WGPUTextureFormat_BC1RGBAUnorm = 0x00000032, - WGPUTextureFormat_BC1RGBAUnormSrgb = 0x00000033, - WGPUTextureFormat_BC2RGBAUnorm = 0x00000034, - WGPUTextureFormat_BC2RGBAUnormSrgb = 0x00000035, - WGPUTextureFormat_BC3RGBAUnorm = 0x00000036, - WGPUTextureFormat_BC3RGBAUnormSrgb = 0x00000037, - WGPUTextureFormat_BC4RUnorm = 0x00000038, - WGPUTextureFormat_BC4RSnorm = 0x00000039, - WGPUTextureFormat_BC5RGUnorm = 0x0000003A, - WGPUTextureFormat_BC5RGSnorm = 0x0000003B, - WGPUTextureFormat_BC6HRGBUfloat = 0x0000003C, - WGPUTextureFormat_BC6HRGBFloat = 0x0000003D, - WGPUTextureFormat_BC7RGBAUnorm = 0x0000003E, - WGPUTextureFormat_BC7RGBAUnormSrgb = 0x0000003F, - WGPUTextureFormat_ETC2RGB8Unorm = 0x00000040, - WGPUTextureFormat_ETC2RGB8UnormSrgb = 0x00000041, - WGPUTextureFormat_ETC2RGB8A1Unorm = 0x00000042, - WGPUTextureFormat_ETC2RGB8A1UnormSrgb = 0x00000043, - WGPUTextureFormat_ETC2RGBA8Unorm = 0x00000044, - WGPUTextureFormat_ETC2RGBA8UnormSrgb = 0x00000045, - WGPUTextureFormat_EACR11Unorm = 0x00000046, - WGPUTextureFormat_EACR11Snorm = 0x00000047, - WGPUTextureFormat_EACRG11Unorm = 0x00000048, - WGPUTextureFormat_EACRG11Snorm = 0x00000049, - WGPUTextureFormat_ASTC4x4Unorm = 0x0000004A, - WGPUTextureFormat_ASTC4x4UnormSrgb = 0x0000004B, - WGPUTextureFormat_ASTC5x4Unorm = 0x0000004C, - WGPUTextureFormat_ASTC5x4UnormSrgb = 0x0000004D, - WGPUTextureFormat_ASTC5x5Unorm = 0x0000004E, - WGPUTextureFormat_ASTC5x5UnormSrgb = 0x0000004F, - WGPUTextureFormat_ASTC6x5Unorm = 0x00000050, - WGPUTextureFormat_ASTC6x5UnormSrgb = 0x00000051, - WGPUTextureFormat_ASTC6x6Unorm = 0x00000052, - WGPUTextureFormat_ASTC6x6UnormSrgb = 0x00000053, - WGPUTextureFormat_ASTC8x5Unorm = 0x00000054, - WGPUTextureFormat_ASTC8x5UnormSrgb = 0x00000055, - WGPUTextureFormat_ASTC8x6Unorm = 0x00000056, - WGPUTextureFormat_ASTC8x6UnormSrgb = 0x00000057, - WGPUTextureFormat_ASTC8x8Unorm = 0x00000058, - WGPUTextureFormat_ASTC8x8UnormSrgb = 0x00000059, - WGPUTextureFormat_ASTC10x5Unorm = 0x0000005A, - WGPUTextureFormat_ASTC10x5UnormSrgb = 0x0000005B, - WGPUTextureFormat_ASTC10x6Unorm = 0x0000005C, - WGPUTextureFormat_ASTC10x6UnormSrgb = 0x0000005D, - WGPUTextureFormat_ASTC10x8Unorm = 0x0000005E, - WGPUTextureFormat_ASTC10x8UnormSrgb = 0x0000005F, - WGPUTextureFormat_ASTC10x10Unorm = 0x00000060, - WGPUTextureFormat_ASTC10x10UnormSrgb = 0x00000061, - WGPUTextureFormat_ASTC12x10Unorm = 0x00000062, - WGPUTextureFormat_ASTC12x10UnormSrgb = 0x00000063, - WGPUTextureFormat_ASTC12x12Unorm = 0x00000064, - WGPUTextureFormat_ASTC12x12UnormSrgb = 0x00000065, - WGPUTextureFormat_Force32 = 0x7FFFFFFF + WGPUTextureFormat_Undefined = 0x00000000, + WGPUTextureFormat_R8Unorm = 0x00000001, + WGPUTextureFormat_R8Snorm = 0x00000002, + WGPUTextureFormat_R8Uint = 0x00000003, + WGPUTextureFormat_R8Sint = 0x00000004, + WGPUTextureFormat_R16Unorm = 0x00000005, + WGPUTextureFormat_R16Snorm = 0x00000006, + WGPUTextureFormat_R16Uint = 0x00000007, + WGPUTextureFormat_R16Sint = 0x00000008, + WGPUTextureFormat_R16Float = 0x00000009, + WGPUTextureFormat_RG8Unorm = 0x0000000A, + WGPUTextureFormat_RG8Snorm = 0x0000000B, + WGPUTextureFormat_RG8Uint = 0x0000000C, + WGPUTextureFormat_RG8Sint = 0x0000000D, + WGPUTextureFormat_R32Float = 0x0000000E, + WGPUTextureFormat_R32Uint = 0x0000000F, + WGPUTextureFormat_R32Sint = 0x00000010, + WGPUTextureFormat_RG16Unorm = 0x00000011, + WGPUTextureFormat_RG16Snorm = 0x00000012, + WGPUTextureFormat_RG16Uint = 0x00000013, + WGPUTextureFormat_RG16Sint = 0x00000014, + WGPUTextureFormat_RG16Float = 0x00000015, + WGPUTextureFormat_RGBA8Unorm = 0x00000016, + WGPUTextureFormat_RGBA8UnormSrgb = 0x00000017, + WGPUTextureFormat_RGBA8Snorm = 0x00000018, + WGPUTextureFormat_RGBA8Uint = 0x00000019, + WGPUTextureFormat_RGBA8Sint = 0x0000001A, + WGPUTextureFormat_BGRA8Unorm = 0x0000001B, + WGPUTextureFormat_BGRA8UnormSrgb = 0x0000001C, + WGPUTextureFormat_RGB10A2Uint = 0x0000001D, + WGPUTextureFormat_RGB10A2Unorm = 0x0000001E, + WGPUTextureFormat_RG11B10Ufloat = 0x0000001F, + WGPUTextureFormat_RGB9E5Ufloat = 0x00000020, + WGPUTextureFormat_RG32Float = 0x00000021, + WGPUTextureFormat_RG32Uint = 0x00000022, + WGPUTextureFormat_RG32Sint = 0x00000023, + WGPUTextureFormat_RGBA16Unorm = 0x00000024, + WGPUTextureFormat_RGBA16Snorm = 0x00000025, + WGPUTextureFormat_RGBA16Uint = 0x00000026, + WGPUTextureFormat_RGBA16Sint = 0x00000027, + WGPUTextureFormat_RGBA16Float = 0x00000028, + WGPUTextureFormat_RGBA32Float = 0x00000029, + WGPUTextureFormat_RGBA32Uint = 0x0000002A, + WGPUTextureFormat_RGBA32Sint = 0x0000002B, + WGPUTextureFormat_Stencil8 = 0x0000002C, + WGPUTextureFormat_Depth16Unorm = 0x0000002D, + WGPUTextureFormat_Depth24Plus = 0x0000002E, + WGPUTextureFormat_Depth24PlusStencil8 = 0x0000002F, + WGPUTextureFormat_Depth32Float = 0x00000030, + WGPUTextureFormat_Depth32FloatStencil8 = 0x00000031, + WGPUTextureFormat_BC1RGBAUnorm = 0x00000032, + WGPUTextureFormat_BC1RGBAUnormSrgb = 0x00000033, + WGPUTextureFormat_BC2RGBAUnorm = 0x00000034, + WGPUTextureFormat_BC2RGBAUnormSrgb = 0x00000035, + WGPUTextureFormat_BC3RGBAUnorm = 0x00000036, + WGPUTextureFormat_BC3RGBAUnormSrgb = 0x00000037, + WGPUTextureFormat_BC4RUnorm = 0x00000038, + WGPUTextureFormat_BC4RSnorm = 0x00000039, + WGPUTextureFormat_BC5RGUnorm = 0x0000003A, + WGPUTextureFormat_BC5RGSnorm = 0x0000003B, + WGPUTextureFormat_BC6HRGBUfloat = 0x0000003C, + WGPUTextureFormat_BC6HRGBFloat = 0x0000003D, + WGPUTextureFormat_BC7RGBAUnorm = 0x0000003E, + WGPUTextureFormat_BC7RGBAUnormSrgb = 0x0000003F, + WGPUTextureFormat_ETC2RGB8Unorm = 0x00000040, + WGPUTextureFormat_ETC2RGB8UnormSrgb = 0x00000041, + WGPUTextureFormat_ETC2RGB8A1Unorm = 0x00000042, + WGPUTextureFormat_ETC2RGB8A1UnormSrgb = 0x00000043, + WGPUTextureFormat_ETC2RGBA8Unorm = 0x00000044, + WGPUTextureFormat_ETC2RGBA8UnormSrgb = 0x00000045, + WGPUTextureFormat_EACR11Unorm = 0x00000046, + WGPUTextureFormat_EACR11Snorm = 0x00000047, + WGPUTextureFormat_EACRG11Unorm = 0x00000048, + WGPUTextureFormat_EACRG11Snorm = 0x00000049, + WGPUTextureFormat_ASTC4x4Unorm = 0x0000004A, + WGPUTextureFormat_ASTC4x4UnormSrgb = 0x0000004B, + WGPUTextureFormat_ASTC5x4Unorm = 0x0000004C, + WGPUTextureFormat_ASTC5x4UnormSrgb = 0x0000004D, + WGPUTextureFormat_ASTC5x5Unorm = 0x0000004E, + WGPUTextureFormat_ASTC5x5UnormSrgb = 0x0000004F, + WGPUTextureFormat_ASTC6x5Unorm = 0x00000050, + WGPUTextureFormat_ASTC6x5UnormSrgb = 0x00000051, + WGPUTextureFormat_ASTC6x6Unorm = 0x00000052, + WGPUTextureFormat_ASTC6x6UnormSrgb = 0x00000053, + WGPUTextureFormat_ASTC8x5Unorm = 0x00000054, + WGPUTextureFormat_ASTC8x5UnormSrgb = 0x00000055, + WGPUTextureFormat_ASTC8x6Unorm = 0x00000056, + WGPUTextureFormat_ASTC8x6UnormSrgb = 0x00000057, + WGPUTextureFormat_ASTC8x8Unorm = 0x00000058, + WGPUTextureFormat_ASTC8x8UnormSrgb = 0x00000059, + WGPUTextureFormat_ASTC10x5Unorm = 0x0000005A, + WGPUTextureFormat_ASTC10x5UnormSrgb = 0x0000005B, + WGPUTextureFormat_ASTC10x6Unorm = 0x0000005C, + WGPUTextureFormat_ASTC10x6UnormSrgb = 0x0000005D, + WGPUTextureFormat_ASTC10x8Unorm = 0x0000005E, + WGPUTextureFormat_ASTC10x8UnormSrgb = 0x0000005F, + WGPUTextureFormat_ASTC10x10Unorm = 0x00000060, + WGPUTextureFormat_ASTC10x10UnormSrgb = 0x00000061, + WGPUTextureFormat_ASTC12x10Unorm = 0x00000062, + WGPUTextureFormat_ASTC12x10UnormSrgb = 0x00000063, + WGPUTextureFormat_ASTC12x12Unorm = 0x00000064, + WGPUTextureFormat_ASTC12x12UnormSrgb = 0x00000065, + WGPUTextureFormat_Force32 = 0x7FFFFFFF } WGPUTextureFormat; typedef enum WGPUTextureSampleType { - WGPUTextureSampleType_BindingNotUsed = 0x00000000, - WGPUTextureSampleType_Undefined = 0x00000001, - WGPUTextureSampleType_Float = 0x00000002, - WGPUTextureSampleType_UnfilterableFloat = 0x00000003, - WGPUTextureSampleType_Depth = 0x00000004, - WGPUTextureSampleType_Sint = 0x00000005, - WGPUTextureSampleType_Uint = 0x00000006, - WGPUTextureSampleType_Force32 = 0x7FFFFFFF + WGPUTextureSampleType_BindingNotUsed = 0x00000000, + WGPUTextureSampleType_Undefined = 0x00000001, + WGPUTextureSampleType_Float = 0x00000002, + WGPUTextureSampleType_UnfilterableFloat = 0x00000003, + WGPUTextureSampleType_Depth = 0x00000004, + WGPUTextureSampleType_Sint = 0x00000005, + WGPUTextureSampleType_Uint = 0x00000006, + WGPUTextureSampleType_Force32 = 0x7FFFFFFF } WGPUTextureSampleType; typedef enum WGPUTextureViewDimension { - WGPUTextureViewDimension_Undefined = 0x00000000, - WGPUTextureViewDimension_1D = 0x00000001, - WGPUTextureViewDimension_2D = 0x00000002, - WGPUTextureViewDimension_2DArray = 0x00000003, - WGPUTextureViewDimension_Cube = 0x00000004, - WGPUTextureViewDimension_CubeArray = 0x00000005, - WGPUTextureViewDimension_3D = 0x00000006, - WGPUTextureViewDimension_Force32 = 0x7FFFFFFF + WGPUTextureViewDimension_Undefined = 0x00000000, + WGPUTextureViewDimension_1D = 0x00000001, + WGPUTextureViewDimension_2D = 0x00000002, + WGPUTextureViewDimension_2DArray = 0x00000003, + WGPUTextureViewDimension_Cube = 0x00000004, + WGPUTextureViewDimension_CubeArray = 0x00000005, + WGPUTextureViewDimension_3D = 0x00000006, + WGPUTextureViewDimension_Force32 = 0x7FFFFFFF } WGPUTextureViewDimension; typedef enum WGPUVertexFormat { - WGPUVertexFormat_Uint8 = 0x00000001, - WGPUVertexFormat_Uint8x2 = 0x00000002, - WGPUVertexFormat_Uint8x4 = 0x00000003, - WGPUVertexFormat_Sint8 = 0x00000004, - WGPUVertexFormat_Sint8x2 = 0x00000005, - WGPUVertexFormat_Sint8x4 = 0x00000006, - WGPUVertexFormat_Unorm8 = 0x00000007, - WGPUVertexFormat_Unorm8x2 = 0x00000008, - WGPUVertexFormat_Unorm8x4 = 0x00000009, - WGPUVertexFormat_Snorm8 = 0x0000000A, - WGPUVertexFormat_Snorm8x2 = 0x0000000B, - WGPUVertexFormat_Snorm8x4 = 0x0000000C, - WGPUVertexFormat_Uint16 = 0x0000000D, - WGPUVertexFormat_Uint16x2 = 0x0000000E, - WGPUVertexFormat_Uint16x4 = 0x0000000F, - WGPUVertexFormat_Sint16 = 0x00000010, - WGPUVertexFormat_Sint16x2 = 0x00000011, - WGPUVertexFormat_Sint16x4 = 0x00000012, - WGPUVertexFormat_Unorm16 = 0x00000013, - WGPUVertexFormat_Unorm16x2 = 0x00000014, - WGPUVertexFormat_Unorm16x4 = 0x00000015, - WGPUVertexFormat_Snorm16 = 0x00000016, - WGPUVertexFormat_Snorm16x2 = 0x00000017, - WGPUVertexFormat_Snorm16x4 = 0x00000018, - WGPUVertexFormat_Float16 = 0x00000019, - WGPUVertexFormat_Float16x2 = 0x0000001A, - WGPUVertexFormat_Float16x4 = 0x0000001B, - WGPUVertexFormat_Float32 = 0x0000001C, - WGPUVertexFormat_Float32x2 = 0x0000001D, - WGPUVertexFormat_Float32x3 = 0x0000001E, - WGPUVertexFormat_Float32x4 = 0x0000001F, - WGPUVertexFormat_Uint32 = 0x00000020, - WGPUVertexFormat_Uint32x2 = 0x00000021, - WGPUVertexFormat_Uint32x3 = 0x00000022, - WGPUVertexFormat_Uint32x4 = 0x00000023, - WGPUVertexFormat_Sint32 = 0x00000024, - WGPUVertexFormat_Sint32x2 = 0x00000025, - WGPUVertexFormat_Sint32x3 = 0x00000026, - WGPUVertexFormat_Sint32x4 = 0x00000027, - WGPUVertexFormat_Unorm10_10_10_2 = 0x00000028, - WGPUVertexFormat_Unorm8x4BGRA = 0x00000029, - WGPUVertexFormat_Force32 = 0x7FFFFFFF + WGPUVertexFormat_Uint8 = 0x00000001, + WGPUVertexFormat_Uint8x2 = 0x00000002, + WGPUVertexFormat_Uint8x4 = 0x00000003, + WGPUVertexFormat_Sint8 = 0x00000004, + WGPUVertexFormat_Sint8x2 = 0x00000005, + WGPUVertexFormat_Sint8x4 = 0x00000006, + WGPUVertexFormat_Unorm8 = 0x00000007, + WGPUVertexFormat_Unorm8x2 = 0x00000008, + WGPUVertexFormat_Unorm8x4 = 0x00000009, + WGPUVertexFormat_Snorm8 = 0x0000000A, + WGPUVertexFormat_Snorm8x2 = 0x0000000B, + WGPUVertexFormat_Snorm8x4 = 0x0000000C, + WGPUVertexFormat_Uint16 = 0x0000000D, + WGPUVertexFormat_Uint16x2 = 0x0000000E, + WGPUVertexFormat_Uint16x4 = 0x0000000F, + WGPUVertexFormat_Sint16 = 0x00000010, + WGPUVertexFormat_Sint16x2 = 0x00000011, + WGPUVertexFormat_Sint16x4 = 0x00000012, + WGPUVertexFormat_Unorm16 = 0x00000013, + WGPUVertexFormat_Unorm16x2 = 0x00000014, + WGPUVertexFormat_Unorm16x4 = 0x00000015, + WGPUVertexFormat_Snorm16 = 0x00000016, + WGPUVertexFormat_Snorm16x2 = 0x00000017, + WGPUVertexFormat_Snorm16x4 = 0x00000018, + WGPUVertexFormat_Float16 = 0x00000019, + WGPUVertexFormat_Float16x2 = 0x0000001A, + WGPUVertexFormat_Float16x4 = 0x0000001B, + WGPUVertexFormat_Float32 = 0x0000001C, + WGPUVertexFormat_Float32x2 = 0x0000001D, + WGPUVertexFormat_Float32x3 = 0x0000001E, + WGPUVertexFormat_Float32x4 = 0x0000001F, + WGPUVertexFormat_Uint32 = 0x00000020, + WGPUVertexFormat_Uint32x2 = 0x00000021, + WGPUVertexFormat_Uint32x3 = 0x00000022, + WGPUVertexFormat_Uint32x4 = 0x00000023, + WGPUVertexFormat_Sint32 = 0x00000024, + WGPUVertexFormat_Sint32x2 = 0x00000025, + WGPUVertexFormat_Sint32x3 = 0x00000026, + WGPUVertexFormat_Sint32x4 = 0x00000027, + WGPUVertexFormat_Unorm10_10_10_2 = 0x00000028, + WGPUVertexFormat_Unorm8x4BGRA = 0x00000029, + WGPUVertexFormat_Force32 = 0x7FFFFFFF } WGPUVertexFormat; typedef enum WGPUVertexStepMode { - WGPUVertexStepMode_Undefined = 0x00000000, - WGPUVertexStepMode_Vertex = 0x00000001, - WGPUVertexStepMode_Instance = 0x00000002, - WGPUVertexStepMode_Force32 = 0x7FFFFFFF + WGPUVertexStepMode_Undefined = 0x00000000, + WGPUVertexStepMode_Vertex = 0x00000001, + WGPUVertexStepMode_Instance = 0x00000002, + WGPUVertexStepMode_Force32 = 0x7FFFFFFF } WGPUVertexStepMode; -typedef WGPUFlags WGPUBufferUsage; -static const WGPUBufferUsage WGPUBufferUsage_None = 0x0000000000000000; -static const WGPUBufferUsage WGPUBufferUsage_MapRead = 0x0000000000000001; -static const WGPUBufferUsage WGPUBufferUsage_MapWrite = 0x0000000000000002; -static const WGPUBufferUsage WGPUBufferUsage_CopySrc = 0x0000000000000004; -static const WGPUBufferUsage WGPUBufferUsage_CopyDst = 0x0000000000000008; -static const WGPUBufferUsage WGPUBufferUsage_Index = 0x0000000000000010; -static const WGPUBufferUsage WGPUBufferUsage_Vertex = 0x0000000000000020; -static const WGPUBufferUsage WGPUBufferUsage_Uniform = 0x0000000000000040; -static const WGPUBufferUsage WGPUBufferUsage_Storage = 0x0000000000000080; -static const WGPUBufferUsage WGPUBufferUsage_Indirect = 0x0000000000000100; +typedef WGPUFlags WGPUBufferUsage; +static const WGPUBufferUsage WGPUBufferUsage_None = 0x0000000000000000; +static const WGPUBufferUsage WGPUBufferUsage_MapRead = 0x0000000000000001; +static const WGPUBufferUsage WGPUBufferUsage_MapWrite = 0x0000000000000002; +static const WGPUBufferUsage WGPUBufferUsage_CopySrc = 0x0000000000000004; +static const WGPUBufferUsage WGPUBufferUsage_CopyDst = 0x0000000000000008; +static const WGPUBufferUsage WGPUBufferUsage_Index = 0x0000000000000010; +static const WGPUBufferUsage WGPUBufferUsage_Vertex = 0x0000000000000020; +static const WGPUBufferUsage WGPUBufferUsage_Uniform = 0x0000000000000040; +static const WGPUBufferUsage WGPUBufferUsage_Storage = 0x0000000000000080; +static const WGPUBufferUsage WGPUBufferUsage_Indirect = 0x0000000000000100; static const WGPUBufferUsage WGPUBufferUsage_QueryResolve = 0x0000000000000200; -typedef WGPUFlags WGPUColorWriteMask; -static const WGPUColorWriteMask WGPUColorWriteMask_None = 0x0000000000000000; -static const WGPUColorWriteMask WGPUColorWriteMask_Red = 0x0000000000000001; +typedef WGPUFlags WGPUColorWriteMask; +static const WGPUColorWriteMask WGPUColorWriteMask_None = 0x0000000000000000; +static const WGPUColorWriteMask WGPUColorWriteMask_Red = 0x0000000000000001; static const WGPUColorWriteMask WGPUColorWriteMask_Green = 0x0000000000000002; -static const WGPUColorWriteMask WGPUColorWriteMask_Blue = 0x0000000000000004; +static const WGPUColorWriteMask WGPUColorWriteMask_Blue = 0x0000000000000004; static const WGPUColorWriteMask WGPUColorWriteMask_Alpha = 0x0000000000000008; -static const WGPUColorWriteMask WGPUColorWriteMask_All = 0x000000000000000F; +static const WGPUColorWriteMask WGPUColorWriteMask_All = 0x000000000000000F; -typedef WGPUFlags WGPUMapMode; -static const WGPUMapMode WGPUMapMode_None = 0x0000000000000000; -static const WGPUMapMode WGPUMapMode_Read = 0x0000000000000001; +typedef WGPUFlags WGPUMapMode; +static const WGPUMapMode WGPUMapMode_None = 0x0000000000000000; +static const WGPUMapMode WGPUMapMode_Read = 0x0000000000000001; static const WGPUMapMode WGPUMapMode_Write = 0x0000000000000002; -typedef WGPUFlags WGPUShaderStage; -static const WGPUShaderStage WGPUShaderStage_None = 0x0000000000000000; -static const WGPUShaderStage WGPUShaderStage_Vertex = 0x0000000000000001; +typedef WGPUFlags WGPUShaderStage; +static const WGPUShaderStage WGPUShaderStage_None = 0x0000000000000000; +static const WGPUShaderStage WGPUShaderStage_Vertex = 0x0000000000000001; static const WGPUShaderStage WGPUShaderStage_Fragment = 0x0000000000000002; -static const WGPUShaderStage WGPUShaderStage_Compute = 0x0000000000000004; +static const WGPUShaderStage WGPUShaderStage_Compute = 0x0000000000000004; -typedef WGPUFlags WGPUTextureUsage; -static const WGPUTextureUsage WGPUTextureUsage_None = 0x0000000000000000; -static const WGPUTextureUsage WGPUTextureUsage_CopySrc = 0x0000000000000001; -static const WGPUTextureUsage WGPUTextureUsage_CopyDst = 0x0000000000000002; -static const WGPUTextureUsage WGPUTextureUsage_TextureBinding = 0x0000000000000004; -static const WGPUTextureUsage WGPUTextureUsage_StorageBinding = 0x0000000000000008; +typedef WGPUFlags WGPUTextureUsage; +static const WGPUTextureUsage WGPUTextureUsage_None = 0x0000000000000000; +static const WGPUTextureUsage WGPUTextureUsage_CopySrc = 0x0000000000000001; +static const WGPUTextureUsage WGPUTextureUsage_CopyDst = 0x0000000000000002; +static const WGPUTextureUsage WGPUTextureUsage_TextureBinding = 0x0000000000000004; +static const WGPUTextureUsage WGPUTextureUsage_StorageBinding = 0x0000000000000008; static const WGPUTextureUsage WGPUTextureUsage_RenderAttachment = 0x0000000000000010; -typedef void (*WGPUDeviceLostCallback)(WGPUDevice const * device, WGPUDeviceLostReason reason, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2); -typedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus status, WGPUAdapter adapter, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2); -typedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus status, WGPUDevice device, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2); -typedef void (*WGPUUncapturedErrorCallback)(WGPUDevice const * device, WGPUErrorType type, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2); +typedef void (*WGPUDeviceLostCallback)(WGPUDevice const *device, WGPUDeviceLostReason reason, WGPUStringView message, WGPU_NULLABLE void *userdata1, + WGPU_NULLABLE void *userdata2); +typedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus status, WGPUAdapter adapter, WGPUStringView message, WGPU_NULLABLE void *userdata1, + WGPU_NULLABLE void *userdata2); +typedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus status, WGPUDevice device, WGPUStringView message, WGPU_NULLABLE void *userdata1, + WGPU_NULLABLE void *userdata2); +typedef void (*WGPUUncapturedErrorCallback)(WGPUDevice const *device, WGPUErrorType type, WGPUStringView message, WGPU_NULLABLE void *userdata1, + WGPU_NULLABLE void *userdata2); typedef struct WGPUChainedStruct { - struct WGPUChainedStruct * next; - WGPUSType sType; + struct WGPUChainedStruct *next; + WGPUSType sType; } WGPUChainedStruct; typedef struct WGPUDeviceLostCallbackInfo { - WGPUChainedStruct * nextInChain; - WGPUCallbackMode mode; - WGPUDeviceLostCallback callback; - WGPU_NULLABLE void* userdata1; - WGPU_NULLABLE void* userdata2; + WGPUChainedStruct *nextInChain; + WGPUCallbackMode mode; + WGPUDeviceLostCallback callback; + WGPU_NULLABLE void *userdata1; + WGPU_NULLABLE void *userdata2; } WGPUDeviceLostCallbackInfo; typedef struct WGPURequestAdapterCallbackInfo { - WGPUChainedStruct * nextInChain; - WGPUCallbackMode mode; - WGPURequestAdapterCallback callback; - WGPU_NULLABLE void* userdata1; - WGPU_NULLABLE void* userdata2; + WGPUChainedStruct *nextInChain; + WGPUCallbackMode mode; + WGPURequestAdapterCallback callback; + WGPU_NULLABLE void *userdata1; + WGPU_NULLABLE void *userdata2; } WGPURequestAdapterCallbackInfo; typedef struct WGPURequestDeviceCallbackInfo { - WGPUChainedStruct * nextInChain; - WGPUCallbackMode mode; - WGPURequestDeviceCallback callback; - WGPU_NULLABLE void* userdata1; - WGPU_NULLABLE void* userdata2; + WGPUChainedStruct *nextInChain; + WGPUCallbackMode mode; + WGPURequestDeviceCallback callback; + WGPU_NULLABLE void *userdata1; + WGPU_NULLABLE void *userdata2; } WGPURequestDeviceCallbackInfo; typedef struct WGPUUncapturedErrorCallbackInfo { - WGPUChainedStruct * nextInChain; - WGPUUncapturedErrorCallback callback; - WGPU_NULLABLE void* userdata1; - WGPU_NULLABLE void* userdata2; + WGPUChainedStruct *nextInChain; + WGPUUncapturedErrorCallback callback; + WGPU_NULLABLE void *userdata1; + WGPU_NULLABLE void *userdata2; } WGPUUncapturedErrorCallbackInfo; typedef struct WGPUAdapterInfo { - WGPUChainedStruct * nextInChain; - WGPUStringView vendor; - WGPUStringView architecture; - WGPUStringView device; - WGPUStringView description; - WGPUBackendType backendType; - WGPUAdapterType adapterType; - uint32_t vendorID; - uint32_t deviceID; - uint32_t subgroupMinSize; - uint32_t subgroupMaxSize; + WGPUChainedStruct *nextInChain; + WGPUStringView vendor; + WGPUStringView architecture; + WGPUStringView device; + WGPUStringView description; + WGPUBackendType backendType; + WGPUAdapterType adapterType; + uint32_t vendorID; + uint32_t deviceID; + uint32_t subgroupMinSize; + uint32_t subgroupMaxSize; } WGPUAdapterInfo; typedef struct WGPUBindGroupEntry { - WGPUChainedStruct * nextInChain; - uint32_t binding; - WGPU_NULLABLE WGPUBuffer buffer; - uint64_t offset; - uint64_t size; - WGPU_NULLABLE WGPUSampler sampler; - WGPU_NULLABLE WGPUTextureView textureView; + WGPUChainedStruct *nextInChain; + uint32_t binding; + WGPU_NULLABLE WGPUBuffer buffer; + uint64_t offset; + uint64_t size; + WGPU_NULLABLE WGPUSampler sampler; + WGPU_NULLABLE WGPUTextureView textureView; } WGPUBindGroupEntry; typedef struct WGPUBlendComponent { - WGPUBlendOperation operation; - WGPUBlendFactor srcFactor; - WGPUBlendFactor dstFactor; + WGPUBlendOperation operation; + WGPUBlendFactor srcFactor; + WGPUBlendFactor dstFactor; } WGPUBlendComponent; typedef struct WGPUBufferBindingLayout { - WGPUChainedStruct * nextInChain; - WGPUBufferBindingType type; - WGPUBool hasDynamicOffset; - uint64_t minBindingSize; + WGPUChainedStruct *nextInChain; + WGPUBufferBindingType type; + WGPUBool hasDynamicOffset; + uint64_t minBindingSize; } WGPUBufferBindingLayout; typedef struct WGPUBufferDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; - WGPUBufferUsage usage; - uint64_t size; - WGPUBool mappedAtCreation; + WGPUChainedStruct *nextInChain; + WGPUStringView label; + WGPUBufferUsage usage; + uint64_t size; + WGPUBool mappedAtCreation; } WGPUBufferDescriptor; typedef struct WGPUColor { - double r; - double g; - double b; - double a; + double r; + double g; + double b; + double a; } WGPUColor; typedef struct WGPUCommandBufferDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; + WGPUChainedStruct *nextInChain; + WGPUStringView label; } WGPUCommandBufferDescriptor; typedef struct WGPUCommandEncoderDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; + WGPUChainedStruct *nextInChain; + WGPUStringView label; } WGPUCommandEncoderDescriptor; typedef struct WGPUConstantEntry { - WGPUChainedStruct * nextInChain; - WGPUStringView key; - double value; + WGPUChainedStruct *nextInChain; + WGPUStringView key; + double value; } WGPUConstantEntry; typedef struct WGPUExtent3D { - uint32_t width; - uint32_t height; - uint32_t depthOrArrayLayers; + uint32_t width; + uint32_t height; + uint32_t depthOrArrayLayers; } WGPUExtent3D; typedef struct WGPUFuture { - uint64_t id; + uint64_t id; } WGPUFuture; typedef struct WGPUInstanceLimits { - WGPUChainedStruct * nextInChain; - size_t timedWaitAnyMaxCount; + WGPUChainedStruct *nextInChain; + size_t timedWaitAnyMaxCount; } WGPUInstanceLimits; typedef struct WGPULimits { - WGPUChainedStruct * nextInChain; - uint32_t maxTextureDimension1D; - uint32_t maxTextureDimension2D; - uint32_t maxTextureDimension3D; - uint32_t maxTextureArrayLayers; - uint32_t maxBindGroups; - uint32_t maxBindGroupsPlusVertexBuffers; - uint32_t maxBindingsPerBindGroup; - uint32_t maxDynamicUniformBuffersPerPipelineLayout; - uint32_t maxDynamicStorageBuffersPerPipelineLayout; - uint32_t maxSampledTexturesPerShaderStage; - uint32_t maxSamplersPerShaderStage; - uint32_t maxStorageBuffersPerShaderStage; - uint32_t maxStorageTexturesPerShaderStage; - uint32_t maxUniformBuffersPerShaderStage; - uint64_t maxUniformBufferBindingSize; - uint64_t maxStorageBufferBindingSize; - uint32_t minUniformBufferOffsetAlignment; - uint32_t minStorageBufferOffsetAlignment; - uint32_t maxVertexBuffers; - uint64_t maxBufferSize; - uint32_t maxVertexAttributes; - uint32_t maxVertexBufferArrayStride; - uint32_t maxInterStageShaderVariables; - uint32_t maxColorAttachments; - uint32_t maxColorAttachmentBytesPerSample; - uint32_t maxComputeWorkgroupStorageSize; - uint32_t maxComputeInvocationsPerWorkgroup; - uint32_t maxComputeWorkgroupSizeX; - uint32_t maxComputeWorkgroupSizeY; - uint32_t maxComputeWorkgroupSizeZ; - uint32_t maxComputeWorkgroupsPerDimension; - uint32_t maxImmediateSize; + WGPUChainedStruct *nextInChain; + uint32_t maxTextureDimension1D; + uint32_t maxTextureDimension2D; + uint32_t maxTextureDimension3D; + uint32_t maxTextureArrayLayers; + uint32_t maxBindGroups; + uint32_t maxBindGroupsPlusVertexBuffers; + uint32_t maxBindingsPerBindGroup; + uint32_t maxDynamicUniformBuffersPerPipelineLayout; + uint32_t maxDynamicStorageBuffersPerPipelineLayout; + uint32_t maxSampledTexturesPerShaderStage; + uint32_t maxSamplersPerShaderStage; + uint32_t maxStorageBuffersPerShaderStage; + uint32_t maxStorageTexturesPerShaderStage; + uint32_t maxUniformBuffersPerShaderStage; + uint64_t maxUniformBufferBindingSize; + uint64_t maxStorageBufferBindingSize; + uint32_t minUniformBufferOffsetAlignment; + uint32_t minStorageBufferOffsetAlignment; + uint32_t maxVertexBuffers; + uint64_t maxBufferSize; + uint32_t maxVertexAttributes; + uint32_t maxVertexBufferArrayStride; + uint32_t maxInterStageShaderVariables; + uint32_t maxColorAttachments; + uint32_t maxColorAttachmentBytesPerSample; + uint32_t maxComputeWorkgroupStorageSize; + uint32_t maxComputeInvocationsPerWorkgroup; + uint32_t maxComputeWorkgroupSizeX; + uint32_t maxComputeWorkgroupSizeY; + uint32_t maxComputeWorkgroupSizeZ; + uint32_t maxComputeWorkgroupsPerDimension; + uint32_t maxImmediateSize; } WGPULimits; typedef struct WGPUMultisampleState { - WGPUChainedStruct * nextInChain; - uint32_t count; - uint32_t mask; - WGPUBool alphaToCoverageEnabled; + WGPUChainedStruct *nextInChain; + uint32_t count; + uint32_t mask; + WGPUBool alphaToCoverageEnabled; } WGPUMultisampleState; typedef struct WGPUOrigin3D { - uint32_t x; - uint32_t y; - uint32_t z; + uint32_t x; + uint32_t y; + uint32_t z; } WGPUOrigin3D; typedef struct WGPUPassTimestampWrites { - WGPUChainedStruct * nextInChain; - WGPUQuerySet querySet; - uint32_t beginningOfPassWriteIndex; - uint32_t endOfPassWriteIndex; + WGPUChainedStruct *nextInChain; + WGPUQuerySet querySet; + uint32_t beginningOfPassWriteIndex; + uint32_t endOfPassWriteIndex; } WGPUPassTimestampWrites; typedef struct WGPUPipelineLayoutDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; - size_t bindGroupLayoutCount; - WGPUBindGroupLayout const * bindGroupLayouts; - uint32_t immediateSize; + WGPUChainedStruct *nextInChain; + WGPUStringView label; + size_t bindGroupLayoutCount; + WGPUBindGroupLayout const *bindGroupLayouts; + uint32_t immediateSize; } WGPUPipelineLayoutDescriptor; typedef struct WGPUPrimitiveState { - WGPUChainedStruct * nextInChain; - WGPUPrimitiveTopology topology; - WGPUIndexFormat stripIndexFormat; - WGPUFrontFace frontFace; - WGPUCullMode cullMode; - WGPUBool unclippedDepth; + WGPUChainedStruct *nextInChain; + WGPUPrimitiveTopology topology; + WGPUIndexFormat stripIndexFormat; + WGPUFrontFace frontFace; + WGPUCullMode cullMode; + WGPUBool unclippedDepth; } WGPUPrimitiveState; typedef struct WGPUQueueDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; + WGPUChainedStruct *nextInChain; + WGPUStringView label; } WGPUQueueDescriptor; typedef struct WGPURenderPassDepthStencilAttachment { - WGPUChainedStruct * nextInChain; - WGPUTextureView view; - WGPULoadOp depthLoadOp; - WGPUStoreOp depthStoreOp; - float depthClearValue; - WGPUBool depthReadOnly; - WGPULoadOp stencilLoadOp; - WGPUStoreOp stencilStoreOp; - uint32_t stencilClearValue; - WGPUBool stencilReadOnly; + WGPUChainedStruct *nextInChain; + WGPUTextureView view; + WGPULoadOp depthLoadOp; + WGPUStoreOp depthStoreOp; + float depthClearValue; + WGPUBool depthReadOnly; + WGPULoadOp stencilLoadOp; + WGPUStoreOp stencilStoreOp; + uint32_t stencilClearValue; + WGPUBool stencilReadOnly; } WGPURenderPassDepthStencilAttachment; typedef struct WGPUSamplerBindingLayout { - WGPUChainedStruct * nextInChain; - WGPUSamplerBindingType type; + WGPUChainedStruct *nextInChain; + WGPUSamplerBindingType type; } WGPUSamplerBindingLayout; typedef struct WGPUSamplerDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; - WGPUAddressMode addressModeU; - WGPUAddressMode addressModeV; - WGPUAddressMode addressModeW; - WGPUFilterMode magFilter; - WGPUFilterMode minFilter; - WGPUMipmapFilterMode mipmapFilter; - float lodMinClamp; - float lodMaxClamp; - WGPUCompareFunction compare; - uint16_t maxAnisotropy; + WGPUChainedStruct *nextInChain; + WGPUStringView label; + WGPUAddressMode addressModeU; + WGPUAddressMode addressModeV; + WGPUAddressMode addressModeW; + WGPUFilterMode magFilter; + WGPUFilterMode minFilter; + WGPUMipmapFilterMode mipmapFilter; + float lodMinClamp; + float lodMaxClamp; + WGPUCompareFunction compare; + uint16_t maxAnisotropy; } WGPUSamplerDescriptor; typedef struct WGPUShaderSourceWGSL { - WGPUChainedStruct chain; - WGPUStringView code; + WGPUChainedStruct chain; + WGPUStringView code; } WGPUShaderSourceWGSL; typedef struct WGPUStencilFaceState { - WGPUCompareFunction compare; - WGPUStencilOperation failOp; - WGPUStencilOperation depthFailOp; - WGPUStencilOperation passOp; + WGPUCompareFunction compare; + WGPUStencilOperation failOp; + WGPUStencilOperation depthFailOp; + WGPUStencilOperation passOp; } WGPUStencilFaceState; typedef struct WGPUStorageTextureBindingLayout { - WGPUChainedStruct * nextInChain; - WGPUStorageTextureAccess access; - WGPUTextureFormat format; - WGPUTextureViewDimension viewDimension; + WGPUChainedStruct *nextInChain; + WGPUStorageTextureAccess access; + WGPUTextureFormat format; + WGPUTextureViewDimension viewDimension; } WGPUStorageTextureBindingLayout; typedef struct WGPUSurfaceCapabilities { - WGPUChainedStruct * nextInChain; - WGPUTextureUsage usages; - size_t formatCount; - WGPUTextureFormat const * formats; - size_t presentModeCount; - WGPUPresentMode const * presentModes; - size_t alphaModeCount; - WGPUCompositeAlphaMode const * alphaModes; + WGPUChainedStruct *nextInChain; + WGPUTextureUsage usages; + size_t formatCount; + WGPUTextureFormat const *formats; + size_t presentModeCount; + WGPUPresentMode const *presentModes; + size_t alphaModeCount; + WGPUCompositeAlphaMode const *alphaModes; } WGPUSurfaceCapabilities; typedef struct WGPUSurfaceConfiguration { - WGPUChainedStruct * nextInChain; - WGPUDevice device; - WGPUTextureFormat format; - WGPUTextureUsage usage; - uint32_t width; - uint32_t height; - size_t viewFormatCount; - WGPUTextureFormat const * viewFormats; - WGPUCompositeAlphaMode alphaMode; - WGPUPresentMode presentMode; + WGPUChainedStruct *nextInChain; + WGPUDevice device; + WGPUTextureFormat format; + WGPUTextureUsage usage; + uint32_t width; + uint32_t height; + size_t viewFormatCount; + WGPUTextureFormat const *viewFormats; + WGPUCompositeAlphaMode alphaMode; + WGPUPresentMode presentMode; } WGPUSurfaceConfiguration; typedef struct WGPUSurfaceTexture { - WGPUChainedStruct * nextInChain; - WGPUTexture texture; - WGPUSurfaceGetCurrentTextureStatus status; + WGPUChainedStruct *nextInChain; + WGPUTexture texture; + WGPUSurfaceGetCurrentTextureStatus status; } WGPUSurfaceTexture; typedef struct WGPUTexelCopyBufferLayout { - uint64_t offset; - uint32_t bytesPerRow; - uint32_t rowsPerImage; + uint64_t offset; + uint32_t bytesPerRow; + uint32_t rowsPerImage; } WGPUTexelCopyBufferLayout; typedef struct WGPUTextureBindingLayout { - WGPUChainedStruct * nextInChain; - WGPUTextureSampleType sampleType; - WGPUTextureViewDimension viewDimension; - WGPUBool multisampled; + WGPUChainedStruct *nextInChain; + WGPUTextureSampleType sampleType; + WGPUTextureViewDimension viewDimension; + WGPUBool multisampled; } WGPUTextureBindingLayout; typedef struct WGPUTextureViewDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; - WGPUTextureFormat format; - WGPUTextureViewDimension dimension; - uint32_t baseMipLevel; - uint32_t mipLevelCount; - uint32_t baseArrayLayer; - uint32_t arrayLayerCount; - WGPUTextureAspect aspect; - WGPUTextureUsage usage; + WGPUChainedStruct *nextInChain; + WGPUStringView label; + WGPUTextureFormat format; + WGPUTextureViewDimension dimension; + uint32_t baseMipLevel; + uint32_t mipLevelCount; + uint32_t baseArrayLayer; + uint32_t arrayLayerCount; + WGPUTextureAspect aspect; + WGPUTextureUsage usage; } WGPUTextureViewDescriptor; typedef struct WGPUVertexAttribute { - WGPUChainedStruct * nextInChain; - WGPUVertexFormat format; - uint64_t offset; - uint32_t shaderLocation; + WGPUChainedStruct *nextInChain; + WGPUVertexFormat format; + uint64_t offset; + uint32_t shaderLocation; } WGPUVertexAttribute; typedef struct WGPUBindGroupDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; - WGPUBindGroupLayout layout; - size_t entryCount; - WGPUBindGroupEntry const * entries; + WGPUChainedStruct *nextInChain; + WGPUStringView label; + WGPUBindGroupLayout layout; + size_t entryCount; + WGPUBindGroupEntry const *entries; } WGPUBindGroupDescriptor; typedef struct WGPUBindGroupLayoutEntry { - WGPUChainedStruct * nextInChain; - uint32_t binding; - WGPUShaderStage visibility; - uint32_t bindingArraySize; - WGPUBufferBindingLayout buffer; - WGPUSamplerBindingLayout sampler; - WGPUTextureBindingLayout texture; - WGPUStorageTextureBindingLayout storageTexture; + WGPUChainedStruct *nextInChain; + uint32_t binding; + WGPUShaderStage visibility; + uint32_t bindingArraySize; + WGPUBufferBindingLayout buffer; + WGPUSamplerBindingLayout sampler; + WGPUTextureBindingLayout texture; + WGPUStorageTextureBindingLayout storageTexture; } WGPUBindGroupLayoutEntry; typedef struct WGPUBlendState { - WGPUBlendComponent color; - WGPUBlendComponent alpha; + WGPUBlendComponent color; + WGPUBlendComponent alpha; } WGPUBlendState; typedef struct WGPUDepthStencilState { - WGPUChainedStruct * nextInChain; - WGPUTextureFormat format; - WGPUOptionalBool depthWriteEnabled; - WGPUCompareFunction depthCompare; - WGPUStencilFaceState stencilFront; - WGPUStencilFaceState stencilBack; - uint32_t stencilReadMask; - uint32_t stencilWriteMask; - int32_t depthBias; - float depthBiasSlopeScale; - float depthBiasClamp; + WGPUChainedStruct *nextInChain; + WGPUTextureFormat format; + WGPUOptionalBool depthWriteEnabled; + WGPUCompareFunction depthCompare; + WGPUStencilFaceState stencilFront; + WGPUStencilFaceState stencilBack; + uint32_t stencilReadMask; + uint32_t stencilWriteMask; + int32_t depthBias; + float depthBiasSlopeScale; + float depthBiasClamp; } WGPUDepthStencilState; typedef struct WGPUDeviceDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; - size_t requiredFeatureCount; - WGPUFeatureName const * requiredFeatures; - WGPU_NULLABLE WGPULimits const * requiredLimits; - WGPUQueueDescriptor defaultQueue; - WGPUDeviceLostCallbackInfo deviceLostCallbackInfo; - WGPUUncapturedErrorCallbackInfo uncapturedErrorCallbackInfo; + WGPUChainedStruct *nextInChain; + WGPUStringView label; + size_t requiredFeatureCount; + WGPUFeatureName const *requiredFeatures; + WGPU_NULLABLE WGPULimits const *requiredLimits; + WGPUQueueDescriptor defaultQueue; + WGPUDeviceLostCallbackInfo deviceLostCallbackInfo; + WGPUUncapturedErrorCallbackInfo uncapturedErrorCallbackInfo; } WGPUDeviceDescriptor; typedef struct WGPUInstanceDescriptor { - WGPUChainedStruct * nextInChain; - size_t requiredFeatureCount; - WGPUInstanceFeatureName const * requiredFeatures; - WGPU_NULLABLE WGPUInstanceLimits const * requiredLimits; + WGPUChainedStruct *nextInChain; + size_t requiredFeatureCount; + WGPUInstanceFeatureName const *requiredFeatures; + WGPU_NULLABLE WGPUInstanceLimits const *requiredLimits; } WGPUInstanceDescriptor; typedef struct WGPURenderPassColorAttachment { - WGPUChainedStruct * nextInChain; - WGPU_NULLABLE WGPUTextureView view; - uint32_t depthSlice; - WGPU_NULLABLE WGPUTextureView resolveTarget; - WGPULoadOp loadOp; - WGPUStoreOp storeOp; - WGPUColor clearValue; + WGPUChainedStruct *nextInChain; + WGPU_NULLABLE WGPUTextureView view; + uint32_t depthSlice; + WGPU_NULLABLE WGPUTextureView resolveTarget; + WGPULoadOp loadOp; + WGPUStoreOp storeOp; + WGPUColor clearValue; } WGPURenderPassColorAttachment; typedef struct WGPURequestAdapterOptions { - WGPUChainedStruct * nextInChain; - WGPUFeatureLevel featureLevel; - WGPUPowerPreference powerPreference; - WGPUBool forceFallbackAdapter; - WGPUBackendType backendType; - WGPU_NULLABLE WGPUSurface compatibleSurface; + WGPUChainedStruct *nextInChain; + WGPUFeatureLevel featureLevel; + WGPUPowerPreference powerPreference; + WGPUBool forceFallbackAdapter; + WGPUBackendType backendType; + WGPU_NULLABLE WGPUSurface compatibleSurface; } WGPURequestAdapterOptions; typedef struct WGPUShaderModuleDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; + WGPUChainedStruct *nextInChain; + WGPUStringView label; } WGPUShaderModuleDescriptor; typedef struct WGPUTexelCopyBufferInfo { - WGPUTexelCopyBufferLayout layout; - WGPUBuffer buffer; + WGPUTexelCopyBufferLayout layout; + WGPUBuffer buffer; } WGPUTexelCopyBufferInfo; typedef struct WGPUTexelCopyTextureInfo { - WGPUTexture texture; - uint32_t mipLevel; - WGPUOrigin3D origin; - WGPUTextureAspect aspect; + WGPUTexture texture; + uint32_t mipLevel; + WGPUOrigin3D origin; + WGPUTextureAspect aspect; } WGPUTexelCopyTextureInfo; typedef struct WGPUTextureDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; - WGPUTextureUsage usage; - WGPUTextureDimension dimension; - WGPUExtent3D size; - WGPUTextureFormat format; - uint32_t mipLevelCount; - uint32_t sampleCount; - size_t viewFormatCount; - WGPUTextureFormat const * viewFormats; + WGPUChainedStruct *nextInChain; + WGPUStringView label; + WGPUTextureUsage usage; + WGPUTextureDimension dimension; + WGPUExtent3D size; + WGPUTextureFormat format; + uint32_t mipLevelCount; + uint32_t sampleCount; + size_t viewFormatCount; + WGPUTextureFormat const *viewFormats; } WGPUTextureDescriptor; typedef struct WGPUVertexBufferLayout { - WGPUChainedStruct * nextInChain; - WGPUVertexStepMode stepMode; - uint64_t arrayStride; - size_t attributeCount; - WGPUVertexAttribute const * attributes; + WGPUChainedStruct *nextInChain; + WGPUVertexStepMode stepMode; + uint64_t arrayStride; + size_t attributeCount; + WGPUVertexAttribute const *attributes; } WGPUVertexBufferLayout; typedef struct WGPUBindGroupLayoutDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; - size_t entryCount; - WGPUBindGroupLayoutEntry const * entries; + WGPUChainedStruct *nextInChain; + WGPUStringView label; + size_t entryCount; + WGPUBindGroupLayoutEntry const *entries; } WGPUBindGroupLayoutDescriptor; typedef struct WGPUColorTargetState { - WGPUChainedStruct * nextInChain; - WGPUTextureFormat format; - WGPU_NULLABLE WGPUBlendState const * blend; - WGPUColorWriteMask writeMask; + WGPUChainedStruct *nextInChain; + WGPUTextureFormat format; + WGPU_NULLABLE WGPUBlendState const *blend; + WGPUColorWriteMask writeMask; } WGPUColorTargetState; typedef struct WGPURenderPassDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; - size_t colorAttachmentCount; - WGPURenderPassColorAttachment const * colorAttachments; - WGPU_NULLABLE WGPURenderPassDepthStencilAttachment const * depthStencilAttachment; - WGPU_NULLABLE WGPUQuerySet occlusionQuerySet; - WGPU_NULLABLE WGPUPassTimestampWrites const * timestampWrites; + WGPUChainedStruct *nextInChain; + WGPUStringView label; + size_t colorAttachmentCount; + WGPURenderPassColorAttachment const *colorAttachments; + WGPU_NULLABLE WGPURenderPassDepthStencilAttachment const *depthStencilAttachment; + WGPU_NULLABLE WGPUQuerySet occlusionQuerySet; + WGPU_NULLABLE WGPUPassTimestampWrites const *timestampWrites; } WGPURenderPassDescriptor; typedef struct WGPUVertexState { - WGPUChainedStruct * nextInChain; - WGPUShaderModule module; - WGPUStringView entryPoint; - size_t constantCount; - WGPUConstantEntry const * constants; - size_t bufferCount; - WGPUVertexBufferLayout const * buffers; + WGPUChainedStruct *nextInChain; + WGPUShaderModule module; + WGPUStringView entryPoint; + size_t constantCount; + WGPUConstantEntry const *constants; + size_t bufferCount; + WGPUVertexBufferLayout const *buffers; } WGPUVertexState; typedef struct WGPUFragmentState { - WGPUChainedStruct * nextInChain; - WGPUShaderModule module; - WGPUStringView entryPoint; - size_t constantCount; - WGPUConstantEntry const * constants; - size_t targetCount; - WGPUColorTargetState const * targets; + WGPUChainedStruct *nextInChain; + WGPUShaderModule module; + WGPUStringView entryPoint; + size_t constantCount; + WGPUConstantEntry const *constants; + size_t targetCount; + WGPUColorTargetState const *targets; } WGPUFragmentState; typedef struct WGPURenderPipelineDescriptor { - WGPUChainedStruct * nextInChain; - WGPUStringView label; - WGPU_NULLABLE WGPUPipelineLayout layout; - WGPUVertexState vertex; - WGPUPrimitiveState primitive; - WGPU_NULLABLE WGPUDepthStencilState const * depthStencil; - WGPUMultisampleState multisample; - WGPU_NULLABLE WGPUFragmentState const * fragment; + WGPUChainedStruct *nextInChain; + WGPUStringView label; + WGPU_NULLABLE WGPUPipelineLayout layout; + WGPUVertexState vertex; + WGPUPrimitiveState primitive; + WGPU_NULLABLE WGPUDepthStencilState const *depthStencil; + WGPUMultisampleState multisample; + WGPU_NULLABLE WGPUFragmentState const *fragment; } WGPURenderPipelineDescriptor; #define IMPORT(str) __attribute__((import_module("imports"), import_name(str))) diff --git a/base/sources/iron.h b/base/sources/iron.h index 9ed3d04a..5bc81de4 100644 --- a/base/sources/iron.h +++ b/base/sources/iron.h @@ -725,7 +725,7 @@ gpu_shader_t *gpu_create_shader_from_source(char *source, int source_size, gpu_s ID3DBlob *error_message = NULL; ID3DBlob *shader_buffer = NULL; - UINT flags = D3DCOMPILE_SKIP_OPTIMIZATION | D3DCOMPILE_SKIP_VALIDATION; + UINT flags = D3DCOMPILE_SKIP_OPTIMIZATION | D3DCOMPILE_SKIP_VALIDATION; HRESULT hr = D3DCompile(temp_string_s, strlen(source) + 1, NULL, NULL, NULL, "main", shader_type == GPU_SHADER_TYPE_VERTEX ? "vs_5_0" : "ps_5_0", flags, 0, &shader_buffer, &error_message); if (hr != S_OK) { diff --git a/base/sources/iron_gc.c b/base/sources/iron_gc.c index c38792c9..32de075a 100644 --- a/base/sources/iron_gc.c +++ b/base/sources/iron_gc.c @@ -72,7 +72,7 @@ typedef struct garbage_collector { void *bos; // bottom of stack } garbage_collector_t; -static garbage_collector_t _gc; +static garbage_collector_t _gc; static garbage_collector_t *gc = &_gc; static gc_allocation_t *gc_allocation_new(void *ptr, size_t size) { diff --git a/base/sources/iron_ui.c b/base/sources/iron_ui.c index b3ddd395..5db81e45 100644 --- a/base/sources/iron_ui.c +++ b/base/sources/iron_ui.c @@ -323,14 +323,14 @@ void ui_draw_string(char *text, float x_offset, float y_offset, int align, bool return; } if (truncation) { - char *full_text = text; - size_t len = strlen(text); + char *full_text = text; + size_t len = strlen(text); if (len > sizeof(truncated) - 3) { len = sizeof(truncated) - 3; } memcpy(truncated, text, len); truncated[len] = '\0'; - text = &truncated[0]; + text = &truncated[0]; while (strlen(text) > 0 && draw_string_width(current->ops->font, current->font_size, text) > current->_w - 6.0 * UI_SCALE()) { text[strlen(text) - 1] = 0; } @@ -2450,7 +2450,7 @@ void ui_tooltip(char *text) { } memcpy(current->tooltip_text, text, len); current->tooltip_text[len] = '\0'; - current->tooltip_y = current->_y + current->_window_y; + current->tooltip_y = current->_y + current->_window_y; } void ui_tooltip_image(gpu_texture_t *image, int max_width) { diff --git a/base/sources/kong/kong.c b/base/sources/kong/kong.c index abd0b259..36bbc24e 100644 --- a/base/sources/kong/kong.c +++ b/base/sources/kong/kong.c @@ -2048,7 +2048,7 @@ void functions_init(void) { function *new_functions = realloc(functions, functions_size * sizeof(function)); debug_context context = {0}; check(new_functions != NULL, context, "Could not allocate functions"); - functions = new_functions; + functions = new_functions; zero_new_function_slots(); next_function_index = 0; @@ -2679,7 +2679,7 @@ function_id add_function(name_id name) { init_type_ref(&functions[f].return_type, NO_NAME); functions[f].parameters_size = 0; memset(functions[f].parameter_attributes, 0, sizeof(functions[f].parameter_attributes)); - functions[f].block = NULL; + functions[f].block = NULL; functions[f].code.size = 0; functions[f].descriptor_set_group_index = UINT32_MAX; functions[f].used_builtins = (builtins){0}; diff --git a/base/sources/libs/bc7enc.c b/base/sources/libs/bc7enc.c index b2308c42..703055ec 100644 --- a/base/sources/libs/bc7enc.c +++ b/base/sources/libs/bc7enc.c @@ -479,7 +479,7 @@ static uint64_t evaluate_solution(const color_quad_u8 *pLow, const color_quad_u8 } } - // 16 scalar extractions — only done once per evaluate_solution call. + // 16 scalar extractions for (uint32_t i = 0; i < pParams->m_num_pixels; i++) { total_err += (uint64_t)best_err_f[i]; pResults->m_pSelectors_temp[i] = (uint8_t)(int)best_sel_f[i]; diff --git a/base/sources/libs/minic.c b/base/sources/libs/minic.c index ba89d115..e9bad04b 100644 --- a/base/sources/libs/minic.c +++ b/base/sources/libs/minic.c @@ -17,25 +17,27 @@ // ██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║ // ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝ -#define MINIC_TOK_LIST \ - X(TOK_INT, "'int'") \ - X(TOK_FLOAT, "'float'") \ - X(TOK_CHAR, "'char'") \ - X(TOK_DOUBLE, "'double'") \ - X(TOK_BOOL, "'bool'") \ - X(TOK_RETURN, "'return'") \ - X(TOK_IF, "'if'") \ - X(TOK_ELSE, "'else'") \ - X(TOK_WHILE, "'while'") X(TOK_FOR, "'for'") X(TOK_BREAK, "'break'") X(TOK_CONTINUE, "'continue'") X(TOK_STRUCT, "'struct'") X(TOK_TYPEDEF, "'typedef'") \ - X(TOK_ENUM, "'enum'") X(TOK_VOID, "'void'") X(TOK_IDENT, "identifier") X(TOK_NUMBER, "number") X(TOK_CHAR_LIT, "char literal") \ - X(TOK_STR_LIT, "string literal") X(TOK_LPAREN, "'('") X(TOK_RPAREN, "')'") X(TOK_LBRACE, "'{'") X(TOK_RBRACE, "'}'") X(TOK_LBRACKET, "'['") \ - X(TOK_RBRACKET, "']'") X(TOK_SEMICOLON, "';'") X(TOK_COMMA, "','") X(TOK_ASSIGN, "'='") X(TOK_PLUS_ASSIGN, "'+='") X(TOK_MINUS_ASSIGN, "'-='") \ - X(TOK_MUL_ASSIGN, "'*='") X(TOK_DIV_ASSIGN, "'/='") X(TOK_MOD_ASSIGN, "'%='") X(TOK_SHL_ASSIGN, "'<<='") X(TOK_SHR_ASSIGN, "'>>='") \ - X(TOK_AND_ASSIGN, "'&='") X(TOK_OR_ASSIGN, "'|='") X(TOK_XOR_ASSIGN, "'^='") X(TOK_EQ, "'=='") X(TOK_NEQ, "'!='") X(TOK_LT, "'<'") \ - X(TOK_GT, "'>'") X(TOK_LE, "'<='") X(TOK_GE, "'>='") X(TOK_AND, "'&&'") X(TOK_OR, "'||'") X(TOK_NOT, "'!'") X(TOK_AMP, "'&'") \ - X(TOK_PLUS, "'+'") X(TOK_MINUS, "'-'") X(TOK_INC, "'++'") X(TOK_DEC, "'--'") X(TOK_STAR, "'*'") X(TOK_SLASH, "'/'") \ - X(TOK_PERCENT, "'%'") X(TOK_SHL, "'<<'") X(TOK_SHR, "'>>'") X(TOK_BITOR, "'|'") X(TOK_XOR, "'^'") X(TOK_BITNOT, "'~'") \ - X(TOK_DOT, "'.'") X(TOK_ARROW, "'->'") X(TOK_EOF, "end of file") +#define MINIC_TOK_LIST \ + X(TOK_INT, "'int'") \ + X(TOK_FLOAT, "'float'") \ + X(TOK_CHAR, "'char'") \ + X(TOK_DOUBLE, "'double'") \ + X(TOK_BOOL, "'bool'") \ + X(TOK_RETURN, "'return'") \ + X(TOK_IF, "'if'") \ + X(TOK_ELSE, "'else'") \ + X(TOK_WHILE, "'while'") \ + X(TOK_FOR, "'for'") \ + X(TOK_BREAK, "'break'") X(TOK_CONTINUE, "'continue'") X(TOK_STRUCT, "'struct'") X(TOK_TYPEDEF, "'typedef'") X(TOK_ENUM, "'enum'") X(TOK_VOID, "'void'") \ + X(TOK_IDENT, "identifier") X(TOK_NUMBER, "number") X(TOK_CHAR_LIT, "char literal") X(TOK_STR_LIT, "string literal") X(TOK_LPAREN, "'('") \ + X(TOK_RPAREN, "')'") X(TOK_LBRACE, "'{'") X(TOK_RBRACE, "'}'") X(TOK_LBRACKET, "'['") X(TOK_RBRACKET, "']'") X(TOK_SEMICOLON, "';'") \ + X(TOK_COMMA, "','") X(TOK_ASSIGN, "'='") X(TOK_PLUS_ASSIGN, "'+='") X(TOK_MINUS_ASSIGN, "'-='") X(TOK_MUL_ASSIGN, "'*='") \ + X(TOK_DIV_ASSIGN, "'/='") X(TOK_MOD_ASSIGN, "'%='") X(TOK_SHL_ASSIGN, "'<<='") X(TOK_SHR_ASSIGN, "'>>='") X(TOK_AND_ASSIGN, "'&='") \ + X(TOK_OR_ASSIGN, "'|='") X(TOK_XOR_ASSIGN, "'^='") X(TOK_EQ, "'=='") X(TOK_NEQ, "'!='") X(TOK_LT, "'<'") X(TOK_GT, "'>'") \ + X(TOK_LE, "'<='") X(TOK_GE, "'>='") X(TOK_AND, "'&&'") X(TOK_OR, "'||'") X(TOK_NOT, "'!'") X(TOK_AMP, "'&'") X(TOK_PLUS, "'+'") \ + X(TOK_MINUS, "'-'") X(TOK_INC, "'++'") X(TOK_DEC, "'--'") X(TOK_STAR, "'*'") X(TOK_SLASH, "'/'") X(TOK_PERCENT, "'%'") \ + X(TOK_SHL, "'<<'") X(TOK_SHR, "'>>'") X(TOK_BITOR, "'|'") X(TOK_XOR, "'^'") X(TOK_BITNOT, "'~'") X(TOK_DOT, "'.'") \ + X(TOK_ARROW, "'->'") X(TOK_EOF, "end of file") typedef enum { #define X(t, s) t, @@ -526,7 +528,7 @@ static minic_val_t minic_var_addr(minic_env_t *e, const char *name) { return minic_val_ptr(NULL); } } - // Address of a minic_val_t — the MINIC_T_PTR deref sentinel means deref reads a full minic_val_t + // Address of a minic_val_t return minic_val_typed_ptr(&v->val, MINIC_T_PTR); } @@ -1114,7 +1116,7 @@ static minic_val_t minic_parse_shift(minic_env_t *e) { minic_lex_next(&e->lex); int a = (int)minic_val_to_d(v); int b = (int)minic_val_to_d(minic_parse_expr(e)); - v = minic_val_int(op == TOK_SHL ? (int)((unsigned int)a << b) : (a >> b)); + v = minic_val_int(op == TOK_SHL ? (int)((unsigned int)a << b) : (a >> b)); } return v; } @@ -1414,7 +1416,7 @@ static void minic_parse_stmt(minic_env_t *e) { v = minic_parse_cond(e); if (is_ptr) { if (v.type != MINIC_T_PTR) { - // NULL literal passed as integer 0 — convert + // NULL literal passed as integer 0 v = minic_val_ptr((void *)(uintptr_t)(uint64_t)minic_val_to_d(v)); } // Only stamp the declared element type for native C pointers. @@ -1846,7 +1848,7 @@ static void minic_register_structs(minic_env_t *e) { minic_lex_next(&l); // Consume struct name } if (l.cur.type != TOK_LBRACE) { - continue; // Forward decl or typedef-without-body — skip + continue; // Forward decl or typedef-without-body } if (e->struct_count >= e->struct_cap) { break; @@ -1937,7 +1939,7 @@ static void minic_register_funcs(minic_env_t *e) { } if (!minic_lex_type(e)) { if (e->lex.cur.type == TOK_IDENT) { - // Unknown typedef'd type — treat as an opaque pointer type + // Unknown typedef type strncpy(decl_struct, e->lex.cur.text, MINIC_MAX_NAME - 1); minic_lex_next(&e->lex); ret_type = MINIC_T_PTR; diff --git a/base/tools/iris/iris.c b/base/tools/iris/iris.c index 70630d89..c259a88f 100644 --- a/base/tools/iris/iris.c +++ b/base/tools/iris/iris.c @@ -685,7 +685,7 @@ static int fit_refs_for_attention(int num_heads, int out_h, int out_w, int *ref_ if (w < 16) w = 16; - /* No progress — already at minimum. */ + /* No progress. */ if (h == ref_dims[best * 2] && w == ref_dims[best * 2 + 1]) break; @@ -743,7 +743,7 @@ iris_image *iris_img2img(iris_ctx *ctx, const char *prompt, const iris_image *in p.width = (p.width / 16) * 16; p.height = (p.height / 16) * 16; - /* Check attention memory budget — shrink reference if needed. */ + /* Check attention memory budget */ int ref_w = p.width, ref_h = p.height; { int ref_dims[2] = {p.height, p.width}; @@ -1087,7 +1087,7 @@ iris_image *iris_img2img_strength(iris_ctx *ctx, const char *prompt, const iris_ * at every denoising step, so it reconstructs the original and blends in * latent space (no pixel-space seams). * 2. The masked region of the reference fed to attention is neutralized - * (filled with mid-gray) so the model does not "see" — and redraw — the + * (filled with mid-gray) so the model does not "see" and redraw the * content being removed. * Output dimensions always match the (16-aligned) input; any width/height * override in params is ignored since the keep region must align with x0. */ @@ -1119,7 +1119,7 @@ iris_image *iris_inpaint(iris_ctx *ctx, const char *prompt, const iris_image *in if (p.height < 64) p.height = 64; - /* Check attention memory budget — shrink if needed (ref == target grid). */ + /* Check attention memory budget */ int ref_w = p.width, ref_h = p.height; { int ref_dims[2] = {p.height, p.width}; diff --git a/base/tools/iris/iris_metal.m b/base/tools/iris/iris_metal.m index 388cad25..10bf1862 100644 --- a/base/tools/iris/iris_metal.m +++ b/base/tools/iris/iris_metal.m @@ -6201,7 +6201,7 @@ int iris_metal_attention_fused(float *out, const float *Q, const float *K, const } /* ======================================================================== - * F32 VAE GPU Operations — Keep data on GPU for the VAE decoder + * F32 VAE GPU Operations * ======================================================================== */ /* GroupNorm on f32 GPU tensors */ diff --git a/base/tools/iris/iris_shaders.metal b/base/tools/iris/iris_shaders.metal index 68d38174..1ef7c3d8 100644 --- a/base/tools/iris/iris_shaders.metal +++ b/base/tools/iris/iris_shaders.metal @@ -2009,7 +2009,7 @@ kernel void rope_bf16( } /* ======================================================================== - * F32 VAE Shaders — GPU-resident VAE decoder operations + * F32 VAE Shaders * ======================================================================== */ /* GroupNorm f32: one threadgroup per (batch, group) pair.