コード例 #1
0
        public unsafe ReflectInterfaceVariable GetInputVariableByLocation(uint location)
        {
            fixed(SpirvReflectNative.SpvReflectShaderModule *inmodule = &NativeShaderModule)
            {
                var reflt = new ReflectInterfaceVariable();

                SpirvReflectNative.SpvReflectResult result = SpirvReflectNative.SpvReflectResult.SPV_REFLECT_RESULT_NOT_READY;
                var nativeOut = SpirvReflectNative.spvReflectGetInputVariableByLocation(inmodule, location, &result);

                SpirvReflectUtils.Assert(result == SpirvReflectNative.SpvReflectResult.SPV_REFLECT_RESULT_SUCCESS);
                ReflectInterfaceVariable.PopulateReflectInterfaceVariable(ref *nativeOut, ref reflt);
                return(reflt);
            }
        }
コード例 #2
0
        public unsafe ReflectInterfaceVariable GetInputVariableBySemantic(string semantic)
        {
            fixed(SpirvReflectNative.SpvReflectShaderModule *inmodule = &NativeShaderModule)
            {
                var reflt = new ReflectInterfaceVariable();

                SpirvReflectNative.SpvReflectResult result = SpirvReflectNative.SpvReflectResult.SPV_REFLECT_RESULT_NOT_READY;
                byte[] semanticBytes = Encoding.ASCII.GetBytes(semantic);

                fixed(byte *ptr = semanticBytes)
                {
                    var nativeOut = SpirvReflectNative.spvReflectGetInputVariableBySemantic(inmodule, (sbyte *)ptr, &result);

                    SpirvReflectUtils.Assert(result == SpirvReflectNative.SpvReflectResult.SPV_REFLECT_RESULT_SUCCESS);
                    ReflectInterfaceVariable.PopulateReflectInterfaceVariable(ref *nativeOut, ref reflt);
                    return(reflt);
                }
            }
        }