Refactor ShaderVariable use and non-32-bit precision. Closes #2466

This commit is contained in:
baldurk
2022-02-02 11:38:37 +00:00
parent 4b748c6368
commit e42b0ff2ca
18 changed files with 508 additions and 351 deletions
@@ -364,6 +364,25 @@ struct TypeConversion<double, false>
static PyObject *ConvertToPy(const double &in) { return PyFloat_FromDouble(in); }
};
template <>
struct TypeConversion<rdhalf, false>
{
static int ConvertFromPy(PyObject *in, rdhalf &out)
{
if(!PyFloat_Check(in))
return SWIG_TypeError;
out.set(float(PyFloat_AsDouble(in)));
if(PyErr_Occurred())
return SWIG_OverflowError;
return SWIG_OK;
}
static PyObject *ConvertToPy(const rdhalf &in) { return PyFloat_FromDouble((float)in); }
};
// partial specialisation for enums, we just convert as their underlying type,
// whatever integer size that happens to be
template <typename T>
+2
View File
@@ -100,6 +100,7 @@ VA_IGNORE_REST_OF_FILE
%ignore rdcfixedarray::operator[];
%ignore rdcliteral;
%ignore rdcpair;
%ignore rdhalf;
%ignore bytebuf;
// special handling for RENDERDOC_GetDefaultCaptureOptions to transform output parameter to a return value
@@ -331,6 +332,7 @@ TEMPLATE_FIXEDARRAY_INSTANTIATE(rdcfixedarray, ResourceId, 8)
TEMPLATE_FIXEDARRAY_INSTANTIATE(rdcfixedarray, bool, 4)
TEMPLATE_FIXEDARRAY_INSTANTIATE(rdcfixedarray, bool, 8)
TEMPLATE_FIXEDARRAY_INSTANTIATE(rdcfixedarray, float, 16)
TEMPLATE_FIXEDARRAY_INSTANTIATE(rdcfixedarray, rdhalf, 16)
TEMPLATE_FIXEDARRAY_INSTANTIATE(rdcfixedarray, int32_t, 16)
TEMPLATE_FIXEDARRAY_INSTANTIATE(rdcfixedarray, uint32_t, 16)
TEMPLATE_FIXEDARRAY_INSTANTIATE(rdcfixedarray, double, 16)