Skip to content

Commit

Permalink
bvm: adde Get/Set-ApiVersion (app shaders only)
Browse files Browse the repository at this point in the history
  • Loading branch information
valdok committed Aug 3, 2022
1 parent 92788a2 commit 25e7ad7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bvm/bvm2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3076,6 +3076,20 @@ namespace bvm2 {
}
}

BVM_METHOD(GetApiVersion)
{
return Shaders::ApiVersion::Current;
}

BVM_METHOD_HOST_AUTO(GetApiVersion)

BVM_METHOD(SetApiVersion)
{
Wasm::Test(Shaders::ApiVersion::Current == nVer);
}

BVM_METHOD_HOST_AUTO(SetApiVersion)

void ProcessorManager::RunOnce()
{
assert(!IsSuspended());
Expand Down
7 changes: 7 additions & 0 deletions bvm/bvm2_opcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@
macro(const char*, szComment) sep \
macro(uint32_t, nCharge)

#define BVMOp_GetApiVersion(macro, sep) \

#define BVMOp_SetApiVersion(macro, sep) \
macro(uint32_t, nVer)

#define BVMOp_GenerateRandom(macro, sep) \
macro(void*, pBuf) sep \
macro(uint32_t, nSize)
Expand Down Expand Up @@ -546,6 +551,8 @@
macro(0x6B, uint8_t , DocGetNum64) \
macro(0x6C, uint32_t , DocGetBlob) \
macro(0x70, void , GenerateKernel) \
macro(0x78, uint32_t , GetApiVersion) \
macro(0x79, void , SetApiVersion) \
macro(0xA0, void , GenerateRandom) \
macro(0xA1, void , get_SlotImage) \
macro(0xA2, void , SlotInit) \
Expand Down
5 changes: 5 additions & 0 deletions bvm/bvm2_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,9 @@ struct Stream

static const uint32_t s_NonceSlots = 256;

struct ApiVersion
{
static const uint32_t Current = 1;
};

#pragma pack (pop)

0 comments on commit 25e7ad7

Please sign in to comment.