parent
c31c7b7144
commit
70629f4d71
8 changed files with 0 additions and 71288 deletions
|
@ -996,8 +996,6 @@ def handle_class(klass):
|
|||
constructors.write(f" {{\"{klass.version}\", &create_{winclassname}, &destroy_{winclassname}}},\n")
|
||||
constructors.write(f" {{\"FnTable:{klass.version}\", &create_{winclassname}_FnTable, &destroy_{winclassname}_FnTable}},\n")
|
||||
|
||||
generate_c_api_thunk_tests(winclassname, klass.methods)
|
||||
|
||||
|
||||
def canonical_typename(cursor):
|
||||
if type(cursor) in (Cursor, Struct):
|
||||
|
@ -1196,180 +1194,6 @@ extern void call_flat_method_f(void);
|
|||
|
||||
f.write("#endif\n")
|
||||
|
||||
def generate_c_api_method_test(f, header, thunks_c, class_name, method):
|
||||
thunk_params = get_capi_thunk_params(method)
|
||||
f.write("\n init_thunk(t, this_ptr_value, %s_%s, %s);\n" % (class_name, method.name, thunk_params))
|
||||
f.write(" ")
|
||||
header.write("\n")
|
||||
thunks_c.write("\n")
|
||||
|
||||
returns_record = method.result_type.get_canonical().kind == TypeKind.RECORD
|
||||
if returns_record:
|
||||
f.write("%s *" % strip_ns(method.result_type.spelling))
|
||||
header.write("%s *" % strip_ns(method.result_type.spelling))
|
||||
thunks_c.write("%s *" % strip_ns(method.result_type.spelling))
|
||||
else:
|
||||
f.write("%s " % strip_ns(method.result_type.spelling))
|
||||
header.write("%s " % strip_ns(method.result_type.spelling))
|
||||
thunks_c.write("%s " % strip_ns(method.result_type.spelling))
|
||||
first_param = True
|
||||
f.write('(__stdcall *capi_%s_%s)(' % (class_name, method.name))
|
||||
header.write('__thiscall %s_%s(void *_this' % (class_name, method.name))
|
||||
thunks_c.write('__thiscall %s_%s(void *_this' % (class_name, method.name))
|
||||
if returns_record:
|
||||
f.write("%s *_r" % strip_ns(method.result_type.spelling))
|
||||
first_param = False
|
||||
header.write(", %s *_r" % strip_ns(method.result_type.spelling))
|
||||
thunks_c.write(", %s *_r" % strip_ns(method.result_type.spelling))
|
||||
|
||||
for param in method.get_arguments():
|
||||
if param.type.kind == TypeKind.POINTER \
|
||||
and param.type.get_pointee().kind == TypeKind.UNEXPOSED:
|
||||
typename = "void *"
|
||||
else:
|
||||
typename = param.type.spelling.split("::")[-1].replace("&", "*");
|
||||
if not first_param:
|
||||
f.write(", ")
|
||||
first_param = False
|
||||
f.write("%s %s" % (typename, param.spelling))
|
||||
header.write(", %s %s" % (typename, param.spelling))
|
||||
thunks_c.write(", %s %s" % (typename, param.spelling))
|
||||
f.write(") = (void *)t;\n")
|
||||
header.write(");\n")
|
||||
thunks_c.write(")\n{\n")
|
||||
|
||||
def get_param_typename(param):
|
||||
param_size = param.type.get_size()
|
||||
if param.type.kind == TypeKind.POINTER \
|
||||
or param.type.spelling.endswith("&") \
|
||||
or param.type.spelling == "vr::glSharedTextureHandle_t":
|
||||
return "ptr"
|
||||
elif param.type.spelling == "bool":
|
||||
return "bool"
|
||||
elif param.type.spelling == "float":
|
||||
return "float"
|
||||
elif param.type.spelling == "vr::HmdRect2_t":
|
||||
return "HmdRect2"
|
||||
elif param.type.spelling == "vr::HmdVector2_t":
|
||||
return "HmdVector2"
|
||||
elif param.type.spelling == "vr::HmdVector3_t":
|
||||
return "HmdVector3"
|
||||
elif param.type.spelling == "vr::HmdColor_t":
|
||||
return "HmdColor"
|
||||
elif param_size == 8:
|
||||
return "uint64"
|
||||
elif param_size == 4 or param_size == 2:
|
||||
return "uint32"
|
||||
else:
|
||||
return "unknown"
|
||||
|
||||
thunks_c.write(" push_ptr_parameter(_this);\n")
|
||||
if returns_record:
|
||||
thunks_c.write(" push_ptr_parameter(_r);\n")
|
||||
for param in method.get_arguments():
|
||||
typename = get_param_typename(param)
|
||||
thunks_c.write(" push_%s_parameter(%s);\n" % (typename, param.spelling))
|
||||
if method.result_type.kind != TypeKind.VOID:
|
||||
thunks_c.write(" return 0;\n")
|
||||
thunks_c.write("}\n")
|
||||
|
||||
parameter_checks = []
|
||||
def add_parameter_check(typename, value):
|
||||
parameter_checks.append("check_%s_parameter(\"%s_%s\", %s)" % (typename, class_name, method.name, value))
|
||||
add_parameter_check("ptr", "this_ptr_value")
|
||||
f.write("\n")
|
||||
f.write(" clear_parameters();\n")
|
||||
f.write(" capi_%s_%s(" % (class_name, method.name))
|
||||
first_param = True
|
||||
if returns_record:
|
||||
f.write("data_ptr_value")
|
||||
first_param = False
|
||||
add_parameter_check("ptr", "data_ptr_value")
|
||||
for i, param in enumerate(method.get_arguments()):
|
||||
i += 1
|
||||
typename = get_param_typename(param)
|
||||
if typename == "ptr":
|
||||
v = "(void *)%s" % i
|
||||
elif typename == "bool":
|
||||
v = "1"
|
||||
elif typename == "float":
|
||||
v = "%s.0f" % i
|
||||
elif typename == "HmdRect2":
|
||||
v = "DEFAULT_RECT"
|
||||
elif typename == "HmdVector2":
|
||||
v = "DEFAULT_VECTOR2"
|
||||
elif typename == "HmdVector3":
|
||||
v = "DEFAULT_VECTOR3"
|
||||
elif typename == "HmdColor":
|
||||
v = "DEFAULT_COLOR"
|
||||
else:
|
||||
v = str(i)
|
||||
if not first_param:
|
||||
f.write(", ")
|
||||
first_param = False
|
||||
f.write(v)
|
||||
add_parameter_check(typename, v)
|
||||
f.write(");\n")
|
||||
for c in parameter_checks:
|
||||
f.write(" %s;\n" % c)
|
||||
|
||||
def generate_c_api_thunk_tests(winclassname, methods):
|
||||
class_name = re.sub(r'^win[A-Za-z]+_', '', winclassname)
|
||||
|
||||
filename = "tests/capi_thunks_autogen.h"
|
||||
file_exists = os.path.isfile(filename)
|
||||
header = open(filename, "a")
|
||||
if not file_exists:
|
||||
header.write("""/* This file is auto-generated, do not edit. */
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
||||
#include "cxx.h"
|
||||
#include "flatapi.h"
|
||||
#include "vrclient_defs.h"
|
||||
|
||||
#include "capi_thunks.h"
|
||||
""")
|
||||
header.write("\nvoid test_capi_thunks_%s(void);\n" % class_name)
|
||||
|
||||
filename = "tests/capi_thunks_autogen.c"
|
||||
file_exists = os.path.isfile(filename)
|
||||
thunks_c = open(filename, "a")
|
||||
if not file_exists:
|
||||
thunks_c.write("""/* This file is auto-generated, do not edit. */
|
||||
#include "capi_thunks_autogen.h"
|
||||
""")
|
||||
|
||||
filename = "tests/capi_thunks_tests_autogen.c"
|
||||
file_exists = os.path.isfile(filename)
|
||||
with open(filename, "a") as f:
|
||||
if not file_exists:
|
||||
f.write("""/* This file is auto-generated, do not edit. */
|
||||
#include "capi_thunks_autogen.h"
|
||||
""")
|
||||
f.write("\nvoid test_capi_thunks_%s(void)\n{\n" % class_name)
|
||||
f.write(" struct thunk *t = alloc_thunks(1);\n");
|
||||
for method in methods:
|
||||
generate_c_api_method_test(f, header, thunks_c, class_name, method)
|
||||
f.write(" VirtualFree(t, 0, MEM_RELEASE);\n")
|
||||
f.write("}\n")
|
||||
|
||||
filename = "tests/main_autogen.c"
|
||||
file_exists = os.path.isfile(filename)
|
||||
with open(filename, "a") as f:
|
||||
if not file_exists:
|
||||
f.write("""/* This file is auto-generated, do not edit. */
|
||||
#include "capi_thunks_autogen.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
""")
|
||||
f.write(" test_capi_thunks_%s();\n" % class_name)
|
||||
|
||||
|
||||
def enumerate_structs(cursor, vr_only=False):
|
||||
|
@ -1565,11 +1389,6 @@ for _, klass in sorted(all_classes.items()):
|
|||
sdkver = klass._sdkver
|
||||
handle_class(klass)
|
||||
|
||||
|
||||
with open("tests/main_autogen.c", "a") as f:
|
||||
f.write(" printf(\"All tests executed.\\n\");\n")
|
||||
f.write("}\n")
|
||||
|
||||
generate_flatapi_c()
|
||||
|
||||
|
||||
|
|
|
@ -1,289 +0,0 @@
|
|||
#include "capi_thunks_autogen.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MAX_PARAMETERS 20
|
||||
|
||||
HmdRect2_t DEFAULT_RECT;
|
||||
HmdVector2_t DEFAULT_VECTOR2;
|
||||
HmdVector3_t DEFAULT_VECTOR3;
|
||||
HmdColor_t DEFAULT_COLOR;
|
||||
|
||||
enum parameter_type
|
||||
{
|
||||
PT_PTR,
|
||||
PT_BOOL,
|
||||
PT_FLOAT,
|
||||
PT_UINT32,
|
||||
PT_UINT64,
|
||||
PT_HMDRECT2,
|
||||
PT_HMDVECTOR2,
|
||||
PT_HMDVECTOR3,
|
||||
PT_HMDCOLOR,
|
||||
};
|
||||
|
||||
struct parameter
|
||||
{
|
||||
enum parameter_type pt;
|
||||
union
|
||||
{
|
||||
const void *ptr;
|
||||
bool b;
|
||||
float f;
|
||||
uint32_t u32;
|
||||
uint64_t u64;
|
||||
HmdRect2_t hmd_rect2;
|
||||
HmdVector2_t hmd_vector2;
|
||||
HmdVector3_t hmd_vector3;
|
||||
HmdColor_t hmd_color;
|
||||
} value;
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
unsigned int parameter_index;
|
||||
unsigned int parameter_count;
|
||||
struct parameter parameters[MAX_PARAMETERS];
|
||||
}
|
||||
params;
|
||||
|
||||
void clear_parameters(void)
|
||||
{
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
}
|
||||
|
||||
struct parameter *get_next_parameter(void)
|
||||
{
|
||||
assert(params.parameter_count < MAX_PARAMETERS);
|
||||
return ¶ms.parameters[params.parameter_count++];
|
||||
}
|
||||
|
||||
struct parameter *get_pushed_parameter(void)
|
||||
{
|
||||
assert(params.parameter_index < params.parameter_count);
|
||||
return ¶ms.parameters[params.parameter_index++];
|
||||
}
|
||||
|
||||
void push_ptr_parameter(const void *v)
|
||||
{
|
||||
struct parameter *param = get_next_parameter();
|
||||
|
||||
param->pt = PT_PTR;
|
||||
param->value.ptr = v;
|
||||
}
|
||||
|
||||
void push_bool_parameter(bool b)
|
||||
{
|
||||
struct parameter *param = get_next_parameter();
|
||||
|
||||
param->pt = PT_BOOL;
|
||||
param->value.b = b;
|
||||
}
|
||||
|
||||
void push_float_parameter(float f)
|
||||
{
|
||||
struct parameter *param = get_next_parameter();
|
||||
|
||||
param->pt = PT_FLOAT;
|
||||
param->value.f = f;
|
||||
}
|
||||
|
||||
void push_uint32_parameter(uint32_t u)
|
||||
{
|
||||
struct parameter *param = get_next_parameter();
|
||||
|
||||
param->pt = PT_UINT32;
|
||||
param->value.u32 = u;
|
||||
}
|
||||
|
||||
void push_uint64_parameter(uint64_t u)
|
||||
{
|
||||
struct parameter *param = get_next_parameter();
|
||||
|
||||
param->pt = PT_UINT64;
|
||||
param->value.u64 = u;
|
||||
}
|
||||
|
||||
void push_HmdRect2_parameter(HmdRect2_t v)
|
||||
{
|
||||
struct parameter *param = get_next_parameter();
|
||||
|
||||
param->pt = PT_HMDRECT2;
|
||||
param->value.hmd_rect2 = v;
|
||||
}
|
||||
|
||||
void push_HmdVector2_parameter(HmdVector2_t v)
|
||||
{
|
||||
struct parameter *param = get_next_parameter();
|
||||
|
||||
param->pt = PT_HMDVECTOR2;
|
||||
param->value.hmd_vector2 = v;
|
||||
}
|
||||
|
||||
void push_HmdVector3_parameter(HmdVector3_t v)
|
||||
{
|
||||
struct parameter *param = get_next_parameter();
|
||||
|
||||
param->pt = PT_HMDVECTOR3;
|
||||
param->value.hmd_vector3 = v;
|
||||
|
||||
}
|
||||
|
||||
void push_HmdColor_parameter(HmdColor_t v)
|
||||
{
|
||||
struct parameter *param = get_next_parameter();
|
||||
|
||||
param->pt = PT_HMDCOLOR;
|
||||
param->value.hmd_color = v;
|
||||
}
|
||||
|
||||
void check_ptr_parameter_(const char *file, unsigned int line, const char *name, const void *v)
|
||||
{
|
||||
unsigned int i = params.parameter_index;
|
||||
struct parameter *param = get_pushed_parameter();
|
||||
|
||||
if (param->pt != PT_PTR)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Invalid parameter type %#x.\n", file, line, name, i, param->pt);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (param->value.ptr != v)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Got %p, expected %p.\n", file, line, name, i, param->value.ptr, v);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
void check_bool_parameter_(const char *file, unsigned int line, const char *name, bool b)
|
||||
{
|
||||
unsigned int i = params.parameter_index;
|
||||
struct parameter *param = get_pushed_parameter();
|
||||
|
||||
if (param->pt != PT_BOOL)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Invalid parameter type %#x.\n", file, line, name, i, param->pt);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (param->value.b != b)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Got %#x, expected %#x.\n", file, line, name, i, param->value.b, b);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
void check_float_parameter_(const char *file, unsigned int line, const char *name, float f)
|
||||
{
|
||||
unsigned int i = params.parameter_index;
|
||||
struct parameter *param = get_pushed_parameter();
|
||||
|
||||
if (param->pt != PT_FLOAT)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Invalid parameter type %#x.\n", file, line, name, i, param->pt);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (param->value.f != f)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Got %.8ex, expected %.8ex.\n", file, line, name, i, param->value.f, f);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
void check_uint32_parameter_(const char *file, unsigned int line, const char *name, uint32_t u)
|
||||
{
|
||||
unsigned int i = params.parameter_index;
|
||||
struct parameter *param = get_pushed_parameter();
|
||||
|
||||
if (param->pt != PT_UINT32)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Invalid parameter type %#x.\n", file, line, name, i, param->pt);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (param->value.u32 != u)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Got %"PRIu32", expected %"PRIu32".\n",
|
||||
file, line, name, i, param->value.u32, u);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
void check_uint64_parameter_(const char *file, unsigned int line, const char *name, uint64_t u)
|
||||
{
|
||||
unsigned int i = params.parameter_index;
|
||||
struct parameter *param = get_pushed_parameter();
|
||||
|
||||
if (param->pt != PT_UINT64)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Invalid parameter type %#x.\n", file, line, name, i, param->pt);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (param->value.u64 != u)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Got %"PRIu64", expected %"PRIu64".\n",
|
||||
file, line, name, i, param->value.u64, u);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
void check_HmdRect2_parameter_(const char *file, unsigned int line, const char *name, HmdRect2_t v)
|
||||
{
|
||||
unsigned int i = params.parameter_index;
|
||||
struct parameter *param = get_pushed_parameter();
|
||||
|
||||
if (param->pt != PT_HMDRECT2)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Invalid parameter type %#x.\n", file, line, name, i, param->pt);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "TODO: compare HmdRect2\n");
|
||||
}
|
||||
|
||||
void check_HmdVector2_parameter_(const char *file, unsigned int line, const char *name, HmdVector2_t v)
|
||||
{
|
||||
unsigned int i = params.parameter_index;
|
||||
struct parameter *param = get_pushed_parameter();
|
||||
|
||||
if (param->pt != PT_HMDVECTOR2)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Invalid parameter type %#x.\n", file, line, name, i, param->pt);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "TODO: compare HmdVector2\n");
|
||||
}
|
||||
|
||||
void check_HmdVector3_parameter_(const char *file, unsigned int line, const char *name, HmdVector3_t v)
|
||||
{
|
||||
unsigned int i = params.parameter_index;
|
||||
struct parameter *param = get_pushed_parameter();
|
||||
|
||||
if (param->pt != PT_HMDVECTOR3)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Invalid parameter type %#x.\n", file, line, name, i, param->pt);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "TODO: compare HmdVector3\n");
|
||||
}
|
||||
|
||||
void check_HmdColor_parameter_(const char *file, unsigned int line, const char *name, HmdColor_t v)
|
||||
{
|
||||
unsigned int i = params.parameter_index;
|
||||
struct parameter *param = get_pushed_parameter();
|
||||
|
||||
if (param->pt != PT_HMDCOLOR)
|
||||
{
|
||||
fprintf(stderr, "%s:%u, %s, %u: Invalid parameter type %#x.\n", file, line, name, i, param->pt);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "TODO: compare HmdColor\n");
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#ifdef __i386__
|
||||
# define this_ptr_value ((void *)0xdeadbeef)
|
||||
#else
|
||||
# define this_ptr_value ((void *)0xdeadbeefdeadc0de)
|
||||
#endif
|
||||
|
||||
#define data_ptr_value ((void *)0xd474)
|
||||
|
||||
extern void clear_parameters(void);
|
||||
|
||||
extern HmdRect2_t DEFAULT_RECT;
|
||||
extern HmdVector2_t DEFAULT_VECTOR2;
|
||||
extern HmdVector3_t DEFAULT_VECTOR3;
|
||||
extern HmdColor_t DEFAULT_COLOR;
|
||||
|
||||
extern void push_ptr_parameter(const void *v);
|
||||
extern void push_bool_parameter(bool b);
|
||||
extern void push_float_parameter(float f);
|
||||
extern void push_uint32_parameter(uint32_t u);
|
||||
extern void push_uint64_parameter(uint64_t u);
|
||||
extern void push_HmdRect2_parameter(HmdRect2_t v);
|
||||
extern void push_HmdVector2_parameter(HmdVector2_t v);
|
||||
extern void push_HmdVector3_parameter(HmdVector3_t v);
|
||||
extern void push_HmdColor_parameter(HmdColor_t v);
|
||||
|
||||
#define check_ptr_parameter(a, b) check_ptr_parameter_(__FILE__, __LINE__, a, b)
|
||||
extern void check_ptr_parameter_(const char *file, unsigned int line, const char *name, const void *v);
|
||||
#define check_bool_parameter(a, b) check_bool_parameter_(__FILE__, __LINE__, a, b)
|
||||
extern void check_bool_parameter_(const char *file, unsigned int line, const char *name, bool b);
|
||||
#define check_float_parameter(a, b) check_float_parameter_(__FILE__, __LINE__, a, b)
|
||||
extern void check_float_parameter_(const char *file, unsigned int line, const char *name, float f);
|
||||
#define check_uint32_parameter(a, b) check_uint32_parameter_(__FILE__, __LINE__, a, b)
|
||||
extern void check_uint32_parameter_(const char *file, unsigned int line, const char *name, uint32_t u);
|
||||
#define check_uint64_parameter(a, b) check_uint64_parameter_(__FILE__, __LINE__, a, b)
|
||||
extern void check_uint64_parameter_(const char *file, unsigned int line, const char *name, uint64_t u);
|
||||
#define check_HmdRect2_parameter(a, b) check_HmdRect2_parameter_(__FILE__, __LINE__, a, b)
|
||||
extern void check_HmdRect2_parameter_(const char *file, unsigned int line, const char *name, HmdRect2_t v);
|
||||
#define check_HmdVector2_parameter(a, b) check_HmdVector2_parameter_(__FILE__, __LINE__, a, b)
|
||||
extern void check_HmdVector2_parameter_(const char *file, unsigned int line, const char *name, HmdVector2_t v);
|
||||
#define check_HmdVector3_parameter(a, b) check_HmdVector3_parameter_(__FILE__, __LINE__, a, b)
|
||||
extern void check_HmdVector3_parameter_(const char *file, unsigned int line, const char *name, HmdVector3_t v);
|
||||
#define check_HmdColor_parameter(a, b) check_HmdColor_parameter_(__FILE__, __LINE__, a, b)
|
||||
extern void check_HmdColor_parameter_(const char *file, unsigned int line, const char *name, HmdColor_t v);
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,116 +0,0 @@
|
|||
/* This file is auto-generated, do not edit. */
|
||||
#include "capi_thunks_autogen.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
test_capi_thunks_IVRApplications_001();
|
||||
test_capi_thunks_IVRApplications_002();
|
||||
test_capi_thunks_IVRApplications_003();
|
||||
test_capi_thunks_IVRApplications_004();
|
||||
test_capi_thunks_IVRApplications_005();
|
||||
test_capi_thunks_IVRApplications_006();
|
||||
test_capi_thunks_IVRApplications_007();
|
||||
test_capi_thunks_IVRChaperoneSetup_004();
|
||||
test_capi_thunks_IVRChaperoneSetup_005();
|
||||
test_capi_thunks_IVRChaperoneSetup_006();
|
||||
test_capi_thunks_IVRChaperone_002();
|
||||
test_capi_thunks_IVRChaperone_003();
|
||||
test_capi_thunks_IVRChaperone_004();
|
||||
test_capi_thunks_IVRClientCore_002();
|
||||
test_capi_thunks_IVRClientCore_003();
|
||||
test_capi_thunks_IVRCompositor_005();
|
||||
test_capi_thunks_IVRCompositor_006();
|
||||
test_capi_thunks_IVRCompositor_007();
|
||||
test_capi_thunks_IVRCompositor_008();
|
||||
test_capi_thunks_IVRCompositor_009();
|
||||
test_capi_thunks_IVRCompositor_010();
|
||||
test_capi_thunks_IVRCompositor_011();
|
||||
test_capi_thunks_IVRCompositor_012();
|
||||
test_capi_thunks_IVRCompositor_013();
|
||||
test_capi_thunks_IVRCompositor_014();
|
||||
test_capi_thunks_IVRCompositor_015();
|
||||
test_capi_thunks_IVRCompositor_016();
|
||||
test_capi_thunks_IVRCompositor_017();
|
||||
test_capi_thunks_IVRCompositor_018();
|
||||
test_capi_thunks_IVRCompositor_019();
|
||||
test_capi_thunks_IVRCompositor_020();
|
||||
test_capi_thunks_IVRCompositor_021();
|
||||
test_capi_thunks_IVRCompositor_022();
|
||||
test_capi_thunks_IVRCompositor_024();
|
||||
test_capi_thunks_IVRCompositor_026();
|
||||
test_capi_thunks_IVRCompositor_027();
|
||||
test_capi_thunks_IVRControlPanel_006();
|
||||
test_capi_thunks_IVRDriverManager_001();
|
||||
test_capi_thunks_IVRExtendedDisplay_001();
|
||||
test_capi_thunks_IVRHeadsetView_001();
|
||||
test_capi_thunks_IVRIOBuffer_001();
|
||||
test_capi_thunks_IVRIOBuffer_002();
|
||||
test_capi_thunks_IVRInput_003();
|
||||
test_capi_thunks_IVRInput_004();
|
||||
test_capi_thunks_IVRInput_005();
|
||||
test_capi_thunks_IVRInput_006();
|
||||
test_capi_thunks_IVRInput_007();
|
||||
test_capi_thunks_IVRInput_010();
|
||||
test_capi_thunks_IVRMailbox_001();
|
||||
test_capi_thunks_IVRNotifications_001();
|
||||
test_capi_thunks_IVRNotifications_002();
|
||||
test_capi_thunks_IVROverlayView_003();
|
||||
test_capi_thunks_IVROverlay_001();
|
||||
test_capi_thunks_IVROverlay_002();
|
||||
test_capi_thunks_IVROverlay_003();
|
||||
test_capi_thunks_IVROverlay_004();
|
||||
test_capi_thunks_IVROverlay_005();
|
||||
test_capi_thunks_IVROverlay_007();
|
||||
test_capi_thunks_IVROverlay_008();
|
||||
test_capi_thunks_IVROverlay_010();
|
||||
test_capi_thunks_IVROverlay_011();
|
||||
test_capi_thunks_IVROverlay_012();
|
||||
test_capi_thunks_IVROverlay_013();
|
||||
test_capi_thunks_IVROverlay_014();
|
||||
test_capi_thunks_IVROverlay_016();
|
||||
test_capi_thunks_IVROverlay_017();
|
||||
test_capi_thunks_IVROverlay_018();
|
||||
test_capi_thunks_IVROverlay_019();
|
||||
test_capi_thunks_IVROverlay_020();
|
||||
test_capi_thunks_IVROverlay_021();
|
||||
test_capi_thunks_IVROverlay_022();
|
||||
test_capi_thunks_IVROverlay_024();
|
||||
test_capi_thunks_IVROverlay_025();
|
||||
test_capi_thunks_IVROverlay_026();
|
||||
test_capi_thunks_IVROverlay_027();
|
||||
test_capi_thunks_IVRRenderModels_001();
|
||||
test_capi_thunks_IVRRenderModels_002();
|
||||
test_capi_thunks_IVRRenderModels_004();
|
||||
test_capi_thunks_IVRRenderModels_005();
|
||||
test_capi_thunks_IVRRenderModels_006();
|
||||
test_capi_thunks_IVRResources_001();
|
||||
test_capi_thunks_IVRScreenshots_001();
|
||||
test_capi_thunks_IVRSettings_001();
|
||||
test_capi_thunks_IVRSettings_002();
|
||||
test_capi_thunks_IVRSettings_003();
|
||||
test_capi_thunks_IVRSystem_003();
|
||||
test_capi_thunks_IVRSystem_004();
|
||||
test_capi_thunks_IVRSystem_005();
|
||||
test_capi_thunks_IVRSystem_006();
|
||||
test_capi_thunks_IVRSystem_009();
|
||||
test_capi_thunks_IVRSystem_010();
|
||||
test_capi_thunks_IVRSystem_011();
|
||||
test_capi_thunks_IVRSystem_012();
|
||||
test_capi_thunks_IVRSystem_014();
|
||||
test_capi_thunks_IVRSystem_015();
|
||||
test_capi_thunks_IVRSystem_016();
|
||||
test_capi_thunks_IVRSystem_017();
|
||||
test_capi_thunks_IVRSystem_019();
|
||||
test_capi_thunks_IVRSystem_020();
|
||||
test_capi_thunks_IVRSystem_021();
|
||||
test_capi_thunks_IVRSystem_022();
|
||||
test_capi_thunks_IVRTrackedCamera_001();
|
||||
test_capi_thunks_IVRTrackedCamera_002();
|
||||
test_capi_thunks_IVRTrackedCamera_003();
|
||||
test_capi_thunks_IVRTrackedCamera_004();
|
||||
test_capi_thunks_IVRTrackedCamera_005();
|
||||
test_capi_thunks_IVRTrackedCamera_006();
|
||||
printf("All tests executed.\n");
|
||||
}
|
|
@ -1,249 +0,0 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
/* never dereferenced */
|
||||
typedef struct VROverlayIntersectionParams_t VROverlayIntersectionParams_t;
|
||||
typedef struct VROverlayIntersectionResults_t VROverlayIntersectionResults_t;
|
||||
typedef struct RenderModel_ComponentState_t RenderModel_ComponentState_t;
|
||||
typedef struct RenderModel_ControllerMode_State_t RenderModel_ControllerMode_State_t;
|
||||
typedef struct RenderModel_t RenderModel_t;
|
||||
typedef struct RenderModel_TextureMap_t RenderModel_TextureMap_t;
|
||||
typedef struct TrackedDevicePose_t TrackedDevicePose_t;
|
||||
typedef struct VREvent_t VREvent_t;
|
||||
typedef struct Compositor_FrameTiming Compositor_FrameTiming;
|
||||
typedef struct Compositor_CumulativeStats Compositor_CumulativeStats;
|
||||
typedef struct Compositor_StageRenderSettings Compositor_StageRenderSettings;
|
||||
typedef struct Compositor_BenchmarkResults Compositor_BenchmarkResults;
|
||||
typedef struct AppOverrideKeys_t AppOverrideKeys_t;
|
||||
typedef struct VROverlayIntersectionMaskPrimitive_t VROverlayIntersectionMaskPrimitive_t;
|
||||
typedef struct NotificationBitmap_t NotificationBitmap_t;
|
||||
typedef struct CameraVideoStreamFrameHeader_t CameraVideoStreamFrameHeader_t;
|
||||
typedef struct Compositor_OverlaySettings Compositor_OverlaySettings;
|
||||
typedef struct ChaperoneSoftBoundsInfo_t ChaperoneSoftBoundsInfo_t;
|
||||
typedef struct ChaperoneSeatedBoundsInfo_t ChaperoneSeatedBoundsInfo_t;
|
||||
typedef struct NotificationBitmap NotificationBitmap;
|
||||
typedef struct ComponentState_t ComponentState_t;
|
||||
typedef struct CameraVideoStreamFrame_t CameraVideoStreamFrame_t;
|
||||
/* XXX VRControllerState_t is an alias for a versioned struct! */
|
||||
typedef struct VRControllerState_t VRControllerState_t;
|
||||
typedef struct VkDevice_T VkDevice_T;
|
||||
typedef struct VkPhysicalDevice_T VkPhysicalDevice_T;
|
||||
typedef struct VkInstance_T VkInstance_T;
|
||||
typedef struct VkQueue_T VkQueue_T;
|
||||
typedef struct InputDigitalActionData_t InputDigitalActionData_t;
|
||||
typedef struct InputSkeletonActionData_t InputSkeletonActionData_t;
|
||||
typedef struct InputPoseActionData_t InputPoseActionData_t;
|
||||
typedef struct InputAnalogActionData_t InputAnalogActionData_t;
|
||||
typedef struct VRActiveActionSet_t VRActiveActionSet_t;
|
||||
typedef struct VRBoneTransform_t VRBoneTransform_t;
|
||||
typedef struct InputOriginInfo_t InputOriginInfo_t;
|
||||
typedef struct InputSkeletalActionData_t InputSkeletalActionData_t;
|
||||
typedef struct VRSkeletalSummaryData_t VRSkeletalSummaryData_t;
|
||||
typedef struct InputBindingInfo_t InputBindingInfo_t;
|
||||
typedef struct VRNativeDevice_t VRNativeDevice_t;
|
||||
typedef struct VROverlayView_t VROverlayView_t;
|
||||
typedef struct VROverlayProjection_t VROverlayProjection_t;
|
||||
|
||||
/* dereferenced structs */
|
||||
typedef struct HmdMatrix34_t
|
||||
{
|
||||
float m[3][4];
|
||||
} HmdMatrix34_t;
|
||||
|
||||
typedef struct HmdMatrix44_t
|
||||
{
|
||||
float m[4][4];
|
||||
} HmdMatrix44_t;
|
||||
|
||||
typedef struct HmdVector3_t
|
||||
{
|
||||
float v[3];
|
||||
} HmdVector3_t;
|
||||
|
||||
typedef struct HmdVector4_t
|
||||
{
|
||||
float v[4];
|
||||
} HmdVector4_t;
|
||||
|
||||
typedef struct HmdVector3d_t
|
||||
{
|
||||
double v[3];
|
||||
} HmdVector3d_t;
|
||||
|
||||
typedef struct HmdVector2_t
|
||||
{
|
||||
float v[2];
|
||||
} HmdVector2_t;
|
||||
|
||||
typedef struct HmdQuaternion_t
|
||||
{
|
||||
double w, x, y, z;
|
||||
} HmdQuaternion_t;
|
||||
|
||||
typedef struct HmdColor_t
|
||||
{
|
||||
float r, g, b, a;
|
||||
} HmdColor_t;
|
||||
|
||||
typedef struct HmdQuad_t
|
||||
{
|
||||
HmdVector3_t vCorners[ 4 ];
|
||||
} HmdQuad_t;
|
||||
|
||||
typedef struct HmdRect2_t
|
||||
{
|
||||
HmdVector2_t vTopLeft;
|
||||
HmdVector2_t vBottomRight;
|
||||
} HmdRect2_t;
|
||||
|
||||
typedef struct DistortionCoordinates_t
|
||||
{
|
||||
float rfRed[2];
|
||||
float rfGreen[2];
|
||||
float rfBlue[2];
|
||||
} DistortionCoordinates_t;
|
||||
|
||||
typedef struct HiddenAreaMesh_t
|
||||
{
|
||||
const HmdVector2_t *pVertexData;
|
||||
uint32_t unTriangleCount;
|
||||
} HiddenAreaMesh_t;
|
||||
|
||||
typedef enum EGraphicsAPIConvention
|
||||
{
|
||||
API_DirectX = 0,
|
||||
API_OpenGL = 1,
|
||||
} EGraphicsAPIConvention;
|
||||
|
||||
typedef EGraphicsAPIConvention GraphicsAPIConvention;
|
||||
|
||||
typedef struct VRTextureBounds_t
|
||||
{
|
||||
float uMin, vMin;
|
||||
float uMax, vMax;
|
||||
} VRTextureBounds_t;
|
||||
|
||||
typedef VRTextureBounds_t Compositor_TextureBounds;
|
||||
|
||||
typedef enum ETextureType
|
||||
{
|
||||
TextureType_DirectX = 0, // Handle is an ID3D11Texture
|
||||
TextureType_OpenGL = 1, // Handle is an OpenGL texture name or an OpenGL render buffer name, depending on submit flags
|
||||
TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure
|
||||
TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef
|
||||
TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure
|
||||
} ETextureType;
|
||||
|
||||
struct VRVulkanTextureData_t
|
||||
{
|
||||
uint64_t m_nImage; // VkImage
|
||||
VkDevice_T *m_pDevice;
|
||||
VkPhysicalDevice_T *m_pPhysicalDevice;
|
||||
VkInstance_T *m_pInstance;
|
||||
VkQueue_T *m_pQueue;
|
||||
uint32_t m_nQueueFamilyIndex;
|
||||
uint32_t m_nWidth, m_nHeight, m_nFormat, m_nSampleCount;
|
||||
};
|
||||
|
||||
struct VRVulkanTextureArrayData_t
|
||||
{
|
||||
struct VRVulkanTextureData_t t;
|
||||
uint32_t m_unArrayIndex;
|
||||
uint32_t m_unArraySize;
|
||||
};
|
||||
|
||||
typedef struct Texture_t
|
||||
{
|
||||
void *handle;
|
||||
uint32_t eType;
|
||||
uint32_t eColorSpace;
|
||||
} Texture_t;
|
||||
|
||||
typedef struct VRTextureWithPose_t
|
||||
{
|
||||
Texture_t texture;
|
||||
HmdMatrix34_t mDeviceToAbsoluteTracking;
|
||||
} VRTextureWithPose_t;
|
||||
|
||||
typedef struct VRTextureDepthInfo_t
|
||||
{
|
||||
void* handle;
|
||||
HmdMatrix44_t mProjection;
|
||||
HmdVector2_t vRange;
|
||||
} VRTextureDepthInfo_t;
|
||||
|
||||
typedef struct VRTextureWithDepth_t
|
||||
{
|
||||
Texture_t texture;
|
||||
VRTextureDepthInfo_t depth;
|
||||
} VRTextureWithDepth_t;
|
||||
|
||||
typedef struct VRTextureWithPoseAndDepth_t
|
||||
{
|
||||
Texture_t texture;
|
||||
HmdMatrix34_t mDeviceToAbsoluteTracking;
|
||||
VRTextureDepthInfo_t depth;
|
||||
} VRTextureWithPoseAndDepth_t;
|
||||
|
||||
typedef enum EVRSubmitFlags
|
||||
{
|
||||
// Simple render path. App submits rendered left and right eye images with no lens distortion correction applied.
|
||||
Submit_Default = 0x00,
|
||||
|
||||
// App submits final left and right eye images with lens distortion already applied (lens distortion makes the images appear
|
||||
// barrel distorted with chromatic aberration correction applied). The app would have used the data returned by
|
||||
// vr::IVRSystem::ComputeDistortion() to apply the correct distortion to the rendered images before calling Submit().
|
||||
Submit_LensDistortionAlreadyApplied = 0x01,
|
||||
|
||||
// If the texture pointer passed in is actually a renderbuffer (e.g. for MSAA in OpenGL) then set this flag.
|
||||
Submit_GlRenderBuffer = 0x02,
|
||||
|
||||
// Do not use
|
||||
Submit_Reserved = 0x04,
|
||||
|
||||
// Set to indicate that pTexture is a pointer to a VRTextureWithPose_t.
|
||||
// This flag can be combined with Submit_TextureWithDepth to pass a VRTextureWithPoseAndDepth_t.
|
||||
Submit_TextureWithPose = 0x08,
|
||||
|
||||
// Set to indicate that pTexture is a pointer to a VRTextureWithDepth_t.
|
||||
// This flag can be combined with Submit_TextureWithPose to pass a VRTextureWithPoseAndDepth_t.
|
||||
Submit_TextureWithDepth = 0x10,
|
||||
|
||||
// Set to indicate a discontinuity between this and the last frame.
|
||||
// This will prevent motion smoothing from attempting to extrapolate using the pair.
|
||||
Submit_FrameDiscontinuty = 0x20,
|
||||
|
||||
// Set to indicate that pTexture->handle is a contains VRVulkanTextureArrayData_t
|
||||
Submit_VulkanTextureWithArrayData = 0x40,
|
||||
|
||||
// If the texture pointer passed in is an OpenGL Array texture, set this flag
|
||||
Submit_GlArrayTexture = 0x80,
|
||||
|
||||
// Do not use
|
||||
Submit_Reserved2 = 0x8000,
|
||||
} EVRSubmitFlags;
|
||||
|
||||
typedef enum EVRCompositorTimingMode
|
||||
{
|
||||
VRCompositorTimingMode_Implicit = 0,
|
||||
VRCompositorTimingMode_Explicit_RuntimePerformsPostPresentHandoff = 1,
|
||||
VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff = 2,
|
||||
} EVRCompositorTimingMode;
|
||||
|
||||
typedef enum EVRRenderModelError
|
||||
{
|
||||
VRRenderModelError_None = 0,
|
||||
VRRenderModelError_Loading = 100,
|
||||
VRRenderModelError_NotSupported = 200,
|
||||
VRRenderModelError_InvalidArg = 300,
|
||||
VRRenderModelError_InvalidTexture = 400,
|
||||
} EVRRenderModelError;
|
||||
|
||||
typedef enum EVROverlayError
|
||||
{
|
||||
VROverlayError_InvalidHandle = 11,
|
||||
} EVROverlayError;
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue