2017-10-26 15:40:39 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "spirv_code_buffer.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
2017-12-20 20:21:44 +01:00
|
|
|
struct SpirvImageOperands {
|
|
|
|
uint32_t flags = 0;
|
|
|
|
uint32_t sLodBias = 0;
|
|
|
|
uint32_t sLod = 0;
|
|
|
|
uint32_t sConstOffset = 0;
|
|
|
|
uint32_t sGradX = 0;
|
|
|
|
uint32_t sGradY = 0;
|
|
|
|
uint32_t gOffset = 0;
|
|
|
|
uint32_t gConstOffsets = 0;
|
|
|
|
uint32_t sSampleId = 0;
|
|
|
|
uint32_t sMinLod = 0;
|
|
|
|
};
|
|
|
|
|
2017-10-26 15:40:39 +02:00
|
|
|
/**
|
|
|
|
* \brief SPIR-V module
|
|
|
|
*
|
|
|
|
* This class generates a code buffer containing a full
|
|
|
|
* SPIR-V shader module. Ensures that the module layout
|
|
|
|
* is valid, as defined in the SPIR-V 1.0 specification,
|
|
|
|
* section 2.4 "Logical Layout of a Module".
|
|
|
|
*/
|
|
|
|
class SpirvModule {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
SpirvModule();
|
|
|
|
~SpirvModule();
|
|
|
|
|
|
|
|
SpirvCodeBuffer compile() const;
|
|
|
|
|
|
|
|
uint32_t allocateId();
|
|
|
|
|
|
|
|
void enableCapability(
|
|
|
|
spv::Capability capability);
|
|
|
|
|
2017-12-27 14:31:38 +01:00
|
|
|
void enableExtension(
|
|
|
|
const char* extensionName);
|
|
|
|
|
2017-10-26 15:40:39 +02:00
|
|
|
void addEntryPoint(
|
|
|
|
uint32_t entryPointId,
|
|
|
|
spv::ExecutionModel executionModel,
|
|
|
|
const char* name,
|
|
|
|
uint32_t interfaceCount,
|
|
|
|
const uint32_t* interfaceIds);
|
|
|
|
|
|
|
|
void setMemoryModel(
|
|
|
|
spv::AddressingModel addressModel,
|
|
|
|
spv::MemoryModel memoryModel);
|
|
|
|
|
2017-12-18 16:41:05 +01:00
|
|
|
void setExecutionMode(
|
|
|
|
uint32_t entryPointId,
|
|
|
|
spv::ExecutionMode executionMode);
|
2017-10-26 15:40:39 +02:00
|
|
|
|
|
|
|
void setLocalSize(
|
|
|
|
uint32_t entryPointId,
|
|
|
|
uint32_t x,
|
|
|
|
uint32_t y,
|
|
|
|
uint32_t z);
|
|
|
|
|
2017-12-18 16:41:05 +01:00
|
|
|
void setOutputVertices(
|
|
|
|
uint32_t entryPointId,
|
|
|
|
uint32_t vertexCount);
|
2017-12-08 13:24:08 +01:00
|
|
|
|
2017-10-26 15:40:39 +02:00
|
|
|
void setDebugName(
|
|
|
|
uint32_t expressionId,
|
|
|
|
const char* debugName);
|
|
|
|
|
2017-11-13 00:22:52 +01:00
|
|
|
void setDebugMemberName(
|
|
|
|
uint32_t structId,
|
|
|
|
uint32_t memberId,
|
|
|
|
const char* debugName);
|
|
|
|
|
2017-10-26 15:40:39 +02:00
|
|
|
uint32_t constBool(
|
|
|
|
bool v);
|
|
|
|
|
|
|
|
uint32_t consti32(
|
|
|
|
int32_t v);
|
|
|
|
|
|
|
|
uint32_t consti64(
|
|
|
|
int64_t v);
|
|
|
|
|
|
|
|
uint32_t constu32(
|
|
|
|
uint32_t v);
|
|
|
|
|
|
|
|
uint32_t constu64(
|
|
|
|
uint64_t v);
|
|
|
|
|
|
|
|
uint32_t constf32(
|
|
|
|
float v);
|
|
|
|
|
|
|
|
uint32_t constf64(
|
|
|
|
double v);
|
|
|
|
|
|
|
|
uint32_t constComposite(
|
|
|
|
uint32_t typeId,
|
|
|
|
uint32_t constCount,
|
|
|
|
const uint32_t* constIds);
|
|
|
|
|
2017-12-08 14:56:34 +01:00
|
|
|
void decorate(
|
|
|
|
uint32_t object,
|
|
|
|
spv::Decoration decoration);
|
|
|
|
|
2017-12-08 19:39:33 +01:00
|
|
|
void decorateArrayStride(
|
|
|
|
uint32_t object,
|
|
|
|
uint32_t stride);
|
|
|
|
|
2017-12-03 20:23:26 +01:00
|
|
|
void decorateBinding(
|
|
|
|
uint32_t object,
|
|
|
|
uint32_t binding);
|
|
|
|
|
2017-11-13 00:22:52 +01:00
|
|
|
void decorateBlock(
|
|
|
|
uint32_t object);
|
|
|
|
|
2017-11-07 15:10:38 +01:00
|
|
|
void decorateBuiltIn(
|
|
|
|
uint32_t object,
|
|
|
|
spv::BuiltIn builtIn);
|
|
|
|
|
|
|
|
void decorateComponent(
|
|
|
|
uint32_t object,
|
|
|
|
uint32_t location);
|
|
|
|
|
2017-12-03 20:23:26 +01:00
|
|
|
void decorateDescriptorSet(
|
|
|
|
uint32_t object,
|
|
|
|
uint32_t set);
|
|
|
|
|
2017-11-07 15:10:38 +01:00
|
|
|
void decorateLocation(
|
|
|
|
uint32_t object,
|
|
|
|
uint32_t location);
|
|
|
|
|
2017-11-13 00:22:52 +01:00
|
|
|
void memberDecorateBuiltIn(
|
|
|
|
uint32_t structId,
|
|
|
|
uint32_t memberId,
|
|
|
|
spv::BuiltIn builtIn);
|
|
|
|
|
2017-12-08 17:08:26 +01:00
|
|
|
void memberDecorateOffset(
|
|
|
|
uint32_t structId,
|
|
|
|
uint32_t memberId,
|
|
|
|
uint32_t offset);
|
|
|
|
|
2017-10-26 15:40:39 +02:00
|
|
|
uint32_t defVoidType();
|
|
|
|
|
|
|
|
uint32_t defBoolType();
|
|
|
|
|
|
|
|
uint32_t defIntType(
|
|
|
|
uint32_t width,
|
|
|
|
uint32_t isSigned);
|
|
|
|
|
|
|
|
uint32_t defFloatType(
|
|
|
|
uint32_t width);
|
|
|
|
|
|
|
|
uint32_t defVectorType(
|
|
|
|
uint32_t elementType,
|
|
|
|
uint32_t elementCount);
|
|
|
|
|
|
|
|
uint32_t defMatrixType(
|
|
|
|
uint32_t columnType,
|
|
|
|
uint32_t columnCount);
|
|
|
|
|
|
|
|
uint32_t defArrayType(
|
|
|
|
uint32_t typeId,
|
|
|
|
uint32_t length);
|
|
|
|
|
2017-12-08 19:50:36 +01:00
|
|
|
uint32_t defArrayTypeUnique(
|
|
|
|
uint32_t typeId,
|
|
|
|
uint32_t length);
|
|
|
|
|
2017-10-26 15:40:39 +02:00
|
|
|
uint32_t defRuntimeArrayType(
|
|
|
|
uint32_t typeId);
|
|
|
|
|
2017-12-08 19:50:36 +01:00
|
|
|
uint32_t defRuntimeArrayTypeUnique(
|
|
|
|
uint32_t typeId);
|
|
|
|
|
2017-10-26 15:40:39 +02:00
|
|
|
uint32_t defFunctionType(
|
|
|
|
uint32_t returnType,
|
|
|
|
uint32_t argCount,
|
|
|
|
const uint32_t* argTypes);
|
|
|
|
|
|
|
|
uint32_t defStructType(
|
|
|
|
uint32_t memberCount,
|
|
|
|
const uint32_t* memberTypes);
|
2017-12-08 19:50:36 +01:00
|
|
|
|
|
|
|
uint32_t defStructTypeUnique(
|
|
|
|
uint32_t memberCount,
|
|
|
|
const uint32_t* memberTypes);
|
2017-10-26 15:40:39 +02:00
|
|
|
|
|
|
|
uint32_t defPointerType(
|
|
|
|
uint32_t variableType,
|
|
|
|
spv::StorageClass storageClass);
|
|
|
|
|
2017-12-03 20:23:26 +01:00
|
|
|
uint32_t defSamplerType();
|
|
|
|
|
|
|
|
uint32_t defImageType(
|
|
|
|
uint32_t sampledType,
|
|
|
|
spv::Dim dimensionality,
|
|
|
|
uint32_t depth,
|
|
|
|
uint32_t arrayed,
|
|
|
|
uint32_t multisample,
|
|
|
|
uint32_t sampled,
|
|
|
|
spv::ImageFormat format);
|
|
|
|
|
|
|
|
uint32_t defSampledImageType(
|
|
|
|
uint32_t imageType);
|
|
|
|
|
2017-10-26 16:32:10 +02:00
|
|
|
uint32_t newVar(
|
|
|
|
uint32_t pointerType,
|
|
|
|
spv::StorageClass storageClass);
|
|
|
|
|
2017-12-19 17:41:23 +01:00
|
|
|
uint32_t newVarInit(
|
|
|
|
uint32_t pointerType,
|
|
|
|
spv::StorageClass storageClass,
|
|
|
|
uint32_t initialValue);
|
|
|
|
|
2017-10-26 15:40:39 +02:00
|
|
|
void functionBegin(
|
|
|
|
uint32_t returnType,
|
|
|
|
uint32_t functionId,
|
|
|
|
uint32_t functionType,
|
|
|
|
spv::FunctionControlMask functionControl);
|
|
|
|
|
|
|
|
uint32_t functionParameter(
|
|
|
|
uint32_t parameterType);
|
|
|
|
|
|
|
|
void functionEnd();
|
|
|
|
|
2017-11-16 01:30:17 +01:00
|
|
|
uint32_t opAccessChain(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t composite,
|
|
|
|
uint32_t indexCount,
|
|
|
|
const uint32_t* indexArray);
|
|
|
|
|
2017-11-07 15:10:38 +01:00
|
|
|
uint32_t opBitcast(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
2017-12-19 00:45:31 +01:00
|
|
|
uint32_t opBitwiseAnd(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand1,
|
|
|
|
uint32_t operand2);
|
|
|
|
|
|
|
|
uint32_t opBitwiseOr(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand1,
|
|
|
|
uint32_t operand2);
|
|
|
|
|
|
|
|
uint32_t opBitwiseXor(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand1,
|
|
|
|
uint32_t operand2);
|
|
|
|
|
2017-12-19 20:26:05 +01:00
|
|
|
uint32_t opNot(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
2017-12-20 23:50:39 +01:00
|
|
|
uint32_t opShiftLeftLogical(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t base,
|
|
|
|
uint32_t shift);
|
|
|
|
|
|
|
|
uint32_t opShiftRightArithmetic(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t base,
|
|
|
|
uint32_t shift);
|
|
|
|
|
|
|
|
uint32_t opShiftRightLogical(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t base,
|
|
|
|
uint32_t shift);
|
|
|
|
|
2017-12-19 18:12:18 +01:00
|
|
|
uint32_t opConvertFtoS(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opConvertFtoU(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opConvertStoF(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opConvertUtoF(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
2017-12-10 22:35:55 +01:00
|
|
|
uint32_t opCompositeConstruct(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t valueCount,
|
|
|
|
const uint32_t* valueArray);
|
|
|
|
|
2017-11-07 15:10:38 +01:00
|
|
|
uint32_t opCompositeExtract(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t composite,
|
|
|
|
uint32_t indexCount,
|
|
|
|
const uint32_t* indexArray);
|
|
|
|
|
2017-11-13 02:07:13 +01:00
|
|
|
uint32_t opCompositeInsert(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t object,
|
|
|
|
uint32_t composite,
|
|
|
|
uint32_t indexCount,
|
|
|
|
const uint32_t* indexArray);
|
|
|
|
|
2017-12-19 20:26:05 +01:00
|
|
|
uint32_t opDpdx(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opDpdy(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opDpdxCoarse(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opDpdyCoarse(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opDpdxFine(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opDpdyFine(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
2017-11-07 15:10:38 +01:00
|
|
|
uint32_t opVectorShuffle(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vectorLeft,
|
|
|
|
uint32_t vectorRight,
|
|
|
|
uint32_t indexCount,
|
|
|
|
const uint32_t* indexArray);
|
|
|
|
|
2017-11-16 01:30:17 +01:00
|
|
|
uint32_t opSNegate(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opFNegate(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opSAbs(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opFAbs(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
2017-11-17 11:41:56 +01:00
|
|
|
uint32_t opIAdd(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
2017-12-27 12:49:25 +01:00
|
|
|
uint32_t opISub(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
2017-11-17 11:41:56 +01:00
|
|
|
uint32_t opFAdd(
|
|
|
|
uint32_t resultType,
|
2017-12-27 12:49:25 +01:00
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
|
|
|
uint32_t opFSub(
|
|
|
|
uint32_t resultType,
|
2017-11-17 11:41:56 +01:00
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
2017-12-18 16:41:05 +01:00
|
|
|
uint32_t opSDiv(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
|
|
|
uint32_t opUDiv(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
|
|
|
uint32_t opSRem(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
|
|
|
uint32_t opUMod(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
2017-12-17 01:36:41 +01:00
|
|
|
uint32_t opFDiv(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
2017-12-09 01:49:30 +01:00
|
|
|
uint32_t opIMul(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
2017-11-29 21:46:09 +01:00
|
|
|
uint32_t opFMul(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
2017-12-13 15:32:54 +01:00
|
|
|
|
|
|
|
uint32_t opFFma(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b,
|
|
|
|
uint32_t c);
|
2017-11-29 21:46:09 +01:00
|
|
|
|
2017-12-13 16:35:01 +01:00
|
|
|
uint32_t opFMax(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
|
|
|
uint32_t opFMin(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
2017-12-18 00:28:54 +01:00
|
|
|
uint32_t opSMax(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
|
|
|
uint32_t opSMin(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
2017-12-20 23:50:39 +01:00
|
|
|
uint32_t opUMax(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
|
|
|
uint32_t opUMin(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t a,
|
|
|
|
uint32_t b);
|
|
|
|
|
2017-11-17 11:41:56 +01:00
|
|
|
uint32_t opFClamp(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t x,
|
|
|
|
uint32_t minVal,
|
|
|
|
uint32_t maxVal);
|
|
|
|
|
2017-12-17 01:36:41 +01:00
|
|
|
uint32_t opIEqual(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
|
|
|
uint32_t opINotEqual(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
2017-12-18 00:28:54 +01:00
|
|
|
uint32_t opSLessThan(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
|
|
|
uint32_t opSLessThanEqual(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
|
|
|
uint32_t opSGreaterThan(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
|
|
|
uint32_t opSGreaterThanEqual(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
2017-12-21 17:14:11 +01:00
|
|
|
uint32_t opULessThan(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
|
|
|
uint32_t opULessThanEqual(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
|
|
|
uint32_t opUGreaterThan(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
|
|
|
uint32_t opUGreaterThanEqual(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
2017-12-17 01:36:41 +01:00
|
|
|
uint32_t opFOrdEqual(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
|
|
|
uint32_t opFOrdNotEqual(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
|
|
|
uint32_t opFOrdLessThan(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
|
|
|
uint32_t opFOrdLessThanEqual(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
|
|
|
uint32_t opFOrdGreaterThan(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
|
|
|
uint32_t opFOrdGreaterThanEqual(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
2017-12-08 17:08:26 +01:00
|
|
|
uint32_t opDot(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector1,
|
|
|
|
uint32_t vector2);
|
|
|
|
|
2017-12-13 16:35:01 +01:00
|
|
|
uint32_t opSin(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector);
|
|
|
|
|
|
|
|
uint32_t opCos(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t vector);
|
|
|
|
|
2017-12-18 00:28:54 +01:00
|
|
|
uint32_t opSqrt(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
2017-12-10 20:01:38 +01:00
|
|
|
uint32_t opInverseSqrt(
|
|
|
|
uint32_t resultType,
|
2017-12-18 00:28:54 +01:00
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opExp2(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
|
|
|
|
|
|
|
uint32_t opLog2(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t operand);
|
2017-12-10 20:01:38 +01:00
|
|
|
|
2017-12-17 01:36:41 +01:00
|
|
|
uint32_t opSelect(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t condition,
|
|
|
|
uint32_t operand1,
|
|
|
|
uint32_t operand2);
|
|
|
|
|
2017-10-26 15:40:39 +02:00
|
|
|
uint32_t opFunctionCall(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t functionId,
|
|
|
|
uint32_t argCount,
|
|
|
|
const uint32_t* argIds);
|
|
|
|
|
2017-11-01 16:43:04 +01:00
|
|
|
void opLabel(
|
|
|
|
uint32_t labelId);
|
|
|
|
|
|
|
|
uint32_t opLoad(
|
|
|
|
uint32_t typeId,
|
|
|
|
uint32_t pointerId);
|
|
|
|
|
|
|
|
void opStore(
|
|
|
|
uint32_t pointerId,
|
|
|
|
uint32_t valueId);
|
|
|
|
|
2017-12-28 16:03:17 +01:00
|
|
|
uint32_t opImageRead(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t image,
|
|
|
|
uint32_t coordinates,
|
|
|
|
const SpirvImageOperands& operands);
|
|
|
|
|
|
|
|
void opImageWrite(
|
|
|
|
uint32_t image,
|
|
|
|
uint32_t coordinates,
|
|
|
|
uint32_t texel,
|
|
|
|
const SpirvImageOperands& operands);
|
|
|
|
|
2017-12-03 20:23:26 +01:00
|
|
|
uint32_t opSampledImage(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t image,
|
|
|
|
uint32_t sampler);
|
|
|
|
|
2017-12-27 01:37:15 +01:00
|
|
|
uint32_t opImageQuerySizeLod(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t image,
|
|
|
|
uint32_t lod);
|
|
|
|
|
|
|
|
uint32_t opImageQuerySize(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t image);
|
|
|
|
|
|
|
|
uint32_t opImageQueryLevels(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t image);
|
|
|
|
|
|
|
|
uint32_t opImageFetch(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t image,
|
|
|
|
uint32_t coordinates,
|
|
|
|
const SpirvImageOperands& operands);
|
|
|
|
|
2017-12-03 20:23:26 +01:00
|
|
|
uint32_t opImageSampleImplicitLod(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t sampledImage,
|
2017-12-20 20:21:44 +01:00
|
|
|
uint32_t coordinates,
|
|
|
|
const SpirvImageOperands& operands);
|
2017-12-03 20:23:26 +01:00
|
|
|
|
2017-12-20 14:54:24 +01:00
|
|
|
uint32_t opImageSampleExplicitLod(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t sampledImage,
|
|
|
|
uint32_t coordinates,
|
2017-12-20 20:21:44 +01:00
|
|
|
const SpirvImageOperands& operands);
|
2017-12-20 14:54:24 +01:00
|
|
|
|
|
|
|
uint32_t opImageSampleDrefImplicitLod(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t sampledImage,
|
|
|
|
uint32_t coordinates,
|
2017-12-20 20:21:44 +01:00
|
|
|
uint32_t reference,
|
|
|
|
const SpirvImageOperands& operands);
|
2017-12-20 14:54:24 +01:00
|
|
|
|
2017-12-20 00:16:49 +01:00
|
|
|
uint32_t opImageSampleDrefExplicitLod(
|
|
|
|
uint32_t resultType,
|
|
|
|
uint32_t sampledImage,
|
|
|
|
uint32_t coordinates,
|
|
|
|
uint32_t reference,
|
2017-12-20 20:21:44 +01:00
|
|
|
const SpirvImageOperands& operands);
|
2017-12-20 00:16:49 +01:00
|
|
|
|
2017-12-29 00:51:31 +01:00
|
|
|
void opControlBarrier(
|
|
|
|
uint32_t execution,
|
|
|
|
uint32_t memory,
|
|
|
|
uint32_t semantics);
|
|
|
|
|
|
|
|
void opMemoryBarrier(
|
|
|
|
uint32_t memory,
|
|
|
|
uint32_t semantics);
|
|
|
|
|
2017-12-18 11:53:28 +01:00
|
|
|
void opLoopMerge(
|
|
|
|
uint32_t mergeBlock,
|
|
|
|
uint32_t continueTarget,
|
|
|
|
uint32_t loopControl);
|
|
|
|
|
|
|
|
void opSelectionMerge(
|
|
|
|
uint32_t mergeBlock,
|
|
|
|
uint32_t selectionControl);
|
|
|
|
|
|
|
|
void opBranch(
|
|
|
|
uint32_t label);
|
|
|
|
|
|
|
|
void opBranchConditional(
|
|
|
|
uint32_t condition,
|
|
|
|
uint32_t trueLabel,
|
|
|
|
uint32_t falseLabel);
|
|
|
|
|
2017-11-01 16:43:04 +01:00
|
|
|
void opReturn();
|
|
|
|
|
2017-12-18 16:41:05 +01:00
|
|
|
void opKill();
|
|
|
|
|
|
|
|
void opEmitVertex();
|
|
|
|
|
|
|
|
void opEndPrimitive();
|
|
|
|
|
2017-10-26 15:40:39 +02:00
|
|
|
private:
|
|
|
|
|
2017-11-16 01:30:17 +01:00
|
|
|
uint32_t m_id = 1;
|
|
|
|
uint32_t m_instExtGlsl450 = 0;
|
2017-10-26 15:40:39 +02:00
|
|
|
|
|
|
|
SpirvCodeBuffer m_capabilities;
|
2017-12-27 14:31:38 +01:00
|
|
|
SpirvCodeBuffer m_extensions;
|
2017-11-16 01:30:17 +01:00
|
|
|
SpirvCodeBuffer m_instExt;
|
2017-10-26 15:40:39 +02:00
|
|
|
SpirvCodeBuffer m_memoryModel;
|
|
|
|
SpirvCodeBuffer m_entryPoints;
|
|
|
|
SpirvCodeBuffer m_execModeInfo;
|
|
|
|
SpirvCodeBuffer m_debugNames;
|
|
|
|
SpirvCodeBuffer m_annotations;
|
2017-11-13 00:22:52 +01:00
|
|
|
SpirvCodeBuffer m_typeConstDefs;
|
2017-10-26 15:40:39 +02:00
|
|
|
SpirvCodeBuffer m_variables;
|
|
|
|
SpirvCodeBuffer m_code;
|
|
|
|
|
|
|
|
uint32_t defType(
|
|
|
|
spv::Op op,
|
|
|
|
uint32_t argCount,
|
|
|
|
const uint32_t* argIds);
|
|
|
|
|
2017-11-16 01:30:17 +01:00
|
|
|
void instImportGlsl450();
|
|
|
|
|
2017-12-20 20:21:44 +01:00
|
|
|
uint32_t getImageOperandWordCount(
|
|
|
|
const SpirvImageOperands& op) const;
|
|
|
|
|
|
|
|
void putImageOperands(
|
|
|
|
const SpirvImageOperands& op);
|
|
|
|
|
2017-10-26 15:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|