adding api functions
This commit is contained in:
@@ -39,6 +39,7 @@ extern "C"
|
|||||||
|
|
||||||
#ifndef spirv_H
|
#ifndef spirv_H
|
||||||
typedef enum SpvBuiltIn_ SpvBuiltIn;
|
typedef enum SpvBuiltIn_ SpvBuiltIn;
|
||||||
|
typedef enum SpvDecoration_ SpvDecoration;
|
||||||
#endif /* spirv_H */
|
#endif /* spirv_H */
|
||||||
|
|
||||||
typedef int SpvBool;
|
typedef int SpvBool;
|
||||||
@@ -100,6 +101,9 @@ SPV_API SpvResult SpvAddSpecializationInfo(SpvRuntime runtime, SpvRuntimeSpecial
|
|||||||
SPV_API SpvResult SpvGetResultByName(SpvRuntime runtime, const char* name, SpvWord* result);
|
SPV_API SpvResult SpvGetResultByName(SpvRuntime runtime, const char* name, SpvWord* result);
|
||||||
SPV_API SpvResult SpvGetResultLocation(SpvRuntime runtime, SpvWord location, SpvLocationType type, SpvWord* result);
|
SPV_API SpvResult SpvGetResultLocation(SpvRuntime runtime, SpvWord location, SpvLocationType type, SpvWord* result);
|
||||||
SPV_API SpvResult SpvGetEntryPointByName(SpvRuntime runtime, const char* name, SpvWord* result);
|
SPV_API SpvResult SpvGetEntryPointByName(SpvRuntime runtime, const char* name, SpvWord* result);
|
||||||
|
SPV_API SpvResult SpvGetResultMemorySize(SpvRuntime runtime, SpvWord result, SpvSize* size);
|
||||||
|
SPV_API SpvBool SpvHasResultDecoration(SpvRuntime runtime, SpvWord result, SpvDecoration decoration);
|
||||||
|
|
||||||
SPV_API SpvResult SpvCallEntryPoint(SpvRuntime runtime, SpvWord entry_point_index);
|
SPV_API SpvResult SpvCallEntryPoint(SpvRuntime runtime, SpvWord entry_point_index);
|
||||||
|
|
||||||
SPV_API SpvResult SpvReadOutput(SpvRuntime runtime, SpvByte* output, SpvSize output_size, SpvWord result);
|
SPV_API SpvResult SpvReadOutput(SpvRuntime runtime, SpvByte* output, SpvSize output_size, SpvWord result);
|
||||||
@@ -264,6 +268,208 @@ SPV_API SpvResult SpvWriteDescriptorSet(SpvRuntime runtime, const SpvByte* input
|
|||||||
SpvBuiltInCullMaskKHR = 6021,
|
SpvBuiltInCullMaskKHR = 6021,
|
||||||
SpvBuiltInMax = 0x7fffffff,
|
SpvBuiltInMax = 0x7fffffff,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef enum SpvDecoration_ {
|
||||||
|
SpvDecorationRelaxedPrecision = 0,
|
||||||
|
SpvDecorationSpecId = 1,
|
||||||
|
SpvDecorationBlock = 2,
|
||||||
|
SpvDecorationBufferBlock = 3,
|
||||||
|
SpvDecorationRowMajor = 4,
|
||||||
|
SpvDecorationColMajor = 5,
|
||||||
|
SpvDecorationArrayStride = 6,
|
||||||
|
SpvDecorationMatrixStride = 7,
|
||||||
|
SpvDecorationGLSLShared = 8,
|
||||||
|
SpvDecorationGLSLPacked = 9,
|
||||||
|
SpvDecorationCPacked = 10,
|
||||||
|
SpvDecorationBuiltIn = 11,
|
||||||
|
SpvDecorationNoPerspective = 13,
|
||||||
|
SpvDecorationFlat = 14,
|
||||||
|
SpvDecorationPatch = 15,
|
||||||
|
SpvDecorationCentroid = 16,
|
||||||
|
SpvDecorationSample = 17,
|
||||||
|
SpvDecorationInvariant = 18,
|
||||||
|
SpvDecorationRestrict = 19,
|
||||||
|
SpvDecorationAliased = 20,
|
||||||
|
SpvDecorationVolatile = 21,
|
||||||
|
SpvDecorationConstant = 22,
|
||||||
|
SpvDecorationCoherent = 23,
|
||||||
|
SpvDecorationNonWritable = 24,
|
||||||
|
SpvDecorationNonReadable = 25,
|
||||||
|
SpvDecorationUniform = 26,
|
||||||
|
SpvDecorationUniformId = 27,
|
||||||
|
SpvDecorationSaturatedConversion = 28,
|
||||||
|
SpvDecorationStream = 29,
|
||||||
|
SpvDecorationLocation = 30,
|
||||||
|
SpvDecorationComponent = 31,
|
||||||
|
SpvDecorationIndex = 32,
|
||||||
|
SpvDecorationBinding = 33,
|
||||||
|
SpvDecorationDescriptorSet = 34,
|
||||||
|
SpvDecorationOffset = 35,
|
||||||
|
SpvDecorationXfbBuffer = 36,
|
||||||
|
SpvDecorationXfbStride = 37,
|
||||||
|
SpvDecorationFuncParamAttr = 38,
|
||||||
|
SpvDecorationFPRoundingMode = 39,
|
||||||
|
SpvDecorationFPFastMathMode = 40,
|
||||||
|
SpvDecorationLinkageAttributes = 41,
|
||||||
|
SpvDecorationNoContraction = 42,
|
||||||
|
SpvDecorationInputAttachmentIndex = 43,
|
||||||
|
SpvDecorationAlignment = 44,
|
||||||
|
SpvDecorationMaxByteOffset = 45,
|
||||||
|
SpvDecorationAlignmentId = 46,
|
||||||
|
SpvDecorationMaxByteOffsetId = 47,
|
||||||
|
SpvDecorationSaturatedToLargestFloat8NormalConversionEXT = 4216,
|
||||||
|
SpvDecorationNoSignedWrap = 4469,
|
||||||
|
SpvDecorationNoUnsignedWrap = 4470,
|
||||||
|
SpvDecorationWeightTextureQCOM = 4487,
|
||||||
|
SpvDecorationBlockMatchTextureQCOM = 4488,
|
||||||
|
SpvDecorationBlockMatchSamplerQCOM = 4499,
|
||||||
|
SpvDecorationExplicitInterpAMD = 4999,
|
||||||
|
SpvDecorationNodeSharesPayloadLimitsWithAMDX = 5019,
|
||||||
|
SpvDecorationNodeMaxPayloadsAMDX = 5020,
|
||||||
|
SpvDecorationTrackFinishWritingAMDX = 5078,
|
||||||
|
SpvDecorationPayloadNodeNameAMDX = 5091,
|
||||||
|
SpvDecorationPayloadNodeBaseIndexAMDX = 5098,
|
||||||
|
SpvDecorationPayloadNodeSparseArrayAMDX = 5099,
|
||||||
|
SpvDecorationPayloadNodeArraySizeAMDX = 5100,
|
||||||
|
SpvDecorationPayloadDispatchIndirectAMDX = 5105,
|
||||||
|
SpvDecorationArrayStrideIdEXT = 5124,
|
||||||
|
SpvDecorationOffsetIdEXT = 5125,
|
||||||
|
SpvDecorationUTFEncodedKHR = 5145,
|
||||||
|
SpvDecorationOverrideCoverageNV = 5248,
|
||||||
|
SpvDecorationPassthroughNV = 5250,
|
||||||
|
SpvDecorationViewportRelativeNV = 5252,
|
||||||
|
SpvDecorationSecondaryViewportRelativeNV = 5256,
|
||||||
|
SpvDecorationPerPrimitiveEXT = 5271,
|
||||||
|
SpvDecorationPerPrimitiveNV = 5271,
|
||||||
|
SpvDecorationPerViewNV = 5272,
|
||||||
|
SpvDecorationPerTaskNV = 5273,
|
||||||
|
SpvDecorationPerVertexKHR = 5285,
|
||||||
|
SpvDecorationPerVertexNV = 5285,
|
||||||
|
SpvDecorationNonUniform = 5300,
|
||||||
|
SpvDecorationNonUniformEXT = 5300,
|
||||||
|
SpvDecorationRestrictPointer = 5355,
|
||||||
|
SpvDecorationRestrictPointerEXT = 5355,
|
||||||
|
SpvDecorationAliasedPointer = 5356,
|
||||||
|
SpvDecorationAliasedPointerEXT = 5356,
|
||||||
|
SpvDecorationMemberOffsetNV = 5358,
|
||||||
|
SpvDecorationHitObjectShaderRecordBufferNV = 5386,
|
||||||
|
SpvDecorationHitObjectShaderRecordBufferEXT = 5389,
|
||||||
|
SpvDecorationBankNV = 5397,
|
||||||
|
SpvDecorationBindlessSamplerNV = 5398,
|
||||||
|
SpvDecorationBindlessImageNV = 5399,
|
||||||
|
SpvDecorationBoundSamplerNV = 5400,
|
||||||
|
SpvDecorationBoundImageNV = 5401,
|
||||||
|
SpvDecorationSIMTCallINTEL = 5599,
|
||||||
|
SpvDecorationReferencedIndirectlyINTEL = 5602,
|
||||||
|
SpvDecorationClobberINTEL = 5607,
|
||||||
|
SpvDecorationSideEffectsINTEL = 5608,
|
||||||
|
SpvDecorationVectorComputeVariableINTEL = 5624,
|
||||||
|
SpvDecorationFuncParamIOKindINTEL = 5625,
|
||||||
|
SpvDecorationVectorComputeFunctionINTEL = 5626,
|
||||||
|
SpvDecorationStackCallINTEL = 5627,
|
||||||
|
SpvDecorationGlobalVariableOffsetINTEL = 5628,
|
||||||
|
SpvDecorationCounterBuffer = 5634,
|
||||||
|
SpvDecorationHlslCounterBufferGOOGLE = 5634,
|
||||||
|
SpvDecorationHlslSemanticGOOGLE = 5635,
|
||||||
|
SpvDecorationUserSemantic = 5635,
|
||||||
|
SpvDecorationUserTypeGOOGLE = 5636,
|
||||||
|
SpvDecorationFunctionRoundingModeINTEL = 5822,
|
||||||
|
SpvDecorationFunctionDenormModeINTEL = 5823,
|
||||||
|
SpvDecorationRegisterALTERA = 5825,
|
||||||
|
SpvDecorationRegisterINTEL = 5825,
|
||||||
|
SpvDecorationMemoryALTERA = 5826,
|
||||||
|
SpvDecorationMemoryINTEL = 5826,
|
||||||
|
SpvDecorationNumbanksALTERA = 5827,
|
||||||
|
SpvDecorationNumbanksINTEL = 5827,
|
||||||
|
SpvDecorationBankwidthALTERA = 5828,
|
||||||
|
SpvDecorationBankwidthINTEL = 5828,
|
||||||
|
SpvDecorationMaxPrivateCopiesALTERA = 5829,
|
||||||
|
SpvDecorationMaxPrivateCopiesINTEL = 5829,
|
||||||
|
SpvDecorationSinglepumpALTERA = 5830,
|
||||||
|
SpvDecorationSinglepumpINTEL = 5830,
|
||||||
|
SpvDecorationDoublepumpALTERA = 5831,
|
||||||
|
SpvDecorationDoublepumpINTEL = 5831,
|
||||||
|
SpvDecorationMaxReplicatesALTERA = 5832,
|
||||||
|
SpvDecorationMaxReplicatesINTEL = 5832,
|
||||||
|
SpvDecorationSimpleDualPortALTERA = 5833,
|
||||||
|
SpvDecorationSimpleDualPortINTEL = 5833,
|
||||||
|
SpvDecorationMergeALTERA = 5834,
|
||||||
|
SpvDecorationMergeINTEL = 5834,
|
||||||
|
SpvDecorationBankBitsALTERA = 5835,
|
||||||
|
SpvDecorationBankBitsINTEL = 5835,
|
||||||
|
SpvDecorationForcePow2DepthALTERA = 5836,
|
||||||
|
SpvDecorationForcePow2DepthINTEL = 5836,
|
||||||
|
SpvDecorationStridesizeALTERA = 5883,
|
||||||
|
SpvDecorationStridesizeINTEL = 5883,
|
||||||
|
SpvDecorationWordsizeALTERA = 5884,
|
||||||
|
SpvDecorationWordsizeINTEL = 5884,
|
||||||
|
SpvDecorationTrueDualPortALTERA = 5885,
|
||||||
|
SpvDecorationTrueDualPortINTEL = 5885,
|
||||||
|
SpvDecorationBurstCoalesceALTERA = 5899,
|
||||||
|
SpvDecorationBurstCoalesceINTEL = 5899,
|
||||||
|
SpvDecorationCacheSizeALTERA = 5900,
|
||||||
|
SpvDecorationCacheSizeINTEL = 5900,
|
||||||
|
SpvDecorationDontStaticallyCoalesceALTERA = 5901,
|
||||||
|
SpvDecorationDontStaticallyCoalesceINTEL = 5901,
|
||||||
|
SpvDecorationPrefetchALTERA = 5902,
|
||||||
|
SpvDecorationPrefetchINTEL = 5902,
|
||||||
|
SpvDecorationStallEnableALTERA = 5905,
|
||||||
|
SpvDecorationStallEnableINTEL = 5905,
|
||||||
|
SpvDecorationFuseLoopsInFunctionALTERA = 5907,
|
||||||
|
SpvDecorationFuseLoopsInFunctionINTEL = 5907,
|
||||||
|
SpvDecorationMathOpDSPModeALTERA = 5909,
|
||||||
|
SpvDecorationMathOpDSPModeINTEL = 5909,
|
||||||
|
SpvDecorationAliasScopeINTEL = 5914,
|
||||||
|
SpvDecorationNoAliasINTEL = 5915,
|
||||||
|
SpvDecorationInitiationIntervalALTERA = 5917,
|
||||||
|
SpvDecorationInitiationIntervalINTEL = 5917,
|
||||||
|
SpvDecorationMaxConcurrencyALTERA = 5918,
|
||||||
|
SpvDecorationMaxConcurrencyINTEL = 5918,
|
||||||
|
SpvDecorationPipelineEnableALTERA = 5919,
|
||||||
|
SpvDecorationPipelineEnableINTEL = 5919,
|
||||||
|
SpvDecorationBufferLocationALTERA = 5921,
|
||||||
|
SpvDecorationBufferLocationINTEL = 5921,
|
||||||
|
SpvDecorationIOPipeStorageALTERA = 5944,
|
||||||
|
SpvDecorationIOPipeStorageINTEL = 5944,
|
||||||
|
SpvDecorationFunctionFloatingPointModeINTEL = 6080,
|
||||||
|
SpvDecorationSingleElementVectorINTEL = 6085,
|
||||||
|
SpvDecorationVectorComputeCallableFunctionINTEL = 6087,
|
||||||
|
SpvDecorationMediaBlockIOINTEL = 6140,
|
||||||
|
SpvDecorationStallFreeALTERA = 6151,
|
||||||
|
SpvDecorationStallFreeINTEL = 6151,
|
||||||
|
SpvDecorationFPMaxErrorDecorationINTEL = 6170,
|
||||||
|
SpvDecorationLatencyControlLabelALTERA = 6172,
|
||||||
|
SpvDecorationLatencyControlLabelINTEL = 6172,
|
||||||
|
SpvDecorationLatencyControlConstraintALTERA = 6173,
|
||||||
|
SpvDecorationLatencyControlConstraintINTEL = 6173,
|
||||||
|
SpvDecorationConduitKernelArgumentALTERA = 6175,
|
||||||
|
SpvDecorationConduitKernelArgumentINTEL = 6175,
|
||||||
|
SpvDecorationRegisterMapKernelArgumentALTERA = 6176,
|
||||||
|
SpvDecorationRegisterMapKernelArgumentINTEL = 6176,
|
||||||
|
SpvDecorationMMHostInterfaceAddressWidthALTERA = 6177,
|
||||||
|
SpvDecorationMMHostInterfaceAddressWidthINTEL = 6177,
|
||||||
|
SpvDecorationMMHostInterfaceDataWidthALTERA = 6178,
|
||||||
|
SpvDecorationMMHostInterfaceDataWidthINTEL = 6178,
|
||||||
|
SpvDecorationMMHostInterfaceLatencyALTERA = 6179,
|
||||||
|
SpvDecorationMMHostInterfaceLatencyINTEL = 6179,
|
||||||
|
SpvDecorationMMHostInterfaceReadWriteModeALTERA = 6180,
|
||||||
|
SpvDecorationMMHostInterfaceReadWriteModeINTEL = 6180,
|
||||||
|
SpvDecorationMMHostInterfaceMaxBurstALTERA = 6181,
|
||||||
|
SpvDecorationMMHostInterfaceMaxBurstINTEL = 6181,
|
||||||
|
SpvDecorationMMHostInterfaceWaitRequestALTERA = 6182,
|
||||||
|
SpvDecorationMMHostInterfaceWaitRequestINTEL = 6182,
|
||||||
|
SpvDecorationStableKernelArgumentALTERA = 6183,
|
||||||
|
SpvDecorationStableKernelArgumentINTEL = 6183,
|
||||||
|
SpvDecorationHostAccessINTEL = 6188,
|
||||||
|
SpvDecorationInitModeALTERA = 6190,
|
||||||
|
SpvDecorationInitModeINTEL = 6190,
|
||||||
|
SpvDecorationImplementInRegisterMapALTERA = 6191,
|
||||||
|
SpvDecorationImplementInRegisterMapINTEL = 6191,
|
||||||
|
SpvDecorationConditionalINTEL = 6247,
|
||||||
|
SpvDecorationCacheControlLoadINTEL = 6442,
|
||||||
|
SpvDecorationCacheControlStoreINTEL = 6443,
|
||||||
|
SpvDecorationMax = 0x7fffffff,
|
||||||
|
} SpvDecoration;
|
||||||
#endif /* spirv_H */
|
#endif /* spirv_H */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
+18
-8
@@ -4,8 +4,8 @@ const spv = ffi.spv;
|
|||||||
|
|
||||||
const CSpecializationEntry = extern struct {
|
const CSpecializationEntry = extern struct {
|
||||||
id: spv.SpvWord,
|
id: spv.SpvWord,
|
||||||
offset: u32,
|
offset: c_ulong,
|
||||||
size: u32,
|
size: c_ulong,
|
||||||
};
|
};
|
||||||
|
|
||||||
const LocationType = enum(c_int) {
|
const LocationType = enum(c_int) {
|
||||||
@@ -49,7 +49,7 @@ export fn SpvDeinitRuntime(rt: *spv.Runtime) callconv(.c) void {
|
|||||||
allocator.destroy(rt);
|
allocator.destroy(rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn SpvAddSpecializationInfo(rt: *spv.Runtime, entry: CSpecializationEntry, data: [*]const u8, data_size: u32) callconv(.c) ffi.Result {
|
export fn SpvAddSpecializationInfo(rt: *spv.Runtime, entry: CSpecializationEntry, data: [*]const u8, data_size: c_ulong) callconv(.c) ffi.Result {
|
||||||
const allocator = std.heap.c_allocator;
|
const allocator = std.heap.c_allocator;
|
||||||
rt.addSpecializationInfo(
|
rt.addSpecializationInfo(
|
||||||
allocator,
|
allocator,
|
||||||
@@ -75,38 +75,48 @@ export fn SpvGetResultByLocation(rt: *spv.Runtime, location: spv.SpvWord, kind:
|
|||||||
}) catch |err| return toCResult(err);
|
}) catch |err| return toCResult(err);
|
||||||
return .Success;
|
return .Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn SpvGetResultByName(rt: *spv.Runtime, name: [*:0]const u8, result: *spv.SpvWord) callconv(.c) ffi.Result {
|
export fn SpvGetResultByName(rt: *spv.Runtime, name: [*:0]const u8, result: *spv.SpvWord) callconv(.c) ffi.Result {
|
||||||
result.* = rt.getResultByName(std.mem.span(name)) catch |err| return toCResult(err);
|
result.* = rt.getResultByName(std.mem.span(name)) catch |err| return toCResult(err);
|
||||||
return .Success;
|
return .Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export fn SpvGetResultMemorySize(rt: *spv.Runtime, result: spv.SpvWord, size: *c_ulong) callconv(.c) ffi.Result {
|
||||||
|
size.* = rt.getResultMemorySize(result) catch |err| return toCResult(err);
|
||||||
|
return .Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
export fn SpvHasResultDecoration(rt: *spv.Runtime, result: spv.SpvWord, decoration: spv.spv.SpvDecoration) callconv(.c) c_int {
|
||||||
|
return if (rt.hasResultDecoration(result, decoration)) 1 else 0;
|
||||||
|
}
|
||||||
|
|
||||||
export fn SpvCallEntryPoint(rt: *spv.Runtime, entry_point: spv.SpvWord) callconv(.c) ffi.Result {
|
export fn SpvCallEntryPoint(rt: *spv.Runtime, entry_point: spv.SpvWord) callconv(.c) ffi.Result {
|
||||||
const allocator = std.heap.c_allocator;
|
const allocator = std.heap.c_allocator;
|
||||||
rt.callEntryPoint(allocator, entry_point) catch |err| return toCResult(err);
|
rt.callEntryPoint(allocator, entry_point) catch |err| return toCResult(err);
|
||||||
return .Success;
|
return .Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn SpvReadOutput(rt: *spv.Runtime, output: [*]u8, output_size: u32, result: spv.SpvWord) callconv(.c) ffi.Result {
|
export fn SpvReadOutput(rt: *spv.Runtime, output: [*]u8, output_size: c_ulong, result: spv.SpvWord) callconv(.c) ffi.Result {
|
||||||
rt.readOutput(output[0..output_size], result) catch |err| return toCResult(err);
|
rt.readOutput(output[0..output_size], result) catch |err| return toCResult(err);
|
||||||
return .Success;
|
return .Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn SpvReadBuiltIn(rt: *spv.Runtime, output: [*]u8, output_size: u32, builtin: spv.spv.SpvBuiltIn) callconv(.c) ffi.Result {
|
export fn SpvReadBuiltIn(rt: *spv.Runtime, output: [*]u8, output_size: c_ulong, builtin: spv.spv.SpvBuiltIn) callconv(.c) ffi.Result {
|
||||||
rt.readBuiltIn(output[0..output_size], builtin) catch |err| return toCResult(err);
|
rt.readBuiltIn(output[0..output_size], builtin) catch |err| return toCResult(err);
|
||||||
return .Success;
|
return .Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn SpvWriteInput(rt: *spv.Runtime, input: [*]const u8, input_size: u32, result: spv.SpvWord) callconv(.c) ffi.Result {
|
export fn SpvWriteInput(rt: *spv.Runtime, input: [*]const u8, input_size: c_ulong, result: spv.SpvWord) callconv(.c) ffi.Result {
|
||||||
rt.writeInput(input[0..input_size], result) catch |err| return toCResult(err);
|
rt.writeInput(input[0..input_size], result) catch |err| return toCResult(err);
|
||||||
return .Success;
|
return .Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn SpvWriteBuiltIn(rt: *spv.Runtime, input: [*]const u8, input_size: u32, builtin: spv.spv.SpvBuiltIn) callconv(.c) ffi.Result {
|
export fn SpvWriteBuiltIn(rt: *spv.Runtime, input: [*]const u8, input_size: c_ulong, builtin: spv.spv.SpvBuiltIn) callconv(.c) ffi.Result {
|
||||||
rt.writeBuiltIn(input[0..input_size], builtin) catch |err| return toCResult(err);
|
rt.writeBuiltIn(input[0..input_size], builtin) catch |err| return toCResult(err);
|
||||||
return .Success;
|
return .Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn SpvWriteDescriptorSet(rt: *spv.Runtime, input: [*]const u8, input_size: u32, set: spv.SpvWord, binding: spv.SpvWord, descriptor_index: spv.SpvWord) callconv(.c) ffi.Result {
|
export fn SpvWriteDescriptorSet(rt: *spv.Runtime, input: [*]const u8, input_size: c_ulong, set: spv.SpvWord, binding: spv.SpvWord, descriptor_index: spv.SpvWord) callconv(.c) ffi.Result {
|
||||||
rt.writeDescriptorSet(input[0..input_size], set, binding, descriptor_index) catch |err| return toCResult(err);
|
rt.writeDescriptorSet(input[0..input_size], set, binding, descriptor_index) catch |err| return toCResult(err);
|
||||||
return .Success;
|
return .Success;
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-2
@@ -132,10 +132,10 @@ pub fn getResultByName(self: *const Self, name: []const u8) RuntimeError!SpvWord
|
|||||||
|
|
||||||
pub fn getResultByLocation(self: *const Self, location: SpvWord, kind: enum { input, output }) RuntimeError!SpvWord {
|
pub fn getResultByLocation(self: *const Self, location: SpvWord, kind: enum { input, output }) RuntimeError!SpvWord {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
.input => if (location < self.mod.input_locations.len) {
|
.input => if (location < self.mod.input_locations.len and self.mod.input_locations[location] != 0) {
|
||||||
return self.mod.input_locations[location];
|
return self.mod.input_locations[location];
|
||||||
},
|
},
|
||||||
.output => if (location < self.mod.output_locations.len) {
|
.output => if (location < self.mod.output_locations.len and self.mod.output_locations[location] != 0) {
|
||||||
return self.mod.output_locations[location];
|
return self.mod.output_locations[location];
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -317,6 +317,19 @@ pub fn flushDescriptorSets(self: *const Self, allocator: std.mem.Allocator) Runt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn getResultMemorySize(self: *const Self, result: SpvWord) RuntimeError!usize {
|
||||||
|
const value = try self.results[result].getConstValue();
|
||||||
|
return value.getPlainMemorySize();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn hasResultDecoration(self: *const Self, result: SpvWord, decoration: spv.SpvDecoration) bool {
|
||||||
|
for (self.results[result].decorations.items) |result_decoration| {
|
||||||
|
if (result_decoration.rtype == decoration)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
fn reset(self: *Self) void {
|
fn reset(self: *Self) void {
|
||||||
self.function_stack.clearRetainingCapacity();
|
self.function_stack.clearRetainingCapacity();
|
||||||
self.current_function = null;
|
self.current_function = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user