sdlShaderCrossReflectGraphicsSpirv function shadercross

Pointer<SdlShaderCrossGraphicsShaderMetadata> sdlShaderCrossReflectGraphicsSpirv(
  1. Pointer<Uint8> bytecode,
  2. int bytecodeSize,
  3. int props
)

Reflect graphics shader info from SPIRV code. If your shader source is HLSL, you should obtain SPIR-V bytecode from SDL_ShaderCross_CompileSPIRVFromHLSL(). This must be freed with SDL_free() when you are done with the metadata.

\param bytecode the SPIRV bytecode. \param bytecode_size the length of the SPIRV bytecode. \param props a properties object filled in with extra shader metadata, provided by the user. \returns A metadata struct on success, NULL otherwise. The struct must be free'd when it is no longer needed.

\threadsafety It is safe to call this function from any thread.

extern SDL_DECLSPEC SDL_ShaderCross_GraphicsShaderMetadata * SDLCALL SDL_ShaderCross_ReflectGraphicsSPIRV( const Uint8 *bytecode, size_t bytecode_size, SDL_PropertiesID props)

Implementation

Pointer<SdlShaderCrossGraphicsShaderMetadata>
sdlShaderCrossReflectGraphicsSpirv(
  Pointer<Uint8> bytecode,
  int bytecodeSize,
  int props,
) {
  final sdlShaderCrossReflectGraphicsSpirvLookupFunction = _libShadercross
      .lookupFunction<
        Pointer<SdlShaderCrossGraphicsShaderMetadata> Function(
          Pointer<Uint8> bytecode,
          Uint32 bytecodeSize,
          Uint32 props,
        ),
        Pointer<SdlShaderCrossGraphicsShaderMetadata> Function(
          Pointer<Uint8> bytecode,
          int bytecodeSize,
          int props,
        )
      >('SDL_ShaderCross_ReflectGraphicsSPIRV');
  return sdlShaderCrossReflectGraphicsSpirvLookupFunction(
    bytecode,
    bytecodeSize,
    props,
  );
}