SPIRV-Tools/source/wasm
Nathan Gauër 7f9184a5b2
kokoro: fix dubious ownership (#5082)
Kokoro clones repos with a different user used to run the build steps,
meaning if some git command must be run at build time, they will fail
because of this dubious ownership issue.
Running some git commands makes only sense with history, so changing
checkout depth so we can run them and get the true result.

This is a known Kororo issue.
Fixing this is required to generate the version file using git history.

Signed-off-by: Nathan Gauër <brioche@google.com>

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-01-23 15:32:39 +00:00
..
build.sh kokoro: fix dubious ownership (#5082) 2023-01-23 15:32:39 +00:00
docker-compose.yml Update minimum required CMake to 3.17.2 (#5041) 2022-12-21 16:22:17 -05:00
package.json Add Wasm build (#3752) 2021-11-01 16:45:51 -04:00
README.md Add Wasm build (#3752) 2021-11-01 16:45:51 -04:00
spirv-tools.cpp Add SPIR-V 1.6 support to wasm build (#4674) 2022-01-13 13:49:35 -05:00
spirv-tools.d.ts Add SPIR-V 1.6 support to wasm build (#4674) 2022-01-13 13:49:35 -05:00

SPIRV-Tools

Wasm (WebAssembly) build of https://github.com/KhronosGroup/SPIRV-Tools

Usage

const spirvTools = require("spirv-tools");

const test = async () => {
  // Load the library
  const spv = await spirvTools();

  // assemble
  const source = `
             OpCapability Linkage 
             OpCapability Shader 
             OpMemoryModel Logical GLSL450 
             OpSource GLSL 450 
             OpDecorate %spec SpecId 1 
      %int = OpTypeInt 32 1 
     %spec = OpSpecConstant %int 0 
    %const = OpConstant %int 42`;
  const asResult = spv.as(
    source,
    spv.SPV_ENV_UNIVERSAL_1_3,
    spv.SPV_TEXT_TO_BINARY_OPTION_NONE
  );
  console.log(`as returned ${asResult.byteLength} bytes`);

  // re-disassemble
  const disResult = spv.dis(
    asResult,
    spv.SPV_ENV_UNIVERSAL_1_3,
    spv.SPV_BINARY_TO_TEXT_OPTION_INDENT |
      spv.SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES |
      spv.SPV_BINARY_TO_TEXT_OPTION_COLOR
  );
  console.log("dis:\n", disResult);
};

test();